@eui/tools 6.14.10 → 6.14.11
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 +9 -0
- package/package.json +1 -1
- package/scripts/csdr/audit/styles.js +163 -91
- package/scripts/csdr/config/packages.js +64 -57
package/.version.properties
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
6.14.
|
|
1
|
+
6.14.11
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## 6.14.11 (2023-12-08)
|
|
2
|
+
|
|
3
|
+
##### Chores
|
|
4
|
+
|
|
5
|
+
* **other:**
|
|
6
|
+
* 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))
|
|
7
|
+
|
|
8
|
+
* * *
|
|
9
|
+
* * *
|
|
1
10
|
## 6.14.10 (2023-12-06)
|
|
2
11
|
|
|
3
12
|
##### Chores
|
package/package.json
CHANGED
|
@@ -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;
|
|
@@ -9,10 +9,9 @@ const tools = require('../../utils/tools');
|
|
|
9
9
|
// INNER MODULES
|
|
10
10
|
const innerGlobal = require('./global');
|
|
11
11
|
|
|
12
|
-
|
|
13
12
|
module.exports.getCsdrPackages = () => {
|
|
14
13
|
return innerGlobal.getCsdrConfig(false).packages;
|
|
15
|
-
}
|
|
14
|
+
};
|
|
16
15
|
|
|
17
16
|
module.exports.getCsdrPackagesFull = (flattenChildren = true) => {
|
|
18
17
|
const packages = innerGlobal.getCsdrConfig(flattenChildren).packages;
|
|
@@ -26,11 +25,11 @@ module.exports.getCsdrPackagesFull = (flattenChildren = true) => {
|
|
|
26
25
|
// tools.logInfo(`Package: ${p} is in local config but not found in global... should be cleaned up`);
|
|
27
26
|
// console.log(e);
|
|
28
27
|
}
|
|
29
|
-
})
|
|
28
|
+
});
|
|
30
29
|
return outputPackages;
|
|
31
|
-
}
|
|
30
|
+
};
|
|
32
31
|
|
|
33
|
-
const getPackages = module.exports.getPackages = () => {
|
|
32
|
+
const getPackages = (module.exports.getPackages = () => {
|
|
34
33
|
const packages = innerGlobal.getConfig().packages;
|
|
35
34
|
const packagesKeys = Object.keys(packages);
|
|
36
35
|
|
|
@@ -42,10 +41,9 @@ const getPackages = module.exports.getPackages = () => {
|
|
|
42
41
|
// tools.logInfo(`Package: ${p} is in local config but not found in global... should be cleaned up`);
|
|
43
42
|
// console.log(e);
|
|
44
43
|
}
|
|
45
|
-
})
|
|
44
|
+
});
|
|
46
45
|
return outputPackages;
|
|
47
|
-
}
|
|
48
|
-
|
|
46
|
+
});
|
|
49
47
|
|
|
50
48
|
module.exports.getPackageByNpmPkg = (npmPkg, fromCsdrConfig) => {
|
|
51
49
|
let packages;
|
|
@@ -54,7 +52,7 @@ module.exports.getPackageByNpmPkg = (npmPkg, fromCsdrConfig) => {
|
|
|
54
52
|
if (fromCsdrConfig) {
|
|
55
53
|
packages = innerGlobal.getCsdrConfig().packages;
|
|
56
54
|
|
|
57
|
-
|
|
55
|
+
// get only packages installed config based on super .euirc.json file generated
|
|
58
56
|
} else {
|
|
59
57
|
packages = innerGlobal.getConfig().packages;
|
|
60
58
|
}
|
|
@@ -69,7 +67,7 @@ module.exports.getPackageByNpmPkg = (npmPkg, fromCsdrConfig) => {
|
|
|
69
67
|
}
|
|
70
68
|
|
|
71
69
|
return;
|
|
72
|
-
}
|
|
70
|
+
};
|
|
73
71
|
|
|
74
72
|
module.exports.getPackageByRepository = (repository, fromCsdrConfig) => {
|
|
75
73
|
let packages;
|
|
@@ -78,7 +76,7 @@ module.exports.getPackageByRepository = (repository, fromCsdrConfig) => {
|
|
|
78
76
|
if (fromCsdrConfig) {
|
|
79
77
|
packages = innerGlobal.getCsdrConfig().packages;
|
|
80
78
|
|
|
81
|
-
|
|
79
|
+
// get only packages installed config based on super .euirc.json file generated
|
|
82
80
|
} else {
|
|
83
81
|
packages = innerGlobal.getConfig().packages;
|
|
84
82
|
}
|
|
@@ -93,16 +91,15 @@ module.exports.getPackageByRepository = (repository, fromCsdrConfig) => {
|
|
|
93
91
|
}
|
|
94
92
|
|
|
95
93
|
return;
|
|
96
|
-
}
|
|
94
|
+
};
|
|
97
95
|
|
|
98
|
-
module.exports.isLocalPackage = (npmPkg) => {
|
|
96
|
+
const isLocalPackage = module.exports.isLocalPackage = (npmPkg) => {
|
|
99
97
|
tools.logInfo(`Checking if ${npmPkg} is localled installed`);
|
|
100
98
|
|
|
101
|
-
const packagesFound = getPackages().filter(p => p.npmPkg === npmPkg);
|
|
99
|
+
const packagesFound = getPackages().filter((p) => p.npmPkg === npmPkg);
|
|
102
100
|
|
|
103
101
|
return packagesFound.length > 0;
|
|
104
|
-
}
|
|
105
|
-
|
|
102
|
+
};
|
|
106
103
|
|
|
107
104
|
module.exports.getPackage = (pkgName, fromCsdrConfig, optional) => {
|
|
108
105
|
let packages;
|
|
@@ -111,12 +108,11 @@ module.exports.getPackage = (pkgName, fromCsdrConfig, optional) => {
|
|
|
111
108
|
if (fromCsdrConfig) {
|
|
112
109
|
packages = innerGlobal.getCsdrConfig().packages;
|
|
113
110
|
|
|
114
|
-
|
|
111
|
+
// get only packages installed config based on super .euirc.json file generated
|
|
115
112
|
} else {
|
|
116
113
|
packages = innerGlobal.getConfig().packages;
|
|
117
114
|
}
|
|
118
115
|
|
|
119
|
-
|
|
120
116
|
// checking if package has been provided as input param, if not we default to command line root argument
|
|
121
117
|
// if that case package name is f.e. : pkg:build <package-name>
|
|
122
118
|
if (!pkgName) {
|
|
@@ -126,7 +122,6 @@ module.exports.getPackage = (pkgName, fromCsdrConfig, optional) => {
|
|
|
126
122
|
// fetch package from config
|
|
127
123
|
let pkg = packages[pkgName];
|
|
128
124
|
|
|
129
|
-
|
|
130
125
|
if (!pkg && !optional) {
|
|
131
126
|
throw 'PACKAGE_NOT_FOUND';
|
|
132
127
|
}
|
|
@@ -136,7 +131,7 @@ module.exports.getPackage = (pkgName, fromCsdrConfig, optional) => {
|
|
|
136
131
|
|
|
137
132
|
// additional pkg infos
|
|
138
133
|
pkg.paths = this.getPackagePaths(pkg);
|
|
139
|
-
pkg.tsConfigFileName = `${path.parse(pkg.paths.tsConfig).name}.json
|
|
134
|
+
pkg.tsConfigFileName = `${path.parse(pkg.paths.tsConfig).name}.json`;
|
|
140
135
|
|
|
141
136
|
// devops file location
|
|
142
137
|
if (pkg.child) {
|
|
@@ -166,13 +161,28 @@ module.exports.getPackage = (pkgName, fromCsdrConfig, optional) => {
|
|
|
166
161
|
}
|
|
167
162
|
}
|
|
168
163
|
|
|
169
|
-
|
|
170
|
-
|
|
164
|
+
// set local package flag
|
|
165
|
+
if (tools.isDirExists(pkg.paths.root)) {
|
|
166
|
+
pkg.local = true;
|
|
167
|
+
} else {
|
|
168
|
+
pkg.local = false;
|
|
169
|
+
}
|
|
171
170
|
|
|
171
|
+
// derive srcRoot structure flag
|
|
172
|
+
if (pkg.local) {
|
|
173
|
+
if (tools.isDirExists(pkg.paths.srcLib)) {
|
|
174
|
+
pkg.srcRootDefault = true;
|
|
175
|
+
} else {
|
|
176
|
+
pkg.srcRootDefault = false;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return pkg;
|
|
181
|
+
};
|
|
172
182
|
|
|
173
183
|
module.exports.getPackagePaths = (pkg) => {
|
|
174
184
|
const rootDirectory = process.cwd();
|
|
175
|
-
const resolvePath = relativePath => path.resolve(rootDirectory, relativePath);
|
|
185
|
+
const resolvePath = (relativePath) => path.resolve(rootDirectory, relativePath);
|
|
176
186
|
|
|
177
187
|
const packagesBasePath = 'packages';
|
|
178
188
|
|
|
@@ -197,7 +207,8 @@ module.exports.getPackagePaths = (pkg) => {
|
|
|
197
207
|
}
|
|
198
208
|
|
|
199
209
|
// Remotes specific, to switch install root dir to the remote folder itself (independent dependencies / angular & eUI version, etc...)
|
|
200
|
-
var repoNodeModules,
|
|
210
|
+
var repoNodeModules,
|
|
211
|
+
remoteNodeModules = false;
|
|
201
212
|
const depsBaseFile = path.join(resolvePath(packagesPath + '/' + folder), 'dependencies-base.json');
|
|
202
213
|
const depsCompositeFile = path.join(resolvePath(packagesPath + '/' + folder), 'dependencies-composite.json');
|
|
203
214
|
if (pkg.remote && (tools.isFileExists(depsBaseFile) || tools.isFileExists(depsCompositeFile))) {
|
|
@@ -207,7 +218,6 @@ module.exports.getPackagePaths = (pkg) => {
|
|
|
207
218
|
repoNodeModules = resolvePath('node_modules');
|
|
208
219
|
}
|
|
209
220
|
|
|
210
|
-
|
|
211
221
|
// Central gathering for pkg paths, always refer to this when fetching pkg paths in code, single sources of truth
|
|
212
222
|
const paths = {
|
|
213
223
|
rootDirectory,
|
|
@@ -220,37 +230,38 @@ module.exports.getPackagePaths = (pkg) => {
|
|
|
220
230
|
publish: resolvePath(packagesPath + '/' + folder + publishFolder),
|
|
221
231
|
src: resolvePath(packagesPath + '/' + folder + '/src'),
|
|
222
232
|
lib: resolvePath(packagesPath + '/' + folder + '/src/lib'),
|
|
233
|
+
srcLib: resolvePath(packagesPath + '/' + folder + '/src/lib'),
|
|
223
234
|
tsConfig: this.getTSConfigPath(resolvePath, packagesPath + '/' + folder),
|
|
224
235
|
};
|
|
225
236
|
|
|
226
237
|
return paths;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
238
|
+
};
|
|
230
239
|
|
|
231
240
|
module.exports.getBuildablePackages = () => {
|
|
232
|
-
return this.getPackages().filter(pkg => {
|
|
241
|
+
return this.getPackages().filter((pkg) => {
|
|
233
242
|
if (!pkg.build) {
|
|
234
243
|
return true;
|
|
235
244
|
}
|
|
236
245
|
return pkg.build.exec !== false;
|
|
237
|
-
})
|
|
238
|
-
}
|
|
246
|
+
});
|
|
247
|
+
};
|
|
239
248
|
|
|
240
249
|
module.exports.getRemotePackages = () => {
|
|
241
|
-
return this.getPackages().filter(pkg => {
|
|
250
|
+
return this.getPackages().filter((pkg) => {
|
|
242
251
|
return pkg.remote;
|
|
243
|
-
})
|
|
244
|
-
}
|
|
252
|
+
});
|
|
253
|
+
};
|
|
245
254
|
|
|
246
255
|
module.exports.getBuildablePackagesWithDeps = () => {
|
|
247
|
-
return this.getDepGraph()
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
256
|
+
return this.getDepGraph()
|
|
257
|
+
.overallOrder()
|
|
258
|
+
.filter((pkg) => {
|
|
259
|
+
if (!pkg.build) {
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
262
|
+
return pkg.build.exec !== false;
|
|
263
|
+
});
|
|
264
|
+
};
|
|
254
265
|
|
|
255
266
|
module.exports.getDepGraph = () => {
|
|
256
267
|
const DepGraph = require('dependency-graph').DepGraph;
|
|
@@ -273,8 +284,7 @@ module.exports.getDepGraph = () => {
|
|
|
273
284
|
});
|
|
274
285
|
|
|
275
286
|
return graph;
|
|
276
|
-
}
|
|
277
|
-
|
|
287
|
+
};
|
|
278
288
|
|
|
279
289
|
const getEuiVersionCore = (pkg) => {
|
|
280
290
|
let version;
|
|
@@ -288,7 +298,7 @@ const getEuiVersionCore = (pkg) => {
|
|
|
288
298
|
if (euiDepsBase) {
|
|
289
299
|
let euiVersion = euiDepsBase.split('.')[0];
|
|
290
300
|
|
|
291
|
-
if (euiVersion.substr(0,1) === '^') {
|
|
301
|
+
if (euiVersion.substr(0, 1) === '^') {
|
|
292
302
|
euiVersion = euiVersion.substr(1);
|
|
293
303
|
}
|
|
294
304
|
version = `${euiVersion}.x`;
|
|
@@ -300,10 +310,9 @@ const getEuiVersionCore = (pkg) => {
|
|
|
300
310
|
}
|
|
301
311
|
|
|
302
312
|
return version;
|
|
303
|
-
}
|
|
304
|
-
|
|
313
|
+
};
|
|
305
314
|
|
|
306
|
-
const getPackageEuiVersion = module.exports.getPackageEuiVersion = (pkg, log = false) => {
|
|
315
|
+
const getPackageEuiVersion = (module.exports.getPackageEuiVersion = (pkg, log = false) => {
|
|
307
316
|
if (pkg.parent !== true && pkg.tsPackage !== false) {
|
|
308
317
|
let version;
|
|
309
318
|
|
|
@@ -331,9 +340,7 @@ const getPackageEuiVersion = module.exports.getPackageEuiVersion = (pkg, log = f
|
|
|
331
340
|
|
|
332
341
|
return version;
|
|
333
342
|
}
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
|
|
343
|
+
});
|
|
337
344
|
|
|
338
345
|
module.exports.getLocalPackagesEuiVersion = (log = true) => {
|
|
339
346
|
tools.logTitle('getting local packages installed eUI version...');
|
|
@@ -347,29 +354,29 @@ module.exports.getLocalPackagesEuiVersion = (log = true) => {
|
|
|
347
354
|
if (version) {
|
|
348
355
|
versionsFound.push(version);
|
|
349
356
|
}
|
|
350
|
-
})
|
|
357
|
+
});
|
|
351
358
|
|
|
352
359
|
versionsFound = tools.removeArrayDuplicates(versionsFound);
|
|
353
360
|
|
|
354
361
|
return versionsFound;
|
|
355
|
-
}
|
|
362
|
+
};
|
|
356
363
|
|
|
357
364
|
module.exports.getTSConfigPath = (resolvePath, packagePath) => {
|
|
358
365
|
const tsPath = resolvePath(`${packagePath}/tsconfig.json`);
|
|
359
366
|
const oldPath = resolvePath(`${packagePath}/tsconfig.lib.json`);
|
|
360
367
|
|
|
361
368
|
return tools.isFileExists(tsPath) ? tsPath : oldPath;
|
|
362
|
-
}
|
|
369
|
+
};
|
|
363
370
|
|
|
364
371
|
module.exports.getTSConfigFileName = (tsConfigPath) => {
|
|
365
372
|
return tsConfigPath.split('/')[tsConfigPath.split('/').length - 1];
|
|
366
|
-
}
|
|
373
|
+
};
|
|
367
374
|
|
|
368
375
|
module.exports.getPackageScopes = () => {
|
|
369
376
|
const packagesObj = this.getCsdrPackages();
|
|
370
377
|
let packages = Object.keys(packagesObj);
|
|
371
|
-
packages = packages.map(p => packagesObj[p]).filter(p => !p.backend && !p.remote && p.npmPkg !== undefined);
|
|
372
|
-
const scopes = packages.map(p => p.npmPkg.split('/')[0]);
|
|
378
|
+
packages = packages.map((p) => packagesObj[p]).filter((p) => !p.backend && !p.remote && p.npmPkg !== undefined);
|
|
379
|
+
const scopes = packages.map((p) => p.npmPkg.split('/')[0]);
|
|
373
380
|
|
|
374
381
|
return tools.removeArrayDuplicates(scopes);
|
|
375
|
-
}
|
|
382
|
+
};
|