-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathrelease.js
108 lines (89 loc) · 2.2 KB
/
release.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/usr/bin/env node
"use strict";
// Stop the release process if any of the asynchronous operations fails.
process.on( "unhandledRejection", reason => {
console.error( "Unhandled rejection:", reason );
throw reason;
} );
var commonTasks, stableTasks,
fs = require( "fs" ),
Release = {
define: function( props ) {
for ( var prop in props ) {
Release[ prop ] = props[ prop ];
}
},
complete: function() {
console.log( "Release complete." );
console.log( "Please review the project-specific release checklist." );
}
};
fs.readdirSync( "./lib" ).forEach( function( filename ) {
if ( filename.endsWith( ".js" ) ) {
require( "./lib/" + filename )( Release );
}
} );
commonTasks = [
Release._checkExecutables,
Release._parseArguments,
Release.confirm,
Release._section( "setting up repo" ),
Release._createReleaseDirectory,
Release._cloneRepo,
Release._loadReleaseScript,
Release._checkRepoState,
Release._checkNpmCredentials,
Release._section( "calculating versions" ),
Release._getVersions,
Release.confirm,
Release._section( "building release" ),
Release._createReleaseBranch,
Release._section( "generating changelog" ),
Release._generateChangelog,
Release._section( "gathering contributors" ),
Release._gatherContributors,
function( fn ) {
if ( Release.cdnPublish ) {
Release._section( "publishing to jQuery CDN" )();
Release.walk( [
Release._copyCdnArtifacts,
Release.confirmReview,
Release._pushToCdn
], fn );
} else {
fn();
}
},
Release._section( "pushing tag" ),
Release.confirmReview,
Release._pushRelease,
function( fn ) {
if ( Release.dist ) {
Release._section( "additional custom distribution" );
Release.dist( fn );
} else {
fn();
}
},
function() {
if ( Release.npmPublish ) {
Release._section( "publishing to npm" )();
}
},
Release._publishNpm
];
stableTasks = [
Release._section( "updating branch version" ),
Release._updateBranchVersion,
function() {
Release._section( "pushing " + Release.branch )();
},
Release.confirmReview,
Release._pushBranch
];
Release.walk( commonTasks, function() {
if ( Release.preRelease ) {
return Release.complete();
}
Release.walk( stableTasks, Release.complete );
} );