feat(build): add npm publish script

Also fixes gulpfile:
- `runSequence` needs to be called with `done` callback
- `es5build` should only run when the task executes…
This commit is contained in:
Tobias Bosch 2015-02-10 15:18:16 -08:00
parent 6e923cbf84
commit 729e38af19
9 changed files with 123 additions and 83 deletions

View File

@ -253,16 +253,19 @@ gulp.task('build/transpile.js.dev.es6', transpile(gulp, gulpPlugins, {
srcFolderInsertion: CONFIG.srcFolderInsertion.js
}));
gulp.task('build/transpile.js.dev.es5', es5build({
src: CONFIG.dest.js.dev.es6,
dest: CONFIG.dest.js.dev.es5,
modules: 'instantiate'
}));
gulp.task('build/transpile.js.dev.es5', function() {
return es5build({
src: CONFIG.dest.js.dev.es6,
dest: CONFIG.dest.js.dev.es5,
modules: 'instantiate'
});
});
gulp.task('build/transpile.js.dev', function() {
return runSequence(
gulp.task('build/transpile.js.dev', function(done) {
runSequence(
'build/transpile.js.dev.es6',
'build/transpile.js.dev.es5'
'build/transpile.js.dev.es5',
done
);
});
@ -275,16 +278,19 @@ gulp.task('build/transpile.js.prod.es6', transpile(gulp, gulpPlugins, {
srcFolderInsertion: CONFIG.srcFolderInsertion.js
}));
gulp.task('build/transpile.js.prod.es5', es5build({
src: CONFIG.dest.js.prod.es6,
dest: CONFIG.dest.js.prod.es5,
modules: 'instantiate'
}));
gulp.task('build/transpile.js.prod.es5', function() {
return es5build({
src: CONFIG.dest.js.prod.es6,
dest: CONFIG.dest.js.prod.es5,
modules: 'instantiate'
});
});
gulp.task('build/transpile.js.prod', function() {
return runSequence(
gulp.task('build/transpile.js.prod', function(done) {
runSequence(
'build/transpile.js.prod.es6',
'build/transpile.js.prod.es5'
'build/transpile.js.prod.es5',
done
);
});
@ -344,11 +350,19 @@ gulp.task('build/html.dart', html(gulp, gulpPlugins, {
gulp.task('build/copy.js.dev', function() {
return gulp.src(CONFIG.copy.js)
.pipe(gulpPlugins.template({
'channel': 'dev',
'packageJson': require('./package.json')
}))
.pipe(gulp.dest(CONFIG.dest.js.dev.es6));
});
gulp.task('build/copy.js.prod', function() {
return gulp.src(CONFIG.copy.js)
.pipe(gulpPlugins.template({
'channel': 'prod',
'packageJson': require('./package.json')
}))
.pipe(gulp.dest(CONFIG.dest.js.prod.es6));
});
@ -522,40 +536,45 @@ gulp.task('ci', function(done) {
runSequence(
'test.transpiler.unittest',
'test.js/ci',
'test.dart/ci'
'test.dart/ci',
done
);
});
// -----------------
// orchestrated targets
gulp.task('build.dart', function() {
return runSequence(
gulp.task('build.dart', function(done) {
runSequence(
['build/deps.js.dart2js', 'build/transpile.dart', 'build/html.dart'],
'build/pubspec.dart',
'build/multicopy.dart',
'build/pubbuild.dart',
'build/analyze.dart',
'build/format.dart'
'build/format.dart',
done
);
});
gulp.task('build.js.dev', function() {
return runSequence(
gulp.task('build.js.dev', function(done) {
runSequence(
['build/deps.js.dev', 'build/transpile.js.dev', 'build/html.js.dev', 'build/copy.js.dev'],
'build/multicopy.js.dev'
'build/multicopy.js.dev',
done
);
});
gulp.task('build.js.prod', function() {
return runSequence(
gulp.task('build.js.prod', function(done) {
runSequence(
['build/deps.js.prod', 'build/transpile.js.prod', 'build/html.js.prod', 'build/copy.js.prod'],
'build/multicopy.js.prod'
'build/multicopy.js.prod',
done
);
});
gulp.task('build.cjs', function() {
return runSequence(
['build/transpile/tools.cjs', 'build/transpile/e2eTest.cjs']
gulp.task('build.cjs', function(done) {
runSequence(
['build/transpile/tools.cjs', 'build/transpile/e2eTest.cjs'],
done
);
});

View File

@ -3,6 +3,11 @@ Angular2
The sources for this package are in the main [Angular2](https://github.com/angular/angular) repo. Please file issues and pull requests against that repo. This is the repository for the upcoming 2.0 version. If you're looking for the current official version of Angular you should go to [angular/angular.js](https://github.com/angular/angular.js)
Angular2 has 2 versions:
1. a development version that includes runtime type assertions: See `ng2dev` npm tag
2. a production version that does not include runtime type assertions: See `ng2prod` npm tag
All sources are in ES6 format and have the suffix `.es6`. They don't depend on any runtime
and can be used by any modern ES6 -> ES5 transpiler.

View File

@ -1,23 +1,16 @@
{
"name": "angular2",
"version": "2.0.0-alpha.1",
"name": "angular",
"version": "<%= packageJson.version %>.<%= channel %>",
"description": "Angular 2 - a web framework for modern web apps",
"homepage": "https://github.com/angular/angular",
"bugs": "https://github.com/angular/angular/issues",
"contributors": {
"Alex Eagle": "alexeagle@google.com",
"Chirayu Krishnappa": "chirayu@google.com",
"Jeff Cross": "crossj@google.com",
"Misko Hevery": "misko@google.com",
"Rado Kirov": "radokirov@google.com",
"Tobias Bosch": "tbosch@google.com",
"Victor Savkin": "vsavkin@google.com",
"Yegor Jbanov": "yjbanov@google.com"
},
"license": "Apache-2.0",
"homepage": "<%= packageJson.homepage %>",
"bugs": "<%= packageJson.bugs %>",
"contributors": <%= JSON.stringify(packageJson.contributors) %>,
"license": "<%= packageJson.license %>",
"dependencies": {
"zone": "0.4.*",
"rtts-assert": "2.0.0-alpha.1"
<% if (channel==='dev') { %>
"ng-rtts-assert": "<%= packageJson.version %>",
<% } %>
"zone.js": "0.4.*"
},
"devDependencies": {
"yargs": "2.3.*",

View File

@ -1,16 +1,11 @@
name: angular2
version: 2.0.0-alpha.1
version: <%= packageJson.version %>
authors:
- Alex Eagle <alexeagle@google.com>
- Chirayu Krishnappa <chirayu@google.com>
- Jeff Cross <crossj@google.com>
- Misko Hevery <misko@google.com>
- Rado Kirov <radokirov@google.com>
- Tobias Bosch <tbosch@google.com>
- Victor Savkin <vsavkin@google.com>
- Yegor Jbanov <yjbanov@google.com>
<%= Object.keys(packageJson.contributors).map(function(name) {
return '- '+name+' <'+packageJson.contributors[name]+'>';
}).join('\n') %>
description: Angular 2 for Dart - a web framework for modern web apps
homepage: https://github.com/angular/angular
homepage: <%= packageJson.homepage %>
environment:
sdk: '>=1.4.0'
dependencies:

View File

@ -1,20 +1,11 @@
{
"name": "rtts-assert",
"version": "2.0.0-alpha.1",
"description": "A type assertion library for Traceur.",
"homepage": "https://github.com/angular/angular",
"bugs": "https://github.com/angular/angular/issues",
"contributors": {
"Alex Eagle": "alexeagle@google.com",
"Chirayu Krishnappa": "chirayu@google.com",
"Jeff Cross": "crossj@google.com",
"Misko Hevery": "misko@google.com",
"Rado Kirov": "radokirov@google.com",
"Tobias Bosch": "tbosch@google.com",
"Victor Savkin": "vsavkin@google.com",
"Yegor Jbanov": "yjbanov@google.com"
},
"license": "Apache-2.0",
"name": "ng-rtts-assert",
"version": "<%= packageJson.version %>",
"description": "A run-time type assertion library for JavaScript",
"homepage": "<%= packageJson.homepage %>",
"bugs": "<%= packageJson.bugs %>",
"contributors": <%= JSON.stringify(packageJson.contributors) %>,
"license": "<%= packageJson.license %>",
"devDependencies": {
"yargs": "2.3.*",
"gulp-sourcemaps": "1.3.*",

View File

@ -1,17 +1,27 @@
{
"name": "angular",
"version": "0.0.0",
"description": "Angular",
"version": "2.0.0-alpha.5",
"description": "Angular 2 - a web framework for modern web apps",
"homepage": "https://github.com/angular/angular",
"bugs": "https://github.com/angular/angular/issues",
"contributors": {
"Alex Eagle": "alexeagle@google.com",
"Chirayu Krishnappa": "chirayu@google.com",
"Jeff Cross": "crossj@google.com",
"Misko Hevery": "misko@google.com",
"Rado Kirov": "radokirov@google.com",
"Tobias Bosch": "tbosch@google.com",
"Victor Savkin": "vsavkin@google.com",
"Yegor Jbanov": "yjbanov@google.com"
},
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/angular/angular.git"
},
"bugs": "https://github.com/angular/angular/issues",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Tobias Bosch <tbosch@google.com>",
"license": "Apache-2.0",
"dependencies": {
"es6-module-loader": "^0.9.2",
"systemjs": "^0.9.1",
@ -22,9 +32,6 @@
"node-uuid": "1.4.x"
},
"devDependencies": {
"yargs": "2.3.*",
"gulp-sourcemaps": "1.3.*",
"gulp-traceur": "0.16.*",
"angular": "1.3.5",
"bower": "^1.3.12",
"canonical-path": "0.0.2",
@ -36,11 +43,13 @@
"gulp": "^3.8.8",
"gulp-changed": "^1.0.0",
"gulp-connect": "~1.0.5",
"gulp-ejs": "^0.3.1",
"gulp-jasmine": "^1.0.1",
"gulp-load-plugins": "^0.7.1",
"gulp-rename": "^1.2.0",
"gulp-shell": "^0.2.10",
"gulp-sourcemaps": "1.3.*",
"gulp-template": "^3.0.0",
"gulp-traceur": "0.16.*",
"gulp-webserver": "^0.8.7",
"karma": "^0.12.23",
"karma-chrome-launcher": "^0.1.4",
@ -55,6 +64,7 @@
"q": "^1.0.1",
"run-sequence": "^0.3.6",
"sprintf-js": "1.0.*",
"through2": "^0.6.1"
"through2": "^0.6.1",
"yargs": "2.3.*"
}
}

24
scripts/publish/npm_publish.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
set -ex
ROOT_DIR=$(cd $(dirname $0)/../..; pwd)
cd $ROOT_DIR
gulp clean
gulp build.js.prod build.js.dev
function angular {
CHANNEL=$1
cd $ROOT_DIR/dist/js/$CHANNEL/es6/angular2
rm -fr test
npm publish ./ --tag "ng2$CHANNEL"
}
function rttsAssert {
cd $ROOT_DIR/dist/js/prod/es6/rtts_assert
rm -fr test
npm publish ./
}
rttsAssert
angular dev
angular prod

View File

@ -47,7 +47,7 @@ if (!module.parent) {
function run(config) {
var src = ['!node_modules', '!node_modules/**', './**/*.es6'];
gulp.src(src, {cwd: config.src})
return gulp.src(src, {cwd: config.src})
.pipe(rename(function(file) {
file.extname = file.extname.replace('.es6', '.js');
}))

View File

@ -9,6 +9,9 @@ module.exports = function(gulp, plugins, config) {
var files = [];
var pubSpecCopy = util.streamToPromise(gulp.src(config.src)
.pipe(plugins.changed(config.dest)) // Only forward files that changed.
.pipe(plugins.template({
'packageJson': require('../../package.json')
}))
.pipe(through2.obj(function(file, enc, done) {
files.push(path.resolve(process.cwd(), config.dest, file.relative));
this.push(file);