From 9175a049d311e6b914c6fd64752ce1679365ef2e Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Fri, 20 May 2016 09:08:39 -0700 Subject: [PATCH] feat: add minified bundles BREAKING CHANGE: bundles are now in the bundles/ subdirectory within each package --- build.sh | 24 ++++++++++++++---------- modules/playground/src/bootstrap.ts | 16 ++++++++-------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/build.sh b/build.sh index b5f31c7ee6..1881b0b930 100755 --- a/build.sh +++ b/build.sh @@ -60,8 +60,9 @@ for PACKAGE in \ do SRCDIR=./modules/@angular/${PACKAGE} DESTDIR=./dist/packages-dist/${PACKAGE} - UMDES6PATH=${DESTDIR}/esm/${PACKAGE}.umd.js - UMDES5PATH=${DESTDIR}/${PACKAGE}.umd.js + UMD_ES6_PATH=${DESTDIR}/esm/${PACKAGE}.umd.js + UMD_ES5_PATH=${DESTDIR}/bundles/${PACKAGE}.umd.js + UMD_ES5_MIN_PATH=${DESTDIR}/bundles/${PACKAGE}.umd.min.js if [[ ${PACKAGE} == "router-deprecated" ]]; then echo "====== COMPILING: \$(npm bin)/tsc -p ${SRCDIR}/tsconfig-es5.json =====" @@ -95,6 +96,8 @@ do fi echo "====== BUNDLING: ${SRCDIR} =====" + mkdir ${DESTDIR}/bundles + ( cd ${SRCDIR} echo "..." # here just to have grep match something and not exit with 1 @@ -103,24 +106,25 @@ do # workaround for https://github.com/rollup/rollup/issues/626 if [[ ${TRAVIS} ]]; then - sed -i "s/ class exports\./ class /g" ${DESTDIR}/esm/${PACKAGE}.umd.js + sed -i "s/ class exports\./ class /g" ${UMD_ES6_PATH} else - sed -i '' "s/ class exports\./ class /g" ${DESTDIR}/esm/${PACKAGE}.umd.js + sed -i '' "s/ class exports\./ class /g" ${UMD_ES6_PATH} fi $(npm bin)/tsc \ - --out ${UMDES5PATH} \ + --out ${UMD_ES5_PATH} \ --target es5 \ --allowJs \ - ${UMDES6PATH} \ + ${UMD_ES6_PATH} \ modules/\@angular/manual_typings/globals.d.ts \ modules/\@angular/typings/es6-collections/es6-collections.d.ts \ modules/\@angular/typings/es6-promise/es6-promise.d.ts - rm ${UMDES6PATH} + rm ${UMD_ES6_PATH} - cat ./modules/@angular/license-banner.txt > ${UMDES5PATH}.tmp - cat ${UMDES5PATH} >> ${UMDES5PATH}.tmp - mv ${UMDES5PATH}.tmp ${UMDES5PATH} + cat ./modules/@angular/license-banner.txt > ${UMD_ES5_PATH}.tmp + cat ${UMD_ES5_PATH} >> ${UMD_ES5_PATH}.tmp + mv ${UMD_ES5_PATH}.tmp ${UMD_ES5_PATH} + $(npm bin)/uglifyjs -c --screw-ie8 -o ${UMD_ES5_MIN_PATH} ${UMD_ES5_PATH} fi done diff --git a/modules/playground/src/bootstrap.ts b/modules/playground/src/bootstrap.ts index f32d84b2c4..1c69c2dbc3 100644 --- a/modules/playground/src/bootstrap.ts +++ b/modules/playground/src/bootstrap.ts @@ -18,14 +18,14 @@ declare var System: any; System.config({ map: { 'index': 'index.js', - '@angular/core': '/packages-dist/core/core.umd.js', - '@angular/common': '/packages-dist/common/common.umd.js', - '@angular/compiler': '/packages-dist/compiler/compiler.umd.js', - '@angular/platform-browser': '/packages-dist/platform-browser/platform-browser.umd.js', - '@angular/http': '/packages-dist/http/http.umd.js', - '@angular/upgrade': '/packages-dist/upgrade/upgrade.umd.js', - '@angular/router': '/packages-dist/router/router.umd.js', - '@angular/router-deprecated': '/packages-dist/router-deprecated/router-deprecated.umd.js', + '@angular/core': '/packages-dist/core/bundles/core.umd.js', + '@angular/common': '/packages-dist/common/bundles/common.umd.js', + '@angular/compiler': '/packages-dist/compiler/bundles/compiler.umd.js', + '@angular/platform-browser': '/packages-dist/platform-browser/bundles/platform-browser.umd.js', + '@angular/http': '/packages-dist/http/bundles/http.umd.js', + '@angular/upgrade': '/packages-dist/upgrade/bundles/upgrade.umd.js', + '@angular/router': '/packages-dist/router/bundles/router.umd.js', + '@angular/router-deprecated': '/packages-dist/router-deprecated/bundles/router-deprecated.umd.js', '@angular/core/src/facade': '/all/@angular/core/src/facade', 'rxjs': location.pathname.replace(/index\.html$/, '') + 'rxjs' },