@angular/pwa 18.0.0-next.0 → 18.0.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/pwa",
3
- "version": "18.0.0-next.0",
3
+ "version": "18.0.0-next.1",
4
4
  "description": "PWA schematics for Angular",
5
5
  "keywords": [
6
6
  "Angular CLI",
@@ -17,8 +17,8 @@
17
17
  "save": false
18
18
  },
19
19
  "dependencies": {
20
- "@angular-devkit/schematics": "18.0.0-next.0",
21
- "@schematics/angular": "18.0.0-next.0",
20
+ "@angular-devkit/schematics": "18.0.0-next.1",
21
+ "@schematics/angular": "18.0.0-next.1",
22
22
  "parse5-html-rewriting-stream": "7.0.0"
23
23
  },
24
24
  "peerDependencies": {
package/pwa/index.js CHANGED
@@ -74,21 +74,6 @@ function default_1(options) {
74
74
  testTargets.push(target);
75
75
  }
76
76
  }
77
- // Add manifest to asset configuration
78
- const assetEntry = path_1.posix.join(project.sourceRoot ?? path_1.posix.join(project.root, 'src'), 'manifest.webmanifest');
79
- for (const target of [...buildTargets, ...testTargets]) {
80
- if (target.options) {
81
- if (Array.isArray(target.options.assets)) {
82
- target.options.assets.push(assetEntry);
83
- }
84
- else {
85
- target.options.assets = [assetEntry];
86
- }
87
- }
88
- else {
89
- target.options = { assets: [assetEntry] };
90
- }
91
- }
92
77
  // Find all index.html files in build targets
93
78
  const indexFiles = new Set();
94
79
  for (const target of buildTargets) {
@@ -109,10 +94,30 @@ function default_1(options) {
109
94
  // Setup service worker schematic options
110
95
  const { title, ...swOptions } = options;
111
96
  await (0, utility_1.writeWorkspace)(host, workspace);
97
+ let assetsDir = path_1.posix.join(sourcePath, 'assets');
98
+ if (host.exists(assetsDir)) {
99
+ // Add manifest to asset configuration
100
+ const assetEntry = path_1.posix.join(project.sourceRoot ?? path_1.posix.join(project.root, 'src'), 'manifest.webmanifest');
101
+ for (const target of [...buildTargets, ...testTargets]) {
102
+ if (target.options) {
103
+ if (Array.isArray(target.options.assets)) {
104
+ target.options.assets.push(assetEntry);
105
+ }
106
+ else {
107
+ target.options.assets = [assetEntry];
108
+ }
109
+ }
110
+ else {
111
+ target.options = { assets: [assetEntry] };
112
+ }
113
+ }
114
+ }
115
+ else {
116
+ assetsDir = path_1.posix.join(project.root, 'public');
117
+ }
112
118
  return (0, schematics_1.chain)([
113
119
  (0, schematics_1.externalSchematic)('@schematics/angular', 'service-worker', swOptions),
114
- (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./files/root'), [(0, schematics_1.template)({ ...options }), (0, schematics_1.move)(sourcePath)])),
115
- (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./files/assets'), [(0, schematics_1.move)(path_1.posix.join(sourcePath, 'assets'))])),
120
+ (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./files/assets'), [(0, schematics_1.template)({ ...options }), (0, schematics_1.move)(assetsDir)])),
116
121
  ...[...indexFiles].map((path) => updateIndexFile(path)),
117
122
  ]);
118
123
  };
File without changes