@wavemaker/angular-app 12.0.0-next.25185 → 12.0.0-next.25480

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/angular.json CHANGED
@@ -13,16 +13,6 @@
13
13
  "build": {
14
14
  "builder": "@angular-builders/custom-webpack:browser",
15
15
  "options": {
16
- "customWebpackConfig": {
17
- "path": "./wm-custom-webpack.config.js"
18
- },
19
- "indexTransform": "./build-scripts/index-html-transform.js",
20
- "deployUrl": "ng-bundle/",
21
- "outputPath": "dist/ng-bundle",
22
- "index": {
23
- "input": "src/index.html",
24
- "output": "../../index.html"
25
- },
26
16
  "main": "src/main.ts",
27
17
  "polyfills": "src/polyfills.ts",
28
18
  "tsConfig": "src/tsconfig.app.json",
@@ -94,9 +84,7 @@
94
84
  "./node_modules/@wavemaker/app-ng-runtime/scripts/swipey/swipey.jquery.plugin.js",
95
85
  "./node_modules/@wavemaker/app-ng-runtime/scripts/jquery.ui.touch-punch/jquery.ui.touch-punch.min.js",
96
86
  "./node_modules/summernote/dist/summernote-lite.min.js",
97
- "./node_modules/hammerjs/hammer.min.js",
98
87
  "./node_modules/iscroll/build/iscroll.js",
99
- "./node_modules/js-cookie/src/js.cookie.js",
100
88
  "./node_modules/jssha/dist/sha256.js",
101
89
  "./node_modules/@ztree/ztree_v3/js/jquery.ztree.all.js",
102
90
  "./node_modules/@wavemaker/app-ng-runtime/scripts/tree-keyboard-navigation/keyboard-navigation.js"
@@ -104,6 +92,16 @@
104
92
  },
105
93
  "configurations": {
106
94
  "production": {
95
+ "customWebpackConfig": {
96
+ "path": "./wm-custom-webpack.config.js"
97
+ },
98
+ "indexTransform": "./build-scripts/index-html-transform.js",
99
+ "deployUrl": "ng-bundle/",
100
+ "outputPath": "dist/ng-bundle",
101
+ "index": {
102
+ "input": "src/index.html",
103
+ "output": "../../index.html"
104
+ },
107
105
  "fileReplacements": [
108
106
  {
109
107
  "replace": "src/environments/environment.ts",
@@ -133,6 +131,16 @@
133
131
  ]
134
132
  },
135
133
  "development": {
134
+ "customWebpackConfig": {
135
+ "path": "./wm-custom-webpack.config.js"
136
+ },
137
+ "indexTransform": "./build-scripts/index-html-transform.js",
138
+ "deployUrl": "ng-bundle/",
139
+ "outputPath": "dist/ng-bundle",
140
+ "index": {
141
+ "input": "src/index.html",
142
+ "output": "../../index.html"
143
+ },
136
144
  "fileReplacements": [
137
145
  {
138
146
  "replace": "src/environments/environment.ts",
@@ -155,6 +163,16 @@
155
163
  ]
156
164
  },
157
165
  "local": {
166
+ "customWebpackConfig": {
167
+ "path": "./wm-custom-webpack.config.js"
168
+ },
169
+ "indexTransform": "./build-scripts/index-html-transform.js",
170
+ "deployUrl": "ng-bundle/",
171
+ "outputPath": "dist/ng-bundle",
172
+ "index": {
173
+ "input": "src/index.html",
174
+ "output": "../../index.html"
175
+ },
158
176
  "fileReplacements": [
159
177
  {
160
178
  "replace": "src/environments/environment.ts",
@@ -182,96 +200,45 @@
182
200
  "maximumWarning": "2mb"
183
201
  }
184
202
  ]
185
- }
186
- },
187
- "defaultConfiguration": "production"
188
- },
189
- "build-ng": {
190
- "builder": "@angular-devkit/build-angular:browser",
191
- "options": {
192
- "outputPath": "dist",
193
- "index": {
194
- "input": "src/index.html",
195
- "output": "../index.html"
196
203
  },
197
- "main": "src/main.ts",
198
- "polyfills": "src/polyfills.ts",
199
- "tsConfig": "src/tsconfig.app.json",
200
- "assets": [
201
- "src/favicon.ico",
202
- "src/favicon.png",
203
- "src/assets",
204
- {
205
- "glob": "**/*",
206
- "input": "src/servicedefs",
207
- "output": "/servicedefs/"
208
- },
209
- {
210
- "glob": "**/*",
211
- "input": "src/resources",
212
- "output": "/resources/"
213
- }
214
- ],
215
- "styles": [
216
- "src/styles.css",
217
- "src/assets/styles/css/wm-style.css",
218
- "src/assets/themes/material/style.css",
219
- "src/assets/app.css",
220
- {
221
- "input": "src/assets/print.css",
222
- "inject": false,
223
- "bundleName": "print"
224
- }
225
- ],
226
- "scripts": [
227
- "./node_modules/x2js/x2js.js",
228
- "./node_modules/d3/dist/d3.min.js",
229
- "./node_modules/@wavemaker/nvd3/build/nv.d3.min.js",
230
- "./node_modules/jquery/dist/jquery.min.js",
231
- "./node_modules/jquery-ui/ui/disable-selection.js",
232
- "./node_modules/jquery-ui/ui/version.js",
233
- "./node_modules/jquery-ui/ui/widget.js",
234
- "./node_modules/jquery-ui/ui/scroll-parent.js",
235
- "./node_modules/jquery-ui/ui/plugin.js",
236
- "./node_modules/jquery-ui/ui/data.js",
237
- "./node_modules/jquery-ui/ui/widgets/mouse.js",
238
- "./node_modules/jquery-ui/ui/widgets/resizable.js",
239
- "./node_modules/jquery-ui/ui/widgets/sortable.js",
240
- "./node_modules/jquery-ui/ui/widgets/droppable.js",
241
- "./libraries/scripts/datatable/datatable.js",
242
- "./node_modules/summernote/dist/summernote-lite.min.js",
243
- "./node_modules/hammerjs/hammer.min.js",
244
- "./node_modules/iscroll/build/iscroll.js",
245
- "./node_modules/js-cookie/src/js.cookie.js",
246
- "./node_modules/jssha/dist/sha256.js",
247
- "./node_modules/@ztree/ztree_v3/js/jquery.ztree.all.js",
248
- "./libraries/scripts/tree-keyboard-navigation/keyboard-navigation.js"
249
- ],
250
- "aot": false,
251
- "vendorChunk": true,
252
- "extractLicenses": false,
253
- "buildOptimizer": false,
254
- "sourceMap": true,
255
- "optimization": false,
256
- "namedChunks": true
257
- },
258
- "configurations": {
259
- "production": {
260
- "browserTarget": "angular-app:build:production"
204
+ "ng-serve": {
205
+ "indexTransform": "./build-scripts/index-html-transform-ng-serve.ts",
206
+ "deployUrl": "ng-bundle/",
207
+ "outputPath": "dist/ng-bundle",
208
+ "index": "src/index.html",
209
+ "fileReplacements": [
210
+ {
211
+ "replace": "src/environments/environment.ts",
212
+ "with": "src/environments/environment.dev.ts"
213
+ }
214
+ ],
215
+ "optimization": false,
216
+ "outputHashing": "none",
217
+ "sourceMap": true,
218
+ "namedChunks": true,
219
+ "aot": true,
220
+ "extractLicenses": false,
221
+ "vendorChunk": true,
222
+ "buildOptimizer": false,
223
+ "budgets": [
224
+ {
225
+ "type": "initial",
226
+ "maximumWarning": "2mb"
227
+ }
228
+ ]
261
229
  }
262
230
  },
263
- "defaultConfiguration": ""
231
+ "defaultConfiguration": "production"
264
232
  },
265
233
  "serve": {
266
- "builder": "@angular-devkit/build-angular:dev-server",
267
- "options": {
268
- "buildTarget": "angular-app:build"
269
- },
234
+ "builder": "@angular-builders/custom-webpack:dev-server",
270
235
  "configurations": {
271
- "production": {
272
- "buildTarget": "angular-app:build:production"
236
+ "development": {
237
+ "buildTarget": "angular-app:build:ng-serve",
238
+ "proxyConfig": "proxy.conf.js"
273
239
  }
274
- }
240
+ },
241
+ "defaultConfiguration": "development"
275
242
  },
276
243
  "extract-i18n": {
277
244
  "builder": "@angular-devkit/build-angular:extract-i18n",
@@ -0,0 +1,20 @@
1
+ import {TargetOptions} from '@angular-builders/custom-webpack';
2
+
3
+ export default function indexHtmlTransformNgServe(
4
+ targetOptions: TargetOptions,
5
+ indexHtml: string
6
+ ): string {
7
+ const deployUrl = 'ng-bundle/';
8
+ const wmStylesHref = `${deployUrl}wm-styles.css`;
9
+
10
+ const metaDeployUrl = `<meta name="deployUrl" content="${deployUrl}">`;
11
+ const linkWmStyles = `<link rel="stylesheet" type="text/css" href="${wmStylesHref}">`;
12
+
13
+ const injectHtml = `${metaDeployUrl}
14
+ ${linkWmStyles}`;
15
+ const headCloseIndex = indexHtml.indexOf('</head>');
16
+
17
+ return `${indexHtml.slice(0, headCloseIndex)}
18
+ ${injectHtml}
19
+ ${indexHtml.slice(headCloseIndex)}`;
20
+ }
@@ -7,33 +7,6 @@ const exec = util.promisify(require('child_process').exec);
7
7
  const cheerio = require(`cheerio`);
8
8
  const crypto = require(`crypto`);
9
9
 
10
- const generateHashForScripts = (updatedFilenames) => {
11
- //from angular 12(IVY), scripts array in angular json, doesn't allow `@` symbol in the name/value
12
- //so removed `@` from wavemaker.com in the file name and adding it back in the post-build.js file
13
- const scriptsMap = {};
14
- return new Promise(resolve => {
15
- fs.readdir(global.opPath, (err, items) => {
16
- const promises = items.map(i => {
17
- const nohashIndex = i.indexOf('-NOHASH.js');
18
- if (nohashIndex > 0) {
19
- const key = i.substring(0, nohashIndex);
20
- const filename = `${key}-NOHASH.js`;
21
- const updatedFilename = `${key}.js`
22
- scriptsMap[`${key}.js`] = updatedFilename;
23
- updatedFilenames[filename] = updatedFilename;
24
- return Promise.all([
25
- copyFile(`${global.opPath}/${filename}`, `${global.opPath}/${updatedFilename}`),
26
- // copyFile(`${opPath}/${key}-NOHASH.br.js`, `${opPath}/${key}.${hash}.br.js`),
27
- // copyFile(`${opPath}/${key}-NOHASH.gzip.js`, `${opPath}/${key}.${hash}.gzip.js`)
28
- ]);
29
- }
30
- });
31
- Promise.all(promises).then(() => {
32
- return writeFile(`${global.opPath}/path_mapping.json`, JSON.stringify(scriptsMap, null, 2));
33
- }).then(resolve);
34
- });
35
- });
36
- };
37
10
  let isProdBuild;
38
11
  let isDevBuild;
39
12
  let $;
@@ -145,10 +118,10 @@ const updatePwaAssets = (deployUrl, updatedFileNames, updatedFileHashes) => {
145
118
  deployUrl = deployUrl === "_cdnUrl_" ? 'ng-bundle/' : deployUrl;
146
119
 
147
120
  // copy service worker and its config to root directory
148
- fs.copyFileSync('./dist/ng-bundle/ngsw-worker.js', './dist/ngsw-worker.js');
149
- fs.copyFileSync('./dist/ng-bundle/wmsw-worker.js', './dist/wmsw-worker.js');
150
- fs.copyFileSync('./dist/ng-bundle/ngsw.json', ngswPath);
151
- fs.copyFileSync('./dist/ng-bundle/manifest.json', manifestPath);
121
+ fs.copyFileSync(`./dist/ng-bundle/${global.randomHash}/ngsw-worker.js`, './dist/ngsw-worker.js');
122
+ fs.copyFileSync(`./dist/ng-bundle/${global.randomHash}/wmsw-worker.js`, './dist/wmsw-worker.js');
123
+ fs.copyFileSync(`./dist/ng-bundle/${global.randomHash}/ngsw.json`, ngswPath);
124
+ fs.copyFileSync(`./dist/ng-bundle/${global.randomHash}/manifest.json`, manifestPath);
152
125
 
153
126
  // update the icons url in manifest.json
154
127
  const manifest = JSON.parse(fs.readFileSync(manifestPath).toString());
@@ -191,9 +164,9 @@ const generateSha1 = (content) => {
191
164
  try {
192
165
  const angularJson = require(`${process.cwd()}/angular.json`);
193
166
  const build = angularJson['projects']['angular-app']['architect']['build'];
194
- let deployUrl = args['deploy-url'] || build['options']['deployUrl'];
167
+ let deployUrl = args['deploy-url'] || build['configurations']['production']['deployUrl'];
195
168
  global.randomHash = deployUrl.split('/')[1];
196
- let outputPath = global.opPath = args['output-path'] || build['options']['outputPath']
169
+ let outputPath = global.opPath = args['output-path'] || build['configurations']['production']['outputPath']
197
170
  const contents = await readFile(`./dist/index.html`, `utf8`);
198
171
  $ = cheerio.load(contents);
199
172
  isProdBuild = fs.existsSync(`${process.cwd()}/${outputPath}/wm-styles.css`);
@@ -233,8 +206,6 @@ const generateSha1 = (content) => {
233
206
  const htmlContent = $.html();
234
207
  await writeFile(`./dist/index.html`, htmlContent);
235
208
 
236
- await generateHashForScripts(updatedFilenames);
237
-
238
209
  if (serviceWorkerEnabled) {
239
210
  // re-generate hash for index.html since its been modified
240
211
  updatedFileHashes['index.html'] = generateSha1(htmlContent);
@@ -1,5 +1,9 @@
1
1
  @if (startApp) {
2
- <router-outlet></router-outlet>
2
+ @if(enableSkipToMainContent) {
3
+ <div id="app-focus-start" tabindex="-1"></div>
4
+ <a href="javascript:void(0);" class="skip" (click)="skipToAppContent($event)">{{appLocale.LABEL_SKIP_TO_MAIN_CONTENT || 'Skip to main content'}}</a>
5
+ }
6
+ <router-outlet></router-outlet>
3
7
  @if (isApplicationType) {
4
8
  <div wmContainer partialContainer content="Common" hidden class="ng-hide"></div>
5
9
  }