This repository was archived by the owner on Apr 4, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +45
-2
lines changed
packages/schematics/angular/application Expand file tree Collapse file tree 6 files changed +45
-2
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "index" : " /index.html" ,
3
+ "assetGroups" : [{
4
+ "name" : " app" ,
5
+ "installMode" : " prefetch" ,
6
+ "resources" : {
7
+ "files" : [
8
+ " /favicon.ico" ,
9
+ " /index.html"
10
+ ],
11
+ "versionedFiles" : [
12
+ " /*.bundle.css" ,
13
+ " /*.bundle.js" ,
14
+ " /*.chunk.js"
15
+ ]
16
+ }
17
+ }, {
18
+ "name" : " assets" ,
19
+ "installMode" : " lazy" ,
20
+ "updateMode" : " prefetch" ,
21
+ "resources" : {
22
+ "files" : [
23
+ " /assets/**"
24
+ ]
25
+ }
26
+ }]
27
+ }
Original file line number Diff line number Diff line change 20
20
"@angular/http" : " ^5.0.0-rc.7" ,
21
21
"@angular/platform-browser" : " ^5.0.0-rc.7" ,
22
22
"@angular/platform-browser-dynamic" : " ^5.0.0-rc.7" ,
23
- "@angular/router" : " ^5.0.0-rc.7" ,
23
+ "@angular/router" : " ^5.0.0-rc.7" ,<% if (serviceWorker) { %>
24
+ "@angular/service-worker" : " ^5.0.0-rc.7" ,<% } %>
24
25
"core-js" : " ^2.4.1" ,
25
26
"rxjs" : " ^5.4.2" ,
26
27
"zone.js" : " ^0.8.14"
Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ export default function (options: ApplicationOptions): Rule {
95
95
apply ( url ( './files' ) , [
96
96
options . minimal ? filter ( minimalPathFilter ) : noop ( ) ,
97
97
options . skipGit ? filter ( path => ! path . endsWith ( '/__dot__gitignore' ) ) : noop ( ) ,
98
+ options . serviceWorker ? noop ( ) : filter ( path => ! path . endsWith ( '/ngsw-config.json' ) ) ,
98
99
template ( {
99
100
utils : stringUtils ,
100
101
'dot' : '.' ,
Original file line number Diff line number Diff line change @@ -2,15 +2,20 @@ import { BrowserModule } from '@angular/platform-browser';
2
2
import { NgModule } from '@angular/core' ;
3
3
< % if ( routing ) { % >
4
4
import { AppRoutingModule } from './app-routing.module' ; < % } % >
5
+ < % if ( serviceWorker ) { % >
6
+ import { ServiceWorkerModule } from '@angular/service-worker' ; < % } % >
5
7
import { AppComponent } from './app.component' ;
8
+ < % if ( serviceWorker ) { % >
9
+ import { environment } from '../environments/environment' ; < % } % >
6
10
7
11
@NgModule ( {
8
12
declarations : [
9
13
AppComponent
10
14
] ,
11
15
imports : [
12
16
BrowserModule < % if ( routing ) { % > ,
13
- AppRoutingModule < % } % >
17
+ AppRoutingModule < % } % > < % if ( serviceWorker ) { % > ,
18
+ environment . production ? ServiceWorkerModule . register ( '/ngsw-worker.js' ) : [ ] < % } % >
14
19
] ,
15
20
providers : [ ] ,
16
21
bootstrap : [ AppComponent ]
Original file line number Diff line number Diff line change @@ -52,4 +52,8 @@ export interface Schema {
52
52
* Should create a minimal app.
53
53
*/
54
54
minimal ?: boolean ;
55
+ /**
56
+ * Should install the @angular/service-worker.
57
+ */
58
+ serviceWorker ?: boolean ;
55
59
}
Original file line number Diff line number Diff line change 79
79
"description" : " Should create a minimal app." ,
80
80
"type" : " boolean" ,
81
81
"default" : false
82
+ },
83
+ "serviceWorker" : {
84
+ "description" : " Should install the @angular/service-worker." ,
85
+ "type" : " boolean" ,
86
+ "default" : false
82
87
}
83
88
},
84
89
"required" : [
You can’t perform that action at this time.
0 commit comments