mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 04:14:21 +08:00
Added publish.nightly task to gulp file.
This commit is contained in:
44
gulpfile.js
44
gulpfile.js
@ -843,6 +843,50 @@ gulp.task('publish.npm', function(done) {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Publishes a new tag to npm with a nightly tag.
|
||||
*/
|
||||
gulp.task('publish.nightly', function(done) {
|
||||
var fs = require('fs');
|
||||
var spawn = require('child_process').spawn;
|
||||
var packageJSON = require('./package.json');
|
||||
var hashLength = 8;
|
||||
|
||||
// Generate a unique hash based on current timestamp
|
||||
function createUniqueHash() {
|
||||
var makeHash = require('crypto').createHash('sha1');
|
||||
var timeString = (new Date).getTime().toString();
|
||||
return makeHash.update(timeString).digest('hex').substring(0, hashLength);
|
||||
}
|
||||
|
||||
/**
|
||||
* Split the version on dash so that we can add nightly
|
||||
* to all production, beta, and nightly releases
|
||||
* 0.1.0 -becomes- 0.1.0-r8e7684t
|
||||
* 0.1.0-beta.0 -becomes- 0.1.0-beta.0-r8e7684t
|
||||
* 0.1.0-beta.0-t5678e3v -becomes- 0.1.0-beta.0-r8e7684t
|
||||
*/
|
||||
packageJSON.version = packageJSON.version.split('-')
|
||||
.slice(0, 2)
|
||||
.concat(createUniqueHash())
|
||||
.join('-');
|
||||
|
||||
var npmCmd = spawn('npm', ['publish', '--tag=nightly', './dist']);
|
||||
|
||||
npmCmd.stdout.on('data', function (data) {
|
||||
console.log(data.toString());
|
||||
});
|
||||
|
||||
npmCmd.stderr.on('data', function (data) {
|
||||
console.log('npm err: ' + data.toString());
|
||||
});
|
||||
|
||||
npmCmd.on('close', function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Build Ionic sources, with typechecking, .d.ts definition generation and debug
|
||||
* statements removed.
|
||||
|
Reference in New Issue
Block a user