@wavemaker/angular-codegen 11.6.0-next.140457 → 11.6.0-next.141924

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.
@@ -29,6 +29,11 @@
29
29
  "assets": [
30
30
  "src/favicon.ico",
31
31
  "src/assets",
32
+ {
33
+ "glob": "print.css",
34
+ "input": "src/assets/",
35
+ "output": "."
36
+ },
32
37
  {
33
38
  "glob": "**/*",
34
39
  "input": "libraries/locales/",
@@ -187,7 +192,12 @@
187
192
  "tsConfig": "src/tsconfig.app.json",
188
193
  "assets": [
189
194
  "src/favicon.ico",
190
- "src/assets"
195
+ "src/assets",
196
+ {
197
+ "glob": "print.css",
198
+ "input": "src/assets/",
199
+ "output": "."
200
+ }
191
201
  ],
192
202
  "styles": [
193
203
  "src/styles.css",
@@ -0,0 +1,28 @@
1
+ const { spawnSync } = require('child_process');
2
+
3
+ const args = process.argv.slice(2);
4
+
5
+ const ngBuildArgs = ['build', ...args];
6
+ console.log("Build params - ", ngBuildArgs);
7
+
8
+ //Trigger angular build with the passed params
9
+ const ngBuildProcess = spawnSync('ng', ngBuildArgs, { stdio: 'inherit' });
10
+
11
+ if (ngBuildProcess.status === 0) {
12
+ console.log('ng build completed successfully!');
13
+ } else {
14
+ console.error('Error during ng build:', ngBuildProcess.error || ngBuildProcess.stderr);
15
+ process.exit(1);
16
+ }
17
+
18
+ const ngPostBuildArgs = ['build-scripts/post-build.js', ...args];
19
+ console.log("Post build params - ", ngPostBuildArgs);
20
+
21
+ const ngPostBuildProcess = spawnSync('node', ngPostBuildArgs, { stdio: 'inherit' });
22
+
23
+ if (ngPostBuildProcess.status === 0) {
24
+ console.log('ng post build completed successfully!');
25
+ } else {
26
+ console.error('Error during ng build:', ngPostBuildProcess.error || ngPostBuildProcess.stderr);
27
+ process.exit(1);
28
+ }
@@ -76,7 +76,7 @@ const setMobileProjectType = (angularJson) => {
76
76
  const addMobileSpecificStyles = async (deployUrl) => {
77
77
  if (isDevBuild) {
78
78
  $("body").append(
79
- `<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>`
80
80
  );
81
81
  }
82
82
 
@@ -84,12 +84,12 @@ const addMobileSpecificStyles = async (deployUrl) => {
84
84
  let hash = await generateHash(`${opPath}/wm-android-styles.css`);
85
85
  copyMobileCssFiles(hash, 'wm-android-styles');
86
86
  $("head").append(
87
- `<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" >`
88
88
  );
89
89
  hash = await generateHash(`${opPath}/wm-ios-styles.css`);
90
90
  copyMobileCssFiles(hash, 'wm-ios-styles');
91
91
  $("head").append(
92
- `<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" >`
93
93
  );
94
94
  }
95
95
  }
@@ -108,8 +108,10 @@ const addScriptForWMStylesPath = (wm_styles_path) => {
108
108
  );
109
109
  }
110
110
  }
111
+ }
112
+ const addPrintStylesPath = (print_styles_path) => {
111
113
  $("head").append(
112
- `<link rel="stylesheet" type="text/css" media="print" href="print.css"/>`
114
+ `<link rel="stylesheet" type="text/css" media="print" href="${print_styles_path}"/>`
113
115
  );
114
116
  }
115
117
 
@@ -153,7 +155,7 @@ const getUpdatedFileName = (deployUrl, url, updatedFileNames) => {
153
155
  }
154
156
 
155
157
  if (absUrl in updatedFileNames) {
156
- return `${deployUrl}/${updatedFileNames[absUrl]}` // add the leading '/' back
158
+ return `${deployUrl}${updatedFileNames[absUrl]}` // add the leading '/' back
157
159
  }
158
160
  return `${deployUrl}${url}`;
159
161
  }
@@ -206,7 +208,7 @@ const updatePwaAssets = (deployUrl, updatedFileNames, updatedFileHashes) => {
206
208
  const manifest = JSON.parse(fs.readFileSync(manifestPath).toString());
207
209
  const updatedManifest = {
208
210
  ...manifest,
209
- icons: manifest.icons.map(icon => ({ ...icon, src: `${deployUrl}/${getIconPath(icon.src)}` })),
211
+ icons: manifest.icons.map(icon => ({ ...icon, src: `${deployUrl}${getIconPath(icon.src)}` })),
210
212
  }
211
213
  const manifestContent = JSON.stringify(updatedManifest, null, 4);
212
214
  fs.writeFileSync(manifestPath, manifestContent);
@@ -244,9 +246,6 @@ const generateSha1 = (content) => {
244
246
  const angularJson = require(`${process.cwd()}/angular.json`);
245
247
  const build = angularJson['projects']['angular-app']['architect']['build'];
246
248
  let deployUrl = args['deploy-url'] || build['options']['deployUrl'];
247
- if (deployUrl.endsWith('/')) {
248
- deployUrl = deployUrl.slice(0, deployUrl.length - 1);
249
- }
250
249
 
251
250
  const contents = await readFile(`./dist/index.html`, `utf8`);
252
251
  $ = cheerio.load(contents);
@@ -278,17 +277,22 @@ const generateSha1 = (content) => {
278
277
  await addMobileSpecificStyles(deployUrl);
279
278
  } else {
280
279
  if (isDevBuild) {
281
- wm_styles_path = `${deployUrl}/wm-styles.js`;
280
+ wm_styles_path = `${deployUrl}wm-styles.js`;
282
281
  } else {
283
282
  const fileName = 'wm-styles';
284
283
  const hash = await generateHash(`${opPath}/${fileName}.css`);
285
284
  copyCssFiles(hash, updatedFilenames);
286
285
  const updatedFileName = `${fileName}.${hash}.css`
287
- wm_styles_path = `${deployUrl}/${updatedFileName}`;
286
+ wm_styles_path = `${deployUrl}${updatedFileName}`;
288
287
  }
289
288
  }
290
289
 
291
290
  addScriptForWMStylesPath(wm_styles_path);
291
+ addPrintStylesPath(`${deployUrl}print.css`);
292
+
293
+ //this is required to download all the assets
294
+ $('head').append('<meta name="deployUrl" content="_cdnUrl_" />');
295
+
292
296
  const htmlContent = $.html();
293
297
  await writeFile(`./dist/index.html`, htmlContent);
294
298