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

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
@@ -21,7 +21,7 @@
21
21
  "outputPath": "dist/ng-bundle",
22
22
  "index": {
23
23
  "input": "src/index.html",
24
- "output": "../index.html"
24
+ "output": "../../index.html"
25
25
  },
26
26
  "main": "src/main.ts",
27
27
  "polyfills": "src/polyfills.ts",
@@ -32,13 +32,13 @@
32
32
  "src/assets",
33
33
  {
34
34
  "glob": "**/*",
35
- "input": "libraries/locales/",
36
- "output": "/locales/"
35
+ "input": "libraries/locales/moment-timezone",
36
+ "output": "/locales/moment-timezone"
37
37
  },
38
38
  {
39
39
  "glob": "**/*",
40
- "input": "node_modules/@wavemaker/app-ng-runtime/locales/",
41
- "output": "/locales/"
40
+ "input": "node_modules/@wavemaker/app-ng-runtime/locales/moment-timezone",
41
+ "output": "/locales/moment-timezone"
42
42
  },
43
43
  {
44
44
  "glob": "**/*",
@@ -75,7 +75,6 @@
75
75
  }
76
76
  ],
77
77
  "scripts": [
78
- "./node_modules/x2js/x2js.js",
79
78
  "./node_modules/d3/dist/d3.min.js",
80
79
  "./node_modules/@wavemaker/nvd3/build/nv.d3.min.js",
81
80
  "./node_modules/jquery/dist/jquery.min.js",
@@ -94,9 +93,6 @@
94
93
  "./node_modules/@wavemaker/app-ng-runtime/scripts/datatable/datatable.js",
95
94
  "./node_modules/@wavemaker/app-ng-runtime/scripts/swipey/swipey.jquery.plugin.js",
96
95
  "./node_modules/@wavemaker/app-ng-runtime/scripts/jquery.ui.touch-punch/jquery.ui.touch-punch.min.js",
97
- "./node_modules/moment/min/moment.min.js",
98
- "./node_modules/moment-timezone/builds/moment-timezone.min.js",
99
- "./node_modules/fullcalendar/main.min.js",
100
96
  "./node_modules/summernote/dist/summernote-lite.min.js",
101
97
  "./node_modules/hammerjs/hammer.min.js",
102
98
  "./node_modules/iscroll/build/iscroll.js",
@@ -243,9 +239,6 @@
243
239
  "./node_modules/jquery-ui/ui/widgets/sortable.js",
244
240
  "./node_modules/jquery-ui/ui/widgets/droppable.js",
245
241
  "./libraries/scripts/datatable/datatable.js",
246
- "./node_modules/moment/min/moment.min.js",
247
- "./node_modules/moment-timezone/builds/moment-timezone.min.js",
248
- "./node_modules/fullcalendar/main.min.js",
249
242
  "./node_modules/summernote/dist/summernote-lite.min.js",
250
243
  "./node_modules/hammerjs/hammer.min.js",
251
244
  "./node_modules/iscroll/build/iscroll.js",
@@ -6,6 +6,7 @@ if (processArgs.findIndex(arg => arg.startsWith('--max-old-space-size')) !== -1)
6
6
  process.env.NODE_OPTIONS = processArgs.pop();
7
7
  console.log("Setting node options: ", process.env.NODE_OPTIONS);
8
8
  }
9
+
9
10
  const args = processArgs.slice(2);
10
11
  const ngBuildArgs = ['build', ...args];
11
12
  console.log("\x1b[33m", "Angular build params: ", ngBuildArgs);
@@ -6,94 +6,38 @@ const copyFile = util.promisify(fs.copyFile);
6
6
  const exec = util.promisify(require('child_process').exec);
7
7
  const cheerio = require(`cheerio`);
8
8
  const crypto = require(`crypto`);
