@eui/tools 6.14.10 → 6.14.12
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/.version.properties +1 -1
- package/CHANGELOG.md +19 -0
- package/package.json +1 -1
- package/sandbox.js +70 -10
- package/scripts/csdr/audit/styles.js +163 -91
- package/scripts/csdr/config/packages.js +64 -57
- package/scripts/csdr/install/common.js +20 -15
- package/scripts/csdr/metadata/app.js +0 -1
- package/scripts/csdr/metadata/package-versions.js +4 -22
- package/scripts/csdr/metadata/package.js +143 -150
- package/scripts/csdr/release/package/common.js +18 -21
- package/scripts/csdr/release/package/release-backend.js +0 -6
- package/scripts/csdr/release/package/release-ui.js +9 -3
- package/scripts/csdr/release/package/release-virtual-remote.js +3 -1
package/.version.properties
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
6.14.
|
|
1
|
+
6.14.12
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
## 6.14.12 (2023-12-09)
|
|
2
|
+
|
|
3
|
+
##### Chores
|
|
4
|
+
|
|
5
|
+
* **other:**
|
|
6
|
+
* fix hotfix flag for npm package version fetch - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([a4b99eb0](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/a4b99eb0842675d5cffd3b4d4adaccb3d92e1f54))
|
|
7
|
+
* refactor metadata of UI pkg fetch and store using npm direct call - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([942ba35e](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/942ba35e7f22e309feca6a69f9a7d6599c0c81b1))
|
|
8
|
+
|
|
9
|
+
* * *
|
|
10
|
+
* * *
|
|
11
|
+
## 6.14.11 (2023-12-08)
|
|
12
|
+
|
|
13
|
+
##### Chores
|
|
14
|
+
|
|
15
|
+
* **other:**
|
|
16
|
+
* improve styles audit for non-SoC component style used - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([41cee1b9](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/41cee1b96c507872f08ebca4f002d646869566c0))
|
|
17
|
+
|
|
18
|
+
* * *
|
|
19
|
+
* * *
|
|
1
20
|
## 6.14.10 (2023-12-06)
|
|
2
21
|
|
|
3
22
|
##### Chores
|
package/package.json
CHANGED
package/sandbox.js
CHANGED
|
@@ -1366,18 +1366,78 @@ const publishUtils = require('./scripts/utils/publish/publish-utils');
|
|
|
1366
1366
|
// console.log(compositeDeps);
|
|
1367
1367
|
// })
|
|
1368
1368
|
|
|
1369
|
-
const prj = configUtils.projects.getCsdrProject('eui-showcase-ux-components');
|
|
1369
|
+
// const prj = configUtils.projects.getCsdrProject('eui-showcase-ux-components');
|
|
1370
1370
|
|
|
1371
|
-
Promise.resolve()
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1371
|
+
// Promise.resolve()
|
|
1372
|
+
// .then(() => {
|
|
1373
|
+
// return utils.buildApp.generateProjectDistributionList(prj, true);
|
|
1374
|
+
// })
|
|
1375
|
+
|
|
1376
|
+
// .then((output) => {
|
|
1377
|
+
// console.log(output);
|
|
1378
|
+
|
|
1379
|
+
// const { baseHrefIn } = tools.getArgs();
|
|
1380
|
+
// const baseHref = configUtils.projects.getBaseHref(prj, '17.0.2-snapshot-1701859601406', baseHrefIn);
|
|
1381
|
+
|
|
1382
|
+
// console.log(baseHref);
|
|
1383
|
+
// })
|
|
1384
|
+
|
|
1385
|
+
|
|
1386
|
+
// Promise.resolve()
|
|
1387
|
+
// .then(() => {
|
|
1388
|
+
// const pkgsIn = configUtils.packages.getCsdrPackages();
|
|
1389
|
+
// let pkgs = Object.keys(pkgsIn).map(p => {
|
|
1390
|
+
// return {
|
|
1391
|
+
// name: p,
|
|
1392
|
+
// npmPkg: pkgsIn[p].npmPkg,
|
|
1393
|
+
// remote: pkgsIn[p].remote
|
|
1394
|
+
// }
|
|
1395
|
+
// });
|
|
1396
|
+
// pkgs = pkgs.filter(p => p.npmPkg !== undefined && !p.remote && p.name.indexOf('backend') === -1);
|
|
1397
|
+
// pkgs = tools.sortArray(pkgs, 'name');
|
|
1398
|
+
|
|
1399
|
+
// pkgs.forEach(p => {
|
|
1400
|
+
// const pkg = configUtils.packages.getPackage(p.name, true);
|
|
1401
|
+
|
|
1402
|
+
// const lastMetadataLatest = metadataUtils.package.getPackageVersionsLastLatest(pkg);
|
|
1403
|
+
// const lastMetadataSnapshot = metadataUtils.package.getPackageVersionsLastSnapshot(pkg);
|
|
1404
|
+
// const lastMetadataRc = metadataUtils.package.getPackageVersionsLastRc(pkg);
|
|
1405
|
+
|
|
1406
|
+
// console.log(`Checking ${pkg.name}...`);
|
|
1407
|
+
|
|
1408
|
+
// // TODO check multi-version of LATEST f.e. : csdr-integration-ui 2.x 3.x 4.x
|
|
1409
|
+
|
|
1410
|
+
// try {
|
|
1411
|
+
// const output = execa.sync('npm', ['view', '--latest', pkg.npmPkg, '--json']).stdout;
|
|
1412
|
+
// const json = JSON.parse(output);
|
|
1413
|
+
// const npmSnapshot = json['dist-tags'].snapshot;
|
|
1414
|
+
// const npmLatest = json['dist-tags'].latest;
|
|
1415
|
+
// const npmNext = json['dist-tags'].next;
|
|
1416
|
+
|
|
1417
|
+
// if (
|
|
1418
|
+
// lastMetadataSnapshot !== npmSnapshot ||
|
|
1419
|
+
// lastMetadataLatest !== npmLatest
|
|
1420
|
+
// ) {
|
|
1421
|
+
// console.log(pkg.name);
|
|
1422
|
+
// console.log(lastMetadataSnapshot, lastMetadataLatest, lastMetadataRc);
|
|
1423
|
+
// console.log(npmSnapshot, npmLatest, npmNext);
|
|
1424
|
+
// console.log ('');
|
|
1425
|
+
// }
|
|
1426
|
+
// } catch(e) {
|
|
1427
|
+
// console.log('---Error getting npm info for pkg');
|
|
1428
|
+
// }
|
|
1375
1429
|
|
|
1376
|
-
|
|
1377
|
-
|
|
1430
|
+
// });
|
|
1431
|
+
// })
|
|
1378
1432
|
|
|
1379
|
-
const { baseHrefIn } = tools.getArgs();
|
|
1380
|
-
const baseHref = configUtils.projects.getBaseHref(prj, '17.0.2-snapshot-1701859601406', baseHrefIn);
|
|
1381
1433
|
|
|
1382
|
-
|
|
1434
|
+
Promise.resolve()
|
|
1435
|
+
.then(() => {
|
|
1436
|
+
const pkg = configUtils.packages.getPackage('cc-decidepoc-ui', true);
|
|
1437
|
+
console.log(pkg);
|
|
1438
|
+
const versions = metadataUtils.package.getPackageVersions(pkg);
|
|
1439
|
+
console.log(JSON.stringify(versions, null, 2));
|
|
1440
|
+
})
|
|
1441
|
+
.catch((e) => {
|
|
1442
|
+
console.log(e);
|
|
1383
1443
|
})
|
|
@@ -73,10 +73,10 @@ const runStylesAudit = (module.exports.runStylesAudit = (pkg, customPath) => {
|
|
|
73
73
|
srcPath = customPath;
|
|
74
74
|
tools.logTitle(`Auditing : ${customPath}`);
|
|
75
75
|
} else {
|
|
76
|
-
if (pkg.
|
|
77
|
-
srcPath = pkg.paths.root;
|
|
78
|
-
} else {
|
|
76
|
+
if (pkg.srcRootDefault) {
|
|
79
77
|
srcPath = pkg.paths.src;
|
|
78
|
+
} else {
|
|
79
|
+
srcPath = pkg.paths.root;
|
|
80
80
|
}
|
|
81
81
|
tools.logTitle(`Auditing : ${pkg.name}`);
|
|
82
82
|
}
|
|
@@ -98,6 +98,12 @@ const runStylesAudit = (module.exports.runStylesAudit = (pkg, customPath) => {
|
|
|
98
98
|
count: 0,
|
|
99
99
|
files: [],
|
|
100
100
|
},
|
|
101
|
+
tsNotSoC: {
|
|
102
|
+
count: 0,
|
|
103
|
+
files: [],
|
|
104
|
+
templateCount: 0,
|
|
105
|
+
styleCount: 0,
|
|
106
|
+
},
|
|
101
107
|
thirdPartyDependencies: {
|
|
102
108
|
count: 0,
|
|
103
109
|
dependencies: [],
|
|
@@ -152,11 +158,11 @@ const runStylesAudit = (module.exports.runStylesAudit = (pkg, customPath) => {
|
|
|
152
158
|
},
|
|
153
159
|
uxCmp: {
|
|
154
160
|
count: 0,
|
|
155
|
-
indices: []
|
|
161
|
+
indices: [],
|
|
156
162
|
},
|
|
157
163
|
mywpSharedAll: {
|
|
158
164
|
count: 0,
|
|
159
|
-
indices: []
|
|
165
|
+
indices: [],
|
|
160
166
|
},
|
|
161
167
|
finalReport: {},
|
|
162
168
|
};
|
|
@@ -167,13 +173,113 @@ const runStylesAudit = (module.exports.runStylesAudit = (pkg, customPath) => {
|
|
|
167
173
|
report.package = pkg.name;
|
|
168
174
|
}
|
|
169
175
|
|
|
176
|
+
|
|
170
177
|
let files;
|
|
178
|
+
|
|
179
|
+
// CHECKING TS FILES CONTENT
|
|
180
|
+
// -------------------------
|
|
181
|
+
|
|
182
|
+
files = glob.sync('**/*.ts', { cwd: srcPath, nodir: true, follow: true, dot: true });
|
|
183
|
+
|
|
184
|
+
files.forEach((file) => {
|
|
185
|
+
let result, regex;
|
|
186
|
+
|
|
187
|
+
const filePath = path.join(srcPath, file);
|
|
188
|
+
const fileContent = tools.getFileContent(filePath);
|
|
189
|
+
const linesCount = fileContent.split('\n').length;
|
|
190
|
+
|
|
191
|
+
if (fileContent.indexOf('styles-audit-disabled') !== -1) {
|
|
192
|
+
report.stylesAuditDisabledCount++;
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (linesCount > 500) {
|
|
197
|
+
report.tsOver500.count++;
|
|
198
|
+
report.tsOver500.files.push(file);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
let tsNotSoCTemplateIndices = [];
|
|
202
|
+
regex = /template:/gi;
|
|
203
|
+
while ((result = regex.exec(fileContent))) {
|
|
204
|
+
tsNotSoCTemplateIndices.push(result.index);
|
|
205
|
+
}
|
|
206
|
+
report.tsNotSoC.count += tsNotSoCTemplateIndices.length;
|
|
207
|
+
report.tsNotSoC.templateCount += tsNotSoCTemplateIndices.length;
|
|
208
|
+
if (tsNotSoCTemplateIndices.length > 0) {
|
|
209
|
+
report.tsNotSoC.files.push(file);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
let tsNotSoCStyleIndices = [];
|
|
213
|
+
regex = /styles:/gi;
|
|
214
|
+
while ((result = regex.exec(fileContent))) {
|
|
215
|
+
tsNotSoCStyleIndices.push(result.index);
|
|
216
|
+
}
|
|
217
|
+
report.tsNotSoC.count += tsNotSoCStyleIndices.length;
|
|
218
|
+
report.tsNotSoC.styleCount += tsNotSoCStyleIndices.length;
|
|
219
|
+
if (tsNotSoCStyleIndices.length > 0) {
|
|
220
|
+
report.tsNotSoC.files.push(file);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
report.tsNotSoC.files = tools.removeArrayDuplicates(report.tsNotSoC.files);
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
let primengIndices = [];
|
|
227
|
+
regex = /primeng/gi;
|
|
228
|
+
while ((result = regex.exec(fileContent))) {
|
|
229
|
+
primengIndices.push(result.index);
|
|
230
|
+
}
|
|
231
|
+
report.primeng.count += primengIndices.length;
|
|
232
|
+
report.primeng.indices = [...report.primeng.indices, ...generateIndicesContent(primengIndices, file, fileContent)];
|
|
233
|
+
|
|
234
|
+
let materialIndices = [];
|
|
235
|
+
regex = /@angular\/material/gi;
|
|
236
|
+
while ((result = regex.exec(fileContent))) {
|
|
237
|
+
materialIndices.push(result.index);
|
|
238
|
+
}
|
|
239
|
+
const indicesContent = generateIndicesContent(materialIndices, file, fileContent, [
|
|
240
|
+
'@angular/material/core',
|
|
241
|
+
'@angular/material-moment-adapter',
|
|
242
|
+
]);
|
|
243
|
+
|
|
244
|
+
report.material.count += recalculateIndicesCount(indicesContent);
|
|
245
|
+
report.material.indices = [...report.material.indices, ...indicesContent];
|
|
246
|
+
|
|
247
|
+
let allModulesIndices = [];
|
|
248
|
+
regex = /EuiAllModule/gi;
|
|
249
|
+
while ((result = regex.exec(fileContent))) {
|
|
250
|
+
allModulesIndices.push(result.index);
|
|
251
|
+
}
|
|
252
|
+
regex = /UxAllModule/gi;
|
|
253
|
+
while ((result = regex.exec(fileContent))) {
|
|
254
|
+
allModulesIndices.push(result.index);
|
|
255
|
+
}
|
|
256
|
+
report.allModules.count += allModulesIndices.length;
|
|
257
|
+
report.allModules.indices = [...report.allModules.indices, ...generateIndicesContent(allModulesIndices, file, fileContent)];
|
|
258
|
+
|
|
259
|
+
let mywpSharedAllIndices = [];
|
|
260
|
+
regex = /\@mywp\/shared'|\@mywp\/shared"/gi;
|
|
261
|
+
while ((result = regex.exec(fileContent))) {
|
|
262
|
+
mywpSharedAllIndices.push(result.index);
|
|
263
|
+
}
|
|
264
|
+
report.mywpSharedAll.count += mywpSharedAllIndices.length;
|
|
265
|
+
report.mywpSharedAll.indices = [...report.mywpSharedAll.indices, ...generateIndicesContent(mywpSharedAllIndices, file, fileContent)];
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
// CHECKING STYLES FILE CONTENT
|
|
270
|
+
// ----------------------------
|
|
271
|
+
|
|
171
272
|
const scssFiles = glob.sync('**/*.scss', { cwd: srcPath, nodir: true, follow: true, dot: true });
|
|
172
273
|
const cssFiles = glob.sync('**/*.css', { cwd: srcPath, nodir: true, follow: true, dot: true });
|
|
173
274
|
|
|
174
|
-
|
|
275
|
+
let tsFiles = [];
|
|
276
|
+
if (report.tsNotSoC.styleCount > 0) {
|
|
277
|
+
tsFiles = glob.sync('**/*.ts', { cwd: srcPath, nodir: true, follow: true, dot: true });
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
files = [...scssFiles, ...cssFiles, ...tsFiles];
|
|
175
281
|
|
|
176
|
-
report.scssFilesCount +=
|
|
282
|
+
report.scssFilesCount += [...scssFiles, ...cssFiles].length;
|
|
177
283
|
|
|
178
284
|
files.forEach((file) => {
|
|
179
285
|
const filePath = path.join(srcPath, file);
|
|
@@ -188,16 +294,21 @@ const runStylesAudit = (module.exports.runStylesAudit = (pkg, customPath) => {
|
|
|
188
294
|
if (fileContent === '') {
|
|
189
295
|
report.scssEmptyFiles++;
|
|
190
296
|
}
|
|
191
|
-
|
|
297
|
+
if (file.indexOf('.scss') > -1 || file.indexOf('.css') > -1) {
|
|
298
|
+
report.scssLinescount += linesCount;
|
|
299
|
+
}
|
|
192
300
|
|
|
193
|
-
let result,
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
301
|
+
let result, regex;
|
|
302
|
+
|
|
303
|
+
if (file.indexOf('.scss') > -1 || file.indexOf('.css') > -1) {
|
|
304
|
+
let euiIndices = [];
|
|
305
|
+
regex = /\.eui|\.ux/gi;
|
|
306
|
+
while ((result = regex.exec(fileContent))) {
|
|
307
|
+
euiIndices.push(result.index);
|
|
308
|
+
}
|
|
309
|
+
report.euiOverrides.count += euiIndices.length;
|
|
310
|
+
report.euiOverrides.indices = [...report.euiOverrides.indices, ...generateIndicesContent(euiIndices, file, fileContent)];
|
|
198
311
|
}
|
|
199
|
-
report.euiOverrides.count += euiIndices.length;
|
|
200
|
-
report.euiOverrides.indices = [...report.euiOverrides.indices, ...generateIndicesContent(euiIndices, file, fileContent)];
|
|
201
312
|
|
|
202
313
|
let sizesIndices = [];
|
|
203
314
|
regex = /px/gi;
|
|
@@ -256,9 +367,20 @@ const runStylesAudit = (module.exports.runStylesAudit = (pkg, customPath) => {
|
|
|
256
367
|
report.zIndex.indices = [...report.zIndex.indices, ...generateIndicesContent(zIndexIndices, file, fileContent)];
|
|
257
368
|
});
|
|
258
369
|
|
|
259
|
-
files = glob.sync('**/*.html', { cwd: srcPath, nodir: true, follow: true, dot: true });
|
|
260
370
|
|
|
261
|
-
|
|
371
|
+
// CHECKING HTML FILES CONTENT
|
|
372
|
+
// ---------------------------
|
|
373
|
+
|
|
374
|
+
const htmlFiles = glob.sync('**/*.html', { cwd: srcPath, nodir: true, follow: true, dot: true });
|
|
375
|
+
|
|
376
|
+
tsFiles = [];
|
|
377
|
+
if (report.tsNotSoC.templateCount.length > 0) {
|
|
378
|
+
tsFiles = glob.sync('**/*.ts', { cwd: srcPath, nodir: true, follow: true, dot: true });
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
files = [...htmlFiles, ...tsFiles];
|
|
382
|
+
|
|
383
|
+
report.htmlFilesCount += htmlFiles.length;
|
|
262
384
|
|
|
263
385
|
files.forEach((file) => {
|
|
264
386
|
const filePath = path.join(srcPath, file);
|
|
@@ -270,11 +392,13 @@ const runStylesAudit = (module.exports.runStylesAudit = (pkg, customPath) => {
|
|
|
270
392
|
return;
|
|
271
393
|
}
|
|
272
394
|
|
|
273
|
-
|
|
395
|
+
if (file.indexOf('.html') > -1) {
|
|
396
|
+
report.htmlLinesCount += linesCount;
|
|
397
|
+
}
|
|
274
398
|
|
|
275
399
|
let result,
|
|
276
400
|
inlineStylesIndices = [];
|
|
277
|
-
let regex = /style=/gi;
|
|
401
|
+
let regex = /style=|style =/gi;
|
|
278
402
|
while ((result = regex.exec(fileContent))) {
|
|
279
403
|
inlineStylesIndices.push(result.index);
|
|
280
404
|
}
|
|
@@ -282,77 +406,17 @@ const runStylesAudit = (module.exports.runStylesAudit = (pkg, customPath) => {
|
|
|
282
406
|
report.inlineStyles.indices = [...report.inlineStyles.indices, ...generateIndicesContent(inlineStylesIndices, file, fileContent)];
|
|
283
407
|
|
|
284
408
|
let uxCmpIndices = [];
|
|
285
|
-
regex =
|
|
409
|
+
regex = /<ux-/gi;
|
|
286
410
|
while ((result = regex.exec(fileContent))) {
|
|
287
411
|
uxCmpIndices.push(result.index);
|
|
288
412
|
}
|
|
289
|
-
const indicesContent = generateIndicesContent(uxCmpIndices, file, fileContent
|
|
290
|
-
'ux-dyn-forms',
|
|
291
|
-
]);
|
|
413
|
+
const indicesContent = generateIndicesContent(uxCmpIndices, file, fileContent);
|
|
292
414
|
|
|
293
415
|
report.uxCmp.count += recalculateIndicesCount(indicesContent);
|
|
294
416
|
report.uxCmp.indices = [...report.uxCmp.indices, ...indicesContent];
|
|
295
417
|
});
|
|
296
418
|
|
|
297
|
-
files = glob.sync('**/*.ts', { cwd: srcPath, nodir: true, follow: true, dot: true });
|
|
298
|
-
|
|
299
|
-
files.forEach((file) => {
|
|
300
|
-
const filePath = path.join(srcPath, file);
|
|
301
|
-
const fileContent = tools.getFileContent(filePath);
|
|
302
|
-
const linesCount = fileContent.split('\n').length;
|
|
303
|
-
|
|
304
|
-
if (fileContent.indexOf('styles-audit-disabled') !== -1) {
|
|
305
|
-
report.stylesAuditDisabledCount++;
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
if (linesCount > 500) {
|
|
310
|
-
report.tsOver500.count++;
|
|
311
|
-
report.tsOver500.files.push(file);
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
let result,
|
|
315
|
-
primengIndices = [];
|
|
316
|
-
let regex = /primeng/gi;
|
|
317
|
-
while ((result = regex.exec(fileContent))) {
|
|
318
|
-
primengIndices.push(result.index);
|
|
319
|
-
}
|
|
320
|
-
report.primeng.count += primengIndices.length;
|
|
321
|
-
report.primeng.indices = [...report.primeng.indices, ...generateIndicesContent(primengIndices, file, fileContent)];
|
|
322
|
-
|
|
323
|
-
let materialIndices = [];
|
|
324
|
-
regex = /@angular\/material/gi;
|
|
325
|
-
while ((result = regex.exec(fileContent))) {
|
|
326
|
-
materialIndices.push(result.index);
|
|
327
|
-
}
|
|
328
|
-
const indicesContent = generateIndicesContent(materialIndices, file, fileContent, [
|
|
329
|
-
'@angular/material/core',
|
|
330
|
-
'@angular/material-moment-adapter',
|
|
331
|
-
]);
|
|
332
|
-
|
|
333
|
-
report.material.count += recalculateIndicesCount(indicesContent);
|
|
334
|
-
report.material.indices = [...report.material.indices, ...indicesContent];
|
|
335
|
-
|
|
336
|
-
let allModulesIndices = [];
|
|
337
|
-
regex = /EuiAllModule/gi;
|
|
338
|
-
while ((result = regex.exec(fileContent))) {
|
|
339
|
-
allModulesIndices.push(result.index);
|
|
340
|
-
}
|
|
341
|
-
regex = /UxAllModule/gi;
|
|
342
|
-
while ((result = regex.exec(fileContent))) {
|
|
343
|
-
allModulesIndices.push(result.index);
|
|
344
|
-
}
|
|
345
|
-
report.allModules.count += allModulesIndices.length;
|
|
346
|
-
report.allModules.indices = [...report.allModules.indices, ...generateIndicesContent(allModulesIndices, file, fileContent)];
|
|
347
419
|
|
|
348
|
-
let mywpSharedAllIndices = [];
|
|
349
|
-
regex = /\@mywp\/shared'|\@mywp\/shared"/gi;
|
|
350
|
-
while ((result = regex.exec(fileContent))) {
|
|
351
|
-
mywpSharedAllIndices.push(result.index);
|
|
352
|
-
}
|
|
353
|
-
report.mywpSharedAll.count += mywpSharedAllIndices.length;
|
|
354
|
-
report.mywpSharedAll.indices = [...report.mywpSharedAll.indices, ...generateIndicesContent(mywpSharedAllIndices, file, fileContent)];
|
|
355
|
-
});
|
|
356
420
|
|
|
357
421
|
// Analyzing 3rd party dependencies usage
|
|
358
422
|
|
|
@@ -371,14 +435,13 @@ const runStylesAudit = (module.exports.runStylesAudit = (pkg, customPath) => {
|
|
|
371
435
|
|
|
372
436
|
// checking against allowed CSDR known package scopes
|
|
373
437
|
if (!allowedScopes.includes(scope)) {
|
|
374
|
-
|
|
375
438
|
// exclusions known
|
|
376
439
|
let exclusionFound = false;
|
|
377
440
|
exclusions.forEach((exc) => {
|
|
378
441
|
if (scope.indexOf(exc) > -1) {
|
|
379
442
|
exclusionFound = true;
|
|
380
443
|
}
|
|
381
|
-
})
|
|
444
|
+
});
|
|
382
445
|
|
|
383
446
|
if (!exclusionFound) {
|
|
384
447
|
thirdPartyDeps.push(d);
|
|
@@ -431,18 +494,18 @@ const runStylesAudit = (module.exports.runStylesAudit = (pkg, customPath) => {
|
|
|
431
494
|
};
|
|
432
495
|
}
|
|
433
496
|
|
|
434
|
-
if (report.stylesAuditDisabledCount !==0) {
|
|
497
|
+
if (report.stylesAuditDisabledCount !== 0) {
|
|
435
498
|
report.finalReport['stylesAuditDisabledCount'] = {
|
|
436
499
|
description: 'audit disabled count',
|
|
437
500
|
value: report.stylesAuditDisabledCount,
|
|
438
|
-
status: report.stylesAuditDisabledCount !== 0 ? 'IMPROVE': 'OK',
|
|
439
|
-
comment
|
|
440
|
-
}
|
|
501
|
+
status: report.stylesAuditDisabledCount !== 0 ? 'IMPROVE' : 'OK',
|
|
502
|
+
comment: report.stylesAuditDisabledCount !== 0 ? 'If not done yet, files to be checked by eUI team' : null,
|
|
503
|
+
};
|
|
441
504
|
}
|
|
442
505
|
|
|
443
506
|
// BALANCED - styles content
|
|
444
507
|
|
|
445
|
-
if (report.scssFilesCount !== 0) {
|
|
508
|
+
if (report.scssFilesCount !== 0 || report.tsNotSoC.styleCount !== 0) {
|
|
446
509
|
report.finalReport['euiOverrides'] = {
|
|
447
510
|
description: 'eUI overrides found',
|
|
448
511
|
value: report.euiOverrides.count,
|
|
@@ -501,7 +564,7 @@ const runStylesAudit = (module.exports.runStylesAudit = (pkg, customPath) => {
|
|
|
501
564
|
|
|
502
565
|
// CRITICAL ONLY
|
|
503
566
|
|
|
504
|
-
if (report.htmlLinesCount !== 0) {
|
|
567
|
+
if (report.htmlLinesCount !== 0 || report.tsNotSoC.templateCount !== 0) {
|
|
505
568
|
report.finalReport['inlineStyles'] = {
|
|
506
569
|
description: 'inline styles found in HTML',
|
|
507
570
|
value: report.inlineStyles.count,
|
|
@@ -551,16 +614,25 @@ const runStylesAudit = (module.exports.runStylesAudit = (pkg, customPath) => {
|
|
|
551
614
|
status: report.tsOver500.count !== 0 ? 'IMPROVE' : 'OK',
|
|
552
615
|
comment: report.tsOver500.count !== 0 ? 'Split TS files into multiple ones for readability' : null,
|
|
553
616
|
};
|
|
617
|
+
|
|
618
|
+
report.finalReport['tsNotSoC'] = {
|
|
619
|
+
description: 'TS file not respecting SoC template OR scss split content',
|
|
620
|
+
value: report.tsNotSoC.count,
|
|
621
|
+
status: report.tsNotSoC.count !== 0 ? 'IMPROVE' : 'OK',
|
|
622
|
+
comment: report.tsNotSoC.count !== 0 ? 'Split TS file into types of concerns' : null,
|
|
623
|
+
};
|
|
554
624
|
}
|
|
555
625
|
|
|
556
626
|
report.finalReport['thirdPartyDependencies'] = {
|
|
557
627
|
description: 'Third party dependencies usage',
|
|
558
628
|
value: report.thirdPartyDependencies.count,
|
|
559
629
|
status: report.thirdPartyDependencies.count !== 0 ? 'IMPROVE' : 'OK',
|
|
560
|
-
comment:
|
|
630
|
+
comment:
|
|
631
|
+
report.thirdPartyDependencies.count !== 0
|
|
632
|
+
? 'Use 3rd party dependencies only if really necessary (bundle size increase) - contact eUI team for more info'
|
|
633
|
+
: null,
|
|
561
634
|
};
|
|
562
635
|
|
|
563
|
-
|
|
564
636
|
if (Object.keys(report.finalReport).length === 0) {
|
|
565
637
|
tools.logInfo('No sources to audit...skipping');
|
|
566
638
|
return null;
|