From 7b3cca20d28b3411026cb7188e5e9055f85823db Mon Sep 17 00:00:00 2001 From: Jeff Cross Date: Tue, 11 Aug 2015 16:33:03 -0700 Subject: [PATCH] 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 --- scripts/publish/npm_publish.sh | 18 +++++++++++++++++- tools/broccoli/trees/browser_tree.ts | 2 +- tools/broccoli/trees/node_tree.ts | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/scripts/publish/npm_publish.sh b/scripts/publish/npm_publish.sh index 26691997b6..45bb48c067 100755 --- a/scripts/publish/npm_publish.sh +++ b/scripts/publish/npm_publish.sh @@ -6,11 +6,13 @@ ROOT_DIR=$(cd $(dirname $0)/../..; pwd) cd $ROOT_DIR 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 rm -fr $NPM_DIR FILES='!(test|e2e_test|docs)' +DTS_FILES='*.d.ts' function publishRttsAssert { NAME='rtts_assert' @@ -38,6 +40,20 @@ function publishModule { mkdir -p $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 cp -r $ROOT_DIR/dist/build/benchpress_bundle/$FILES $PUBLISH_DIR cp -r $ROOT_DIR/dist/js/cjs/benchpress/README.md $PUBLISH_DIR diff --git a/tools/broccoli/trees/browser_tree.ts b/tools/broccoli/trees/browser_tree.ts index 639c26bb19..f2a1ec2c72 100644 --- a/tools/broccoli/trees/browser_tree.ts +++ b/tools/broccoli/trees/browser_tree.ts @@ -98,7 +98,7 @@ module.exports = function makeBrowserTree(options, destinationPath) { // Use TypeScript to transpile the *.ts files to ES6 var es6Tree = compileWithTypescript(modulesTree, { allowNonTsExtensions: false, - declaration: true, + declaration: false, emitDecoratorMetadata: true, mapRoot: '', // force sourcemaps to use relative path noEmitOnError: false, diff --git a/tools/broccoli/trees/node_tree.ts b/tools/broccoli/trees/node_tree.ts index 1817a6269a..b2b83faf31 100644 --- a/tools/broccoli/trees/node_tree.ts +++ b/tools/broccoli/trees/node_tree.ts @@ -31,7 +31,7 @@ module.exports = function makeNodeTree(destinationPath) { allowNonTsExtensions: false, emitDecoratorMetadata: true, experimentalDecorators: true, - declaration: true, + declaration: false, mapRoot: '', /* force sourcemaps to use relative path */ module: 'commonjs', noEmitOnError: true,