diff options
author | Timmy Willison <timmywil@users.noreply.github.com> | 2024-02-06 09:53:30 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-06 09:53:30 -0500 |
commit | b507c8648f701acd1c48b3c38054ad38d76fd1ca (patch) | |
tree | 086c67b05f822abbb65229a850d0be72fd80dd49 | |
parent | 63767650b5b171b4671304fd2bb2f2890431929f (diff) | |
download | jquery-b507c8648f701acd1c48b3c38054ad38d76fd1ca.tar.gz jquery-b507c8648f701acd1c48b3c38054ad38d76fd1ca.zip |
Release: use buildDefaultFiles directly and pass version
- also add the ability to pass VERSION in env to test final builds
- adjust sha regex to account for lack of shas
- set the version on the dist package.json
Close gh-5408
-rw-r--r-- | build/release.js | 7 | ||||
-rw-r--r-- | build/release/dist.js | 1 | ||||
-rw-r--r-- | build/tasks/build.js | 5 | ||||
-rw-r--r-- | build/tasks/compare_size.mjs | 2 |
4 files changed, 10 insertions, 5 deletions
diff --git a/build/release.js b/build/release.js index ff11d80cc..3cf4f31ab 100644 --- a/build/release.js +++ b/build/release.js @@ -24,6 +24,7 @@ module.exports = function( Release ) { ]; const cdn = require( "./release/cdn" ); const dist = require( "./release/dist" ); + const { buildDefaultFiles } = require( "./tasks/build" ); const npmTags = Release.npmTags; @@ -53,8 +54,8 @@ module.exports = function( Release ) { * committed before creating the tag. * @param {Function} callback */ - generateArtifacts: function( callback ) { - Release.exec( "npm run build:all" ); + generateArtifacts: async function( callback ) { + await buildDefaultFiles( { version: Release.newVersion } ); cdn.makeReleaseCopies( Release ); Release._setSrcVersion(); @@ -77,7 +78,7 @@ module.exports = function( Release ) { * Publish to distribution repo and npm * @param {Function} callback */ - dist: async callback => { + dist: async function( callback ) { await cdn.makeArchives( Release ); dist( Release, distFiles, callback ); } diff --git a/build/release/dist.js b/build/release/dist.js index ad378468f..9851262a2 100644 --- a/build/release/dist.js +++ b/build/release/dist.js @@ -119,6 +119,7 @@ module.exports = function( Release, files, complete ) { delete packageJson.devDependencies; delete packageJson.dependencies; delete packageJson.commitplease; + packageJson.version = Release.newVersion; await fs.writeFile( `${ Release.dir.dist }/package.json`, JSON.stringify( packageJson, null, 2 ) diff --git a/build/tasks/build.js b/build/tasks/build.js index ed70fdd20..c169ce925 100644 --- a/build/tasks/build.js +++ b/build/tasks/build.js @@ -352,7 +352,10 @@ async function build( { } } -async function buildDefaultFiles( { version, watch } = {} ) { +async function buildDefaultFiles( { + version = process.env.VERSION, + watch +} = {} ) { await Promise.all( [ build( { version, watch } ), build( { filename: "jquery.slim.js", slim: true, version, watch } ), diff --git a/build/tasks/compare_size.mjs b/build/tasks/compare_size.mjs index 879a18f93..c8e55bb42 100644 --- a/build/tasks/compare_size.mjs +++ b/build/tasks/compare_size.mjs @@ -109,7 +109,7 @@ export async function compareSize( { cache = ".sizecache.json", files } = {} ) { // Remove the short SHA and .dirty from comparisons. // The short SHA so commits can be compared against each other // and .dirty to compare with the existing branch during development. - const sha = /jQuery v\d+.\d+.\d+(?:-\w+)?\+(?:slim.)?([^ \.]+(?:\.dirty)?)/.exec( contents )[ 1 ]; + const sha = /jQuery v\d+.\d+.\d+(?:-\w+)?(?:\+|\+slim\.)?([^ \.]+(?:\.dirty)?)?/.exec( contents )[ 1 ]; contents = contents.replace( new RegExp( sha, "g" ), "" ); const size = Buffer.byteLength( contents, "utf8" ); |