Skip to content

Commit b507c86

Browse files
authored
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
1 parent 6376765 commit b507c86

File tree

Image for: File tree

4 files changed

Image for: 4 files changed
+10
-5
lines changed

4 files changed

Image for: 4 files changed
+10
-5
lines changed

‎build/release.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ module.exports = function( Release ) {
2424
];
2525
const cdn = require( "./release/cdn" );
2626
const dist = require( "./release/dist" );
27+
const { buildDefaultFiles } = require( "./tasks/build" );
2728

2829
const npmTags = Release.npmTags;
2930

@@ -53,8 +54,8 @@ module.exports = function( Release ) {
5354
* committed before creating the tag.
5455
* @param {Function} callback
5556
*/
56-
generateArtifacts: function( callback ) {
57-
Release.exec( "npm run build:all" );
57+
generateArtifacts: async function( callback ) {
58+
await buildDefaultFiles( { version: Release.newVersion } );
5859

5960
cdn.makeReleaseCopies( Release );
6061
Release._setSrcVersion();
@@ -77,7 +78,7 @@ module.exports = function( Release ) {
7778
* Publish to distribution repo and npm
7879
* @param {Function} callback
7980
*/
80-
dist: async callback => {
81+
dist: async function( callback ) {
8182
await cdn.makeArchives( Release );
8283
dist( Release, distFiles, callback );
8384
}

‎build/release/dist.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ module.exports = function( Release, files, complete ) {
119119
delete packageJson.devDependencies;
120120
delete packageJson.dependencies;
121121
delete packageJson.commitplease;
122+
packageJson.version = Release.newVersion;
122123
await fs.writeFile(
123124
`${ Release.dir.dist }/package.json`,
124125
JSON.stringify( packageJson, null, 2 )

‎build/tasks/build.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,10 @@ async function build( {
352352
}
353353
}
354354

355-
async function buildDefaultFiles( { version, watch } = {} ) {
355+
async function buildDefaultFiles( {
356+
version = process.env.VERSION,
357+
watch
358+
} = {} ) {
356359
await Promise.all( [
357360
build( { version, watch } ),
358361
build( { filename: "jquery.slim.js", slim: true, version, watch } ),

‎build/tasks/compare_size.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export async function compareSize( { cache = ".sizecache.json", files } = {} ) {
109109
// Remove the short SHA and .dirty from comparisons.
110110
// The short SHA so commits can be compared against each other
111111
// and .dirty to compare with the existing branch during development.
112-
const sha = /jQuery v\d+.\d+.\d+(?:-\w+)?\+(?:slim.)?([^ \.]+(?:\.dirty)?)/.exec( contents )[ 1 ];
112+
const sha = /jQuery v\d+.\d+.\d+(?:-\w+)?(?:\+|\+slim\.)?([^ \.]+(?:\.dirty)?)?/.exec( contents )[ 1 ];
113113
contents = contents.replace( new RegExp( sha, "g" ), "" );
114114

115115
const size = Buffer.byteLength( contents, "utf8" );

0 commit comments

Image for: 0 commit comments
Comments
 (0)