fix(aio): switch to ngu-sw-manifest gen to unblock critical path (#16709)

This commit is contained in:
Alex Rickabaugh 2017-05-11 13:21:27 -07:00 committed by Jason Aden
parent 84c30be164
commit abb36e3cba
5 changed files with 75 additions and 10 deletions

View File

@ -21,7 +21,7 @@
"tsconfig": "tsconfig.app.json", "tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json", "testTsconfig": "tsconfig.spec.json",
"prefix": "aio", "prefix": "aio",
"serviceWorker": true, "serviceWorker": false,
"styles": [ "styles": [
"styles.scss" "styles.scss"
], ],

View File

@ -14,6 +14,9 @@
"^/assets/images/.*/unused/", "^/assets/images/.*/unused/",
"^/generated/(?:docs/(?!api/api-list\\.json).*|images|live-examples|zips)/" "^/generated/(?:docs/(?!api/api-list\\.json).*|images|live-examples|zips)/"
], ],
"static.versioned": [
"\\.[0-9a-z]{20}\\."
],
"routing": { "routing": {
"index": "/index.html", "index": "/index.html",
"routes": { "routes": {

View File

@ -8,7 +8,7 @@
"scripts": { "scripts": {
"ng": "yarn check-env && ng", "ng": "yarn check-env && ng",
"start": "yarn check-env && ng serve", "start": "yarn check-env && ng serve",
"build": "yarn check-env && yarn setup && ng build -prod -sm", "build": "yarn check-env && yarn setup && ng build -prod -sm && yarn sw-manifest && yarn sw-copy",
"lint": "yarn check-env && yarn docs-lint && ng lint && yarn example-lint", "lint": "yarn check-env && yarn docs-lint && ng lint && yarn example-lint",
"test": "yarn check-env && ng test", "test": "yarn check-env && ng test",
"pree2e": "yarn ~~update-webdriver", "pree2e": "yarn ~~update-webdriver",
@ -31,7 +31,9 @@
"boilerplate:add": "node ./tools/examples/add-example-boilerplate add", "boilerplate:add": "node ./tools/examples/add-example-boilerplate add",
"boilerplate:remove": "node ./tools/examples/add-example-boilerplate remove", "boilerplate:remove": "node ./tools/examples/add-example-boilerplate remove",
"generate-plunkers": "node ./tools/plunker-builder/generatePlunkers", "generate-plunkers": "node ./tools/plunker-builder/generatePlunkers",
"generate-zips": "node ./tools/example-zipper/generateZips" "generate-zips": "node ./tools/example-zipper/generateZips",
"sw-manifest": "ngu-sw-manifest --dist dist --in ngsw-manifest.json --out dist/ngsw-manifest.json",
"sw-copy": "cp node_modules/@angular/service-worker/bundles/worker-basic.min.js dist/"
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
@ -46,8 +48,9 @@
"@angular/platform-browser-dynamic": "next", "@angular/platform-browser-dynamic": "next",
"@angular/platform-server": "next", "@angular/platform-server": "next",
"@angular/router": "next", "@angular/router": "next",
"@angular/service-worker": "^1.0.0-beta.11", "@angular/service-worker": "^1.0.0-beta.12",
"core-js": "^2.4.1", "core-js": "^2.4.1",
"ng-pwa-tools": "^0.0.10",
"rxjs": "^5.2.0", "rxjs": "^5.2.0",
"zone.js": "^0.8.4" "zone.js": "^0.8.4"
}, },

View File

@ -1,4 +1,4 @@
import { enableProdMode } from '@angular/core'; import { enableProdMode, ApplicationRef } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module'; import { AppModule } from './app/app.module';
@ -8,4 +8,11 @@ if (environment.production) {
enableProdMode(); enableProdMode();
} }
platformBrowserDynamic().bootstrapModule(AppModule); platformBrowserDynamic().bootstrapModule(AppModule).then(ref => {
if ('serviceWorker' in (navigator as any)) {
const appRef: ApplicationRef = ref.injector.get(ApplicationRef);
appRef.isStable.first().subscribe(() => {
(navigator as any).serviceWorker.register('/worker-basic.min.js');
});
}
});

View File

@ -121,9 +121,9 @@
version "4.0.0" version "4.0.0"
resolved "https://registry.yarnpkg.com/@angular/router/-/router-4.0.0.tgz#f4a2dc83b44e023db1d6f2c12ca5a37a22c66afc" resolved "https://registry.yarnpkg.com/@angular/router/-/router-4.0.0.tgz#f4a2dc83b44e023db1d6f2c12ca5a37a22c66afc"
"@angular/service-worker@^1.0.0-beta.11": "@angular/service-worker@^1.0.0-beta.12":
version "1.0.0-beta.11" version "1.0.0-beta.12"
resolved "https://registry.yarnpkg.com/@angular/service-worker/-/service-worker-1.0.0-beta.11.tgz#715840b704e3ce36fff84f9b809d754acc4d4d69" resolved "https://registry.yarnpkg.com/@angular/service-worker/-/service-worker-1.0.0-beta.12.tgz#0c46389df6bcd38d6e05e1c540c43e3a5c44a1f6"
dependencies: dependencies:
base64-js "^1.1.2" base64-js "^1.1.2"
jshashes "^1.0.5" jshashes "^1.0.5"
@ -151,7 +151,7 @@
version "2.5.38" version "2.5.38"
resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-2.5.38.tgz#a4379124c4921d4e21de54ec74669c9e9b356717" resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-2.5.38.tgz#a4379124c4921d4e21de54ec74669c9e9b356717"
"@types/node@^6.0.46", "@types/node@~6.0.60": "@types/node@*", "@types/node@^6.0.46", "@types/node@~6.0.60":
version "6.0.63" version "6.0.63"
resolved "https://registry.yarnpkg.com/@types/node/-/node-6.0.63.tgz#e08acbbd5946e0e95990b1c76f3ce5b7882a48eb" resolved "https://registry.yarnpkg.com/@types/node/-/node-6.0.63.tgz#e08acbbd5946e0e95990b1c76f3ce5b7882a48eb"
@ -163,6 +163,12 @@
version "2.53.39" version "2.53.39"
resolved "https://registry.yarnpkg.com/@types/selenium-webdriver/-/selenium-webdriver-2.53.39.tgz#15ff93392c339abd39d6d3a04e715faa9a263cf3" resolved "https://registry.yarnpkg.com/@types/selenium-webdriver/-/selenium-webdriver-2.53.39.tgz#15ff93392c339abd39d6d3a04e715faa9a263cf3"
"@types/sha1@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@types/sha1/-/sha1-1.1.0.tgz#461eb18906d25e8d07c4678a0ed4f9ca07e46dd9"
dependencies:
"@types/node" "*"
JSONStream@^1.2.1: JSONStream@^1.2.1:
version "1.3.0" version "1.3.0"
resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.0.tgz#680ab9ac6572a8a1a207e0b38721db1c77b215e5" resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.0.tgz#680ab9ac6572a8a1a207e0b38721db1c77b215e5"
@ -1037,6 +1043,10 @@ character-reference-invalid@^1.0.0:
version "1.1.0" version "1.1.0"
resolved "https://registry.yarnpkg.com/character-reference-invalid/-/character-reference-invalid-1.1.0.tgz#dec9ad1dfb9f8d06b4fcdaa2adc3c4fd97af1e68" resolved "https://registry.yarnpkg.com/character-reference-invalid/-/character-reference-invalid-1.1.0.tgz#dec9ad1dfb9f8d06b4fcdaa2adc3c4fd97af1e68"
"charenc@>= 0.0.1":
version "0.0.2"
resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667"
chokidar@^1.4.1, chokidar@^1.4.3, chokidar@^1.6.0: chokidar@^1.4.1, chokidar@^1.4.3, chokidar@^1.6.0:
version "1.6.1" version "1.6.1"
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.6.1.tgz#2f4447ab5e96e50fb3d789fd90d4c72e0e4c70c2" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.6.1.tgz#2f4447ab5e96e50fb3d789fd90d4c72e0e4c70c2"
@ -1513,6 +1523,10 @@ cross-spawn@^5.1.0:
shebang-command "^1.2.0" shebang-command "^1.2.0"
which "^1.2.9" which "^1.2.9"
"crypt@>= 0.0.1":
version "0.0.2"
resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b"
cryptiles@2.x.x: cryptiles@2.x.x:
version "2.0.5" version "2.0.5"
resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8" resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8"
@ -4509,6 +4523,15 @@ nested-error-stacks@^1.0.0:
dependencies: dependencies:
inherits "~2.0.1" inherits "~2.0.1"
ng-pwa-tools@^0.0.10:
version "0.0.10"
resolved "https://registry.yarnpkg.com/ng-pwa-tools/-/ng-pwa-tools-0.0.10.tgz#ffc13db22555ffb5f77356a8ae5e855c6f40eb1d"
dependencies:
"@types/sha1" "^1.1.0"
minimist "^1.2.0"
sha1 "^1.1.1"
ts-node "^3.0.2"
no-case@^2.2.0: no-case@^2.2.0:
version "2.3.1" version "2.3.1"
resolved "https://registry.yarnpkg.com/no-case/-/no-case-2.3.1.tgz#7aeba1c73a52184265554b7dc03baf720df80081" resolved "https://registry.yarnpkg.com/no-case/-/no-case-2.3.1.tgz#7aeba1c73a52184265554b7dc03baf720df80081"
@ -6125,6 +6148,13 @@ sha.js@^2.3.6:
dependencies: dependencies:
inherits "^2.0.1" inherits "^2.0.1"
sha1@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/sha1/-/sha1-1.1.1.tgz#addaa7a93168f393f19eb2b15091618e2700f848"
dependencies:
charenc ">= 0.0.1"
crypt ">= 0.0.1"
shebang-command@^1.2.0: shebang-command@^1.2.0:
version "1.2.0" version "1.2.0"
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea"
@ -6803,6 +6833,21 @@ tryit@^1.0.1:
version "1.0.3" version "1.0.3"
resolved "https://registry.yarnpkg.com/tryit/-/tryit-1.0.3.tgz#393be730a9446fd1ead6da59a014308f36c289cb" resolved "https://registry.yarnpkg.com/tryit/-/tryit-1.0.3.tgz#393be730a9446fd1ead6da59a014308f36c289cb"
ts-node@^3.0.2:
version "3.0.4"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-3.0.4.tgz#a1475ebf24fd4e2ee2fba8b1aa1605b977bde506"
dependencies:
arrify "^1.0.0"
chalk "^1.1.1"
diff "^3.1.0"
make-error "^1.1.1"
minimist "^1.2.0"
mkdirp "^0.5.1"
source-map-support "^0.4.0"
tsconfig "^6.0.0"
v8flags "^2.0.11"
yn "^1.2.0"
ts-node@~2.0.0: ts-node@~2.0.0:
version "2.0.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-2.0.0.tgz#16e4fecc949088238b4cbf1c39c9582526b66f74" resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-2.0.0.tgz#16e4fecc949088238b4cbf1c39c9582526b66f74"
@ -6829,6 +6874,13 @@ tsconfig@^5.0.2:
strip-bom "^2.0.0" strip-bom "^2.0.0"
strip-json-comments "^2.0.0" strip-json-comments "^2.0.0"
tsconfig@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/tsconfig/-/tsconfig-6.0.0.tgz#6b0e8376003d7af1864f8df8f89dd0059ffcd032"
dependencies:
strip-bom "^3.0.0"
strip-json-comments "^2.0.0"
tsickle@^0.21.0: tsickle@^0.21.0:
version "0.21.5" version "0.21.5"
resolved "https://registry.yarnpkg.com/tsickle/-/tsickle-0.21.5.tgz#341c1834b9d293c8cbffc295a86a1e46268ed22f" resolved "https://registry.yarnpkg.com/tsickle/-/tsickle-0.21.5.tgz#341c1834b9d293c8cbffc295a86a1e46268ed22f"