2019-10-08 22:17:55 +00:00
|
|
|
"use strict";
|
|
|
|
|
2016-03-09 17:06:17 +00:00
|
|
|
var fs = require( "fs" );
|
2015-01-28 19:37:29 +00:00
|
|
|
|
2013-12-20 22:13:48 +00:00
|
|
|
module.exports = function( Release ) {
|
2011-04-26 20:23:09 +00:00
|
|
|
|
2020-03-02 21:42:38 +00:00
|
|
|
const distFiles = [
|
|
|
|
"dist/jquery.js",
|
|
|
|
"dist/jquery.min.js",
|
|
|
|
"dist/jquery.min.map",
|
|
|
|
"dist/jquery.slim.js",
|
|
|
|
"dist/jquery.slim.min.js",
|
2023-07-10 17:14:08 +00:00
|
|
|
"dist/jquery.slim.min.map",
|
2024-02-09 00:42:51 +00:00
|
|
|
"dist/jquery.factory.js",
|
|
|
|
"dist/jquery.factory.slim.js",
|
2023-07-10 17:14:08 +00:00
|
|
|
"dist-module/jquery.module.js",
|
|
|
|
"dist-module/jquery.module.min.js",
|
|
|
|
"dist-module/jquery.module.min.map",
|
|
|
|
"dist-module/jquery.slim.module.js",
|
|
|
|
"dist-module/jquery.slim.module.min.js",
|
2024-02-09 00:42:51 +00:00
|
|
|
"dist-module/jquery.slim.module.min.map",
|
|
|
|
"dist-module/jquery.factory.module.js",
|
|
|
|
"dist-module/jquery.factory.slim.module.js"
|
2020-03-02 21:42:38 +00:00
|
|
|
];
|
|
|
|
const filesToCommit = [
|
|
|
|
...distFiles,
|
|
|
|
"src/core.js"
|
|
|
|
];
|
|
|
|
const cdn = require( "./release/cdn" );
|
|
|
|
const dist = require( "./release/dist" );
|
2024-02-06 14:53:30 +00:00
|
|
|
const { buildDefaultFiles } = require( "./tasks/build" );
|
2013-12-20 22:13:48 +00:00
|
|
|
|
2020-03-02 21:42:38 +00:00
|
|
|
const npmTags = Release.npmTags;
|
2013-12-20 22:13:48 +00:00
|
|
|
|
2019-12-09 19:00:44 +00:00
|
|
|
function setSrcVersion( filepath ) {
|
|
|
|
var contents = fs.readFileSync( filepath, "utf8" );
|
|
|
|
contents = contents.replace( /@VERSION/g, Release.newVersion );
|
|
|
|
fs.writeFileSync( filepath, contents, "utf8" );
|
|
|
|
}
|
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
Release.define( {
|
2014-01-10 12:45:01 +00:00
|
|
|
npmPublish: true,
|
2015-01-28 19:37:29 +00:00
|
|
|
issueTracker: "github",
|
2016-05-10 09:12:28 +00:00
|
|
|
|
2024-02-05 16:51:11 +00:00
|
|
|
// Update cdn location to versioned files
|
|
|
|
cdnPublish: "dist/cdn/versioned",
|
|
|
|
|
2016-03-09 17:06:17 +00:00
|
|
|
/**
|
2023-06-27 16:23:58 +00:00
|
|
|
* Set the version in the src folder for distributing ES modules.
|
2016-03-09 17:06:17 +00:00
|
|
|
*/
|
|
|
|
_setSrcVersion: function() {
|
2019-12-09 19:00:44 +00:00
|
|
|
setSrcVersion( `${ __dirname }/../src/core.js` );
|
2016-03-09 17:06:17 +00:00
|
|
|
},
|
2016-05-10 09:12:28 +00:00
|
|
|
|
2013-12-20 22:13:48 +00:00
|
|
|
/**
|
|
|
|
* Generates any release artifacts that should be included in the release.
|
|
|
|
* The callback must be invoked with an array of files that should be
|
|
|
|
* committed before creating the tag.
|
|
|
|
* @param {Function} callback
|
|
|
|
*/
|
2024-02-06 14:53:30 +00:00
|
|
|
generateArtifacts: async function( callback ) {
|
|
|
|
await buildDefaultFiles( { version: Release.newVersion } );
|
2023-07-10 17:14:08 +00:00
|
|
|
|
2015-01-28 19:37:29 +00:00
|
|
|
cdn.makeReleaseCopies( Release );
|
2016-03-09 17:06:17 +00:00
|
|
|
Release._setSrcVersion();
|
2019-10-04 14:13:14 +00:00
|
|
|
callback( filesToCommit );
|
2013-12-20 22:13:48 +00:00
|
|
|
},
|
2016-05-10 09:12:28 +00:00
|
|
|
|
2013-12-20 22:13:48 +00:00
|
|
|
/**
|
2015-01-28 19:37:29 +00:00
|
|
|
* Acts as insertion point for restoring Release.dir.repo
|
|
|
|
* It was changed to reuse npm publish code in jquery-release
|
|
|
|
* for publishing the distribution repo instead
|
2013-12-20 22:13:48 +00:00
|
|
|
*/
|
2015-01-28 19:37:29 +00:00
|
|
|
npmTags: function() {
|
2015-08-16 06:59:58 +00:00
|
|
|
|
2015-01-28 19:37:29 +00:00
|
|
|
// origRepo is not defined if dist was skipped
|
|
|
|
Release.dir.repo = Release.dir.origRepo || Release.dir.repo;
|
|
|
|
return npmTags();
|
2013-12-20 22:13:48 +00:00
|
|
|
},
|
2016-05-10 09:12:28 +00:00
|
|
|
|
2013-12-20 22:13:48 +00:00
|
|
|
/**
|
2015-01-28 19:37:29 +00:00
|
|
|
* Publish to distribution repo and npm
|
|
|
|
* @param {Function} callback
|
2013-12-20 22:13:48 +00:00
|
|
|
*/
|
2024-02-06 14:53:30 +00:00
|
|
|
dist: async function( callback ) {
|
2023-07-10 17:14:08 +00:00
|
|
|
await cdn.makeArchives( Release );
|
|
|
|
dist( Release, distFiles, callback );
|
2013-12-20 22:13:48 +00:00
|
|
|
}
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2013-12-20 22:13:48 +00:00
|
|
|
};
|
2014-03-18 15:48:21 +00:00
|
|
|
|
|
|
|
module.exports.dependencies = [
|
2021-03-01 21:48:41 +00:00
|
|
|
"archiver@5.2.0",
|
|
|
|
"shelljs@0.8.4",
|
|
|
|
"inquirer@8.0.0"
|
2014-03-18 15:48:21 +00:00
|
|
|
];
|