add angular version to publish task

This commit is contained in:
Tim Lancina
2015-09-06 22:11:46 -05:00
parent d464f8f02c
commit 02db50e96d
2 changed files with 15 additions and 10 deletions

View File

@ -41,8 +41,8 @@ var tscReporter = {
}; };
var flagConfig = { var flagConfig = {
string: ['port', 'version'], string: ['port', 'version', 'ngVersion'],
alias: {'p': 'port', 'v': 'version'}, alias: {'p': 'port', 'v': 'version', 'a': 'ngVersion'},
default: { port: 8000 } default: { port: 8000 }
}; };
@ -358,12 +358,17 @@ gulp.task('src', function(done){
}) })
gulp.task('publish', function(done) { gulp.task('publish', function(done) {
var v = flags.version; var version = flags.version;
if (!v) { var ngVersion = flags.ngVersion;
console.error("\nERR: You need to provide a version or tag.\ngulp publish -v {version}\n"); if (!version || !ngVersion) {
console.error("\nERR: You need to provide a version for Ionic as well as " +
"the version of Angular it depends on.\n\n" +
"gulp publish -v {version} -a {ngVersion}\n");
return return
} }
if (v.indexOf("alpha") + v.indexOf("-") > -2) { if (version.indexOf("alpha") + version.indexOf("-") > -2 ||
ngVersion.indexOf("alpha") + ngVersion.indexOf("-") > -2)
{
console.error("\n ERR: Just provide version number. Instead of 2.0.0-alpha.10, just enter 10\n"); console.error("\n ERR: Just provide version number. Instead of 2.0.0-alpha.10, just enter 10\n");
return return
} }
@ -378,7 +383,7 @@ gulp.task('publish', function(done) {
'transpile.common', 'transpile.common',
function() { function() {
var packageJSONTemplate = _.template(fs.readFileSync('scripts/npm/package.json')); var packageJSONTemplate = _.template(fs.readFileSync('scripts/npm/package.json'));
packageJSONContents = packageJSONTemplate({ 'version': v }); packageJSONContents = packageJSONTemplate({ 'version': version, 'ngVersion': ngVersion });
fs.writeFileSync("dist/package.json", packageJSONContents); fs.writeFileSync("dist/package.json", packageJSONContents);
// publish to npm // publish to npm

View File

@ -7,10 +7,10 @@
"url": "https://github.com/driftyco/ionic2.git" "url": "https://github.com/driftyco/ionic2.git"
}, },
"dependencies": { "dependencies": {
"angular2": "2.0.0-alpha.35", "angular2": "2.0.0-alpha.<%= ngVersion %>",
"reflect-metadata": "0.1.0", "reflect-metadata": "0.1.0",
"rtts_assert": "2.0.0-alpha.35", "rtts_assert": "2.0.0-alpha.<%= ngVersion %>",
"traceur-runtime": "0.0.59", "traceur-runtime": "0.0.59",
"zone.js": "0.5.2" "zone.js": "0.5.4"
} }
} }