]> source.dussan.org Git - jquery.git/commitdiff
Release: use buildDefaultFiles directly and pass version (#5409)
authorTimmy Willison <timmywil@users.noreply.github.com>
Tue, 6 Feb 2024 15:16:05 +0000 (10:16 -0500)
committerGitHub <noreply@github.com>
Tue, 6 Feb 2024 15:16:05 +0000 (10:16 -0500)
- 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

build/release.js
build/release/dist.js
build/tasks/build.js
build/tasks/compare_size.mjs

index fb1d444b4351badacca3039903afb63ced92e260..b778ca2448dbb3b71d05b09fec38eb53b6804585 100644 (file)
@@ -18,6 +18,7 @@ module.exports = function( Release ) {
        ];
        const cdn = require( "./release/cdn" );
        const dist = require( "./release/dist" );
+       const { buildDefaultFiles } = require( "./tasks/build" );
 
        const npmTags = Release.npmTags;
 
@@ -41,8 +42,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();
index e85ffd3591e6ed1afb98cc3a688b5c864aa15d4d..c06c6c656d380fa91731ca128ce704e2de7bef67 100644 (file)
@@ -108,6 +108,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 )
index e07c26155f5fe528676b8dbf91cc26cc8e3bc014..e6fa4632d2df7b1bce0ed6cf57320d3d941fae5c 100644 (file)
@@ -320,7 +320,9 @@ async function build( {
        await minify( { filename, dir } );
 }
 
-async function buildDefaultFiles( { version } = {} ) {
+async function buildDefaultFiles( {
+       version = process.env.VERSION
+} = {} ) {
        await Promise.all( [
                build( { version } ),
                build( { filename: "jquery.slim.js", slim: true, version } )
index 879a18f931a5dc6e662f744c1ddcfad4a29bf9fc..c8e55bb42bf8e3646414a658fc1d59b8d77581c0 100644 (file)
@@ -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" );