diff options
author | Timmy Willison <timmywil@users.noreply.github.com> | 2023-09-20 17:19:21 -0400 |
---|---|---|
committer | Timmy Willison <timmywil@users.noreply.github.com> | 2023-09-20 18:20:59 -0400 |
commit | 7ef9099d328e90d19bc40b64148747e854b13e20 (patch) | |
tree | 3f1fee9859ec8fb6eed2b4270173d3b9b185288c | |
parent | 77d6ad7172db3ae11573df7b322d410b161eb43e (diff) | |
download | jquery-7ef9099d328e90d19bc40b64148747e854b13e20.tar.gz jquery-7ef9099d328e90d19bc40b64148747e854b13e20.zip |
Build: fix inconsistent builds in Node 20
- one fileOverrides per build
- only run the lint build when running lint
Close gh-5332
-rw-r--r-- | .github/workflows/node.js.yml | 6 | ||||
-rw-r--r-- | build/tasks/build.js | 28 |
2 files changed, 15 insertions, 19 deletions
diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 65a1d2167..5be13bcdd 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -70,12 +70,8 @@ jobs: run: npx playwright-webkit install-deps if: matrix.NPM_SCRIPT == 'test:browser' && contains(matrix.BROWSERS, 'WebkitHeadless') - - name: Build jQuery for Lint - run: npm run build:all - if: matrix.NPM_SCRIPT == 'test:browserless' - - name: Lint code - run: npm run lint + run: npm run build:all && npm run lint if: matrix.NODE_VERSION == '18.x' - name: Prepare tests diff --git a/build/tasks/build.js b/build/tasks/build.js index 69a4de7c7..f9cc8e2a2 100644 --- a/build/tasks/build.js +++ b/build/tasks/build.js @@ -102,15 +102,6 @@ async function getOutputRollupOptions( { }; } -const fileOverrides = new Map(); - -function setOverride( filePath, source ) { - - // We want normalized paths in overrides as they will be matched - // against normalized paths in the file overrides Rollup plugin. - fileOverrides.set( path.resolve( filePath ), source ); -} - function unique( array ) { return [ ...new Set( array ) ]; } @@ -179,6 +170,15 @@ async function build( { } = {} ) { const pureSlim = slim && !exclude.length && !include.length; + const fileOverrides = new Map(); + + function setOverride( filePath, source ) { + + // We want normalized paths in overrides as they will be matched + // against normalized paths in the file overrides Rollup plugin. + fileOverrides.set( path.resolve( filePath ), source ); + } + // Add the short commit hash to the version string // when the version is not for a release. if ( !version ) { @@ -280,11 +280,6 @@ async function build( { ); } - const bundle = await rollup.rollup( { - ...inputOptions, - plugins: [ rollupFileOverrides( fileOverrides ) ] - } ); - const outputOptions = await getOutputRollupOptions( { esm, factory } ); if ( watch ) { @@ -326,6 +321,11 @@ async function build( { return watcher; } else { + const bundle = await rollup.rollup( { + ...inputOptions, + plugins: [ rollupFileOverrides( fileOverrides ) ] + } ); + const { output: [ { code } ] } = await bundle.generate( outputOptions ); |