9
- const opPath = `${process.cwd()}/dist/ng-bundle`;
10
- const copyCssFiles = (hash, updatedFilenames) => {
11
- const filename = 'wm-styles.css';
12
- const updatedFilename = `wm-styles.${hash}.css`
13
- copyFile(`${opPath}/${filename}`, `${opPath}/${updatedFilename}`);
14
- updatedFilenames[filename] = updatedFilename;
15
- // copyFile(`${opPath}/wm-styles.br.css`,`${opPath}/wm-styles.${hash}.br.css`);
16
- // copyFile(`${opPath}/wm-styles.gzip.css`,`${opPath}/wm-styles.${hash}.gzip.css`);
17
- };
18
- const copyMobileCssFiles = (hash, fileName) => {
19
- // const name = filePath.split('.css')[0];
20
- copyFile(`${opPath}/${fileName}.css`, `${opPath}/${fileName}.${hash}.css`);
21
- // copyFile(`${opPath}/wm-styles.br.css`,`${opPath}/wm-styles.${hash}.br.css`);
22
- // copyFile(`${opPath}/wm-styles.gzip.css`,`${opPath}/wm-styles.${hash}.gzip.css`);
23
- };
24
- const generateHash = async (filepath) => {
25
- const cssContent = await readFile(filepath);
26
- let hash = crypto.createHash('md5');
27
- hash.update(cssContent);
28
- return hash.digest('hex');
29
- };
9
+
30
10
  const generateHashForScripts = (updatedFilenames) => {
31
11
  //from angular 12(IVY), scripts array in angular json, doesn't allow `@` symbol in the name/value
32
12
  //so removed `@` from wavemaker.com in the file name and adding it back in the post-build.js file
33
13
  const scriptsMap = {};
34
14
  return new Promise(resolve => {
35
- fs.readdir(opPath, (err, items) => {
15
+ fs.readdir(global.opPath, (err, items) => {
36
16
  const promises = items.map(i => {
37
17
  const nohashIndex = i.indexOf('-NOHASH.js');
38
18
  if (nohashIndex > 0) {
39
19
  const key = i.substring(0, nohashIndex);
40
- return generateHash(`${opPath}/${i}`).then(hash => {
41
- const filename = `${key}-NOHASH.js`;
42
- const updatedFilename = `${key}.${hash}.js`
43
- scriptsMap[`${key}.js`] = updatedFilename;
44
- updatedFilenames[filename] = updatedFilename;
45
- return Promise.all([
46
- copyFile(`${opPath}/${filename}`, `${opPath}/${updatedFilename}`),
47
- // copyFile(`${opPath}/${key}-NOHASH.br.js`, `${opPath}/${key}.${hash}.br.js`),
48
- // copyFile(`${opPath}/${key}-NOHASH.gzip.js`, `${opPath}/${key}.${hash}.gzip.js`)
49
- ]);
50
- });
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
+ ]);
51
29
  }
52
30
  });
53
31
  Promise.all(promises).then(() => {
54
- return writeFile(`${opPath}/path_mapping.json`, JSON.stringify(scriptsMap, null, 2));
32
+ return writeFile(`${global.opPath}/path_mapping.json`, JSON.stringify(scriptsMap, null, 2));
55
33
  }).then(resolve);
56
34
  });
57
35
  });
58
36
  };
59
- let isMobileProject = false;
60
37
  let isProdBuild;
61
38
  let isDevBuild;
62
39
  let $;
63
40
 
