Skip to content

Commit ced2807

Browse files
committed
Tasks: Add task for publishing to npm
Fixes gh-3
1 parent 5fadeaf commit ced2807

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ The previous release version (used for determining what changed).
192192

193193
The version that will be set in `package.json` after the release.
194194

195+
#### npmPublish
196+
197+
Set to `true` to publish a release via npm. Defaults to `false`.
198+
195199
#### tagTime
196200

197201
Timestamp for the release tag.

lib/npm.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module.exports = function( Release ) {
2+
Release.define({
3+
_publishNpm: function() {
4+
if ( !Release.npmPublish ) {
5+
return;
6+
}
7+
8+
Release.chdir( Release.dir.repo );
9+
10+
var npmCommand = "npm publish";
11+
12+
if ( Release.preRelease ) {
13+
npmCommand += " --tag beta";
14+
}
15+
16+
if ( Release.isTest ) {
17+
console.log( "Actual release would now publish to npm" );
18+
console.log( "Would run: " + npmCommand.cyan );
19+
return;
20+
}
21+
22+
console.log( "Publishing to npm, running " + npmCommand.cyan );
23+
Release.exec( npmCommand );
24+
console.log();
25+
}
26+
});
27+
};

release.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ commonTasks = [
4343
Release._section( "publishing to jQuery CDN" ),
4444
Release._copyCdnArtifacts,
4545
Release.confirmReview,
46-
Release._pushToCdn
46+
Release._pushToCdn,
47+
48+
Release._section( "publishing to npm" ),
49+
Release._publishNpm
4750
];
4851

4952
stableTasks = [

0 commit comments

Comments
 (0)