scripts: Validate Node version - closes
ADD
scripts/_setup.cjs
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+function red(str) {
+ return `\u001b[31m${str}\u001b[39m`;
+}
+
+// Format of node.version is "v12.6.0" so we want to slice off the v
+const versionParts = process.version.slice(1).split('.');
+const major = Number(versionParts[0]);
+
+// Keep this updated alongside engines in package.json
+const EXPECTED_MAJOR = 12;
+
+if (major < EXPECTED_MAJOR) {
+ console.error(red(
+ `Rome requires Node >=v${EXPECTED_MAJOR} but got ${process.version}`,
+ ));
+ process.exit(1);
+}

MODIFY
scripts/ast/add.cjs
scripts/ast/add.cjs
* LICENSE file in the root directory of this source tree.
*/
+require('../_setup.cjs');
+
const path = require('path');
const fs = require('fs');

MODIFY
scripts/ast/remove.cjs
scripts/ast/remove.cjs
* LICENSE file in the root directory of this source tree.
*/
+require('../_setup.cjs');
+
const path = require('path');
const fs = require('fs');

MODIFY
scripts/ast/rename.cjs
scripts/ast/rename.cjs
* LICENSE file in the root directory of this source tree.
*/
+require('../_setup.cjs');
+
const path = require('path');
const fs = require('fs');

MODIFY
scripts/ast/update.cjs
scripts/ast/update.cjs
* LICENSE file in the root directory of this source tree.
*/
+require('../_setup.cjs');
+
const path = require('path');
const fs = require('fs');

MODIFY
scripts/build-release
scripts/build-release
* LICENSE file in the root directory of this source tree.
*/
+require('./_setup.cjs');
+
const {root, argv} = require('./_constants.cjs');
const {execNode} = require('./_utils.cjs');
const path = require('path');

MODIFY
scripts/commit-rome
scripts/commit-rome
* LICENSE file in the root directory of this source tree.
*/
+require('./_setup.cjs');
+
const {root} = require('./_constants.cjs');
const {execNode, unlink} = require('./_utils.cjs');
const path = require('path');

MODIFY
scripts/dev-rome
scripts/dev-rome
* LICENSE file in the root directory of this source tree.
*/
+require('./_setup.cjs');
+
const {root, argv} = require('./_constants.cjs');
const {unlink, execNode} = require('./_utils.cjs');
const path = require('path');

MODIFY
scripts/vendor-rome
scripts/vendor-rome
* LICENSE file in the root directory of this source tree.
*/
+require('./_setup.cjs');
+
const {execNode} = require('./_utils.cjs');
const path = require('path');

scripts: Validate Node version - closes #206