@eui/tools 6.11.32 → 6.12.0

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.
@@ -1 +1 @@
1
- 6.11.32
1
+ 6.12.0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 6.12.0 (2023-06-13)
2
+
3
+ ##### New Features
4
+
5
+ * **audit:**
6
+ * 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))
7
+
8
+ * * *
9
+ * * *
1
10
  ## 6.11.32 (2023-06-09)
2
11
 
3
12
  ##### Chores
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "6.11.32",
3
+ "version": "6.12.0",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
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
- .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
- })
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,20 @@ Promise.resolve()
1248
1248
  // console.log(e);
1249
1249
  // process.exit(1);
1250
1250
  // })
1251
+
1252
+ Promise.resolve()
1253
+ .then(() => {
1254
+ const pkg = configUtils.packages.getPackage('folio-fo-ui', true);
1255
+ console.log(metadataUtils.package.isNewPackageBuild(pkg));
1256
+ const pkg2 = configUtils.packages.getPackage('cc-summa-shared-ui', true);
1257
+ console.log(metadataUtils.package.isNewPackageBuild(pkg2));
1258
+
1259
+ return auditUtils.styles.audit(pkg);
1260
+ })
1261
+ .then(() => {
1262
+ console.log('ok');
1263
+ })
1264
+
1265
+ .catch((e) => {
1266
+ console.log(e);
1267
+ })
@@ -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) => {
@@ -496,14 +497,22 @@ module.exports.audit = (pkg) => {
496
497
  }
497
498
 
498
499
  // getting gates for euiVersion found
499
- const gates = configOptions.AUDIT_STYLES_GATES[euiVersion];
500
+ let gates = configOptions.AUDIT_STYLES_GATES[euiVersion];
500
501
 
501
502
  tools.logTitle(`Checking audit styles gates for local euiVersion : ${euiVersion}`);
502
503
 
503
- // if no gates found for corresponding version, no action
504
+ // if no gates found for corresponding version, checking if new package for new builds
504
505
  if (!gates) {
505
- tools.logInfo('No gates found for local eUI version...skipping');
506
- return;
506
+ tools.logInfo('No gates found for local eUI version...');
507
+
508
+ tools.logInfo('Checking if package is newly created -- all versions gates are checked in that case');
509
+
510
+ if (metadataUtils.package.isNewPackageBuild(pkg)) {
511
+ gates = configOptions.AUDIT_STYLES_GATES['ALL_NEW'];
512
+ } else {
513
+ tools.logInfo('Package is not a newly created package...skipping gates checks...');
514
+ return;
515
+ }
507
516
  }
508
517
 
509
518
  tools.logInfo(`Gates found : ${JSON.stringify(gates)}`);
@@ -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
  }
@@ -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);