Drop Node.js 10 support for development "build" (#10842)
This commit is contained in:
1 parent
6e71422548
commit
b7983971ce
8 files changed
+22
-23
No files matched your search
@@ -18,7 +18,7 @@ jobs:
|
||||
- "ubuntu-latest"
|
||||
node:
|
||||
# Run tests on minimal version we support
|
||||
- "10"
|
||||
- "12"
|
||||
NPM_CLIENT:
|
||||
- "yarn"
|
||||
- "npm"
|
||||
|
||||
@@ -21,7 +21,6 @@ jobs:
|
||||
- "16"
|
||||
- "14"
|
||||
- "12"
|
||||
- "10"
|
||||
include:
|
||||
# only enable coverage on the fastest job
|
||||
- os: "ubuntu-latest"
|
||||
@@ -32,12 +31,8 @@ jobs:
|
||||
exclude:
|
||||
- os: "macos-latest"
|
||||
node: "14"
|
||||
- os: "macos-latest"
|
||||
node: "12"
|
||||
- os: "windows-latest"
|
||||
node: "14"
|
||||
- os: "windows-latest"
|
||||
node: "12"
|
||||
env:
|
||||
ENABLE_CODE_COVERAGE: ${{ matrix.ENABLE_CODE_COVERAGE }}
|
||||
FULL_TEST: ${{ matrix.FULL_TEST }}
|
||||
|
||||
@@ -115,6 +115,10 @@ jobs:
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
|
||||
- name: Config `ignore-engines=true` (Node.js 10)
|
||||
if: matrix.node == '10'
|
||||
run: yarn config set ignore-engines true
|
||||
|
||||
- name: Install Dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
"browser": "./standalone.js",
|
||||
"unpkg": "./standalone.js",
|
||||
"engines": {
|
||||
"node": ">=10.13.0"
|
||||
"node": ">=12.17.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
|
||||
@@ -135,6 +135,7 @@ async function cacheFiles(cache) {
|
||||
async function preparePackage() {
|
||||
const pkg = await util.readJson("package.json");
|
||||
pkg.bin = "./bin-prettier.js";
|
||||
pkg.engines.node = ">=10.13.0";
|
||||
delete pkg.dependencies;
|
||||
delete pkg.devDependencies;
|
||||
pkg.scripts = {
|
||||
|
||||
+6
-1
@@ -1,8 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
// eslint-disable-next-line no-restricted-modules
|
||||
require("please-upgrade-node")(require("../../package.json"));
|
||||
const packageJson = require("../../package.json");
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
packageJson.engines.node = ">=10.13.0";
|
||||
}
|
||||
require("please-upgrade-node")(packageJson);
|
||||
|
||||
// eslint-disable-next-line import/order
|
||||
const stringify = require("fast-json-stable-stringify");
|
||||
// eslint-disable-next-line no-restricted-modules
|
||||
const prettier = require("../index");
|
||||
|
||||
@@ -1,14 +1,5 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`node version error 1`] = `
|
||||
Object {
|
||||
"stderr": "prettier requires at least version 10.13.0 of Node, please upgrade
|
||||
",
|
||||
"stdout": "",
|
||||
"write": Array [],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`show detailed usage with --help l (alias) (stderr) 1`] = `""`;
|
||||
|
||||
exports[`show detailed usage with --help l (alias) (stdout) 1`] = `
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
const prettier = require("prettier-local");
|
||||
const runPrettier = require("../runPrettier");
|
||||
const { isProduction } = require("../env");
|
||||
|
||||
describe("show version with --version", () => {
|
||||
runPrettier("cli/with-shebang", ["--version"]).test({
|
||||
@@ -99,12 +100,14 @@ test("node version error", async () => {
|
||||
writable: false,
|
||||
});
|
||||
const result = runPrettier("cli", ["--help"]);
|
||||
expect(await result.status).toEqual(1);
|
||||
const snapshot = {};
|
||||
for (const name of ["stderr", "stdout", "write"]) {
|
||||
snapshot[name] = await result[name];
|
||||
}
|
||||
expect(snapshot).toMatchSnapshot();
|
||||
expect(await result.status).toBe(1);
|
||||
expect(await result.stderr).toBe(
|
||||
`prettier requires at least version ${
|
||||
isProduction ? "10.13.0" : "12.17.0"
|
||||
} of Node, please upgrade\n`
|
||||
);
|
||||
expect(await result.stdout).toBe("");
|
||||
expect(await result.write).toEqual([]);
|
||||
} finally {
|
||||
Object.defineProperty(process, "version", {
|
||||
value: originalProcessVersion,
|
||||
|
||||
Reference in new issue
Block a user