@wavemaker/angular-codegen 11.11.0-rc.6106 → 11.11.0-rc.6112
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 +0 -2
- package/angular-app/dependency-report.html +1 -1
- package/angular-app/npm-shrinkwrap.json +40 -40
- package/angular-app/package-lock.json +40 -40
- package/angular-app/package.json +5 -5
- package/angular-app/src/assets/styles/css/wm-style.css +1 -1
- package/build-angular-app.js +11 -7
- package/dependencies/pipe-provider.cjs.js +11987 -10502
- package/dependencies/transpilation-web.cjs.js +5984 -5242
- package/download-packages.js +99 -31
- package/npm-shrinkwrap.json +23 -23
- package/package-lock.json +23 -23
- package/package.json +2 -2
- package/src/gen-app-override-css.js +1 -1
- package/src/project-meta.js +1 -1
- package/src/wm-utils.js +1 -1
- package/templates/app.config.ts.hbs +5 -5
package/download-packages.js
CHANGED
|
@@ -2,6 +2,7 @@ const fs = require('fs');
|
|
|
2
2
|
const { executeSyncCmd } = require('./build-util');
|
|
3
3
|
const os = require('os');
|
|
4
4
|
const path = require('path');
|
|
5
|
+
const rimraf = require('rimraf');
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -16,7 +17,6 @@ const isNPMPackageExist = (path, msg) => {
|
|
|
16
17
|
if (successMsg == msg) {
|
|
17
18
|
return true;
|
|
18
19
|
}
|
|
19
|
-
|
|
20
20
|
} else {
|
|
21
21
|
return false;
|
|
22
22
|
}
|
|
@@ -29,52 +29,120 @@ const isNPMPackageExist = (path, msg) => {
|
|
|
29
29
|
* Run npm install
|
|
30
30
|
* Write success file to be make sure it was installed successfully.
|
|
31
31
|
*/
|
|
32
|
-
const downloadNPMPackage = (packageInfo) => {
|
|
32
|
+
const downloadNPMPackage = async (packageInfo) => {
|
|
33
33
|
const HOME_DIR = os.homedir();
|
|
34
34
|
const PATH_NPM_PACKAGE = (packageInfo.baseDir || HOME_DIR + '/.wm/node_modules/') + packageInfo.name + '/' + packageInfo.version;
|
|
35
|
-
const PATH_NPM_PACKAGE_SUCCESS = PATH_NPM_PACKAGE + '/.SUCCESS';
|
|
35
|
+
const PATH_NPM_PACKAGE_SUCCESS = PATH_NPM_PACKAGE + '/.SUCCESS', LOCK_FILE = path.join(PATH_NPM_PACKAGE, ".LOCK");
|
|
36
36
|
let isError = false;
|
|
37
|
+
try {
|
|
38
|
+
if (!packageInfo.baseDir) { // going to install in the .wm folder if baseDir is not defined(optimizeUIBuild true)
|
|
39
|
+
// To check node modules.
|
|
40
|
+
if (!isNPMPackageExist(PATH_NPM_PACKAGE_SUCCESS, packageInfo.successMsg)) {
|
|
41
|
+
// Check if another process is already installing
|
|
42
|
+
if (fs.existsSync(LOCK_FILE)) {
|
|
43
|
+
console.log(`Waiting for another build to complete npm install... for package ${packageInfo.name}`);
|
|
44
|
+
await waitForLock(LOCK_FILE, 20 * 60 * 1000); // Wait for 20 minutes (timeout in milliseconds)
|
|
45
|
+
} else {
|
|
46
|
+
// Acquire the lock
|
|
47
|
+
fs.mkdirSync(PATH_NPM_PACKAGE, { recursive: true });
|
|
48
|
+
fs.writeFileSync(LOCK_FILE, "PROGRESS");
|
|
49
|
+
|
|
50
|
+
await processPackage(packageInfo, PATH_NPM_PACKAGE);
|
|
37
51
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
fs.copyFileSync(packageInfo.packageJsonFile, PATH_NPM_PACKAGE + '/package.json');
|
|
44
|
-
try {
|
|
45
|
-
//expecting this lock file to be present for exact versions to be downloaded from private registry
|
|
46
|
-
fs.copyFileSync(`${path.dirname(packageInfo.packageJsonFile)} + /package-lock.json`, `${PATH_NPM_PACKAGE} + /package-lock.json`);
|
|
47
|
-
} catch (err) {
|
|
48
|
-
if (err.code === 'ENOENT') {
|
|
49
|
-
console.error(`Info: package-lock.json file not found at ${path.dirname(packageInfo.packageJsonFile)}`);
|
|
52
|
+
//only create a .SUCCESS file when there is no error
|
|
53
|
+
if(!isError) {
|
|
54
|
+
isError = false;
|
|
55
|
+
fs.writeFileSync(PATH_NPM_PACKAGE_SUCCESS, packageInfo.successMsg);
|
|
56
|
+
}
|
|
50
57
|
}
|
|
58
|
+
} else {
|
|
59
|
+
console.log(packageInfo.infoMsg + ` Node packages already installed! for package ${packageInfo.name}`);
|
|
51
60
|
}
|
|
52
61
|
} else {
|
|
53
|
-
|
|
54
|
-
npmInstallCMD += packageInfo.skipPackageVersion === true
|
|
55
|
-
? packageInfo.name
|
|
56
|
-
: packageInfo.scope + '/' + packageInfo.name + '@' + packageInfo.version;
|
|
62
|
+
await processPackage(packageInfo, PATH_NPM_PACKAGE);
|
|
57
63
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
isError = false;
|
|
67
|
-
fs.writeFileSync(PATH_NPM_PACKAGE_SUCCESS, packageInfo.successMsg);
|
|
64
|
+
} catch (err) {
|
|
65
|
+
deleteFiles([PATH_NPM_PACKAGE_SUCCESS, LOCK_FILE])
|
|
66
|
+
console.log(`Something went wrong while installing - for package ${packageInfo.name}`, err);
|
|
67
|
+
process.exit(err.code || err.pid);
|
|
68
|
+
} finally {
|
|
69
|
+
//cleanup : in windows / optimizeUIBuild is false, we need to delete the temp downloaded package
|
|
70
|
+
if (!packageInfo.baseDir) {
|
|
71
|
+
deleteFiles([LOCK_FILE]);
|
|
68
72
|
}
|
|
73
|
+
}
|
|
74
|
+
return PATH_NPM_PACKAGE;
|
|
75
|
+
}
|
|
69
76
|
|
|
77
|
+
const processPackage = (packageInfo, PATH_NPM_PACKAGE) => {
|
|
78
|
+
let npmInstallCMD = 'npm install --legacy-peer-deps ';
|
|
79
|
+
if (packageInfo.packageJsonFile && fs.existsSync(packageInfo.packageJsonFile)) {
|
|
80
|
+
fs.copyFileSync(packageInfo.packageJsonFile, PATH_NPM_PACKAGE + '/package.json');
|
|
81
|
+
try {
|
|
82
|
+
//expecting this lock file to be present for exact versions to be downloaded from private registry
|
|
83
|
+
fs.copyFileSync(`${path.dirname(packageInfo.packageJsonFile)} + /package-lock.json`, `${PATH_NPM_PACKAGE} + /package-lock.json`);
|
|
84
|
+
} catch (err) {
|
|
85
|
+
if (err.code === 'ENOENT') {
|
|
86
|
+
console.error(`Info: package-lock.json file not found at ${path.dirname(packageInfo.packageJsonFile)}`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
70
89
|
} else {
|
|
71
|
-
|
|
90
|
+
npmInstallCMD = 'npm init -y && ' + npmInstallCMD;
|
|
91
|
+
npmInstallCMD += packageInfo.skipPackageVersion === true
|
|
92
|
+
? packageInfo.name
|
|
93
|
+
: packageInfo.scope + '/' + packageInfo.name + '@' + packageInfo.version;
|
|
72
94
|
}
|
|
73
95
|
|
|
74
|
-
|
|
96
|
+
fs.mkdirSync(PATH_NPM_PACKAGE, { recursive: true });
|
|
97
|
+
executeSyncCmd('cd ' + PATH_NPM_PACKAGE + ' && ' + npmInstallCMD, (errMsg) => {
|
|
98
|
+
console.log(packageInfo.infoMsg + ' Something wrong with npm installation ', errMsg);
|
|
99
|
+
throw Error(errMsg);
|
|
100
|
+
}, packageInfo.infoMsg);
|
|
101
|
+
}
|
|
75
102
|
|
|
103
|
+
/**
|
|
104
|
+
*
|
|
105
|
+
*/
|
|
106
|
+
const deleteFiles = (files) => {
|
|
107
|
+
files.forEach(file => {
|
|
108
|
+
try {
|
|
109
|
+
rimraf.sync(file);
|
|
110
|
+
console.log(`Successfully deleted file - ${file}`);
|
|
111
|
+
} catch (err) {
|
|
112
|
+
console.error(`Error while deleting file ${file}`, err);
|
|
113
|
+
throw new Error(`Error while deleting file: ${file}, Error: ${err}`);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
76
116
|
}
|
|
77
117
|
|
|
118
|
+
/**
|
|
119
|
+
*
|
|
120
|
+
* @param lockFile
|
|
121
|
+
* @param timeout
|
|
122
|
+
* @returns {Promise<void>}
|
|
123
|
+
*/
|
|
124
|
+
const waitForLock = async (lockFile, timeout) => {
|
|
125
|
+
timeout = timeout || 20 * 60 * 1000 // Wait for 20 minutes (timeout in milliseconds)
|
|
126
|
+
// Helper function to wait for the lock to be released with a timeout
|
|
127
|
+
const startTime = Date.now();
|
|
128
|
+
while (fs.existsSync(lockFile)) {
|
|
129
|
+
if (Date.now() - startTime > timeout) {
|
|
130
|
+
console.error('Timeout!! - waiting for the lock to be released. Exiting...');
|
|
131
|
+
process.exit(1); // Terminate the process with an error code
|
|
132
|
+
}
|
|
133
|
+
await sleep(1000); // Wait for 1 second before checking again
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
*
|
|
139
|
+
* @param ms
|
|
140
|
+
* @returns {Promise<unknown>}
|
|
141
|
+
*/
|
|
142
|
+
const sleep = (ms) => {
|
|
143
|
+
// Helper function to sleep for a given time
|
|
144
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
145
|
+
};
|
|
78
146
|
|
|
79
147
|
module.exports = {
|
|
80
148
|
downloadNPMPackage
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wavemaker/angular-codegen",
|
|
3
|
-
"version": "11.11.0-rc.
|
|
3
|
+
"version": "11.11.0-rc.6112",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@wavemaker/angular-codegen",
|
|
9
|
-
"version": "11.11.0-rc.
|
|
9
|
+
"version": "11.11.0-rc.6112",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@wavemaker/angular-app": "11.11.0-rc.
|
|
12
|
+
"@wavemaker/angular-app": "11.11.0-rc.6112",
|
|
13
13
|
"archiver": "^7.0.1",
|
|
14
14
|
"cheerio": "1.0.0-rc.12",
|
|
15
15
|
"decode-uri-component": "^0.2.0",
|
|
@@ -1377,8 +1377,8 @@
|
|
|
1377
1377
|
}
|
|
1378
1378
|
},
|
|
1379
1379
|
"node_modules/@types/node": {
|
|
1380
|
-
"version": "22.14.
|
|
1381
|
-
"integrity": "sha512-
|
|
1380
|
+
"version": "22.14.1",
|
|
1381
|
+
"integrity": "sha512-u0HuPQwe/dHrItgHHpmw3N2fYCR6x4ivMNbPHRkBVP4CvN+kiRrKHWk3i8tXiO/joPwXLMYvF9TTF0eqgHIuOw==",
|
|
1382
1382
|
"license": "MIT",
|
|
1383
1383
|
"dependencies": {
|
|
1384
1384
|
"undici-types": "~6.21.0"
|
|
@@ -1411,8 +1411,8 @@
|
|
|
1411
1411
|
"license": "MIT"
|
|
1412
1412
|
},
|
|
1413
1413
|
"node_modules/@wavemaker/angular-app": {
|
|
1414
|
-
"version": "11.11.0-rc.
|
|
1415
|
-
"integrity": "sha512-
|
|
1414
|
+
"version": "11.11.0-rc.6112",
|
|
1415
|
+
"integrity": "sha512-vtRY39NPfrJQft07++VW4mrHlFBE7wGej4FoJWNMIfn9772ql6Zv5monwL+UsknuIiNywGGVtsmQbFc0xvZfng==",
|
|
1416
1416
|
"dependencies": {
|
|
1417
1417
|
"@angular/animations": "18.2.13",
|
|
1418
1418
|
"@angular/common": "18.2.13",
|
|
@@ -1430,12 +1430,12 @@
|
|
|
1430
1430
|
"@fullcalendar/list": "6.1.15",
|
|
1431
1431
|
"@fullcalendar/timegrid": "6.1.15",
|
|
1432
1432
|
"@metrichor/jmespath": "0.3.1",
|
|
1433
|
-
"@wavemaker/app-ng-runtime": "11.11.0-rc.
|
|
1434
|
-
"@wavemaker/custom-widgets-m3": "11.11.0-rc.
|
|
1433
|
+
"@wavemaker/app-ng-runtime": "11.11.0-rc.6112",
|
|
1434
|
+
"@wavemaker/custom-widgets-m3": "11.11.0-rc.6112",
|
|
1435
1435
|
"@wavemaker/focus-trap": "1.0.1",
|
|
1436
|
-
"@wavemaker/foundation-css": "11.11.0-rc.
|
|
1436
|
+
"@wavemaker/foundation-css": "11.11.0-rc.6112",
|
|
1437
1437
|
"@wavemaker/nvd3": "1.8.12",
|
|
1438
|
-
"@wavemaker/variables": "11.11.0-rc.
|
|
1438
|
+
"@wavemaker/variables": "11.11.0-rc.6112",
|
|
1439
1439
|
"@ztree/ztree_v3": "3.5.48",
|
|
1440
1440
|
"angular-imask": "^7.6.1",
|
|
1441
1441
|
"angular2-websocket": "0.9.7",
|
|
@@ -1474,8 +1474,8 @@
|
|
|
1474
1474
|
}
|
|
1475
1475
|
},
|
|
1476
1476
|
"node_modules/@wavemaker/app-ng-runtime": {
|
|
1477
|
-
"version": "11.11.0-rc.
|
|
1478
|
-
"integrity": "sha512-
|
|
1477
|
+
"version": "11.11.0-rc.6112",
|
|
1478
|
+
"integrity": "sha512-ATDN1BwkK7gOWoTArI7DLhj+3txztxCMbum4c40TnmG/DN9+W+id+fKyJgaJ8hLvjjtyKhlfsejxsLMpBlFbWQ==",
|
|
1479
1479
|
"license": "MIT",
|
|
1480
1480
|
"engines": {
|
|
1481
1481
|
"node": ">=18.16.1",
|
|
@@ -1483,8 +1483,8 @@
|
|
|
1483
1483
|
}
|
|
1484
1484
|
},
|
|
1485
1485
|
"node_modules/@wavemaker/custom-widgets-m3": {
|
|
1486
|
-
"version": "11.11.0-rc.
|
|
1487
|
-
"integrity": "sha512-
|
|
1486
|
+
"version": "11.11.0-rc.6112",
|
|
1487
|
+
"integrity": "sha512-CIS1Yw9qNByO545btY0WmnNtKG0+FKTrcxiI4cmOnLg6H60DSxv9QbffdX8t8HzZcytp1nBhSdhaK6+OdCZb/g==",
|
|
1488
1488
|
"license": "ISC"
|
|
1489
1489
|
},
|
|
1490
1490
|
"node_modules/@wavemaker/focus-trap": {
|
|
@@ -1497,8 +1497,8 @@
|
|
|
1497
1497
|
}
|
|
1498
1498
|
},
|
|
1499
1499
|
"node_modules/@wavemaker/foundation-css": {
|
|
1500
|
-
"version": "11.11.0-rc.
|
|
1501
|
-
"integrity": "sha512-
|
|
1500
|
+
"version": "11.11.0-rc.6112",
|
|
1501
|
+
"integrity": "sha512-2LRrrTbsH9GKiYWnO4OIgNMpuQ2bv1p2qXYPqNj2JgLxkJrpNew0QxqilIv8jGe20vtxIhfP9rfVMG/DqS8N4A==",
|
|
1502
1502
|
"license": "ISC",
|
|
1503
1503
|
"dependencies": {
|
|
1504
1504
|
"chroma-js": "^3.1.2"
|
|
@@ -1513,8 +1513,8 @@
|
|
|
1513
1513
|
}
|
|
1514
1514
|
},
|
|
1515
1515
|
"node_modules/@wavemaker/variables": {
|
|
1516
|
-
"version": "11.11.0-rc.
|
|
1517
|
-
"integrity": "sha512-
|
|
1516
|
+
"version": "11.11.0-rc.6112",
|
|
1517
|
+
"integrity": "sha512-yXg/R1dLdwY/tVkFXFeJsfR5IVjEcbBgYi2tFeKUZMZrTm3W/+qeQbJ/RsxP6Afuc8xCXCyhEu3k4j8WwTO53Q==",
|
|
1518
1518
|
"license": "ISC",
|
|
1519
1519
|
"dependencies": {
|
|
1520
1520
|
"@metrichor/jmespath": "^0.3.1",
|
|
@@ -2191,8 +2191,8 @@
|
|
|
2191
2191
|
}
|
|
2192
2192
|
},
|
|
2193
2193
|
"node_modules/caniuse-lite": {
|
|
2194
|
-
"version": "1.0.
|
|
2195
|
-
"integrity": "sha512-
|
|
2194
|
+
"version": "1.0.30001713",
|
|
2195
|
+
"integrity": "sha512-wCIWIg+A4Xr7NfhTuHdX+/FKh3+Op3LBbSp2N5Pfx6T/LhdQy3GTyoTg48BReaW/MyMNZAkTadsBtai3ldWK0Q==",
|
|
2196
2196
|
"dev": true,
|
|
2197
2197
|
"funding": [
|
|
2198
2198
|
{
|
|
@@ -3270,8 +3270,8 @@
|
|
|
3270
3270
|
"license": "MIT"
|
|
3271
3271
|
},
|
|
3272
3272
|
"node_modules/electron-to-chromium": {
|
|
3273
|
-
"version": "1.5.
|
|
3274
|
-
"integrity": "sha512
|
|
3273
|
+
"version": "1.5.137",
|
|
3274
|
+
"integrity": "sha512-/QSJaU2JyIuTbbABAo/crOs+SuAZLS+fVVS10PVrIT9hrRkmZl8Hb0xPSkKRUUWHQtYzXHpQUW3Dy5hwMzGZkA==",
|
|
3275
3275
|
"dev": true,
|
|
3276
3276
|
"license": "ISC"
|
|
3277
3277
|
},
|
package/package-lock.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wavemaker/angular-codegen",
|
|
3
|
-
"version": "11.11.0-rc.
|
|
3
|
+
"version": "11.11.0-rc.6112",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@wavemaker/angular-codegen",
|
|
9
|
-
"version": "11.11.0-rc.
|
|
9
|
+
"version": "11.11.0-rc.6112",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@wavemaker/angular-app": "11.11.0-rc.
|
|
12
|
+
"@wavemaker/angular-app": "11.11.0-rc.6112",
|
|
13
13
|
"archiver": "^7.0.1",
|
|
14
14
|
"cheerio": "1.0.0-rc.12",
|
|
15
15
|
"decode-uri-component": "^0.2.0",
|
|
@@ -1377,8 +1377,8 @@
|
|
|
1377
1377
|
}
|
|
1378
1378
|
},
|
|
1379
1379
|
"node_modules/@types/node": {
|
|
1380
|
-
"version": "22.14.
|
|
1381
|
-
"integrity": "sha512-
|
|
1380
|
+
"version": "22.14.1",
|
|
1381
|
+
"integrity": "sha512-u0HuPQwe/dHrItgHHpmw3N2fYCR6x4ivMNbPHRkBVP4CvN+kiRrKHWk3i8tXiO/joPwXLMYvF9TTF0eqgHIuOw==",
|
|
1382
1382
|
"license": "MIT",
|
|
1383
1383
|
"dependencies": {
|
|
1384
1384
|
"undici-types": "~6.21.0"
|
|
@@ -1411,8 +1411,8 @@
|
|
|
1411
1411
|
"license": "MIT"
|
|
1412
1412
|
},
|
|
1413
1413
|
"node_modules/@wavemaker/angular-app": {
|
|
1414
|
-
"version": "11.11.0-rc.
|
|
1415
|
-
"integrity": "sha512-
|
|
1414
|
+
"version": "11.11.0-rc.6112",
|
|
1415
|
+
"integrity": "sha512-vtRY39NPfrJQft07++VW4mrHlFBE7wGej4FoJWNMIfn9772ql6Zv5monwL+UsknuIiNywGGVtsmQbFc0xvZfng==",
|
|
1416
1416
|
"dependencies": {
|
|
1417
1417
|
"@angular/animations": "18.2.13",
|
|
1418
1418
|
"@angular/common": "18.2.13",
|
|
@@ -1430,12 +1430,12 @@
|
|
|
1430
1430
|
"@fullcalendar/list": "6.1.15",
|
|
1431
1431
|
"@fullcalendar/timegrid": "6.1.15",
|
|
1432
1432
|
"@metrichor/jmespath": "0.3.1",
|
|
1433
|
-
"@wavemaker/app-ng-runtime": "11.11.0-rc.
|
|
1434
|
-
"@wavemaker/custom-widgets-m3": "11.11.0-rc.
|
|
1433
|
+
"@wavemaker/app-ng-runtime": "11.11.0-rc.6112",
|
|
1434
|
+
"@wavemaker/custom-widgets-m3": "11.11.0-rc.6112",
|
|
1435
1435
|
"@wavemaker/focus-trap": "1.0.1",
|
|
1436
|
-
"@wavemaker/foundation-css": "11.11.0-rc.
|
|
1436
|
+
"@wavemaker/foundation-css": "11.11.0-rc.6112",
|
|
1437
1437
|
"@wavemaker/nvd3": "1.8.12",
|
|
1438
|
-
"@wavemaker/variables": "11.11.0-rc.
|
|
1438
|
+
"@wavemaker/variables": "11.11.0-rc.6112",
|
|
1439
1439
|
"@ztree/ztree_v3": "3.5.48",
|
|
1440
1440
|
"angular-imask": "^7.6.1",
|
|
1441
1441
|
"angular2-websocket": "0.9.7",
|
|
@@ -1474,8 +1474,8 @@
|
|
|
1474
1474
|
}
|
|
1475
1475
|
},
|
|
1476
1476
|
"node_modules/@wavemaker/app-ng-runtime": {
|
|
1477
|
-
"version": "11.11.0-rc.
|
|
1478
|
-
"integrity": "sha512-
|
|
1477
|
+
"version": "11.11.0-rc.6112",
|
|
1478
|
+
"integrity": "sha512-ATDN1BwkK7gOWoTArI7DLhj+3txztxCMbum4c40TnmG/DN9+W+id+fKyJgaJ8hLvjjtyKhlfsejxsLMpBlFbWQ==",
|
|
1479
1479
|
"license": "MIT",
|
|
1480
1480
|
"engines": {
|
|
1481
1481
|
"node": ">=18.16.1",
|
|
@@ -1483,8 +1483,8 @@
|
|
|
1483
1483
|
}
|
|
1484
1484
|
},
|
|
1485
1485
|
"node_modules/@wavemaker/custom-widgets-m3": {
|
|
1486
|
-
"version": "11.11.0-rc.
|
|
1487
|
-
"integrity": "sha512-
|
|
1486
|
+
"version": "11.11.0-rc.6112",
|
|
1487
|
+
"integrity": "sha512-CIS1Yw9qNByO545btY0WmnNtKG0+FKTrcxiI4cmOnLg6H60DSxv9QbffdX8t8HzZcytp1nBhSdhaK6+OdCZb/g==",
|
|
1488
1488
|
"license": "ISC"
|
|
1489
1489
|
},
|
|
1490
1490
|
"node_modules/@wavemaker/focus-trap": {
|
|
@@ -1497,8 +1497,8 @@
|
|
|
1497
1497
|
}
|
|
1498
1498
|
},
|
|
1499
1499
|
"node_modules/@wavemaker/foundation-css": {
|
|
1500
|
-
"version": "11.11.0-rc.
|
|
1501
|
-
"integrity": "sha512-
|
|
1500
|
+
"version": "11.11.0-rc.6112",
|
|
1501
|
+
"integrity": "sha512-2LRrrTbsH9GKiYWnO4OIgNMpuQ2bv1p2qXYPqNj2JgLxkJrpNew0QxqilIv8jGe20vtxIhfP9rfVMG/DqS8N4A==",
|
|
1502
1502
|
"license": "ISC",
|
|
1503
1503
|
"dependencies": {
|
|
1504
1504
|
"chroma-js": "^3.1.2"
|
|
@@ -1513,8 +1513,8 @@
|
|
|
1513
1513
|
}
|
|
1514
1514
|
},
|
|
1515
1515
|
"node_modules/@wavemaker/variables": {
|
|
1516
|
-
"version": "11.11.0-rc.
|
|
1517
|
-
"integrity": "sha512-
|
|
1516
|
+
"version": "11.11.0-rc.6112",
|
|
1517
|
+
"integrity": "sha512-yXg/R1dLdwY/tVkFXFeJsfR5IVjEcbBgYi2tFeKUZMZrTm3W/+qeQbJ/RsxP6Afuc8xCXCyhEu3k4j8WwTO53Q==",
|
|
1518
1518
|
"license": "ISC",
|
|
1519
1519
|
"dependencies": {
|
|
1520
1520
|
"@metrichor/jmespath": "^0.3.1",
|
|
@@ -2191,8 +2191,8 @@
|
|
|
2191
2191
|
}
|
|
2192
2192
|
},
|
|
2193
2193
|
"node_modules/caniuse-lite": {
|
|
2194
|
-
"version": "1.0.
|
|
2195
|
-
"integrity": "sha512-
|
|
2194
|
+
"version": "1.0.30001713",
|
|
2195
|
+
"integrity": "sha512-wCIWIg+A4Xr7NfhTuHdX+/FKh3+Op3LBbSp2N5Pfx6T/LhdQy3GTyoTg48BReaW/MyMNZAkTadsBtai3ldWK0Q==",
|
|
2196
2196
|
"dev": true,
|
|
2197
2197
|
"funding": [
|
|
2198
2198
|
{
|
|
@@ -3270,8 +3270,8 @@
|
|
|
3270
3270
|
"license": "MIT"
|
|
3271
3271
|
},
|
|
3272
3272
|
"node_modules/electron-to-chromium": {
|
|
3273
|
-
"version": "1.5.
|
|
3274
|
-
"integrity": "sha512
|
|
3273
|
+
"version": "1.5.137",
|
|
3274
|
+
"integrity": "sha512-/QSJaU2JyIuTbbABAo/crOs+SuAZLS+fVVS10PVrIT9hrRkmZl8Hb0xPSkKRUUWHQtYzXHpQUW3Dy5hwMzGZkA==",
|
|
3275
3275
|
"dev": true,
|
|
3276
3276
|
"license": "ISC"
|
|
3277
3277
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wavemaker/angular-codegen",
|
|
3
|
-
"version": "11.11.0-rc.
|
|
3
|
+
"version": "11.11.0-rc.6112",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
".npmrc"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@wavemaker/angular-app": "11.11.0-rc.
|
|
18
|
+
"@wavemaker/angular-app": "11.11.0-rc.6112",
|
|
19
19
|
"archiver": "^7.0.1",
|
|
20
20
|
"cheerio": "1.0.0-rc.12",
|
|
21
21
|
"decode-uri-component": "^0.2.0",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const path=require("path"),fs=require("fs"),{downloadNPMPackage:downloadNPMPackage}=require("../download-packages"),{isPrismProject:isPrismProject,DESIGN_TOKENS_DIR_NAME:DESIGN_TOKENS_DIR_NAME,OVERRIDE_TOKENS_PATH:OVERRIDE_TOKENS_PATH,APP_OVERRIDE_CSS_PATH:APP_OVERRIDE_CSS_PATH}=require("./wm-utils"),{
|
|
1
|
+
const path=require("path"),fs=require("fs"),{downloadNPMPackage:downloadNPMPackage}=require("../download-packages"),{isPrismProject:isPrismProject,DESIGN_TOKENS_DIR_NAME:DESIGN_TOKENS_DIR_NAME,OVERRIDE_TOKENS_PATH:OVERRIDE_TOKENS_PATH,APP_OVERRIDE_CSS_PATH:APP_OVERRIDE_CSS_PATH}=require("./wm-utils"),{getLegacyWmProjectProperties:getLegacyWmProjectProperties}=require("./project-meta"),groupFilesByMode=e=>{const s={default:[]};return fs.readdirSync(e).forEach(o=>{const r=path.join(e,o),t=fs.statSync(r);if(t.isDirectory()){const e=groupFilesByMode(r);for(const o in e)s[o]||(s[o]=[]),s[o].push(...e[o])}else if(t.isFile()&&".json"===path.extname(r)){const e=o.match(/\.([^.]+)\.json$/);if(e){const o=e[1];s[o]||(s[o]=[]),s[o].push(r)}else s.default.push(r)}}),s},generateModeConfigs=(e,s,o)=>{const r=o&&o.name||"css/variables",t=[];for(const o in e){const n=e[o].map(e=>{return{destination:e.replace(s+"/","").replace(/\.json$/,".css"),options:{outputReferences:!0,selector:":root"},format:r,filter:function(s){var o,r=(o=s["@"]&&s["@"].filePath?s["@"].filePath:s.filePath)&&-1!==o.indexOf("overrides")||s.filePath&&-1!==s.filePath.indexOf("overrides"),t=o&&(e.includes(o)||e.includes(s.filePath));return r&&t}}});t.push({mode:o,files:n})}return t},accessFile=e=>{const s=path.dirname(e);fs.existsSync(s)||(fs.mkdirSync(s,{recursive:!0}),console.log(`Directory created: ${s}`)),fs.access(e,fs.constants.F_OK,s=>{if(s){console.log(`${e} does not exist. Creating file...`);const s=JSON.stringify({});fs.writeFile(e,s,s=>{if(s)throw s;console.log(`${e} was created successfully.`)})}})};async function setupSymlink(e,s){try{await fs.promises.mkdir(path.dirname(s),{recursive:!0});try{fs.existsSync(s)&&await fs.promises.unlink(s)}catch(e){console.error("Error removing existing symlink:",e)}const o="win32"===process.platform?"junction":"dir";await fs.promises.symlink(e,s,o),console.log("Symlink created successfully at:",s)}catch(e){console.error("Error creating symlink:",s,e)}}const getStyleDictionaryConfig=(e,s,o)=>{let r="";return{source:[r="default"===o?`src/main/webapp/${OVERRIDE_TOKENS_PATH}/**/!(*.*).json`:`src/main/webapp/${OVERRIDE_TOKENS_PATH}/**/*.${o}.json`],include:[path.join(s,"**","!(*.dark|*.light).json")],platforms:{css:{transformGroup:"css",prefix:"--wm",files:e}}}};async function removeSymlink(e){const s=path.resolve(e);try{fs.lstatSync(s).isSymbolicLink()?(await fs.promises.unlink(s),console.log("Symlink removed successfully:",s)):console.warn("Not a symlink, skipping unlink:",s)}catch(e){console.error("Error during symlink removal:",e)}}async function getCssVarCalcMixFormatter(e,s){try{const o=await import(`${e}/node_modules/style-dictionary/lib/utils/index.js`),{usesReferences:r,getReferences:t}=o,{cssVarCalcMixFormatter:n}=await import(`${s}/node_modules/@wavemaker/foundation-css/utils/style-dictionary-utils.js`);return n(r,t)}catch(e){return console.error("Failed to load CssVarCalcMixFormatter:",e),null}}function processCSSFiles(e,s){for(const{destination:o}of e)try{if(o.endsWith(".css")&&fs.existsSync(o)){const e=fs.readFileSync(o,"utf-8"),r=/(:root\s*\{[^}]*\})/,t=path.basename(o).split(".");let n=e;if(3===t.length&&"light"!==t[1]){const o=t[0],r=t[1];s+=(n=e.replace(/:root/g,`:root[${o}='${r}']`))+"\n"}else{const o=s.match(r),t=e.match(r);if(o&&t){const e=o[1],r=t[1].replace(/:root\s*\{|\}/g,"").trim(),n=e.replace("}",`\n${r}\n}`);s=s.replace(e,n)}else s+=n+"\n"}fs.unlink(o,()=>{})}}catch(e){console.error(`\nStyle dictionary, Error processing file ${o}:`,e)}return s}const generateOverrideCSS=async(e,s,o)=>{const r=await getLegacyWmProjectProperties(s);if(isPrismProject(r)&&(e.generateOverrideCSS||"angular"===e.buildType)){const r=path.join(s+"/src/main/webapp/",OVERRIDE_TOKENS_PATH),t=s+`/src/main/webapp/${APP_OVERRIDE_CSS_PATH}`;if(accessFile(t),fs.existsSync(r)){console.log("CODEGEN ANGULAR APP: generating override css...");let n={scope:"@wavemaker",name:"style-dictionary",version:e.runtimeUIVersion,packageJsonFile:"",successMsg:"STYLE DICTIONARY SUCCESS",infoMsg:"STYLE DICTIONARY PACKAGE : ",skipPackageVersion:!0};n.baseDir=o;const i=downloadNPMPackage(n);let a={scope:"@wavemaker",name:"foundation-css",version:e.runtimeUIVersion,packageJsonFile:"",successMsg:"Foundation-CSS SUCCESS",infoMsg:"Foundation-CSS PACKAGE : "};a.baseDir=o;const c=downloadNPMPackage(a);console.log("FOUNDATION_CSS_PATH",c),await(async()=>{const e=await import(`${i}/node_modules/style-dictionary/lib/StyleDictionary.js`).then(e=>e.default),o=path.join(c,"/node_modules/@wavemaker/foundation-css/tokens"),n=await getCssVarCalcMixFormatter(i,c);n&&e.registerFormat(n);const a=`src/main/webapp/${DESIGN_TOKENS_DIR_NAME}/temp-tokens`,l=groupFilesByMode(r),f=generateModeConfigs(l,s,n);let d="";try{console.log("\nSetting up foundation tokens symlink..."),await setupSymlink(o,a);for(const{mode:s,files:o}of f){console.log(`\nBuilding CSS for mode: ${s}...`);try{const r=getStyleDictionaryConfig(o,a,s);console.log(r,s);const n=new e(r);await n.buildPlatform("css"),console.log(`Style Dictionary build completed for mode: ${s}`),d=processCSSFiles(o,d),fs.writeFileSync(t,d),console.log(`CSS overrides generated successfully for mode: ${s}`)}catch(e){console.error(`Error during Style Dictionary build for mode: ${s}`,e)}}console.log("CODEGEN ANGULAR APP: generating overrides success !")}catch(e){console.error("Error setting up symlink or processing modes:",e)}finally{await removeSymlink(a)}})()}}};module.exports={generateOverrideCSS:generateOverrideCSS};
|
package/src/project-meta.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const parser=require("fast-xml-parser"),{readFile:readFile,readDir:readDir,stat:stat,isPrefabProject:isPrefabProject,getWmProjectPropertiesFilePath:getWmProjectPropertiesFilePath,getThemesConfigPropertiesFilePath:getThemesConfigPropertiesFilePath,getAuthInfoFilePath:getAuthInfoFilePath,getSecurityConfigPath:getSecurityConfigPath,getLayoutsConfigPath:getLayoutsConfigPath,getPagesConfigPath:getPagesConfigPath,getPrefabsDirPath:getPrefabsDirPath,getPrefabPagesDirPath:getPrefabPagesDirPath,getPrefabConfigPath:getPrefabConfigPath}=require("./wm-utils"),{join:join}=require("path"),getWmProjectProperties=async e=>{const t=getWmProjectPropertiesFilePath(e);try{const e=require(t);if(e.WMAppProperties)return e.WMAppProperties;throw new Error("WMAppProperties not found in the provided file.")}catch(e){console.error("Error loading the WMAppProperties file:",e)}},getThemesConfigProperties=async e=>{const t=await readFile(getThemesConfigPropertiesFilePath(e),"utf8");return JSON.parse(t)},getSecurityConfig=async e=>stat(getAuthInfoFilePath(e)).then(()=>new Promise(async(t,r)=>{let a=null;JSON.parse(await readFile(getAuthInfoFilePath(e))).enforceSecurity&&(a=JSON.parse(await readFile(getSecurityConfigPath(e),"utf8"))),t(a)}),()=>Promise.resolve(null)),getAuthInfoConfig=async e=>{let t=await readFile(getAuthInfoFilePath(e),"utf8");return(t=JSON.parse(t)).enforceSecurity?t:null},getLayoutsConfig=async e=>{let t=await readFile(getLayoutsConfigPath(e),"utf8");return t=JSON.parse(t)},getPagesConfig=async e=>{let t=await readFile(getPagesConfigPath(e),"utf8");return t=JSON.parse(t)},getPrefabPartialsConfig=async(e,t)=>{let r=await readFile(`${getPrefabPagesDirPath(e,t)}/pages-config.json`,"utf8");return r=JSON.parse(r).filter(e=>"partial"===e.type.toLowerCase()||"template"===e.type.toLowerCase()).map(e=>({...e,prefabName:t}))},getPrefabConfigsUsedInApp=async(e,t)=>{const r=new Map,a=getPrefabsDirPath(t);return stat(a).then(()=>new Promise(async(i,o)=>{for(const e of await readDir(a))(await stat(join(a,e))).isDirectory()&&r.set(e,await readFile(getPrefabConfigPath(t,e)));isPrefabProject(e)&&r.set("__self__",await readFile(`${t}/src/main/webapp/config.json`)),i(r)}),()=>Promise.resolve(r))};module.exports={getWmProjectProperties:getWmProjectProperties,getThemesConfigProperties:getThemesConfigProperties,getSecurityConfig:getSecurityConfig,getLayoutsConfig:getLayoutsConfig,getPagesConfig:getPagesConfig,getPrefabConfigsUsedInApp:getPrefabConfigsUsedInApp,getPrefabPartialsConfig:getPrefabPartialsConfig,getAuthInfoConfig:getAuthInfoConfig};
|
|
1
|
+
const parser=require("fast-xml-parser"),{readFile:readFile,readDir:readDir,stat:stat,isPrefabProject:isPrefabProject,getWmProjectPropertiesFilePath:getWmProjectPropertiesFilePath,getThemesConfigPropertiesFilePath:getThemesConfigPropertiesFilePath,getAuthInfoFilePath:getAuthInfoFilePath,getSecurityConfigPath:getSecurityConfigPath,getLayoutsConfigPath:getLayoutsConfigPath,getPagesConfigPath:getPagesConfigPath,getPrefabsDirPath:getPrefabsDirPath,getPrefabPagesDirPath:getPrefabPagesDirPath,getPrefabConfigPath:getPrefabConfigPath,getLegacyWmProjectPropertiesFilePath:getLegacyWmProjectPropertiesFilePath}=require("./wm-utils"),{join:join}=require("path"),getWmProjectProperties=async e=>{const t=getWmProjectPropertiesFilePath(e);try{const e=require(t);if(e.WMAppProperties)return e.WMAppProperties;throw new Error("WMAppProperties not found in the provided file.")}catch(e){console.error("Error loading the WMAppProperties file:",e)}},getLegacyWmProjectProperties=async e=>{let t=await readFile(getLegacyWmProjectPropertiesFilePath(e),"utf8");const r={};return parser.parse(t,{textNodeName:"text",ignoreAttributes:!1,ignoreNameSpace:!1,allowBooleanAttributes:!1,parseNodeValue:!0,parseAttributeValue:!1,trimValues:!0,parseTrueNumberOnly:!1,arrayMode:!1,stopNodes:["parse-me-as-string"]},!0).properties.entry.forEach(e=>r[e["@_key"]]=e.text?e.text:""),r},getThemesConfigProperties=async e=>{const t=await readFile(getThemesConfigPropertiesFilePath(e),"utf8");return JSON.parse(t)},getSecurityConfig=async e=>stat(getAuthInfoFilePath(e)).then(()=>new Promise(async(t,r)=>{let a=null;JSON.parse(await readFile(getAuthInfoFilePath(e))).enforceSecurity&&(a=JSON.parse(await readFile(getSecurityConfigPath(e),"utf8"))),t(a)}),()=>Promise.resolve(null)),getAuthInfoConfig=async e=>{let t=await readFile(getAuthInfoFilePath(e),"utf8");return(t=JSON.parse(t)).enforceSecurity?t:null},getLayoutsConfig=async e=>{let t=await readFile(getLayoutsConfigPath(e),"utf8");return t=JSON.parse(t)},getPagesConfig=async e=>{let t=await readFile(getPagesConfigPath(e),"utf8");return t=JSON.parse(t)},getPrefabPartialsConfig=async(e,t)=>{let r=await readFile(`${getPrefabPagesDirPath(e,t)}/pages-config.json`,"utf8");return r=JSON.parse(r).filter(e=>"partial"===e.type.toLowerCase()||"template"===e.type.toLowerCase()).map(e=>({...e,prefabName:t}))},getPrefabConfigsUsedInApp=async(e,t)=>{const r=new Map,a=getPrefabsDirPath(t);return stat(a).then(()=>new Promise(async(i,o)=>{for(const e of await readDir(a))(await stat(join(a,e))).isDirectory()&&r.set(e,await readFile(getPrefabConfigPath(t,e)));isPrefabProject(e)&&r.set("__self__",await readFile(`${t}/src/main/webapp/config.json`)),i(r)}),()=>Promise.resolve(r))};module.exports={getWmProjectProperties:getWmProjectProperties,getThemesConfigProperties:getThemesConfigProperties,getSecurityConfig:getSecurityConfig,getLayoutsConfig:getLayoutsConfig,getPagesConfig:getPagesConfig,getPrefabConfigsUsedInApp:getPrefabConfigsUsedInApp,getPrefabPartialsConfig:getPrefabPartialsConfig,getAuthInfoConfig:getAuthInfoConfig,getLegacyWmProjectProperties:getLegacyWmProjectProperties};
|
package/src/wm-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const util=require("util"),fs=require("fs"),rimraf=require("rimraf"),decodeUriComponent=require("decode-uri-component"),upperFirst=require("lodash/upperFirst"),tar=require("tar-fs"),prettier=require("prettier"),js_beautify=require("js-beautify"),html_beautify=require("js-beautify").html,path=require("path"),stat=util.promisify(fs.stat),createDir=util.promisify(fs.mkdir),createReadStream=util.promisify(fs.createReadStream),readFile=util.promisify(fs.readFile),writeFile=util.promisify(fs.writeFile),readDir=util.promisify(fs.readdir),rename=util.promisify(fs.rename),searchFileByName=(e,t,r)=>{if(!fs.existsSync(e))return;fs.readdirSync(e).forEach(i=>{const a=path.join(e,i);fs.lstatSync(a).isDirectory()?searchFileByName(a,t,r):t.test(a)&&r(a)})},deleteResource=async e=>stat(e).then(()=>new Promise((t,r)=>{rimraf(e,()=>t())}),()=>Promise.resolve()),getComponentName=e=>`${upperFirst(e)}Component`,getComponentModuleName=e=>`${upperFirst(e)}Module`,decodeURIComponent=e=>decodeUriComponent(e.replace(/\+/g," ")),createTar=(e,t)=>new Promise((r,i)=>{tar.pack(e).pipe(fs.createWriteStream(t)).on("finish",r)}),extractTar=(e,t)=>new Promise((r,i)=>{fs.createReadStream(e).pipe(tar.extract(t)).on("finish",r)}),getWebAppPath=e=>`${e}/src/main/webapp`,getLayoutsConfigPath=e=>`${getWebAppPath(e)}/layouts/layouts-config.json`,getLayoutsDirPath=e=>`${getWebAppPath(e)}/layouts`,getPagesDirPath=e=>`${getWebAppPath(e)}/pages`,getPagesConfigPath=e=>`${getWebAppPath(e)}/pages/pages-config.json`,getPrefabsDirPath=e=>`${getWebAppPath(e)}/WEB-INF/prefabs`,getPrefabConfigPath=(e,t)=>`${getPrefabsDirPath(e)}/${t}/webapp/config.json`,getPrefabPagesDirPath=(e,t)=>`${getPrefabsDirPath(e)}/${t}/webapp/pages`,getSecurityConfigPath=e=>`${e}/services/securityService/designtime/intercept-urls.json`,getRolesConfigPath=e=>`${e}/services/securityService/designtime/roles.json`,getAuthInfoFilePath=e=>`${e}/services/securityService/designtime/auth-info.json`,getAppJsFilePath=e=>`${getWebAppPath(e)}/app.js`,getAppVariablesFilePath=e=>`${getWebAppPath(e)}/app.variables.json`,getThemesConfigPropertiesFilePath=e=>`${getWebAppPath(e)}/themes/themes-config.json`,getWmProjectPropertiesFilePath=e=>`${e}/target/ui-resources/wmProperties.js`,getIndexHtmlPath=e=>`${getWebAppPath(e)}/index.html`;let codegenPath="./node_modules/@wavemaker/angular-codegen";const setCodegenPath=e=>{e&&(codegenPath=e)},getCodegenPath=()=>codegenPath,generateRandomHash=()=>Array.from(Array(20),()=>Math.floor(36*Math.random()).toString(36)).join(""),formatContents=(e="",t)=>"javascript"===t?js_beautify(e,{}):prettier.format(e,{semi:!1,parser:"typescript",tabWidth:4}),formatMarkup=(e="")=>html_beautify(e),isMobileProject=e=>"MOBILE"===e.platformType,isPrefabProject=e=>"PREFAB"===e.type,isPrismProject=e=>"PRISM"===e.template,readFileSync=(e,t)=>{let r=fs.readFileSync(e);return t?JSON.parse(r):r};function copyFileSync(e,t){try{fs.copyFileSync(e,t)}catch(t){console.error(`Error copying ${e}: ${t.message}`)}}function copyPrefabFiles(e,t){const r=path.resolve(`${e}`);if(fs.existsSync(r)){const e=fs.readdirSync(r).filter(e=>fs.statSync(path.join(r,e)).isDirectory());t=path.resolve(`${t}`),e.forEach(e=>{const i=path.join(r,e),a=path.join(i,"prefab-servicedefs.json");fs.existsSync(a)&©FileSync(a,path.join(t+"/src","servicedefs",`${e}-prefab-servicedefs.json`));const s=path.join(i,"webapp"),o=path.join(t+"/resources",e);fs.existsSync(s)&©DirWithExclusionsSync(s,o,["resources"]);const n=path.join(s,"resources"),c=path.join(t+"/resources",e+"/resources");fs.existsSync(n)&©DirWithExclusionsSync(n,c)})}}const copyDirWithExclusionsSync=(e,t,r=[])=>{fs.existsSync(t)||fs.mkdirSync(t,{recursive:!0});let i=[];try{i=fs.readdirSync(e,{withFileTypes:!0})}catch(e){if("ENOENT"!==e.code)throw e}for(const a of i){const i=path.join(e,a.name),s=path.join(t,a.name);r.includes(a.name)||(a.isDirectory()?copyDirWithExclusionsSync(i,s,r):fs.copyFileSync(i,s))}},initExpressionParser=()=>{const e=require("../dependencies/expression-parser.cjs"),t=require("../dependencies/pipe-provider.cjs");e.setPipeProvider(new t.PipeProvider({},{get:()=>{}},{}))},DESIGN_TOKENS_DIR_NAME="themes",APP_OVERRIDE_CSS_PATH="themes/app.override.css",OVERRIDE_TOKENS_PATH="themes/overrides";module.exports={stat:stat,createDir:createDir,createReadStream:createReadStream,readFile:readFile,writeFile:writeFile,deleteResource:deleteResource,getComponentName:getComponentName,getComponentModuleName:getComponentModuleName,decodeURIComponent:decodeURIComponent,createTar:createTar,extractTar:extractTar,readDir:readDir,rename:rename,searchFileByName:searchFileByName,getWebAppPath:getWebAppPath,getLayoutsConfigPath:getLayoutsConfigPath,getLayoutsDirPath:getLayoutsDirPath,getPagesDirPath:getPagesDirPath,getPagesConfigPath:getPagesConfigPath,getPrefabsDirPath:getPrefabsDirPath,getPrefabConfigPath:getPrefabConfigPath,getPrefabPagesDirPath:getPrefabPagesDirPath,getSecurityConfigPath:getSecurityConfigPath,getRolesConfigPath:getRolesConfigPath,getAuthInfoFilePath:getAuthInfoFilePath,getAppJsFilePath:getAppJsFilePath,getAppVariablesFilePath:getAppVariablesFilePath,getWmProjectPropertiesFilePath:getWmProjectPropertiesFilePath,getThemesConfigPropertiesFilePath:getThemesConfigPropertiesFilePath,getIndexHtmlPath:getIndexHtmlPath,formatContents:formatContents,formatMarkup:formatMarkup,isMobileProject:isMobileProject,isPrefabProject:isPrefabProject,isPrismProject:isPrismProject,readFileSync:readFileSync,getCodegenPath:getCodegenPath,setCodegenPath:setCodegenPath,initExpressionParser:initExpressionParser,copyFileSync:copyFileSync,copyPrefabFiles:copyPrefabFiles,generateRandomHash:generateRandomHash,copyDirWithExclusionsSync:copyDirWithExclusionsSync,DESIGN_TOKENS_DIR_NAME:"themes",APP_OVERRIDE_CSS_PATH:APP_OVERRIDE_CSS_PATH,OVERRIDE_TOKENS_PATH:"themes/overrides"};
|
|
1
|
+
const util=require("util"),fs=require("fs"),rimraf=require("rimraf"),decodeUriComponent=require("decode-uri-component"),upperFirst=require("lodash/upperFirst"),tar=require("tar-fs"),prettier=require("prettier"),js_beautify=require("js-beautify"),html_beautify=require("js-beautify").html,path=require("path"),stat=util.promisify(fs.stat),createDir=util.promisify(fs.mkdir),createReadStream=util.promisify(fs.createReadStream),readFile=util.promisify(fs.readFile),writeFile=util.promisify(fs.writeFile),readDir=util.promisify(fs.readdir),rename=util.promisify(fs.rename),searchFileByName=(e,t,r)=>{if(!fs.existsSync(e))return;fs.readdirSync(e).forEach(i=>{const a=path.join(e,i);fs.lstatSync(a).isDirectory()?searchFileByName(a,t,r):t.test(a)&&r(a)})},deleteResource=async e=>stat(e).then(()=>new Promise((t,r)=>{rimraf(e,()=>t())}),()=>Promise.resolve()),getComponentName=e=>`${upperFirst(e)}Component`,getComponentModuleName=e=>`${upperFirst(e)}Module`,decodeURIComponent=e=>decodeUriComponent(e.replace(/\+/g," ")),createTar=(e,t)=>new Promise((r,i)=>{tar.pack(e).pipe(fs.createWriteStream(t)).on("finish",r)}),extractTar=(e,t)=>new Promise((r,i)=>{fs.createReadStream(e).pipe(tar.extract(t)).on("finish",r)}),getWebAppPath=e=>`${e}/src/main/webapp`,getLayoutsConfigPath=e=>`${getWebAppPath(e)}/layouts/layouts-config.json`,getLayoutsDirPath=e=>`${getWebAppPath(e)}/layouts`,getPagesDirPath=e=>`${getWebAppPath(e)}/pages`,getPagesConfigPath=e=>`${getWebAppPath(e)}/pages/pages-config.json`,getPrefabsDirPath=e=>`${getWebAppPath(e)}/WEB-INF/prefabs`,getPrefabConfigPath=(e,t)=>`${getPrefabsDirPath(e)}/${t}/webapp/config.json`,getPrefabPagesDirPath=(e,t)=>`${getPrefabsDirPath(e)}/${t}/webapp/pages`,getSecurityConfigPath=e=>`${e}/services/securityService/designtime/intercept-urls.json`,getRolesConfigPath=e=>`${e}/services/securityService/designtime/roles.json`,getAuthInfoFilePath=e=>`${e}/services/securityService/designtime/auth-info.json`,getAppJsFilePath=e=>`${getWebAppPath(e)}/app.js`,getAppVariablesFilePath=e=>`${getWebAppPath(e)}/app.variables.json`,getThemesConfigPropertiesFilePath=e=>`${getWebAppPath(e)}/themes/themes-config.json`,getWmProjectPropertiesFilePath=e=>`${e}/target/ui-resources/wmProperties.js`,getLegacyWmProjectPropertiesFilePath=e=>`${e}/.wmproject.properties`,getIndexHtmlPath=e=>`${getWebAppPath(e)}/index.html`;let codegenPath="./node_modules/@wavemaker/angular-codegen";const setCodegenPath=e=>{e&&(codegenPath=e)},getCodegenPath=()=>codegenPath,generateRandomHash=()=>Array.from(Array(20),()=>Math.floor(36*Math.random()).toString(36)).join(""),formatContents=(e="",t)=>"javascript"===t?js_beautify(e,{}):prettier.format(e,{semi:!1,parser:"typescript",tabWidth:4}),formatMarkup=(e="")=>html_beautify(e),isMobileProject=e=>"MOBILE"===e.platformType,isPrefabProject=e=>"PREFAB"===e.type,isPrismProject=e=>"PRISM"===e.template,readFileSync=(e,t)=>{let r=fs.readFileSync(e);return t?JSON.parse(r):r};function copyFileSync(e,t){try{fs.copyFileSync(e,t)}catch(t){console.error(`Error copying ${e}: ${t.message}`)}}function copyPrefabFiles(e,t){const r=path.resolve(`${e}`);if(fs.existsSync(r)){const e=fs.readdirSync(r).filter(e=>fs.statSync(path.join(r,e)).isDirectory());t=path.resolve(`${t}`),e.forEach(e=>{const i=path.join(r,e),a=path.join(i,"prefab-servicedefs.json");fs.existsSync(a)&©FileSync(a,path.join(t+"/src","servicedefs",`${e}-prefab-servicedefs.json`));const s=path.join(i,"webapp"),o=path.join(t+"/resources",e);fs.existsSync(s)&©DirWithExclusionsSync(s,o,["resources"]);const n=path.join(s,"resources"),c=path.join(t+"/resources",e+"/resources");fs.existsSync(n)&©DirWithExclusionsSync(n,c)})}}const copyDirWithExclusionsSync=(e,t,r=[])=>{fs.existsSync(t)||fs.mkdirSync(t,{recursive:!0});let i=[];try{i=fs.readdirSync(e,{withFileTypes:!0})}catch(e){if("ENOENT"!==e.code)throw e}for(const a of i){const i=path.join(e,a.name),s=path.join(t,a.name);r.includes(a.name)||(a.isDirectory()?copyDirWithExclusionsSync(i,s,r):fs.copyFileSync(i,s))}},initExpressionParser=()=>{const e=require("../dependencies/expression-parser.cjs"),t=require("../dependencies/pipe-provider.cjs");e.setPipeProvider(new t.PipeProvider({},{get:()=>{}},{}))},DESIGN_TOKENS_DIR_NAME="themes",APP_OVERRIDE_CSS_PATH="themes/app.override.css",OVERRIDE_TOKENS_PATH="themes/overrides";module.exports={stat:stat,createDir:createDir,createReadStream:createReadStream,readFile:readFile,writeFile:writeFile,deleteResource:deleteResource,getComponentName:getComponentName,getComponentModuleName:getComponentModuleName,decodeURIComponent:decodeURIComponent,createTar:createTar,extractTar:extractTar,readDir:readDir,rename:rename,searchFileByName:searchFileByName,getWebAppPath:getWebAppPath,getLayoutsConfigPath:getLayoutsConfigPath,getLayoutsDirPath:getLayoutsDirPath,getPagesDirPath:getPagesDirPath,getPagesConfigPath:getPagesConfigPath,getPrefabsDirPath:getPrefabsDirPath,getPrefabConfigPath:getPrefabConfigPath,getPrefabPagesDirPath:getPrefabPagesDirPath,getSecurityConfigPath:getSecurityConfigPath,getRolesConfigPath:getRolesConfigPath,getAuthInfoFilePath:getAuthInfoFilePath,getAppJsFilePath:getAppJsFilePath,getAppVariablesFilePath:getAppVariablesFilePath,getWmProjectPropertiesFilePath:getWmProjectPropertiesFilePath,getThemesConfigPropertiesFilePath:getThemesConfigPropertiesFilePath,getIndexHtmlPath:getIndexHtmlPath,formatContents:formatContents,formatMarkup:formatMarkup,isMobileProject:isMobileProject,isPrefabProject:isPrefabProject,isPrismProject:isPrismProject,readFileSync:readFileSync,getCodegenPath:getCodegenPath,setCodegenPath:setCodegenPath,initExpressionParser:initExpressionParser,copyFileSync:copyFileSync,copyPrefabFiles:copyPrefabFiles,generateRandomHash:generateRandomHash,copyDirWithExclusionsSync:copyDirWithExclusionsSync,DESIGN_TOKENS_DIR_NAME:"themes",APP_OVERRIDE_CSS_PATH:APP_OVERRIDE_CSS_PATH,OVERRIDE_TOKENS_PATH:"themes/overrides",getLegacyWmProjectPropertiesFilePath:getLegacyWmProjectPropertiesFilePath};
|
|
@@ -72,7 +72,10 @@ const wmModules = [
|
|
|
72
72
|
BsDatepickerModule.forRoot(),
|
|
73
73
|
NgCircleProgressModule.forRoot(),
|
|
74
74
|
WmComponentsModule.forRoot(),
|
|
75
|
-
RuntimeBaseModule.forRoot()
|
|
75
|
+
RuntimeBaseModule.forRoot(),
|
|
76
|
+
{{#if isPwa}}
|
|
77
|
+
ServiceWorkerModule.register("wmsw-worker.js", { enabled: environment.production })
|
|
78
|
+
{{/if}}
|
|
76
79
|
)
|
|
77
80
|
];
|
|
78
81
|
export const xsrfHeaderName = "{{xsrfTokenHeaderName}}";
|
|
@@ -120,9 +123,6 @@ export const appConfig: ApplicationConfig = {
|
|
|
120
123
|
// Other application-wide services
|
|
121
124
|
CanDeactivateNgPageGuard,
|
|
122
125
|
LazyLoadScriptsResolve,
|
|
123
|
-
...wmModules
|
|
124
|
-
{{#if isPwa}}
|
|
125
|
-
ServiceWorkerModule.register("wmsw-worker.js", { enabled: environment.production })
|
|
126
|
-
{{/if}}
|
|
126
|
+
...wmModules
|
|
127
127
|
]
|
|
128
128
|
};
|