64
- const setMobileProjectType = (angularJson) => {
65
- let styles = angularJson['projects']['angular-app']['architect']['build']['options']['styles'];
66
- const androidStyles = styles.find((style) => {
67
- let isObject = typeof (style) === 'object';
68
- if (isObject) {
69
- return style.bundleName === 'wm-android-styles';
70
- }
71
- return false;
72
- });
73
- isMobileProject = androidStyles ? true : false;
74
- return isMobileProject;
75
- }
76
- const addMobileSpecificStyles = async (deployUrl) => {
77
- if (isDevBuild) {
78
- $("body").append(
79
- `<script type="text/javascript" defer="true" src="${deployUrl}wm-android-styles.js"></script>`
80
- );
81
- }
82
-
83
- if (isProdBuild) {
84
- let hash = await generateHash(`${opPath}/wm-android-styles.css`);
85
- copyMobileCssFiles(hash, 'wm-android-styles');
86
- $("head").append(
87
- `<link rel="stylesheet" theme="wmtheme" href="${deployUrl}wm-android-styles.${hash}.css" >`
88
- );
89
- hash = await generateHash(`${opPath}/wm-ios-styles.css`);
90
- copyMobileCssFiles(hash, 'wm-ios-styles');
91
- $("head").append(
92
- `<link rel="stylesheet" theme="wmtheme" href="${deployUrl}wm-ios-styles.${hash}.css" >`
93
- );
94
- }
95
- }
96
-
97
41
  const addScriptForWMStylesPath = (wm_styles_path) => {
98
42
  // wm_styles_path will not be present for mobile apps
99
43
  if (wm_styles_path) {
@@ -248,17 +192,12 @@ const generateSha1 = (content) => {
248
192
  const angularJson = require(`${process.cwd()}/angular.json`);
249
193
  const build = angularJson['projects']['angular-app']['architect']['build'];
250
194
  let deployUrl = args['deploy-url'] || build['options']['deployUrl'];
251
-
195
+ global.randomHash = deployUrl.split('/')[1];
196
+ let outputPath = global.opPath = args['output-path'] || build['options']['outputPath']
252
197
  const contents = await readFile(`./dist/index.html`, `utf8`);
253
198
  $ = cheerio.load(contents);
254
- setMobileProjectType(angularJson);
255
- if (!isMobileProject) {
256
- isProdBuild = fs.existsSync(`${process.cwd()}/dist/ng-bundle/wm-styles.css`);
257
- isDevBuild = fs.existsSync(`${process.cwd()}/dist/ng-bundle/wm-styles.js`);
258
- } else {
259
- isDevBuild = fs.existsSync(`${process.cwd()}/dist/ng-bundle/wm-android-styles.js`);
260
- isProdBuild = fs.existsSync(`${process.cwd()}/dist/ng-bundle/wm-android-styles.css`);
261
- }
199
+ isProdBuild = fs.existsSync(`${process.cwd()}/${outputPath}/wm-styles.css`);
200
+ isDevBuild = fs.existsSync(`${process.cwd()}/${outputPath}/wm-styles.js`);
262
201
 
263
202
  if (isProdBuild) {
264
203
  const isOptimizeCss = $('meta[optimizecss]').length;
@@ -275,18 +214,12 @@ const generateSha1 = (content) => {
275
214
  const updatedFileHashes = {}
276
215
  let wm_styles_path;
277
216
 
278
- if (isMobileProject) {
279
- await addMobileSpecificStyles(deployUrl);
217
+ if (isDevBuild) {
218
+ wm_styles_path = `${deployUrl}wm-styles.js`;
280
219
  } else {
281
- if (isDevBuild) {
282
- wm_styles_path = `${deployUrl}wm-styles.js`;
283
- } else {
284
- const fileName = 'wm-styles';
285
- const hash = await generateHash(`${opPath}/${fileName}.css`);
286
- copyCssFiles(hash, updatedFilenames);
287
- const updatedFileName = `${fileName}.${hash}.css`
288
- wm_styles_path = `${deployUrl}${updatedFileName}`;
289
- }
220
+ const fileName = 'wm-styles';
221
+ const updatedFileName = `${fileName}.css`
222
+ wm_styles_path = `${deployUrl}${updatedFileName}`;
290
223
  }
291
224
 
292
225
  addScriptForWMStylesPath(wm_styles_path);
@@ -295,7 +228,7 @@ const generateSha1 = (content) => {
295
228
  //this is required to download all the assets
296
229
  $('head').append(`<meta name="deployUrl" content=${deployUrl} />`);
297
230
  $('script[src$="services/application/wmProperties.js"]').remove();
298
- $('link[href$="favicon.png"]').attr('href', './ng-bundle/favicon.png');
231
+ $('link[href$="favicon.png"]').attr('href', `${deployUrl}favicon.png`);
299
232
 
300
233
  const htmlContent = $.html();
301
234
  await writeFile(`./dist/index.html`, htmlContent);
@@ -1,28 +1,36 @@
1
- <ng-container *ngIf="startApp">
2
- <router-outlet></router-outlet>
3
- <div wmContainer partialContainer content="Common" hidden class="ng-hide" *ngIf="isApplicationType"></div>
4
- <app-spinner name="globalspinner" classname="global-spinner" role="alert" aria-live="assertive" [attr.aria-label]="spinner.arialabel || 'Loading'" [show]="spinner.show" [spinnermessages]="spinner.messages"></app-spinner>
5
- <div wmDialog name="oAuthLoginDialog" title="Application is requesting you to sign in with"
6
- close.event="closeOAuthDialog()">
7
- <ng-template #dialogBody>
8
- <ul class="list-items">
9
- <li class="list-item" *ngFor="let provider of providersConfig">
10
- <button class="btn" (click)="provider.invoke()">{{provider.name}}</button>
11
- </li>
12
- </ul>
13
- </ng-template>
14
- </div>
15
- <div wmConfirmDialog name="_app-confirm-dialog" title.bind="title" message.bind="message" oktext.bind="oktext"
16
- canceltext.bind="canceltext" closable="false" iconclass.bind="iconclass"
17
- escape.event="onEscape()" ok.event="onOk()" cancel.event="onCancel()" close.event="onClose()" opened.event="onOpen()"></div>
18
- <div *ngIf="!isApplicationType" wmConfirmDialog name="PrefabConfirmDialog" title.bind="title" message.bind="text" oktext.bind="okButtonText"
19
- canceltext.bind="cancelButtonText" closable="false" iconclass.bind="iconclass"
20
- escape.event="onEscape()" ok.event="onOk()" cancel.event="onCancel()" close.event="onClose()" opened.event="onOpen()"></div>
21
- <div *ngIf="!isApplicationType" wmAlertDialog name="PrefabAlertDialog" title.bind="title" message.bind="text" oktext.bind="okButtonText"
22
- canceltext.bind="cancelButtonText" closable="false" iconclass.bind="iconclass"
23
- escape.event="onEscape()" ok.event="onOk()" cancel.event="onCancel()" close.event="onClose()" opened.event="onOpen()"></div>
24
- <div wmAppExt></div>
25
- <i id="wm-mobile-display"></i>
26
- </ng-container>
1
+ @if (startApp) {
2
+ <router-outlet></router-outlet>
3
+ @if (isApplicationType) {
4
+ <div wmContainer partialContainer content="Common" hidden class="ng-hide"></div>
5
+ }
6
+ <app-spinner name="globalspinner" classname="global-spinner" role="alert" aria-live="assertive" [attr.aria-label]="spinner.arialabel || 'Loading'" [show]="spinner.show" [spinnermessages]="spinner.messages"></app-spinner>
7
+ <div wmDialog name="oAuthLoginDialog" title="Application is requesting you to sign in with"
8
+ close.event="closeOAuthDialog()">
9
+ <ng-template #dialogBody>
10
+ <ul class="list-items">
11
+ @for (provider of providersConfig; track provider) {
12
+ <li class="list-item">
13
+ <button class="btn" (click)="provider.invoke()">{{provider.name}}</button>
14
+ </li>
15
+ }
16
+ </ul>
17
+ </ng-template>
18
+ </div>
19
+ <div wmConfirmDialog name="_app-confirm-dialog" title.bind="title" message.bind="message" oktext.bind="oktext"
20
+ canceltext.bind="canceltext" closable="false" iconclass.bind="iconclass"
21
+ escape.event="onEscape()" ok.event="onOk()" cancel.event="onCancel()" close.event="onClose()" opened.event="onOpen()"></div>
22
+ @if (!isApplicationType) {
23
+ <div wmConfirmDialog name="PrefabConfirmDialog" title.bind="title" message.bind="text" oktext.bind="okButtonText"
24
+ canceltext.bind="cancelButtonText" closable="false" iconclass.bind="iconclass"
25
+ escape.event="onEscape()" ok.event="onOk()" cancel.event="onCancel()" close.event="onClose()" opened.event="onOpen()"></div>
26
+ }
27
+ @if (!isApplicationType) {
28
+ <div wmAlertDialog name="PrefabAlertDialog" title.bind="title" message.bind="text" oktext.bind="okButtonText"
29
+ canceltext.bind="cancelButtonText" closable="false" iconclass.bind="iconclass"
30
+ escape.event="onEscape()" ok.event="onOk()" cancel.event="onCancel()" close.event="onClose()" opened.event="onOpen()"></div>
31
+ }
32
+ <div wmAppExt></div>
33
+ <i id="wm-mobile-display"></i>
34
+ }
27
35
  <!--Dummy container to create the component dynamically-->
28
36
  <ng-container #dynamicComponent></ng-container>