test: cleanup rxjs custom build

The latest rxjs release works with closure compiler out of the box.
We no longer need to compile our own.

Also put closure options into a file rather than using a shell script.
This commit is contained in:
Alex Eagle
2017-05-03 10:45:45 -07:00
committed by Matias Niemelä
parent 7f9c589ba3
commit 5856298798
11 changed files with 50 additions and 151 deletions

View File

@ -1,53 +0,0 @@
#!/usr/bin/env bash
# Build a folder using angular ES6 and the closure compiler
set -e -o pipefail
# The ES6 distro we built for rxjs works only in the browser, not in nodejs.
# Since we installed rxjs in node_modules for ngc to use, we have to point
# to the alternate distro when compiling with closure.
rm -rf vendor
mkdir vendor
cp -pr ../rxjs/dist/es6 vendor/rxjs
CLOSURE_ARGS=(
"--language_in=ES6_STRICT"
"--language_out=ES5"
"--compilation_level=ADVANCED_OPTIMIZATIONS"
"--warning_level=QUIET"
"--js_output_file=dist/bundle.js"
"--create_source_map=%outname%.map"
"--variable_renaming_report=dist/variable_renaming_report"
"--property_renaming_report=dist/property_renaming_report"
# Don't include ES6 polyfills
"--rewrite_polyfills=false"
# List of path prefixes to be removed from ES6 & CommonJS modules.
"--js_module_root=node_modules/@angular/core"
"--js_module_root=node_modules/@angular/common"
"--js_module_root=node_modules/@angular/compiler"
"--js_module_root=node_modules/@angular/platform-browser"
"--js_module_root=vendor"
# Uncomment for easier debugging
# "--formatting=PRETTY_PRINT"
node_modules/@angular/core/src/testability/testability.externs.js
node_modules/zone.js/dist/zone.js
$(find -L vendor/rxjs -name *.js)
node_modules/@angular/core/@angular/core.js
node_modules/@angular/common/@angular/common.js
node_modules/@angular/compiler/@angular/compiler.js
node_modules/@angular/platform-browser/@angular/platform-browser.js
"built/src/*.js"
"--entry_point=./built/src/main"
)
java -jar node_modules/google-closure-compiler/compiler.jar $(echo ${CLOSURE_ARGS[*]})
# gzip on Travis doesn't have --keep option so copy the original file first
cp dist/bundle.js dist/bundle.tmp
gzip -f dist/bundle.js
mv dist/bundle.tmp dist/bundle.js
ls -alH dist/bundle*

View File

@ -0,0 +1,30 @@
--compilation_level=ADVANCED_OPTIMIZATIONS
--language_out=ES5
--js_output_file=dist/bundle.js
--output_manifest=dist/manifest.MF
--variable_renaming_report=dist/variable_renaming_report
--property_renaming_report=dist/property_renaming_report
--create_source_map=%outname%.map
--warning_level=QUIET
--dependency_mode=STRICT
--rewrite_polyfills=false
node_modules/zone.js/dist/zone_externs.js
--js node_modules/rxjs/**.js
--process_common_js_modules
--module_resolution=node
node_modules/@angular/core/@angular/core.js
--js_module_root=node_modules/@angular/core
node_modules/@angular/core/src/testability/testability.externs.js
node_modules/@angular/common/@angular/common.js
--js_module_root=node_modules/@angular/common
node_modules/@angular/platform-browser/@angular/platform-browser.js
--js_module_root=node_modules/@angular/platform-browser
--js built/**.js
--entry_point=built/src/main

View File

@ -1,14 +1,15 @@
{
"open": false,
"logLevel": "silent",
"logLevel": "silent",
"port": 8080,
"server": {
"baseDir": "src",
"routes": {
"/dist": "dist"
"/dist": "dist",
"/node_modules": "node_modules"
},
"middleware": {
"0": null
}
}
}
}

View File

@ -11,10 +11,10 @@
"@angular/platform-browser": "file:../../dist/packages-dist/platform-browser",
"@angular/platform-server": "file:../../dist/packages-dist/platform-server",
"@angular/tsc-wrapped": "file:../../dist/tools/@angular/tsc-wrapped",
"google-closure-compiler": "20161201.0.0",
"rxjs": "file:../../node_modules/rxjs",
"google-closure-compiler": "20170409.0.0",
"rxjs": "5.3.1",
"typescript": "2.1.6",
"zone.js": "0.7.6"
"zone.js": "0.8.6"
},
"devDependencies": {
"@types/jasmine": "2.5.41",
@ -23,9 +23,10 @@
"protractor": "file:../../node_modules/protractor"
},
"scripts": {
"test": "ngc && ./bundle.sh && concurrently \"yarn run serve\" \"yarn run protractor\" --kill-others --success first",
"closure": "java -jar node_modules/google-closure-compiler/compiler.jar --flagfile closure.conf",
"test": "ngc && yarn run closure && concurrently \"yarn run serve\" \"yarn run protractor\" --kill-others --success first",
"serve": "lite-server -c e2e/browser.config.json",
"preprotractor": "tsc -p e2e",
"protractor": "protractor e2e/protractor.config.js"
}
}
}

View File

@ -1,14 +1,18 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Hello World</title>
<base href="/">
</head>
<body>
<hello-world-app>Loading...</hello-world-app>
<script src="dist/bundle.js"></script>
<body>
<hello-world-app>Loading...</hello-world-app>
<script src="node_modules/zone.js/dist/zone.min.js"></script>
<script src="dist/bundle.js"></script>
</body>
</html>
</html>