diff --git a/gulpfile.js b/gulpfile.js index 36936b6222..b93d8ccbb3 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -296,7 +296,12 @@ function runE2eTsTests(appDir, outputFile) { var appBuildSpawnInfo = spawnExt('npm', ['run', config.build], { cwd: appDir }); var appRunSpawnInfo = spawnExt('npm', ['run', config.run, '--', '-s'], { cwd: appDir }); - return runProtractor(appBuildSpawnInfo.promise, appDir, appRunSpawnInfo, outputFile); + var run = runProtractor(appBuildSpawnInfo.promise, appDir, appRunSpawnInfo, outputFile); + + if (fs.existsSync(appDir + '/aot/index.html')) { + run = run.then(() => runProtractorAoT(appDir, outputFile)); + } + return run; } function runProtractor(prepPromise, appDir, appRunSpawnInfo, outputFile) { @@ -341,6 +346,20 @@ function runProtractor(prepPromise, appDir, appRunSpawnInfo, outputFile) { } } +function runProtractorAoT(appDir, outputFile) { + fs.appendFileSync(outputFile, '++ AoT version ++\n'); + var aotBuildSpawnInfo = spawnExt('npm', ['run', 'build:aot'], { cwd: appDir }); + var promise = aotBuildSpawnInfo.promise; + + var copyFileCmd = 'copy-dist-files.js'; + if (fs.existsSync(appDir + '/' + copyFileCmd)) { + promise = promise.then(() => + spawnExt('node', [copyFileCmd], { cwd: appDir }).promise ); + } + var aotRunSpawnInfo = spawnExt('npm', ['run', 'http-server:e2e', 'aot', '--', '-s'], { cwd: appDir }); + return runProtractor(promise, appDir, aotRunSpawnInfo, outputFile); +} + // start the server in appDir/build/web; then run protractor with the specified // fileName; then shut down the example. All protractor output is appended // to the outputFile. @@ -883,7 +902,7 @@ function harpCompile() { gutil.log("NODE_ENV: " + process.env.NODE_ENV); if(argv.page) harpJsonSetJade2NgTo(true); - + if(skipLangs && fs.existsSync(WWW) && backupApiHtmlFilesExist(WWW)) { gutil.log(`Harp site recompile: skipping recompilation of API docs for [${skipLangs}]`); gutil.log(`API docs will be copied from existing ${WWW} folder.`) diff --git a/public/docs/_examples/_boilerplate/package.json b/public/docs/_examples/_boilerplate/package.json index e168cc9b9f..758ff6f182 100644 --- a/public/docs/_examples/_boilerplate/package.json +++ b/public/docs/_examples/_boilerplate/package.json @@ -9,6 +9,7 @@ "http-server:e2e": "http-server", "http-server:cli": "http-server dist/", "lite": "lite-server", + "lite:aot": "lite-server -c aot/bs-config.json", "postinstall": "typings install", "test": "tsc && concurrently \"tsc -w\" \"karma start karma.conf.js\"", "tsc": "tsc", @@ -17,7 +18,8 @@ "test:webpack": "karma start karma.webpack.conf.js", "build:webpack": "rimraf dist && webpack --config config/webpack.prod.js --bail", "build:cli": "ng build", - "build:aot": "ngc -p tsconfig-aot.json && rollup -c rollup.js", + "build:aot": "ngc -p tsconfig-aot.json && rollup -c rollup-config.js", + "copy-dist-files": "node ./copy-dist-files.js", "i18n": "ng-xi18n" }, "keywords": [], diff --git a/public/docs/_examples/_boilerplate/tsconfig.json b/public/docs/_examples/_boilerplate/tsconfig.json index 64548f5b12..48dda0636f 100644 --- a/public/docs/_examples/_boilerplate/tsconfig.json +++ b/public/docs/_examples/_boilerplate/tsconfig.json @@ -10,5 +10,9 @@ "noImplicitAny": true, "suppressImplicitAnyIndexErrors": true, "types": [] - } + }, + "exclude": [ + "node_modules/*", + "**/*-aot.ts" + ] } diff --git a/public/docs/_examples/cb-aot-compiler/ts/.gitignore b/public/docs/_examples/cb-aot-compiler/ts/.gitignore index f2e297bbd3..2d0d839865 100644 --- a/public/docs/_examples/cb-aot-compiler/ts/.gitignore +++ b/public/docs/_examples/cb-aot-compiler/ts/.gitignore @@ -2,4 +2,4 @@ **/*.metadata.json dist !app/tsconfig.json -!rollup.js \ No newline at end of file +!rollup-config.js \ No newline at end of file diff --git a/public/docs/_examples/cb-aot-compiler/ts/app/app.component.ts b/public/docs/_examples/cb-aot-compiler/ts/app/app.component.ts index 8352eb83f3..8a86e7d213 100644 --- a/public/docs/_examples/cb-aot-compiler/ts/app/app.component.ts +++ b/public/docs/_examples/cb-aot-compiler/ts/app/app.component.ts @@ -13,5 +13,4 @@ export class AppComponent { toggleHeading() { this.showHeading = !this.showHeading; } - } diff --git a/public/docs/_examples/cb-aot-compiler/ts/index.html b/public/docs/_examples/cb-aot-compiler/ts/index.html index 5d3d6b68c4..3444e6bc45 100644 --- a/public/docs/_examples/cb-aot-compiler/ts/index.html +++ b/public/docs/_examples/cb-aot-compiler/ts/index.html @@ -9,7 +9,6 @@ - diff --git a/public/docs/_examples/cb-aot-compiler/ts/rollup.js b/public/docs/_examples/cb-aot-compiler/ts/rollup-config.js similarity index 100% rename from public/docs/_examples/cb-aot-compiler/ts/rollup.js rename to public/docs/_examples/cb-aot-compiler/ts/rollup-config.js diff --git a/public/docs/_examples/package.json b/public/docs/_examples/package.json index 3ec650fc69..31792cf4f9 100644 --- a/public/docs/_examples/package.json +++ b/public/docs/_examples/package.json @@ -74,6 +74,7 @@ "raw-loader": "^0.5.1", "rimraf": "^2.5.4", "rollup-plugin-commonjs": "^4.1.0", + "source-map-explorer": "^1.3.2", "style-loader": "^0.13.1", "ts-loader": "^0.8.2", "ts-node": "^1.3.0", diff --git a/public/docs/_examples/toh-6/ts/.gitignore b/public/docs/_examples/toh-6/ts/.gitignore index 2cb7d2a2e9..316ea7d8ab 100644 --- a/public/docs/_examples/toh-6/ts/.gitignore +++ b/public/docs/_examples/toh-6/ts/.gitignore @@ -1 +1,3 @@ **/*.js +aot/**/*.ts +!rollup-config.js diff --git a/public/docs/_examples/toh-6/ts/aot/bs-config.json b/public/docs/_examples/toh-6/ts/aot/bs-config.json new file mode 100644 index 0000000000..7c85d6eddd --- /dev/null +++ b/public/docs/_examples/toh-6/ts/aot/bs-config.json @@ -0,0 +1,5 @@ +{ + "port": 8000, + "files": ["./aot/**/*.{html,htm,css,js}"], + "server": { "baseDir": "./aot" } +} diff --git a/public/docs/_examples/toh-6/ts/aot/index.html b/public/docs/_examples/toh-6/ts/aot/index.html new file mode 100644 index 0000000000..d42f3e0574 --- /dev/null +++ b/public/docs/_examples/toh-6/ts/aot/index.html @@ -0,0 +1,20 @@ + + + + + + Angular Tour of Heroes + + + + + + + + + + + Loading... + + + diff --git a/public/docs/_examples/toh-6/ts/app/app.component.ts b/public/docs/_examples/toh-6/ts/app/app.component.ts index 01292eb4cd..c9bb797d62 100644 --- a/public/docs/_examples/toh-6/ts/app/app.component.ts +++ b/public/docs/_examples/toh-6/ts/app/app.component.ts @@ -5,7 +5,6 @@ import { Component } from '@angular/core'; @Component({ moduleId: module.id, selector: 'my-app', - template: `

{{title}}