mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
npm publish gulp task
This commit is contained in:
36
gulpfile.js
36
gulpfile.js
@ -52,8 +52,8 @@ var tscReporter = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var flagConfig = {
|
var flagConfig = {
|
||||||
string: 'port',
|
string: ['port', 'version'],
|
||||||
alias: {'p': 'port'},
|
alias: {'p': 'port', 'v': 'version'},
|
||||||
default: { port: 8000 }
|
default: { port: 8000 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -343,14 +343,42 @@ gulp.task('copy.scss', function() {
|
|||||||
.pipe(gulp.dest('dist/src/scss'));
|
.pipe(gulp.dest('dist/src/scss'));
|
||||||
})
|
})
|
||||||
|
|
||||||
|
gulp.task('src', function(done){
|
||||||
|
runSequence(
|
||||||
|
'clean',
|
||||||
|
['bundle', 'sass', 'fonts', 'copy.ts', 'copy.scss'],
|
||||||
|
'transpile.common',
|
||||||
|
done
|
||||||
|
);
|
||||||
|
})
|
||||||
|
|
||||||
gulp.task('publish', function(done) {
|
gulp.task('publish', function(done) {
|
||||||
|
var v = flags.version;
|
||||||
|
if (!v) {
|
||||||
|
console.error("\nERR: You need to provide a version or tag.\ngulp publish -v {version}\n");
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (v.indexOf("alpha") + v.indexOf("-") > -2) {
|
||||||
|
console.error("\n ERR: Just provide version number. Instead of 2.0.0-alpha.10, just enter 10\n");
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
runSequence(
|
runSequence(
|
||||||
'clean',
|
'clean',
|
||||||
['bundle', 'sass', 'fonts', 'copy.ts', 'copy.scss'],
|
['bundle', 'sass', 'fonts', 'copy.ts', 'copy.scss'],
|
||||||
'transpile.common',
|
'transpile.common',
|
||||||
function() {
|
function() {
|
||||||
var packageJSONContents = '{\n "name": "ionic-framework",\n "version": "2.0.0-alpha.1",\n "license": "Apache-2.0",\n "repository": {\n "type": "git",\n "url": "https://github.com/driftyco/ionic2.git"\n }\n}\n';
|
var packageJSONTemplate = _.template(fs.readFileSync('scripts/npm/package.json'));
|
||||||
fs.writeFile("dist/package.json", packageJSONContents, done);
|
packageJSONContents = packageJSONTemplate({ 'version': v });
|
||||||
|
fs.writeFileSync("dist/package.json", packageJSONContents);
|
||||||
|
|
||||||
|
// publish to npm
|
||||||
|
var exec = require('child_process').exec;
|
||||||
|
exec('cd dist && npm publish', function (err, stdout, stderr) {
|
||||||
|
console.log(stdout);
|
||||||
|
console.error(stderr);
|
||||||
|
done();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -6,8 +6,14 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/driftyco/ionic2.git"
|
"url": "https://github.com/driftyco/ionic2.git"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"dependencies": {
|
||||||
"angular2": "2.0.0-alpha.35",
|
"angular2": "2.0.0-alpha.35",
|
||||||
|
"reflect-metadata": "0.1.0",
|
||||||
|
"rtts_assert": "2.0.0-alpha.35",
|
||||||
|
"traceur-runtime": "0.0.59",
|
||||||
|
"zone.js": "0.5.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
"canonical-path": "0.0.2",
|
"canonical-path": "0.0.2",
|
||||||
"connect": "^3.3.4",
|
"connect": "^3.3.4",
|
||||||
"del": "~1.1.1",
|
"del": "~1.1.1",
|
||||||
|
16
scripts/npm/package.json
Normal file
16
scripts/npm/package.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"name": "ionic-framework",
|
||||||
|
"version": "2.0.0-alpha.<%= version %>",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/driftyco/ionic2.git"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"angular2": "2.0.0-alpha.35",
|
||||||
|
"reflect-metadata": "0.1.0",
|
||||||
|
"rtts_assert": "2.0.0-alpha.35",
|
||||||
|
"traceur-runtime": "0.0.59",
|
||||||
|
"zone.js": "0.5.2"
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user