mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
chore(publish): read versions from root package.json
This commit is contained in:
35
gulpfile.js
35
gulpfile.js
@ -456,40 +456,39 @@ gulp.task('package', ['src.release'], function(done){
|
|||||||
])
|
])
|
||||||
.pipe(gulp.dest(distDir));
|
.pipe(gulp.dest(distDir));
|
||||||
|
|
||||||
var inquirer = require('inquirer');
|
var templateVars = {};
|
||||||
inquirer.prompt([
|
var packageJSON = require('./package.json');
|
||||||
{
|
templateVars.ionicVersion = packageJSON.version;
|
||||||
type: 'input',
|
templateVars.angularVersion = packageJSON.dependencies.angular2;
|
||||||
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'));
|
var packageTemplate = _.template(fs.readFileSync('scripts/npm/package.json'));
|
||||||
fs.writeFileSync(distDir + '/package.json', packageTemplate(answers));
|
fs.writeFileSync(distDir + '/package.json', packageTemplate(templateVars));
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('publish', ['package'], function(done){
|
gulp.task('publish', ['package'], function(done){
|
||||||
|
|
||||||
var spawn = require('child_process').spawn;
|
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) {
|
npmCmd.stdout.on('data', function (data) {
|
||||||
console.log(data.toString());
|
console.log(data.toString());
|
||||||
});
|
});
|
||||||
|
|
||||||
npmCmd.stderr.on('data', function (data) {
|
npmCmd.stderr.on('data', function (data) {
|
||||||
|
err = true;
|
||||||
console.log('npm err: ' + data.toString());
|
console.log('npm err: ' + data.toString());
|
||||||
});
|
});
|
||||||
|
|
||||||
npmCmd.on('close', function() {
|
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();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"private": "true",
|
"private": "true",
|
||||||
"name": "ionic2",
|
"name": "ionic2",
|
||||||
"version": "2.0.0-alpha.48",
|
"version": "2.0.0-alpha.52",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ionic-framework",
|
"name": "ionic-framework",
|
||||||
"version": "2.0.0-alpha.<%= ionicVersion %>",
|
"version": "<%= ionicVersion %>",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"keywords": ["ionic", "framework", "mobile", "app", "hybrid", "webapp"],
|
"keywords": ["ionic", "framework", "mobile", "app", "hybrid", "webapp"],
|
||||||
"repository": {
|
"repository": {
|
||||||
@ -16,6 +16,6 @@
|
|||||||
"shelljs": "0.5.3"
|
"shelljs": "0.5.3"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"angular2": "^2.0.0-beta.<%= angularVersion %>"
|
"angular2": "^<%= angularVersion %>"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user