@wavemaker/angular-codegen 11.5.0-next.40003 → 11.5.0-next.NULL

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.
Files changed (36) hide show
  1. angular-codegen/.npmrc +1 -0
  2. angular-codegen/angular-app/.npmrc +1 -0
  3. angular-codegen/angular-app/angular.json +119 -1009
  4. angular-codegen/angular-app/build-scripts/build.js +30 -0
  5. angular-codegen/angular-app/build-scripts/post-build.js +19 -13
  6. angular-codegen/angular-app/package-lock.json +25218 -23221
  7. angular-codegen/angular-app/package.json +57 -51
  8. angular-codegen/angular-app/src/app/lazy-load-scripts.resolve.ts +2 -4
  9. angular-codegen/angular-app/src/assets/print.css +32 -0
  10. angular-codegen/angular-app/src/assets/styles/css/wm-style.css +1 -1
  11. angular-codegen/angular-app/src/polyfills.ts +23 -39
  12. angular-codegen/angular-app/tsconfig.json +6 -3
  13. angular-codegen/angular-app/tsconfig.web-app.json +2 -2
  14. angular-codegen/angular-app/wm-custom-webpack.config.js +8 -11
  15. angular-codegen/build-angular-app.js +1 -1
  16. angular-codegen/dependencies/expression-parser.cjs.js +13624 -12592
  17. angular-codegen/dependencies/pipe-provider.cjs.js +124407 -57688
  18. angular-codegen/dependencies/transpilation-mobile.cjs.js +50241 -27668
  19. angular-codegen/dependencies/transpilation-web.cjs.js +50241 -27668
  20. angular-codegen/download-packages.js +10 -3
  21. angular-codegen/package-lock.json +3633 -2087
  22. angular-codegen/package.json +7 -2
  23. angular-codegen/src/codegen.js +1 -1
  24. angular-codegen/src/gen-app-skeleton.js +1 -1
  25. angular-codegen/src/handlebar-helpers.js +1 -1
  26. angular-codegen/src/pages-util.js +1 -1
  27. angular-codegen/src/update-angular-json.js +1 -1
  28. angular-codegen/templates/app-prefabs.module.ts.hbs +0 -1
  29. angular-codegen/templates/app-routes.ts.hbs +6 -5
  30. angular-codegen/templates/app.module.ts.hbs +24 -4
  31. angular-codegen/templates/layout/layout.module.ts.hbs +1 -1
  32. angular-codegen/templates/page/page.component.ts.hbs +4 -4
  33. angular-codegen/templates/page/page.module.ts.hbs +3 -3
  34. angular-codegen/templates/partial/partial.component.ts.hbs +5 -5
  35. angular-codegen/templates/partial/partial.module.ts.hbs +1 -2
  36. angular-codegen/templates/prefab/prefab.module.ts.hbs +0 -1
@@ -0,0 +1,30 @@
1
+ const { spawnSync } = require('child_process');
2
+ const path = require('path');
3
+
4
+ const args = process.argv.slice(2);
5
+
6
+ const ngBuildArgs = ['build', ...args];
7
+ console.log("Build params - ", ngBuildArgs);
8
+
9
+ //Trigger angular build with the passed params
10
+ const ngPath = path.resolve(process.cwd(), 'node_modules', '.bin', "ng");
11
+ const ngBuildProcess = spawnSync(ngPath, ngBuildArgs, { stdio: 'inherit', shell: true });
12
+
13
+ if (ngBuildProcess.status === 0) {
14
+ console.log('ng build completed successfully!');
15
+ } else {
16
+ console.error('Error during ng build:', ngBuildProcess.error || ngBuildProcess.stderr);
17
+ process.exit(1);
18
+ }
19
+
20
+ const ngPostBuildArgs = ['build-scripts/post-build.js', ...args];
21
+ console.log("Post build params - ", ngPostBuildArgs);
22
+
23
+ const ngPostBuildProcess = spawnSync('node', ngPostBuildArgs, { stdio: 'inherit' });
24
+
25
+ if (ngPostBuildProcess.status === 0) {
26
+ console.log('ng post build completed successfully!');
27
+ } else {
28
+ console.error('Error during ng build:', ngPostBuildProcess.error || ngPostBuildProcess.stderr);
29
+ process.exit(1);
30
+ }
@@ -28,6 +28,8 @@ const generateHash = async (filepath) => {
28
28
  return hash.digest('hex');
29
29
  };
