Tests: include github ref in concurrency group
[jquery.git] / build / release.js
blobbdfb0bc3b9f36a6646ac2b99bd96c61375b01130
1 "use strict";
3 const fs = require( "node:fs" );
5 module.exports = function( Release ) {
7         const distFiles = [
8                 "dist/jquery.js",
9                 "dist/jquery.min.js",
10                 "dist/jquery.min.map",
11                 "dist/jquery.slim.js",
12                 "dist/jquery.slim.min.js",
13                 "dist/jquery.slim.min.map",
14                 "dist/jquery.factory.js",
15                 "dist/jquery.factory.slim.js",
16                 "dist-module/jquery.module.js",
17                 "dist-module/jquery.module.min.js",
18                 "dist-module/jquery.module.min.map",
19                 "dist-module/jquery.slim.module.js",
20                 "dist-module/jquery.slim.module.min.js",
21                 "dist-module/jquery.slim.module.min.map",
22                 "dist-module/jquery.factory.module.js",
23                 "dist-module/jquery.factory.slim.module.js"
24         ];
25         const filesToCommit = [
26                 ...distFiles,
27                 "src/core.js"
28         ];
29         const cdn = require( "./release/cdn" );
30         const dist = require( "./release/dist" );
31         const { buildDefaultFiles } = require( "./tasks/build" );
33         const npmTags = Release.npmTags;
35         function setSrcVersion( filepath ) {
36                 var contents = fs.readFileSync( filepath, "utf8" );
37                 contents = contents.replace( /@VERSION/g, Release.newVersion );
38                 fs.writeFileSync( filepath, contents, "utf8" );
39         }
41         Release.define( {
42                 npmPublish: true,
43                 issueTracker: "github",
45                 // Update cdn location to versioned files
46                 cdnPublish: "dist/cdn/versioned",
48                 /**
49                  * Set the version in the src folder for distributing ES modules.
50                  */
51                 _setSrcVersion: function() {
52                         setSrcVersion( `${ __dirname }/../src/core.js` );
53                 },
55                 /**
56                  * Generates any release artifacts that should be included in the release.
57                  * The callback must be invoked with an array of files that should be
58                  * committed before creating the tag.
59                  * @param {Function} callback
60                  */
61                 generateArtifacts: async function( callback ) {
62                         await buildDefaultFiles( { version: Release.newVersion } );
64                         cdn.makeReleaseCopies( Release );
65                         Release._setSrcVersion();
66                         callback( filesToCommit );
67                 },
69                 /**
70                  * Acts as insertion point for restoring Release.dir.repo
71                  * It was changed to reuse npm publish code in jquery-release
72                  * for publishing the distribution repo instead
73                  */
74                 npmTags: function() {
76                         // origRepo is not defined if dist was skipped
77                         Release.dir.repo = Release.dir.origRepo || Release.dir.repo;
78                         return npmTags();
79                 },
81                 /**
82                  * Publish to distribution repo and npm
83                  * @param {Function} callback
84                  */
85                 dist: async function( callback ) {
86                         await cdn.makeArchives( Release );
87                         dist( Release, distFiles, callback );
88                 }
89         } );
92 module.exports.dependencies = [
93         "archiver@5.2.0",
94         "shelljs@0.8.4",
95         "inquirer@8.0.0"