]> source.dussan.org Git - jquery.git/commitdiff
Release: use buildDefaultFiles directly and pass version
authorTimmy Willison <timmywil@users.noreply.github.com>
Tue, 6 Feb 2024 14:53:30 +0000 (09:53 -0500)
committerGitHub <noreply@github.com>
Tue, 6 Feb 2024 14:53:30 +0000 (09:53 -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 ff11d80cc8c4a095161a15e9f2f0e4b6f136dbe9..3cf4f31abda378b2c984edb41f27fbe73c64fc3c 100644 (file)
@@ -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 );
                }
index ad378468fba13052d8d2a2a33461af3271d77db2..9851262a295d4f62a4b7fc2575b1bd1b4ee40227 100644 (file)
@@ -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 )
index ed70fdd206984379ef282bf13903498c19173186..c169ce925f19dbe719322c611ac8ccd15b852fea 100644 (file)
@@ -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 } ),
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" );