@eui/tools 6.11.32 → 6.12.1
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 +18 -0
- package/package.json +1 -1
- package/sandbox.js +33 -9
- package/scripts/csdr/audit/styles.js +79 -8
- package/scripts/csdr/config/global.js +10 -1
- package/scripts/csdr/metadata/package-versions.js +7 -1
- package/scripts/csdr/metadata/package.js +31 -2
- package/scripts/csdr/release/package/common.js +3 -2
- package/scripts/csdr/release/package/release-ui.js +6 -2
- package/scripts/utils/build/package/angular.js +11 -1
package/.version.properties
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
6.
|
|
1
|
+
6.12.1
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## 6.12.1 (2023-06-13)
|
|
2
|
+
|
|
3
|
+
##### Chores
|
|
4
|
+
|
|
5
|
+
* **other:**
|
|
6
|
+
* adapted styles audit report - metadata storage - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([6e03d9e6](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/6e03d9e68757f5d79be048332c3dc4bbc81577e3))
|
|
7
|
+
|
|
8
|
+
* * *
|
|
9
|
+
* * *
|
|
10
|
+
## 6.12.0 (2023-06-13)
|
|
11
|
+
|
|
12
|
+
##### New Features
|
|
13
|
+
|
|
14
|
+
* **audit:**
|
|
15
|
+
* enforces styles audit gates on newly created packages - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([59c87f1f](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/59c87f1feae9937f324cfc3076c37704d139403d))
|
|
16
|
+
|
|
17
|
+
* * *
|
|
18
|
+
* * *
|
|
1
19
|
## 6.11.32 (2023-06-09)
|
|
2
20
|
|
|
3
21
|
##### Chores
|
package/package.json
CHANGED
package/sandbox.js
CHANGED
|
@@ -1212,15 +1212,15 @@ const versionUtils = require('./scripts/csdr/version/version-utils');
|
|
|
1212
1212
|
// console.log(config);
|
|
1213
1213
|
// })
|
|
1214
1214
|
|
|
1215
|
-
Promise.resolve()
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1215
|
+
// Promise.resolve()
|
|
1216
|
+
// .then(() => {
|
|
1217
|
+
// const prjName = 'my-workplace-host-playground';
|
|
1218
|
+
// const project = configUtils.projects.getCsdrProject(prjName);
|
|
1219
|
+
// return preBuildUtils.projects.preBuild(project, 'TST', true, 'cdn-tst');
|
|
1220
|
+
// })
|
|
1221
|
+
// .catch((e) => {
|
|
1222
|
+
// console.log(e);
|
|
1223
|
+
// })
|
|
1224
1224
|
|
|
1225
1225
|
// Promise.resolve()
|
|
1226
1226
|
// .then(() => {
|
|
@@ -1248,3 +1248,27 @@ Promise.resolve()
|
|
|
1248
1248
|
// console.log(e);
|
|
1249
1249
|
// process.exit(1);
|
|
1250
1250
|
// })
|
|
1251
|
+
|
|
1252
|
+
Promise.resolve()
|
|
1253
|
+
.then(() => {
|
|
1254
|
+
// old package without gates forced
|
|
1255
|
+
const pkg = configUtils.packages.getPackage('folio-fo-ui', true);
|
|
1256
|
+
console.log(metadataUtils.package.isNewPackageBuild(pkg));
|
|
1257
|
+
|
|
1258
|
+
// existing pkg but forced to all gates
|
|
1259
|
+
const pkg2 = configUtils.packages.getPackage('mapar-administration-ui', true);
|
|
1260
|
+
console.log(metadataUtils.package.isNewPackageBuild(pkg2));
|
|
1261
|
+
|
|
1262
|
+
// newly created pkg
|
|
1263
|
+
const pkg3 = configUtils.packages.getPackage('cc-summa-shared-ui', true);
|
|
1264
|
+
console.log(metadataUtils.package.isNewPackageBuild(pkg3));
|
|
1265
|
+
|
|
1266
|
+
return auditUtils.styles.audit(pkg2);
|
|
1267
|
+
})
|
|
1268
|
+
.then((report) => {
|
|
1269
|
+
console.log(report);
|
|
1270
|
+
})
|
|
1271
|
+
|
|
1272
|
+
.catch((e) => {
|
|
1273
|
+
console.log(e);
|
|
1274
|
+
})
|
|
@@ -8,6 +8,7 @@ const glob = require('glob');
|
|
|
8
8
|
const tools = require('../../utils/tools');
|
|
9
9
|
const notificationUtils = require('../../utils/notification/notification-utils');
|
|
10
10
|
const configUtils = require('../config/config-utils');
|
|
11
|
+
const metadataUtils = require('../metadata/metadata-utils');
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
const runStylesAudit = module.exports.runStylesAudit = (pkg, customPath) => {
|
|
@@ -115,6 +116,10 @@ const runStylesAudit = module.exports.runStylesAudit = (pkg, customPath) => {
|
|
|
115
116
|
count: 0,
|
|
116
117
|
indices: []
|
|
117
118
|
},
|
|
119
|
+
allModules: {
|
|
120
|
+
count: 0,
|
|
121
|
+
indices: []
|
|
122
|
+
},
|
|
118
123
|
uxCmp: {
|
|
119
124
|
count: 0,
|
|
120
125
|
// indices: []
|
|
@@ -266,7 +271,20 @@ const runStylesAudit = module.exports.runStylesAudit = (pkg, customPath) => {
|
|
|
266
271
|
}
|
|
267
272
|
report.material.count += materialIndices.length;
|
|
268
273
|
report.material.indices = [...report.material.indices, ...generateIndicesContent(materialIndices, file, fileContent)];
|
|
269
|
-
|
|
274
|
+
|
|
275
|
+
let allModulesIndices = [];
|
|
276
|
+
regex = /EuiAllModule/gi;
|
|
277
|
+
while ( (result = regex.exec(fileContent)) ) {
|
|
278
|
+
allModulesIndices.push(result.index);
|
|
279
|
+
}
|
|
280
|
+
regex = /UxAllModule/gi;
|
|
281
|
+
while ( (result = regex.exec(fileContent)) ) {
|
|
282
|
+
allModulesIndices.push(result.index);
|
|
283
|
+
}
|
|
284
|
+
report.allModules.count += allModulesIndices.length;
|
|
285
|
+
report.allModules.indices = [...report.allModules.indices, ...generateIndicesContent(allModulesIndices, file, fileContent)];
|
|
286
|
+
|
|
287
|
+
})
|
|
270
288
|
|
|
271
289
|
|
|
272
290
|
|
|
@@ -380,6 +398,12 @@ const runStylesAudit = module.exports.runStylesAudit = (pkg, customPath) => {
|
|
|
380
398
|
status: (report.primeng.count !== 0) ? 'CRITICAL' : 'OK',
|
|
381
399
|
comment: (report.primeng.count !== 0) ? 'Remove any PrimeNG usage, deprecated in eUI - this will be blocking as of eUI 16' : null
|
|
382
400
|
}
|
|
401
|
+
report.finalReport['allModules'] = {
|
|
402
|
+
description: 'Usage of EuiAllModule or UxAllModule',
|
|
403
|
+
value: report.allModules.count,
|
|
404
|
+
status: (report.allModules.count !== 0) ? 'CRITICAL' : 'OK',
|
|
405
|
+
comment: (report.allModules.count !== 0) ? 'Use only tree-shakable eUI module imports (as of 15+)' : null
|
|
406
|
+
}
|
|
383
407
|
|
|
384
408
|
// IMPROVE ONLY
|
|
385
409
|
|
|
@@ -444,6 +468,8 @@ module.exports.audit = (pkg) => {
|
|
|
444
468
|
return;
|
|
445
469
|
}
|
|
446
470
|
|
|
471
|
+
let outputReport;
|
|
472
|
+
|
|
447
473
|
tools.logTitle('Audit package styles');
|
|
448
474
|
|
|
449
475
|
const report = runStylesAudit(pkg);
|
|
@@ -452,6 +478,8 @@ module.exports.audit = (pkg) => {
|
|
|
452
478
|
return;
|
|
453
479
|
}
|
|
454
480
|
|
|
481
|
+
outputReport = report;
|
|
482
|
+
|
|
455
483
|
return Promise.resolve()
|
|
456
484
|
.then(() => {
|
|
457
485
|
// FINAL REPORT
|
|
@@ -495,19 +523,40 @@ module.exports.audit = (pkg) => {
|
|
|
495
523
|
return;
|
|
496
524
|
}
|
|
497
525
|
|
|
498
|
-
|
|
499
|
-
const gates = configOptions.AUDIT_STYLES_GATES[euiVersion];
|
|
526
|
+
tools.logTitle(`Checking audit styles gates`);
|
|
500
527
|
|
|
501
|
-
|
|
528
|
+
// getting gates
|
|
529
|
+
let gates;
|
|
530
|
+
const euiVersionGates = configOptions.AUDIT_STYLES_GATES[euiVersion];
|
|
531
|
+
const allNewGates = configOptions.AUDIT_STYLES_GATES['ALL_NEW'];
|
|
502
532
|
|
|
503
|
-
|
|
504
|
-
if (
|
|
505
|
-
tools.logInfo('
|
|
506
|
-
|
|
533
|
+
tools.logInfo('Checking if the package as gates forced');
|
|
534
|
+
if (pkg.build && pkg.build.stylesAuditCheck) {
|
|
535
|
+
tools.logInfo('All gates checks applied');
|
|
536
|
+
gates = allNewGates;
|
|
537
|
+
|
|
538
|
+
} else {
|
|
539
|
+
tools.logInfo('===> no forced gates flag detected ...');
|
|
540
|
+
tools.logInfo('Checking if package is newly created -- all versions gates are checked in that case');
|
|
541
|
+
|
|
542
|
+
if (metadataUtils.package.isNewPackageBuild(pkg)) {
|
|
543
|
+
gates = allNewGates;
|
|
544
|
+
|
|
545
|
+
} else {
|
|
546
|
+
if (euiVersionGates) {
|
|
547
|
+
tools.logInfo('eUI version gates found, applied to older packages where limited gates are set');
|
|
548
|
+
gates = euiVersionGates;
|
|
549
|
+
|
|
550
|
+
} else {
|
|
551
|
+
tools.logInfo('No gates found for local eUI version...');
|
|
552
|
+
return;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
507
555
|
}
|
|
508
556
|
|
|
509
557
|
tools.logInfo(`Gates found : ${JSON.stringify(gates)}`);
|
|
510
558
|
|
|
559
|
+
|
|
511
560
|
// checking gates level if any
|
|
512
561
|
let gatesPassed = true;
|
|
513
562
|
|
|
@@ -533,6 +582,28 @@ module.exports.audit = (pkg) => {
|
|
|
533
582
|
}
|
|
534
583
|
})
|
|
535
584
|
|
|
585
|
+
.then(() => {
|
|
586
|
+
// formatting report for metadata storage
|
|
587
|
+
|
|
588
|
+
const metadataReport = {
|
|
589
|
+
score: outputReport.score,
|
|
590
|
+
total: outputReport.total,
|
|
591
|
+
pcScore: outputReport.pcScore,
|
|
592
|
+
};
|
|
593
|
+
|
|
594
|
+
const summarizedFinalReport = {};
|
|
595
|
+
Object.keys(outputReport.finalReport).forEach((item) => {
|
|
596
|
+
summarizedFinalReport[item] = {
|
|
597
|
+
value: outputReport.finalReport[item].value,
|
|
598
|
+
status: outputReport.finalReport[item].status,
|
|
599
|
+
};
|
|
600
|
+
});
|
|
601
|
+
|
|
602
|
+
metadataReport.finalReport = summarizedFinalReport;
|
|
603
|
+
|
|
604
|
+
return metadataReport;
|
|
605
|
+
})
|
|
606
|
+
|
|
536
607
|
.catch((e) => {
|
|
537
608
|
throw e;
|
|
538
609
|
})
|
|
@@ -383,7 +383,16 @@ module.exports.getConfigOptions = () => {
|
|
|
383
383
|
const gatesForVersion = audit.styles.gates[v];
|
|
384
384
|
configOptions.AUDIT_STYLES_GATES[v] = {
|
|
385
385
|
"material": gatesForVersion.material,
|
|
386
|
-
"primeng": gatesForVersion.primeng
|
|
386
|
+
"primeng": gatesForVersion.primeng,
|
|
387
|
+
"euiOverrides": gatesForVersion.euiOverrides,
|
|
388
|
+
"sizesPxEm": gatesForVersion.sizesPxEm,
|
|
389
|
+
"boxShadow": gatesForVersion.boxShadow,
|
|
390
|
+
"fontFamily": gatesForVersion.fontFamily,
|
|
391
|
+
"plainColors": gatesForVersion.plainColors,
|
|
392
|
+
"important": gatesForVersion.important,
|
|
393
|
+
"ngDeep": gatesForVersion.ngDeep,
|
|
394
|
+
"inlineStyles": gatesForVersion.inlineStyles,
|
|
395
|
+
"uxCmp": gatesForVersion.uxCmp
|
|
387
396
|
};
|
|
388
397
|
})
|
|
389
398
|
}
|
|
@@ -37,7 +37,7 @@ module.exports.getMetadataSync = (pkg) => {
|
|
|
37
37
|
return tools.getJsonFileContent(path.join(DEVOPS_METADATA_PATH, pkg.devopsVersionsMetadataFile));
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
module.exports.storeMetadata = (pkg, pkgVersion, pkgCompositeDeps, duration, envTarget, branches) => {
|
|
40
|
+
module.exports.storeMetadata = (pkg, pkgVersion, pkgCompositeDeps, duration, envTarget, branches, auditStylesReport) => {
|
|
41
41
|
return Promise.resolve()
|
|
42
42
|
.then(() => {
|
|
43
43
|
tools.logInfo('Storing package version history metadata...');
|
|
@@ -75,6 +75,12 @@ module.exports.storeMetadata = (pkg, pkgVersion, pkgCompositeDeps, duration, env
|
|
|
75
75
|
hotfix: isHotfixVersion,
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
+
if (auditStylesReport) {
|
|
79
|
+
if (!pkg.backend && !pkg.remote) {
|
|
80
|
+
newVersionMetadata.auditStylesReport = auditStylesReport;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
78
84
|
if (pkg.remote) {
|
|
79
85
|
tools.logInfo('Writing remote composite dependencies');
|
|
80
86
|
newVersionMetadata.dependencies = pkgCompositeDeps;
|
|
@@ -17,13 +17,13 @@ const innerPackageVersions = require('./package-versions');
|
|
|
17
17
|
const { dryRun } = tools.getArgs();
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
module.exports.storeMetadata = (pkg, pkgVersion, pkgMetadata, branches, pkgCompositeDeps, duration, envTarget) => {
|
|
20
|
+
module.exports.storeMetadata = (pkg, pkgVersion, pkgMetadata, branches, pkgCompositeDeps, duration, envTarget, auditStylesReport) => {
|
|
21
21
|
|
|
22
22
|
tools.logTitle('Storing central and package metadata...');
|
|
23
23
|
|
|
24
24
|
return Promise.resolve()
|
|
25
25
|
.then(() => {
|
|
26
|
-
return innerPackageVersions.storeMetadata(pkg, pkgVersion, pkgCompositeDeps, duration, envTarget, branches);
|
|
26
|
+
return innerPackageVersions.storeMetadata(pkg, pkgVersion, pkgCompositeDeps, duration, envTarget, branches, auditStylesReport);
|
|
27
27
|
})
|
|
28
28
|
|
|
29
29
|
.then(() => {
|
|
@@ -242,6 +242,35 @@ module.exports.getPackageVersionLast = (pkg) => {
|
|
|
242
242
|
return;
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
+
module.exports.getPackageVersionFirst = (pkg) => {
|
|
246
|
+
const pkgVersionsJson = this.getPackageVersionsJson(pkg);
|
|
247
|
+
|
|
248
|
+
if (pkgVersionsJson && pkgVersionsJson.versions) {
|
|
249
|
+
return pkgVersionsJson.versions[0];
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
module.exports.isNewPackageBuild = (pkg) => {
|
|
256
|
+
tools.logInfo('Checking if package is a newly created one : first build date after 2023/06/01');
|
|
257
|
+
|
|
258
|
+
const firstPackageVersion = this.getPackageVersionFirst(pkg);
|
|
259
|
+
|
|
260
|
+
if (firstPackageVersion) {
|
|
261
|
+
const pkgDate = firstPackageVersion.date;
|
|
262
|
+
|
|
263
|
+
const pivotDate = moment('20230601');
|
|
264
|
+
const pkgDateM = moment(pkgDate, 'YYYYMMDD-HH:mm');
|
|
265
|
+
tools.logInfo(`First package build version date : ${pkgDate}`);
|
|
266
|
+
tools.logInfo(`==> NEW package : ${pkgDateM > pivotDate}`);
|
|
267
|
+
return pkgDateM > pivotDate;
|
|
268
|
+
|
|
269
|
+
} else {
|
|
270
|
+
tools.logInfo(`==> no versions metadata found : first build, package is new`);
|
|
271
|
+
return true;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
245
274
|
|
|
246
275
|
module.exports.getPackageVersionsByMajor = (pkg, major, isMaster) => {
|
|
247
276
|
const pkgVersions = this.getPackageVersions(pkg);
|
|
@@ -483,7 +483,7 @@ module.exports.runGitOperations = (pkg, version) => {
|
|
|
483
483
|
|
|
484
484
|
|
|
485
485
|
|
|
486
|
-
module.exports.storeMetadata = (pkg, version, pkgMetadata, pkgCompositeDeps, duration, envTarget) => {
|
|
486
|
+
module.exports.storeMetadata = (pkg, version, pkgMetadata, pkgCompositeDeps, duration, envTarget, auditStylesReport) => {
|
|
487
487
|
utils.tools.logBanner('STORE METADATA');
|
|
488
488
|
|
|
489
489
|
const branches = this.getBranches();
|
|
@@ -495,7 +495,8 @@ module.exports.storeMetadata = (pkg, version, pkgMetadata, pkgCompositeDeps, dur
|
|
|
495
495
|
branches,
|
|
496
496
|
pkgCompositeDeps,
|
|
497
497
|
duration,
|
|
498
|
-
envTarget
|
|
498
|
+
envTarget,
|
|
499
|
+
auditStylesReport,
|
|
499
500
|
);
|
|
500
501
|
})
|
|
501
502
|
|
|
@@ -40,7 +40,7 @@ module.exports.run = () => {
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
// local saved vars
|
|
43
|
-
var newVersion, pkgMetadata, pkgCompositeDeps;
|
|
43
|
+
var newVersion, pkgMetadata, pkgCompositeDeps, auditStylesReport;
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
return Promise.resolve()
|
|
@@ -119,6 +119,10 @@ module.exports.run = () => {
|
|
|
119
119
|
.then(() => {
|
|
120
120
|
return utils.buildPackage.build(pkg, branches.isMaster);
|
|
121
121
|
})
|
|
122
|
+
.then((report) => {
|
|
123
|
+
// storing audit styles metadata for storage
|
|
124
|
+
auditStylesReport = report;
|
|
125
|
+
})
|
|
122
126
|
|
|
123
127
|
|
|
124
128
|
// EXECUTING SONAR ANALYSIS
|
|
@@ -179,7 +183,7 @@ module.exports.run = () => {
|
|
|
179
183
|
.then(() => {
|
|
180
184
|
// get run duration
|
|
181
185
|
const duration = utils.pipeline.getTimerDuration();
|
|
182
|
-
return innerCommon.storeMetadata(pkg, newVersion, pkgMetadata, pkgCompositeDeps, duration, envTarget);
|
|
186
|
+
return innerCommon.storeMetadata(pkg, newVersion, pkgMetadata, pkgCompositeDeps, duration, envTarget, auditStylesReport);
|
|
183
187
|
})
|
|
184
188
|
|
|
185
189
|
// STORING PACKAGE HISTORY
|
|
@@ -19,6 +19,8 @@ module.exports.build = (pkg, isMaster) => {
|
|
|
19
19
|
// FETCH ARGS
|
|
20
20
|
let { deps, skipClean, skipLint, skipTest, skipCompile, skipDoc, build, skipAudit } = pkg.build? {...pkg.build, ...tools.getArgs()} : tools.getArgs();
|
|
21
21
|
|
|
22
|
+
let auditStylesReport;
|
|
23
|
+
|
|
22
24
|
return Promise.resolve()
|
|
23
25
|
.then(() => {
|
|
24
26
|
if (deps === true) {
|
|
@@ -92,7 +94,11 @@ module.exports.build = (pkg, isMaster) => {
|
|
|
92
94
|
return auditUtils.styles.audit(pkg);
|
|
93
95
|
}
|
|
94
96
|
})
|
|
95
|
-
.then(() => {
|
|
97
|
+
.then((report) => {
|
|
98
|
+
if (report) {
|
|
99
|
+
auditStylesReport = report;
|
|
100
|
+
}
|
|
101
|
+
|
|
96
102
|
if (!skipCompile) {
|
|
97
103
|
tools.logInfo('Bundling package...');
|
|
98
104
|
let args = ['--max_old_space_size=8096', ng, 'build', pkg.name];
|
|
@@ -218,6 +224,10 @@ module.exports.build = (pkg, isMaster) => {
|
|
|
218
224
|
})
|
|
219
225
|
})
|
|
220
226
|
|
|
227
|
+
.then(() => {
|
|
228
|
+
return auditStylesReport;
|
|
229
|
+
})
|
|
230
|
+
|
|
221
231
|
.catch((e) => {
|
|
222
232
|
throw e;
|
|
223
233
|
});
|