Update build scripts to target Node.js 10 (#6908)

This commit is contained in:
fisker Cheung authored and Simon Lydell committed 2019-11-13 18:08:40 +01:00
1 parent fe8f52a88c
commit e44c360c62
5 files changed
+5 -44

No files matched your search

+1 -1
View File
@@ -11,7 +11,7 @@
"license": "MIT",
"main": "./index.js",
"engines": {
"node": ">=8"
"node": ">=10"
},
"dependencies": {
"@angular/compiler": "8.2.13",
@@ -1,32 +0,0 @@
"use strict";
//
// BEFORE:
// [__something__].includes(__something__)
// CONSTANT_CASE.includes(__something__)
//
// AFTER:
// [__something__].indexOf(__something__) !== -1
// CONSTANT_CASE.indexOf(__something__) !== -1
//
module.exports = ({ types: t }) => ({
visitor: {
CallExpression(path) {
const node = path.node;
const callee = node.callee;
if (
t.isMemberExpression(callee, { computed: false }) &&
(t.isArrayExpression(callee.object) ||
(t.isIdentifier(callee.object) &&
(/^[A-Z_]+$/.test(callee.object.name) ||
// https://github.com/eemeli/yaml/blob/1005d01/src/Anchors.js#L45
callee.object.name === "names"))) &&
t.isIdentifier(callee.property, { name: "includes" })
) {
callee.property.name = "indexOf";
path.replaceWith(t.binaryExpression("!==", node, t.numericLiteral(-1)));
}
}
}
});
+1 -2
View File
@@ -77,7 +77,6 @@ async function cacheFiles() {
async function preparePackage() {
const pkg = await util.readJson("package.json");
pkg.bin = "./bin-prettier.js";
pkg.engines.node = ">=4";
delete pkg.dependencies;
delete pkg.devDependencies;
pkg.scripts = {
@@ -99,7 +98,7 @@ async function run(params) {
await execa("rm", ["-rf", ".cache"]);
}
const bundleCache = new Cache(".cache/", "v19");
const bundleCache = new Cache(".cache/", "v20");
await bundleCache.load();
console.log(chalk.inverse(" Building packages "));
+1 -1
View File
@@ -47,7 +47,7 @@ function getBabelConfig(bundle) {
require.resolve("./babel-plugins/transform-custom-require")
);
}
const targets = { node: 4 };
const targets = { node: "10" };
if (bundle.target === "universal") {
// From https://jamie.build/last-2-versions
targets.browsers = [">0.25%", "not ie 11", "not op_mini all"];
+2 -8
View File
@@ -2,9 +2,6 @@
const path = require("path");
const PROJECT_ROOT = path.resolve(__dirname, "../..");
const babelReplaceArrayIncludesWithIndexof = require.resolve(
"./babel-plugins/replace-array-includes-with-indexof"
);
/**
* @typedef {Object} Bundle
@@ -29,8 +26,7 @@ const babelReplaceArrayIncludesWithIndexof = require.resolve(
const parsers = [
{
input: "src/language-js/parser-babylon.js",
target: "universal",
babelPlugins: [babelReplaceArrayIncludesWithIndexof]
target: "universal"
},
{
input: "src/language-js/parser-flow.js",
@@ -40,7 +36,6 @@ const parsers = [
{
input: "src/language-js/parser-typescript.js",
target: "universal",
babelPlugins: [babelReplaceArrayIncludesWithIndexof],
commonjs: {
ignore: [
// Optional package for TypeScript that logs ETW events (a Windows-only technology).
@@ -133,8 +128,7 @@ const parsers = [
replacement: require.resolve("lines-and-columns")
}
]
},
babelPlugins: [babelReplaceArrayIncludesWithIndexof]
}
}
].map(parser => {
const name = getFileOutput(parser)