@eui/tools 6.12.5 → 6.12.7

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.12.5
1
+ 6.12.7
package/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## 6.12.7 (2023-06-19)
2
+
3
+ ##### Bug Fixes
4
+
5
+ * **other:**
6
+ * audit-styles for indices count - adapted injection of yarn.lock for remote build - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([9b4bb063](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/9b4bb06339e34a671af1526d258f58fffde1f87d))
7
+
8
+ * * *
9
+ * * *
10
+ ## 6.12.6 (2023-06-19)
11
+
12
+ ##### Bug Fixes
13
+
14
+ * **audit:**
15
+ * mark known allowed material entries as excluded from audit - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([e9e4d8e4](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/e9e4d8e449e0c414030c0c0eff709535f8e7f369))
16
+
17
+ * * *
18
+ * * *
1
19
  ## 6.12.5 (2023-06-19)
2
20
 
3
21
  ##### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "6.12.5",
3
+ "version": "6.12.7",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
@@ -13,7 +13,7 @@ const metadataUtils = require('../metadata/metadata-utils');
13
13
 
14
14
  const runStylesAudit = module.exports.runStylesAudit = (pkg, customPath) => {
15
15
 
16
- const generateIndicesContent = (indices, file, fileContent) => {
16
+ const generateIndicesContent = (indices, file, fileContent, exclusions = []) => {
17
17
  let content = [];
18
18
 
19
19
  indices.forEach((i) => {
@@ -28,16 +28,39 @@ const runStylesAudit = module.exports.runStylesAudit = (pkg, customPath) => {
28
28
 
29
29
  const lineNumber = fileContent.substring(0, i).split('\n').length;
30
30
 
31
- content.push({
32
- file: file,
33
- lineNumber: lineNumber,
34
- content: indiceContent,
31
+ let excluded = false;
32
+ exclusions.forEach((exclusion) => {
33
+ if (indiceContent.indexOf(exclusion) > -1) {
34
+ excluded = true;
35
+ }
35
36
  })
37
+
38
+ if (!excluded) {
39
+ content.push({
40
+ file: file,
41
+ lineNumber: lineNumber,
42
+ content: indiceContent,
43
+ })
44
+ }
36
45
  })
37
46
 
38
47
  return content;
39
48
  }
40
49
 
50
+ const recalculateIndicesCount = (indicesContent) => {
51
+ let count = 0;
52
+
53
+ if (indicesContent && indicesContent.length !== 0) {
54
+ indicesContent.forEach((ic) => {
55
+ ic.forEach((icd) => {
56
+ count++;
57
+ });
58
+ });
59
+ }
60
+
61
+ return count;
62
+ }
63
+
41
64
  const getStatus = (count) => {
42
65
  return (count > 5) ? 'CRITICAL' : (count > 0 && count <= 5) ? 'IMPROVE' : 'OK';
43
66
  }
@@ -285,8 +308,16 @@ const runStylesAudit = module.exports.runStylesAudit = (pkg, customPath) => {
285
308
  while ( (result = regex.exec(fileContent)) ) {
286
309
  materialIndices.push(result.index);
287
310
  }
288
- report.material.count += materialIndices.length;
289
- report.material.indices = [...report.material.indices, ...generateIndicesContent(materialIndices, file, fileContent)];
311
+ const indicesContent = generateIndicesContent(
312
+ materialIndices, file, fileContent,
313
+ [
314
+ '@angular/material/core',
315
+ '@angular/material-moment-adapter'
316
+ ]
317
+ );
318
+
319
+ report.material.count += recalculateIndicesCount(indicesContent);
320
+ report.material.indices = [...report.material.indices, indicesContent];
290
321
 
291
322
  let allModulesIndices = [];
292
323
  regex = /EuiAllModule/gi;
@@ -116,3 +116,43 @@ module.exports.initRootFilesAndResolutions = () => {
116
116
  throw e;
117
117
  })
118
118
  }
119
+
120
+
121
+ module.exports.initRemoteFilesAndResolutions = (packageJsonPath, euiVersion) => {
122
+ tools.logTitle('Processing remote injections for local installed eUI versions if needed');
123
+
124
+ processResolutionsInjection(packageJsonPath, euiVersion);
125
+
126
+ if (!euiVersion || euiVersion === 'DEFAULT') {
127
+ tools.logInfo('euiVersion not found skippint yarn.lock replacement');
128
+
129
+ } else {
130
+ tools.logInfo(`Processing .browserlistrc replacement for eUI version found : ${euiVersion}`);
131
+
132
+ const blResourcesFile = path.join(__dirname, 'resources', euiVersion, 'browserslistrc');
133
+ const blDestFile = path.join(packageJsonPath, '.browserslistrc');
134
+
135
+ if (tools.isFileExists(blResourcesFile)) {
136
+ tools.copy(blResourcesFile, blDestFile);
137
+ } else {
138
+ tools.logInfo('Not found...skipping');
139
+ }
140
+
141
+ tools.logInfo(`Processing yarn.lock replacement for eUI version found : ${euiVersion}`);
142
+
143
+ if (registry) {
144
+ tools.logInfo('Alternate registry found...skipping yarn.lock remplacement');
145
+ return;
146
+ }
147
+
148
+ const yResourcesFile = path.join(__dirname, 'resources', euiVersion, 'yarn.lock');
149
+ const yDestFile = path.join(packageJsonPath, 'yarn.lock');
150
+
151
+ if (tools.isFileExists(yResourcesFile)) {
152
+ tools.copy(yResourcesFile, yDestFile);
153
+ } else {
154
+ tools.logInfo('Not found...skipping');
155
+ }
156
+ }
157
+ }
158
+
@@ -88,7 +88,7 @@ const pkgInstall = (pkg, envTarget, compositeType) => {
88
88
  const euiVersion = configUtils.packages.getPackageEuiVersion(pkg);
89
89
 
90
90
  // checking for resolution updates according to eUI version used
91
- initUtils.global.processResolutionsInjection(pkg.paths.root, euiVersion);
91
+ initUtils.global.initRemoteFilesAndResolutions(pkg.paths.root, euiVersion);
92
92
 
93
93
 
94
94
  if (dryRun) {