Build: Require strict mode in Node.js scripts via ESLint
[jquery.git] / build / release.js
bloba9713fc087e7fcdc0b526b75bfe991961c8f8a55
1 "use strict";
3 var fs = require( "fs" );
5 module.exports = function( Release ) {
7         var
8                 distFiles = [
9                         "dist/jquery.js",
10                         "dist/jquery.min.js",
11                         "dist/jquery.min.map",
12                         "dist/jquery.slim.js",
13                         "dist/jquery.slim.min.js",
14                         "dist/jquery.slim.min.map"
15                 ],
16                 filesToCommit = [
17                         ...distFiles,
18                         "src/core.js"
19                 ],
20                 cdn = require( "./release/cdn" ),
21                 dist = require( "./release/dist" ),
22                 ensureSizzle = require( "./release/ensure-sizzle" ),
24                 npmTags = Release.npmTags;
26         Release.define( {
27                 npmPublish: true,
28                 issueTracker: "github",
30                 /**
31                  * Ensure the repo is in a proper state before release
32                  * @param {Function} callback
33                  */
34                 checkRepoState: function( callback ) {
35                         ensureSizzle( Release, callback );
36                 },
38                 /**
39                  * Set the version in the src folder for distributing AMD
40                  */
41                 _setSrcVersion: function() {
42                         var corePath = __dirname + "/../src/core.js",
43                                 contents = fs.readFileSync( corePath, "utf8" );
44                         contents = contents.replace( /@VERSION/g, Release.newVersion );
45                         fs.writeFileSync( corePath, contents, "utf8" );
46                 },
48                 /**
49                  * Generates any release artifacts that should be included in the release.
50                  * The callback must be invoked with an array of files that should be
51                  * committed before creating the tag.
52                  * @param {Function} callback
53                  */
54                 generateArtifacts: function( callback ) {
55                         Release.exec( "grunt", "Grunt command failed" );
56                         Release.exec(
57                                 "grunt custom:-ajax,-effects --filename=jquery.slim.js && " +
58                                         "grunt remove_map_comment --filename=jquery.slim.js",
59                                 "Grunt custom failed"
60                         );
61                         cdn.makeReleaseCopies( Release );
62                         Release._setSrcVersion();
63                         callback( filesToCommit );
64                 },
66                 /**
67                  * Acts as insertion point for restoring Release.dir.repo
68                  * It was changed to reuse npm publish code in jquery-release
69                  * for publishing the distribution repo instead
70                  */
71                 npmTags: function() {
73                         // origRepo is not defined if dist was skipped
74                         Release.dir.repo = Release.dir.origRepo || Release.dir.repo;
75                         return npmTags();
76                 },
78                 /**
79                  * Publish to distribution repo and npm
80                  * @param {Function} callback
81                  */
82                 dist: function( callback ) {
83                         cdn.makeArchives( Release, function() {
84                                 dist( Release, distFiles, callback );
85                         } );
86                 }
87         } );
90 module.exports.dependencies = [
91         "archiver@1.3.0",
92         "shelljs@0.7.7",
93         "npm@4.4.1",
94         "chalk@1.1.3"