npm publish gulp task

This commit is contained in:
Tim Lancina
2015-08-20 15:29:42 -05:00
parent 432f917e69
commit 83de0ed2ba
3 changed files with 55 additions and 5 deletions

View File

@ -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();
});
} }
) )
}) })

View File

@ -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
View 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"
}
}