30
30
  const generateHashForScripts = (updatedFilenames) => {
31
+ //from angular 12(IVY), scripts array in angular json, doesn't allow `@` symbol in the name/value
32
+ //so removed `@` from wavemaker.com in the file name and adding it back in the post-build.js file
31
33
  const scriptsMap = {};
32
34
  return new Promise(resolve => {
33
35
  fs.readdir(opPath, (err, items) => {
@@ -74,7 +76,7 @@ const setMobileProjectType = (angularJson) => {
74
76
  const addMobileSpecificStyles = async (deployUrl) => {
75
77
  if (isDevBuild) {
76
78
  $("body").append(
77
- `<script type="text/javascript" defer="true" src="${deployUrl}/wm-android-styles.js"></script>`
79
+ `<script type="text/javascript" defer="true" src="${deployUrl}wm-android-styles.js"></script>`
78
80
  );
79
81
  }
80
82
 
@@ -82,12 +84,12 @@ const addMobileSpecificStyles = async (deployUrl) => {
82
84
  let hash = await generateHash(`${opPath}/wm-android-styles.css`);
83
85
  copyMobileCssFiles(hash, 'wm-android-styles');
84
86
  $("head").append(
85
- `<link rel="stylesheet" theme="wmtheme" href="${deployUrl}/wm-android-styles.${hash}.css" >`
87
+ `<link rel="stylesheet" theme="wmtheme" href="${deployUrl}wm-android-styles.${hash}.css" >`
86
88
  );
87
89
  hash = await generateHash(`${opPath}/wm-ios-styles.css`);
88
90
  copyMobileCssFiles(hash, 'wm-ios-styles');
89
91
  $("head").append(
90
- `<link rel="stylesheet" theme="wmtheme" href="${deployUrl}/wm-ios-styles.${hash}.css" >`
92
+ `<link rel="stylesheet" theme="wmtheme" href="${deployUrl}wm-ios-styles.${hash}.css" >`
91
93
  );
92
94
  }
93
95
  }
@@ -106,8 +108,10 @@ const addScriptForWMStylesPath = (wm_styles_path) => {
106
108
  );
107
109
  }
108
110
  }
111
+ }
112
+ const addPrintStylesPath = (print_styles_path) => {
109
113
  $("head").append(
110
- `<link rel="stylesheet" type="text/css" media="print" href="print.css"/>`
114
+ `<link rel="stylesheet" type="text/css" media="print" href="${print_styles_path}"/>`
111
115
  );
112
116
  }
113
117
 
@@ -151,7 +155,7 @@ const getUpdatedFileName = (deployUrl, url, updatedFileNames) => {
151
155
  }
152
156
 
153
157
  if (absUrl in updatedFileNames) {
154
- return `${deployUrl}/${updatedFileNames[absUrl]}` // add the leading '/' back
158
+ return `${deployUrl}${updatedFileNames[absUrl]}` // add the leading '/' back
155
159
  }
156
160
  return `${deployUrl}${url}`;
157
161
  }
@@ -193,6 +197,8 @@ const getIconPath = (iconPath) => {
193
197
  const updatePwaAssets = (deployUrl, updatedFileNames, updatedFileHashes) => {
194
198
  const ngswPath = './dist/ngsw.json';
195
199
  const manifestPath = './dist/manifest.json';
200
+ //this is always from server in case of pwa. Need to fix this to use cdnurl from runtime/build config
201
+ deployUrl = deployUrl === "_cdnUrl_" ? 'ng-bundle/' : deployUrl;
196
202
 
197
203
  // copy service worker and its config to root directory
198
204
  fs.copyFileSync('./dist/ng-bundle/ngsw-worker.js', './dist/ngsw-worker.js');
@@ -204,7 +210,7 @@ const updatePwaAssets = (deployUrl, updatedFileNames, updatedFileHashes) => {
204
210
  const manifest = JSON.parse(fs.readFileSync(manifestPath).toString());
205
211
  const updatedManifest = {
206
212
  ...manifest,
207
- icons: manifest.icons.map(icon => ({ ...icon, src: `${deployUrl}/${getIconPath(icon.src)}` })),
213
+ icons: manifest.icons.map(icon => ({ ...icon, src: `${deployUrl}${getIconPath(icon.src)}` })),
208
214
  }
209
215
  const manifestContent = JSON.stringify(updatedManifest, null, 4);
210
216
  fs.writeFileSync(manifestPath, manifestContent);
@@ -242,9 +248,6 @@ const generateSha1 = (content) => {
242
248
  const angularJson = require(`${process.cwd()}/angular.json`);
243
249
  const build = angularJson['projects']['angular-app']['architect']['build'];
244
250
  let deployUrl = args['deploy-url'] || build['options']['deployUrl'];
245
- if (deployUrl.endsWith('/')) {
246
- deployUrl = deployUrl.slice(0, deployUrl.length - 1);
247
- }
248
251
 
249
252
  const contents = await readFile(`./dist/index.html`, `utf8`);
250
253
  $ = cheerio.load(contents);
@@ -255,8 +258,6 @@ const generateSha1 = (content) => {
255
258
  } else {
256
259
  isDevBuild = fs.existsSync(`${process.cwd()}/dist/ng-bundle/wm-android-styles.js`);
257
260
  isProdBuild = fs.existsSync(`${process.cwd()}/dist/ng-bundle/wm-android-styles.css`);
258
- $("script[type='module']").remove();
259
- $('script[nomodule]').removeAttr('nomodule');
260
261
  }
261
262
 
262
263
  if (isProdBuild) {
@@ -278,17 +279,22 @@ const generateSha1 = (content) => {
278
279
  await addMobileSpecificStyles(deployUrl);
279
280
  } else {
280
281
  if (isDevBuild) {
281
- wm_styles_path = `${deployUrl}/wm-styles.js`;
282
+ wm_styles_path = `${deployUrl}wm-styles.js`;
282
283
  } else {
283
284
  const fileName = 'wm-styles';
284
285
  const hash = await generateHash(`${opPath}/${fileName}.css`);
285
286
  copyCssFiles(hash, updatedFilenames);
286
287
  const updatedFileName = `${fileName}.${hash}.css`
287
- wm_styles_path = `${deployUrl}/${updatedFileName}`;
288
+ wm_styles_path = `${deployUrl}${updatedFileName}`;
288
289
  }
289
290
  }
290
291
 
291
292
  addScriptForWMStylesPath(wm_styles_path);
293
+ addPrintStylesPath(`${deployUrl}print.css`);
294
+
295
+ //this is required to download all the assets
296
+ $('head').append(`<meta name="deployUrl" content=${deployUrl} />`);
297
+
292
298
  const htmlContent = $.html();
293
299
  await writeFile(`./dist/index.html`, htmlContent);
294
300