Skip to content

Commit

Permalink
feature(publish) speed up: npm publish and github release is parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
coderaiser committed Jan 14, 2015
1 parent b15c942 commit 181ec1d
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions lib/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
'git commit -am "feature(package) v{{ version }}"',
'git tag v{{version}}',
'git push origin v{{version}}',
'git push origin master',
'npm publish'
'git push origin master'
].join('&&'),

MSG = [ 'publish <version>',
Expand Down Expand Up @@ -77,21 +76,7 @@
},

function(callback) {
var spawn = spawnify(cmd);

spawn.on('error', function(error) {
emitter.emit('error', error);
});

spawn.on('data', function(data) {
emitter.emit('data', data);
});

spawn.on('exit', function() {
spawn = null;

callback();
});
execute(cmd, emitter, callback);
},

function (callback) {
Expand All @@ -114,6 +99,8 @@

callback(error);
});

execute('npm publish', emitter, callback);
}

], function(error) {
Expand All @@ -125,7 +112,25 @@

return emitter;
}

function execute(cmd, emitter, callback) {
var spawn = spawnify(cmd);

spawn.on('error', function(error) {
emitter.emit('error', error);
});

spawn.on('data', function(data) {
emitter.emit('data', data);
});

spawn.on('exit', function() {
spawn = null;

callback();
});
}

function rmLines(str, count) {
return str
.split('\n')
Expand Down

0 comments on commit 181ec1d

Please sign in to comment.