@wavemaker/angular-codegen 11.10.0-next.25079 → 11.10.0-next.27705
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-app/angular.json +1 -1
- package/angular-app/build-scripts/build.js +1 -0
- package/angular-app/build-scripts/post-build.js +17 -16
- package/angular-app/dependency-report.html +1 -1
- package/angular-app/npm-shrinkwrap.json +130 -112
- package/angular-app/package-lock.json +130 -112
- package/angular-app/package.json +8 -6
- package/angular-app/src/assets/styles/css/wm-style.css +1 -1
- package/angular-app/src/setup-jest.js +4 -1
- package/build-angular-app.js +375 -35
- package/generate-angular-app.js +3 -1
- package/npm-shrinkwrap.json +88 -63
- package/package-lock.json +88 -63
- package/package.json +4 -4
- package/src/codegen-args-cli.js +1 -1
- package/src/codegen-cli.js +1 -1
- package/src/codegen.js +1 -1
- package/src/copy-utils.js +1 -1
- package/src/project-meta.js +1 -1
- package/src/update-angular-json.js +1 -1
- package/src/wm-utils.js +1 -1
package/angular-app/angular.json
CHANGED
|
@@ -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,18 +6,18 @@ 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
|
-
|
|
9
|
+
|
|
10
10
|
const copyCssFiles = (hash, updatedFilenames) => {
|
|
11
11
|
const filename = 'wm-styles.css';
|
|
12
12
|
const updatedFilename = `wm-styles.${hash}.css`
|
|
13
|
-
copyFile(`${opPath}/${filename}`, `${opPath}/${updatedFilename}`);
|
|
13
|
+
copyFile(`${global.opPath}/${filename}`, `${global.opPath}/${updatedFilename}`);
|
|
14
14
|
updatedFilenames[filename] = updatedFilename;
|
|
15
15
|
// copyFile(`${opPath}/wm-styles.br.css`,`${opPath}/wm-styles.${hash}.br.css`);
|
|
16
16
|
// copyFile(`${opPath}/wm-styles.gzip.css`,`${opPath}/wm-styles.${hash}.gzip.css`);
|
|
17
17
|
};
|
|
18
18
|
const copyMobileCssFiles = (hash, fileName) => {
|
|
19
19
|
// const name = filePath.split('.css')[0];
|
|
20
|
-
copyFile(`${opPath}/${fileName}.css`, `${opPath}/${fileName}.${hash}.css`);
|
|
20
|
+
copyFile(`${global.opPath}/${fileName}.css`, `${global.opPath}/${fileName}.${hash}.css`);
|
|
21
21
|
// copyFile(`${opPath}/wm-styles.br.css`,`${opPath}/wm-styles.${hash}.br.css`);
|
|
22
22
|
// copyFile(`${opPath}/wm-styles.gzip.css`,`${opPath}/wm-styles.${hash}.gzip.css`);
|
|
23
23
|
};
|
|
@@ -32,18 +32,18 @@ const generateHashForScripts = (updatedFilenames) => {
|
|
|
32
32
|
//so removed `@` from wavemaker.com in the file name and adding it back in the post-build.js file
|
|
33
33
|
const scriptsMap = {};
|
|
34
34
|
return new Promise(resolve => {
|
|
35
|
-
fs.readdir(opPath, (err, items) => {
|
|
35
|
+
fs.readdir(global.opPath, (err, items) => {
|
|
36
36
|
const promises = items.map(i => {
|
|
37
37
|
const nohashIndex = i.indexOf('-NOHASH.js');
|
|
38
38
|
if (nohashIndex > 0) {
|
|
39
39
|
const key = i.substring(0, nohashIndex);
|
|
40
|
-
return generateHash(`${opPath}/${i}`).then(hash => {
|
|
40
|
+
return generateHash(`${global.opPath}/${i}`).then(hash => {
|
|
41
41
|
const filename = `${key}-NOHASH.js`;
|
|
42
42
|
const updatedFilename = `${key}.${hash}.js`
|
|
43
43
|
scriptsMap[`${key}.js`] = updatedFilename;
|
|
44
44
|
updatedFilenames[filename] = updatedFilename;
|
|
45
45
|
return Promise.all([
|
|
46
|
-
copyFile(`${opPath}/${filename}`, `${opPath}/${updatedFilename}`),
|
|
46
|
+
copyFile(`${global.opPath}/${filename}`, `${global.opPath}/${updatedFilename}`),
|
|
47
47
|
// copyFile(`${opPath}/${key}-NOHASH.br.js`, `${opPath}/${key}.${hash}.br.js`),
|
|
48
48
|
// copyFile(`${opPath}/${key}-NOHASH.gzip.js`, `${opPath}/${key}.${hash}.gzip.js`)
|
|
49
49
|
]);
|
|
@@ -51,7 +51,7 @@ const generateHashForScripts = (updatedFilenames) => {
|
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
53
|
Promise.all(promises).then(() => {
|
|
54
|
-
return writeFile(`${opPath}/path_mapping.json`, JSON.stringify(scriptsMap, null, 2));
|
|
54
|
+
return writeFile(`${global.opPath}/path_mapping.json`, JSON.stringify(scriptsMap, null, 2));
|
|
55
55
|
}).then(resolve);
|
|
56
56
|
});
|
|
57
57
|
});
|
|
@@ -81,12 +81,12 @@ const addMobileSpecificStyles = async (deployUrl) => {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
if (isProdBuild) {
|
|
84
|
-
let hash = await generateHash(`${opPath}/wm-android-styles.css`);
|
|
84
|
+
let hash = await generateHash(`${global.opPath}/wm-android-styles.css`);
|
|
85
85
|
copyMobileCssFiles(hash, 'wm-android-styles');
|
|
86
86
|
$("head").append(
|
|
87
87
|
`<link rel="stylesheet" theme="wmtheme" href="${deployUrl}wm-android-styles.${hash}.css" >`
|
|
88
88
|
);
|
|
89
|
-
hash = await generateHash(`${opPath}/wm-ios-styles.css`);
|
|
89
|
+
hash = await generateHash(`${global.opPath}/wm-ios-styles.css`);
|
|
90
90
|
copyMobileCssFiles(hash, 'wm-ios-styles');
|
|
91
91
|
$("head").append(
|
|
92
92
|
`<link rel="stylesheet" theme="wmtheme" href="${deployUrl}wm-ios-styles.${hash}.css" >`
|
|
@@ -248,16 +248,17 @@ const generateSha1 = (content) => {
|
|
|
248
248
|
const angularJson = require(`${process.cwd()}/angular.json`);
|
|
249
249
|
const build = angularJson['projects']['angular-app']['architect']['build'];
|
|
250
250
|
let deployUrl = args['deploy-url'] || build['options']['deployUrl'];
|
|
251
|
-
|
|
251
|
+
global.randomHash = deployUrl.split('/')[1];
|
|
252
|
+
let outputPath = global.opPath = args['output-path'] || build['options']['outputPath']
|
|
252
253
|
const contents = await readFile(`./dist/index.html`, `utf8`);
|
|
253
254
|
$ = cheerio.load(contents);
|
|
254
255
|
setMobileProjectType(angularJson);
|
|
255
256
|
if (!isMobileProject) {
|
|
256
|
-
isProdBuild = fs.existsSync(`${process.cwd()}/
|
|
257
|
-
isDevBuild = fs.existsSync(`${process.cwd()}/
|
|
257
|
+
isProdBuild = fs.existsSync(`${process.cwd()}/${outputPath}/wm-styles.css`);
|
|
258
|
+
isDevBuild = fs.existsSync(`${process.cwd()}/${outputPath}/wm-styles.js`);
|
|
258
259
|
} else {
|
|
259
|
-
isDevBuild = fs.existsSync(`${process.cwd()}/
|
|
260
|
-
isProdBuild = fs.existsSync(`${process.cwd()}/
|
|
260
|
+
isDevBuild = fs.existsSync(`${process.cwd()}/${outputPath}/wm-android-styles.js`);
|
|
261
|
+
isProdBuild = fs.existsSync(`${process.cwd()}/${outputPath}/wm-android-styles.css`);
|
|
261
262
|
}
|
|
262
263
|
|
|
263
264
|
if (isProdBuild) {
|
|
@@ -282,7 +283,7 @@ const generateSha1 = (content) => {
|
|
|
282
283
|
wm_styles_path = `${deployUrl}wm-styles.js`;
|
|
283
284
|
} else {
|
|
284
285
|
const fileName = 'wm-styles';
|
|
285
|
-
const hash = await generateHash(`${opPath}/${fileName}.css`);
|
|
286
|
+
const hash = await generateHash(`${global.opPath}/${fileName}.css`);
|
|
286
287
|
copyCssFiles(hash, updatedFilenames);
|
|
287
288
|
const updatedFileName = `${fileName}.${hash}.css`
|
|
288
289
|
wm_styles_path = `${deployUrl}${updatedFileName}`;
|
|
@@ -295,7 +296,7 @@ const generateSha1 = (content) => {
|
|
|
295
296
|
//this is required to download all the assets
|
|
296
297
|
$('head').append(`<meta name="deployUrl" content=${deployUrl} />`);
|
|
297
298
|
$('script[src$="services/application/wmProperties.js"]').remove();
|
|
298
|
-
$('link[href$="favicon.png"]').attr('href',
|
|
299
|
+
$('link[href$="favicon.png"]').attr('href', `${deployUrl}favicon.png`);
|
|
299
300
|
|
|
300
301
|
const htmlContent = $.html();
|
|
301
302
|
await writeFile(`./dist/index.html`, htmlContent);
|