mirror of
https://github.com/google/blockly.git
synced 2026-01-05 08:00:09 +01:00
chore(tests): Drop build/test support for node.js v12 (#6222)
* chore(tests): Stop testing on node.js v12 * chore(build): Remove obsolete workaround for closure-calculate-chunks
This commit is contained in:
committed by
GitHub
parent
96758fedd4
commit
e145102b84
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@@ -17,7 +17,7 @@ jobs:
|
||||
# TODO (#2114): re-enable osx build.
|
||||
# os: [ubuntu-latest, macos-latest]
|
||||
os: [ubuntu-latest]
|
||||
node-version: [12.x, 14.x, 16.x]
|
||||
node-version: [14.x, 16.x]
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
steps:
|
||||
|
||||
@@ -42,13 +42,6 @@ const CORE_DIR = path.join(TSC_OUTPUT_DIR, 'core');
|
||||
*/
|
||||
const COMPILED_SUFFIX = '_compressed';
|
||||
|
||||
/**
|
||||
* Checked-in file to cache output of closure-calculate-chunks, to
|
||||
* allow for testing on node.js v12 (or earlier) which is not
|
||||
* compatible with closure-calculate-chunks.
|
||||
*/
|
||||
const CHUNK_CACHE_FILE = 'scripts/gulpfiles/chunks.json'
|
||||
|
||||
/**
|
||||
* Name of an object to be used as a shared "global" namespace by
|
||||
* chunks generated by the Closure Compiler with the
|
||||
@@ -509,29 +502,7 @@ function getChunkOptions() {
|
||||
];
|
||||
const cccCommand = `closure-calculate-chunks ${cccArgs.join(' ')}`;
|
||||
|
||||
// Because (as of 2021-11-25) closure-calculate-chunks v3.0.2
|
||||
// requries node.js v14 or later, we save the output of cccCommand
|
||||
// in a checked-in .json file, so we can use the contents of that
|
||||
// file when building on older versions of node.
|
||||
//
|
||||
// When this is no longer necessary the following section can be
|
||||
// replaced with:
|
||||
//
|
||||
// const rawOptions = JSON.parse(execSync(cccCommand));
|
||||
const nodeMajorVersion = /v(\d+)\./.exec(process.version)[1];
|
||||
let rawOptions;
|
||||
if (nodeMajorVersion >= 14) {
|
||||
rawOptions = JSON.parse(String(execSync(cccCommand)));
|
||||
// Replace absolute paths with relative ones, so they will be
|
||||
// valid on other machines. Only needed because we're saving this
|
||||
// output to use later on another machine.
|
||||
rawOptions.js = rawOptions.js.map(p => p.replace(process.cwd(), '.'));
|
||||
fs.writeFileSync(CHUNK_CACHE_FILE,
|
||||
JSON.stringify(rawOptions, null, 2) + '\n');
|
||||
} else {
|
||||
console.log(`Warning: using pre-computed chunks from ${CHUNK_CACHE_FILE}`);
|
||||
rawOptions = JSON.parse(String(fs.readFileSync(CHUNK_CACHE_FILE)));
|
||||
}
|
||||
const rawOptions = JSON.parse(execSync(cccCommand));
|
||||
|
||||
// rawOptions should now be of the form:
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user