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

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,16 +84,31 @@
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"
91
+ ],
92
+ "allowedCommonJsDependencies": [
93
+ "angular2-websocket/angular2-websocket",
94
+ "he",
95
+ "moment",
96
+ "moment-timezone",
97
+ "x2js"
103
98
  ]
104
99
  },
105
100
  "configurations": {
106
101
  "production": {
102
+ "customWebpackConfig": {
103
+ "path": "./wm-custom-webpack.config.js"
104
+ },
105
+ "indexTransform": "./build-scripts/index-html-transform.js",
106
+ "deployUrl": "ng-bundle/",
107
+ "outputPath": "dist/ng-bundle",
108
+ "index": {
109
+ "input": "src/index.html",
110
+ "output": "../../index.html"
111
+ },
107
112
  "fileReplacements": [
108
113
  {
109
114
  "replace": "src/environments/environment.ts",
@@ -128,11 +133,21 @@
128
133
  "budgets": [
129
134
  {
130
135
  "type": "initial",
131
- "maximumWarning": "2mb"
136
+ "maximumWarning": "5mb"
132
137
  }
133
138
  ]
134
139
  },
135
140
  "development": {
141
+ "customWebpackConfig": {
142
+ "path": "./wm-custom-webpack.config.js"
143
+ },
144
+ "indexTransform": "./build-scripts/index-html-transform.js",
145
+ "deployUrl": "ng-bundle/",
146
+ "outputPath": "dist/ng-bundle",
147
+ "index": {
148
+ "input": "src/index.html",
149
+ "output": "../../index.html"
150
+ },
136
151
  "fileReplacements": [
137
152
  {
138
153
  "replace": "src/environments/environment.ts",
@@ -155,6 +170,16 @@
155
170
  ]
156
171
  },
157
172
  "local": {
173
+ "customWebpackConfig": {
174
+ "path": "./wm-custom-webpack.config.js"
175
+ },
176
+ "indexTransform": "./build-scripts/index-html-transform.js",
177
+ "deployUrl": "ng-bundle/",
178
+ "outputPath": "dist/ng-bundle",
179
+ "index": {
180
+ "input": "src/index.html",
181
+ "output": "../../index.html"
182
+ },
158
183
  "fileReplacements": [
159
184
  {
160
185
  "replace": "src/environments/environment.ts",
@@ -182,96 +207,45 @@
182
207
  "maximumWarning": "2mb"
183
208
  }
184
209
  ]
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
210
  },
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"
211
+ "ng-serve": {
212
+ "indexTransform": "./build-scripts/index-html-transform-ng-serve.ts",
213
+ "deployUrl": "ng-bundle/",
214
+ "outputPath": "dist/ng-bundle",
215
+ "index": "src/index.html",
216
+ "fileReplacements": [
217
+ {
218
+ "replace": "src/environments/environment.ts",
219
+ "with": "src/environments/environment.dev.ts"
220
+ }
221
+ ],
222
+ "optimization": false,
223
+ "outputHashing": "none",
224
+ "sourceMap": true,
225
+ "namedChunks": true,
226
+ "aot": true,
227
+ "extractLicenses": false,
228
+ "vendorChunk": true,
229
+ "buildOptimizer": false,
230
+ "budgets": [
231
+ {
232
+ "type": "initial",
233
+ "maximumWarning": "2mb"
234
+ }
235
+ ]
261
236
  }
262
237
  },
263
- "defaultConfiguration": ""
238
+ "defaultConfiguration": "production"
264
239
  },
265
240
  "serve": {
266
- "builder": "@angular-devkit/build-angular:dev-server",
267
- "options": {
268
- "buildTarget": "angular-app:build"
269
- },
241
+ "builder": "@angular-builders/custom-webpack:dev-server",
270
242
  "configurations": {
271
- "production": {
272
- "buildTarget": "angular-app:build:production"
243
+ "development": {
244
+ "buildTarget": "angular-app:build:ng-serve",
245
+ "proxyConfig": "proxy.conf.js"
273
246
  }
274
- }
247
+ },
248
+ "defaultConfiguration": "development"
275
249
  },
276
250
  "extract-i18n": {
277
251
  "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
  }