feat(npm): publish bundles and their typings in npm distribution

The same bundles that are published to https://code.angularjs.org
are now included in a "bundles" folder inside the npm distribution.

Closes #3555
This commit is contained in:
Jeff Cross 2015-08-11 16:33:03 -07:00
parent 8f5360c387
commit 7b3cca20d2
3 changed files with 19 additions and 3 deletions

View File

@ -6,11 +6,13 @@ ROOT_DIR=$(cd $(dirname $0)/../..; pwd)
cd $ROOT_DIR cd $ROOT_DIR
gulp clean gulp clean
gulp build.js.prod build.js.dev build.js.cjs benchpress.bundle # benchpress.bundle and bundles.js will implicitly build everything we need
gulp benchpress.bundle bundles.js docs/typings
NPM_DIR=$ROOT_DIR/dist/npm NPM_DIR=$ROOT_DIR/dist/npm
rm -fr $NPM_DIR rm -fr $NPM_DIR
FILES='!(test|e2e_test|docs)' FILES='!(test|e2e_test|docs)'
DTS_FILES='*.d.ts'
function publishRttsAssert { function publishRttsAssert {
NAME='rtts_assert' NAME='rtts_assert'
@ -38,6 +40,20 @@ function publishModule {
mkdir -p $PUBLISH_DIR/ts mkdir -p $PUBLISH_DIR/ts
cp -r $ROOT_DIR/modules/$NAME/$FILES $PUBLISH_DIR/ts cp -r $ROOT_DIR/modules/$NAME/$FILES $PUBLISH_DIR/ts
if [ $NAME = "angular2" ]; then
# Publish bundles and typings
mkdir -p $PUBLISH_DIR/bundles/typings/angular2
mkdir -p $PUBLISH_DIR/bundles/typings/es6-promise
mkdir -p $PUBLISH_DIR/bundles/typings/rx
# Copy Bundles
cp -r $ROOT_DIR/dist/js/bundle/$FILES $PUBLISH_DIR/bundles
# Copy Typings
cp -r $ROOT_DIR/dist/docs/typings/angular2/$DTS_FILES $PUBLISH_DIR/bundles/typings/angular2
cp -r $ROOT_DIR/dist/docs/typings/http/$DTS_FILES $PUBLISH_DIR/bundles/typings/angular2
cp -r $ROOT_DIR/modules/angular2/typings/es6-promise/$DTS_FILES $PUBLISH_DIR/bundles/typings/es6-promise
cp -r $ROOT_DIR/modules/angular2/typings/rx/$DTS_FILES $PUBLISH_DIR/bundles/typings/rx
fi
if [ $NAME = "benchpress" ]; then if [ $NAME = "benchpress" ]; then
cp -r $ROOT_DIR/dist/build/benchpress_bundle/$FILES $PUBLISH_DIR cp -r $ROOT_DIR/dist/build/benchpress_bundle/$FILES $PUBLISH_DIR
cp -r $ROOT_DIR/dist/js/cjs/benchpress/README.md $PUBLISH_DIR cp -r $ROOT_DIR/dist/js/cjs/benchpress/README.md $PUBLISH_DIR

View File

@ -98,7 +98,7 @@ module.exports = function makeBrowserTree(options, destinationPath) {
// Use TypeScript to transpile the *.ts files to ES6 // Use TypeScript to transpile the *.ts files to ES6
var es6Tree = compileWithTypescript(modulesTree, { var es6Tree = compileWithTypescript(modulesTree, {
allowNonTsExtensions: false, allowNonTsExtensions: false,
declaration: true, declaration: false,
emitDecoratorMetadata: true, emitDecoratorMetadata: true,
mapRoot: '', // force sourcemaps to use relative path mapRoot: '', // force sourcemaps to use relative path
noEmitOnError: false, noEmitOnError: false,

View File

@ -31,7 +31,7 @@ module.exports = function makeNodeTree(destinationPath) {
allowNonTsExtensions: false, allowNonTsExtensions: false,
emitDecoratorMetadata: true, emitDecoratorMetadata: true,
experimentalDecorators: true, experimentalDecorators: true,
declaration: true, declaration: false,
mapRoot: '', /* force sourcemaps to use relative path */ mapRoot: '', /* force sourcemaps to use relative path */
module: 'commonjs', module: 'commonjs',
noEmitOnError: true, noEmitOnError: true,