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",
|
|
|
|
"dist/jquery.slim.min.map"
|
|
|
|
];
|
|
|
|
const filesToCommit = [
|
|
|
|
...distFiles,
|
|
|
|
"src/core.js"
|
|
|
|
];
|
|
|
|
const cdn = require( "./release/cdn" );
|
|
|
|
const dist = require( "./release/dist" );
|
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
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
generateArtifacts: function( callback ) {
|
2021-03-01 22:48:55 +00:00
|
|
|
Release.exec( "npx grunt", "Grunt command failed" );
|
2015-11-12 18:18:59 +00:00
|
|
|
Release.exec(
|
2021-03-01 22:48:55 +00:00
|
|
|
"npx grunt custom:slim --filename=jquery.slim.js && " +
|
|
|
|
"npx grunt remove_map_comment --filename=jquery.slim.js",
|
2015-11-12 18:18:59 +00:00
|
|
|
"Grunt custom failed"
|
|
|
|
);
|
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
|
|
|
*/
|
2015-01-28 19:37:29 +00:00
|
|
|
dist: function( callback ) {
|
2015-01-30 00:21:39 +00:00
|
|
|
cdn.makeArchives( Release, function() {
|
2019-10-04 14:13:14 +00:00
|
|
|
dist( Release, distFiles, callback );
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
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
|
|
|
];
|