diff --git a/gulpfile.js b/gulpfile.js index f14d8a6a19..c49b9d6ae5 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -456,40 +456,39 @@ gulp.task('package', ['src.release'], function(done){ ]) .pipe(gulp.dest(distDir)); - var inquirer = require('inquirer'); - inquirer.prompt([ - { - type: 'input', - name: 'ionicVersion', - message: '\n\nWhat ionic-framework alpha version number will this be?' - }, - { - type: 'input', - name: 'angularVersion', - message: '\nWhat angular2 beta version number is a peer dependency?' - } - ], function(answers) { - var packageTemplate = _.template(fs.readFileSync('scripts/npm/package.json')); - fs.writeFileSync(distDir + '/package.json', packageTemplate(answers)); - - done(); - }); + var templateVars = {}; + var packageJSON = require('./package.json'); + templateVars.ionicVersion = packageJSON.version; + templateVars.angularVersion = packageJSON.dependencies.angular2; + var packageTemplate = _.template(fs.readFileSync('scripts/npm/package.json')); + fs.writeFileSync(distDir + '/package.json', packageTemplate(templateVars)); + done(); }); gulp.task('publish', ['package'], function(done){ - var spawn = require('child_process').spawn; - var npmCmd = spawn('npm', ['publish', './dist']); + var semver = require('semver'); + var fs = require('fs'); + var err = false; + + var npmCmd = spawn('npm', ['pack', './dist']); npmCmd.stdout.on('data', function (data) { console.log(data.toString()); }); npmCmd.stderr.on('data', function (data) { + err = true; console.log('npm err: ' + data.toString()); }); npmCmd.on('close', function() { + // update package.json + if (!err) { + var packageJSON = require('./package.json'); + packageJSON.version = semver.inc(packageJSON.version, 'prerelease', 'alpha'); + fs.writeFileSync('package.json', JSON.stringify(packageJSON, null, 2)); + } done(); }); diff --git a/package.json b/package.json index 9cca29f9f9..5c8c4822b3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": "true", "name": "ionic2", - "version": "2.0.0-alpha.48", + "version": "2.0.0-alpha.52", "license": "Apache-2.0", "repository": { "type": "git", @@ -85,4 +85,4 @@ "path": "node_modules/ionic-cz-conventional-changelog" } } -} +} \ No newline at end of file diff --git a/scripts/npm/package.json b/scripts/npm/package.json index bd9a3c44fe..ec7719fbcd 100644 --- a/scripts/npm/package.json +++ b/scripts/npm/package.json @@ -1,6 +1,6 @@ { "name": "ionic-framework", - "version": "2.0.0-alpha.<%= ionicVersion %>", + "version": "<%= ionicVersion %>", "license": "Apache-2.0", "keywords": ["ionic", "framework", "mobile", "app", "hybrid", "webapp"], "repository": { @@ -16,6 +16,6 @@ "shelljs": "0.5.3" }, "peerDependencies": { - "angular2": "^2.0.0-beta.<%= angularVersion %>" + "angular2": "^<%= angularVersion %>" } }