@eui/tools 5.3.90 → 6.1.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 +40 -0
- package/bin/eui-scripts.js +2 -0
- package/bin/scripts/audit-package.js +10 -0
- package/bin/scripts/csdr-upgrade-deps.js +1 -4
- package/package.json +1 -1
- package/sandbox.js +176 -108
- package/scripts/csdr/audit/audit-utils.js +3 -98
- package/scripts/csdr/audit/deps.js +89 -0
- package/scripts/csdr/audit/styles.js +457 -0
- package/scripts/csdr/audit/yarn.js +105 -0
- package/scripts/csdr/config/angular.js +26 -23
- package/scripts/csdr/config/global.js +18 -18
- package/scripts/csdr/config/packages.js +86 -14
- package/scripts/csdr/config/projects.js +54 -6
- package/scripts/csdr/config/sync.js +15 -1
- package/scripts/csdr/init/global.js +122 -0
- package/scripts/csdr/init/init-utils.js +8 -296
- package/scripts/csdr/init/init.js +44 -14
- package/scripts/csdr/init/meta.js +3 -2
- package/scripts/csdr/init/packages.js +142 -0
- package/scripts/csdr/init/projects.js +112 -0
- package/scripts/csdr/init/remotes.js +21 -0
- package/scripts/csdr/init/repos.js +5 -31
- package/scripts/csdr/install/common.js +43 -385
- package/scripts/csdr/install/local-dev.js +55 -46
- package/scripts/csdr/install/packages.js +183 -3
- package/scripts/csdr/install/projects.js +202 -2
- package/scripts/csdr/release/package/release-package.js +26 -56
- package/scripts/csdr/release/package/ui.js +6 -85
- package/scripts/csdr/sync/sync-utils.js +8 -8
- package/scripts/csdr/version/app-default.js +0 -3
- package/scripts/csdr/version/package-common.js +2 -4
- package/scripts/csdr/version/package-remote.js +0 -4
- package/scripts/index.js +0 -2
- package/scripts/utils/build/package/build-package-utils.js +5 -13
- package/scripts/utils/build/package/maven.js +6 -12
- package/scripts/utils/build/package/nodeJs.js +0 -1
- package/scripts/utils/build/package/postcss.config.js +0 -2
- package/scripts/utils/build/package/styles.js +1 -0
- package/scripts/utils/changelog-utils.js +4 -2
- package/scripts/utils/git-utils.js +46 -0
- package/scripts/utils/pre-build/elements.js +1 -1
- package/scripts/utils/pre-build/injection/config.js +21 -134
- package/scripts/utils/pre-build/injection/externals.js +135 -90
- package/scripts/utils/pre-build/injection/routes-replacement.js +67 -15
- package/scripts/utils/pre-build/injection/skeletons.js +3 -2
- package/scripts/utils/pre-build/projects.js +1 -3
- package/scripts/utils/publish/npm.js +1 -2
- package/scripts/utils/serve/element.js +17 -2
- package/scripts/utils/svg-utils.js +2 -3
- package/scripts/utils/test/test-utils.js +5 -49
- package/scripts/utils/tools.js +4 -1
- package/scripts/utils/build/package/nestJs.js +0 -45
- package/scripts/utils/build/package/stencil.js +0 -13
package/.version.properties
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
6.1.1
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,43 @@
|
|
|
1
|
+
## 6.1.1 (2022-11-06)
|
|
2
|
+
|
|
3
|
+
##### Chores
|
|
4
|
+
|
|
5
|
+
* **other:**
|
|
6
|
+
* cleanup sandbox add audit pc score - EUI-6448 [EUI-6448](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-6448) ([71addfb8](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/71addfb8f8b2cc4f392e1efb8a49c98948bd1a87))
|
|
7
|
+
* audit final testing - EUI-6448 [EUI-6448](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-6448) ([e2c35c10](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/e2c35c10bbea2445a67b89934d210843b7c6bc00))
|
|
8
|
+
* refactoring / cleanup - added audit specific - EUI-6448 [EUI-6448](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-6448) ([0dc58643](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/0dc58643aa52cfdf2126275ecefa38fbe30e9f97))
|
|
9
|
+
##### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **other:**
|
|
12
|
+
* wrong method call ([de9642f5](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/de9642f59c7683c3605a9876e412c50589f474cb))
|
|
13
|
+
|
|
14
|
+
* * *
|
|
15
|
+
* * *
|
|
16
|
+
## 6.1.0 (2022-11-04)
|
|
17
|
+
|
|
18
|
+
##### Chores
|
|
19
|
+
|
|
20
|
+
* **other:**
|
|
21
|
+
* adapted following master merge - raise version to 6.x to not disrupt the pipelines - MWP-8946 [MWP-8946](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-8946) ([6874463d](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/6874463d6529b654cd84eac5b8f4d97c3672170b))
|
|
22
|
+
* fix remote init specific install when pkgOnly is used - MWP-8946 [MWP-8946](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-8946) ([fc6904e7](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/fc6904e78b012a3a78f6a94f6289a7374dd1a5ea))
|
|
23
|
+
* added initial install of host package dugin host build - MWP-8915 [MWP-8915](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-8915) ([f5e3eb2b](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/f5e3eb2b3d19ed4ce68241f7bdd5b3965771d603))
|
|
24
|
+
* cleanup imports - final fixes testing virtual host - MWP-8915 [MWP-8915](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-8915) ([41cf97f1](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/41cf97f166fb438327155f94eedf4e76d0d2e65b))
|
|
25
|
+
* maintain backward compatibility with existing local mywp-host-playground setup - MWP-8915 [MWP-8915](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-8915) ([11e48b3a](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/11e48b3a9fa15b9625a554767e67e58c06c1d4b2))
|
|
26
|
+
##### New Features
|
|
27
|
+
|
|
28
|
+
* **other:**
|
|
29
|
+
* added virtual host feature - MWP-8915 [MWP-8915](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-8915) ([b55c87fd](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/b55c87fde0fbf184d9914fe5ab7956f77e6887b7))
|
|
30
|
+
##### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* **other:**
|
|
33
|
+
* missing import - adapted element serve for MacOS failures - MWP-8946 [MWP-8946](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-8946) ([c95746f5](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/c95746f53b1a8c11cd3bedc9b82ed38b928e6928))
|
|
34
|
+
* element build and init registration - EUI-8946 [EUI-8946](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-8946) ([aacda118](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/aacda11804bb07ccc1158bd0c4081ef4035b40df))
|
|
35
|
+
* sync issues - MWP-8946 [MWP-8946](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-8946) ([d6dd1dc6](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/d6dd1dc667e9ca5b881c8ba52197a544a8a10c16))
|
|
36
|
+
* register project dependencing on eUI version - MWP-8946 [MWP-8946](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-8946) ([a6821488](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/a682148801bcf154b8fbb7f451ffe9c02a953f41))
|
|
37
|
+
* host package cloning on specific branch - MWP-8946 [MWP-8946](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-8946) ([d7a0db77](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/d7a0db77bba289f07742d8337c1ef5f85dc97ed3))
|
|
38
|
+
|
|
39
|
+
* * *
|
|
40
|
+
* * *
|
|
1
41
|
## 5.3.90 (2022-11-03)
|
|
2
42
|
|
|
3
43
|
##### Bug Fixes
|
package/bin/eui-scripts.js
CHANGED
|
@@ -8,6 +8,7 @@ const args = process.argv.slice(2);
|
|
|
8
8
|
const scriptIndex = args.findIndex(
|
|
9
9
|
x => x === 'clean-package' ||
|
|
10
10
|
x === 'clean-all' ||
|
|
11
|
+
x === 'audit-package' ||
|
|
11
12
|
x === 'build-package' ||
|
|
12
13
|
x === 'build-package-pr-scan' ||
|
|
13
14
|
x === 'build-package-sub' ||
|
|
@@ -47,6 +48,7 @@ const nodeArgs = scriptIndex > 0 ? args.slice(0, scriptIndex) : [];
|
|
|
47
48
|
switch (script) {
|
|
48
49
|
case 'clean-package':
|
|
49
50
|
case 'clean-all':
|
|
51
|
+
case 'audit-package':
|
|
50
52
|
case 'build-package':
|
|
51
53
|
case 'build-package-pr-scan':
|
|
52
54
|
case 'build-package-sub':
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const auditUtils = require('../../scripts/csdr/audit/audit-utils');
|
|
4
|
+
const configUtils = require('../../scripts/csdr/config/config-utils');
|
|
5
|
+
|
|
6
|
+
Promise.resolve()
|
|
7
|
+
.then(() => {
|
|
8
|
+
const pkg = configUtils.packages.getPackage();
|
|
9
|
+
return auditUtils.styles.audit(pkg);
|
|
10
|
+
})
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const installUtils = require('../../scripts/csdr/install/install-utils');
|
|
4
|
-
const configUtils = require('../../scripts/csdr/config/config-utils');
|
|
5
4
|
const tools = require('../../scripts/utils/tools');
|
|
6
5
|
|
|
7
6
|
const { pkg } = tools.getArgs();
|
|
@@ -9,10 +8,8 @@ const { pkg } = tools.getArgs();
|
|
|
9
8
|
Promise.resolve()
|
|
10
9
|
.then(() => {
|
|
11
10
|
|
|
12
|
-
const resolvedPkg = configUtils.packages.getPackage(pkg, false, true);
|
|
13
|
-
|
|
14
11
|
if (pkg) {
|
|
15
|
-
return installUtils.localDev.
|
|
12
|
+
return installUtils.localDev.installPackage(pkg);
|
|
16
13
|
} else {
|
|
17
14
|
return installUtils.localDev.install();
|
|
18
15
|
}
|
package/package.json
CHANGED
package/sandbox.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const fs = require('fs');
|
|
4
|
+
const moment = require('moment');
|
|
5
|
+
const execa = require('execa');
|
|
4
6
|
const glob = require('glob');
|
|
5
7
|
const tools = require('./scripts/utils/tools');
|
|
6
8
|
const semver = require('semver');
|
|
@@ -442,13 +444,6 @@ const versionUtils = require('./scripts/csdr/version/version-utils');
|
|
|
442
444
|
// return mailUtils.send();
|
|
443
445
|
// })
|
|
444
446
|
|
|
445
|
-
// return Promise.resolve()
|
|
446
|
-
// .then(() => {
|
|
447
|
-
// const prjName = 'my-workplace';
|
|
448
|
-
// const prj = configUtils.projects.getCsdrProject(prjName);
|
|
449
|
-
// const deps = compositeUtils.getDeps(prj, 'PROD');
|
|
450
|
-
// console.log(deps);
|
|
451
|
-
// })
|
|
452
447
|
|
|
453
448
|
// return Promise.resolve()
|
|
454
449
|
// .then(() => {
|
|
@@ -593,14 +588,7 @@ const versionUtils = require('./scripts/csdr/version/version-utils');
|
|
|
593
588
|
|
|
594
589
|
// })
|
|
595
590
|
|
|
596
|
-
|
|
597
|
-
// .then(() => {
|
|
598
|
-
// const a = configUtils.packages.getCsdrRemotePackages()
|
|
599
|
-
// .map((p) => {
|
|
600
|
-
// return { name: p.name, npmPkg: p.npmPkg }
|
|
601
|
-
// });
|
|
602
|
-
// console.log(tools.sortArray(a, 'name'));
|
|
603
|
-
// })
|
|
591
|
+
|
|
604
592
|
// return Promise.resolve()
|
|
605
593
|
// .then(() => {
|
|
606
594
|
// console.log('t1')
|
|
@@ -639,37 +627,6 @@ const versionUtils = require('./scripts/csdr/version/version-utils');
|
|
|
639
627
|
|
|
640
628
|
|
|
641
629
|
|
|
642
|
-
|
|
643
|
-
// const prjName = 'my-workplace';
|
|
644
|
-
// const prj = configUtils.projects.getCsdrProject(prjName);
|
|
645
|
-
|
|
646
|
-
// return Promise.resolve()
|
|
647
|
-
// // .then(() => {
|
|
648
|
-
// // return injectionUtils.externals.injectExternalAppSources(prj);
|
|
649
|
-
// // })
|
|
650
|
-
// .then(() => {
|
|
651
|
-
// // return injectionUtils.externals.remapRoutesByEnvConfig(prj, 'DEV', true);
|
|
652
|
-
// return injectionUtils.routesReplacement.buildRoutes(prj, 'DEV', true);
|
|
653
|
-
// })
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
// return Promise.resolve()
|
|
660
|
-
// .then(() => {
|
|
661
|
-
// const pkg = configUtils.packages.getPackage('opsys-result-quality-management-eui10-remote-el-ui', true);
|
|
662
|
-
// return translationUtils.elements.generate('eui,opsys', pkg)
|
|
663
|
-
// })
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
// return Promise.resolve()
|
|
668
|
-
// .then(() => {
|
|
669
|
-
// const pkg = configUtils.packages.getPackage('eui', true);
|
|
670
|
-
// console.log(pkg);
|
|
671
|
-
// })
|
|
672
|
-
|
|
673
630
|
// return Promise.resolve()
|
|
674
631
|
// .then(() => {
|
|
675
632
|
// const pkg = configUtils.packages.getPackageByNpmPkg('@csdr/core', true);
|
|
@@ -683,59 +640,7 @@ const versionUtils = require('./scripts/csdr/version/version-utils');
|
|
|
683
640
|
// );
|
|
684
641
|
// })
|
|
685
642
|
|
|
686
|
-
// return Promise.resolve()
|
|
687
|
-
// .then(() => {
|
|
688
|
-
// const prjName = 'my-workplace';
|
|
689
|
-
// const prj = configUtils.projects.getCsdrProject(prjName);
|
|
690
643
|
|
|
691
|
-
// return compositeUtils.getDeps(prj, 'DEV');
|
|
692
|
-
// })
|
|
693
|
-
|
|
694
|
-
// return Promise.resolve()
|
|
695
|
-
// .then(() => {
|
|
696
|
-
// const configOptions = configUtils.global.getConfigOptions();
|
|
697
|
-
// console.log(configOptions);
|
|
698
|
-
// })
|
|
699
|
-
|
|
700
|
-
// return Promise.resolve()
|
|
701
|
-
// .then(() => {
|
|
702
|
-
// const versions = configUtils.packages.getLocalPackagesEuiVersion();
|
|
703
|
-
// console.log(versions);
|
|
704
|
-
// const prj = configUtils.projects.getProject();
|
|
705
|
-
// console.log(prj);
|
|
706
|
-
// })
|
|
707
|
-
|
|
708
|
-
// return Promise.resolve()
|
|
709
|
-
// .then(() => {
|
|
710
|
-
// const pkg = configUtils.packages.getPackage('cc-task-centre-eui10-remote-el-ui', true);
|
|
711
|
-
// return installUtils.remotes.installDeps(pkg);
|
|
712
|
-
// })
|
|
713
|
-
// .then((deps) => {
|
|
714
|
-
// console.log(deps);
|
|
715
|
-
// })
|
|
716
|
-
// .catch((e) => {
|
|
717
|
-
// console.log(e);
|
|
718
|
-
// process.exit(1);
|
|
719
|
-
// })
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
// return Promise.resolve()
|
|
723
|
-
// .then(() => {
|
|
724
|
-
// var from = path.join(process.cwd(), 'node_modules', '@mywp', 'config');
|
|
725
|
-
// var globPattern = '**/*';
|
|
726
|
-
// var files = glob.sync(globPattern, { cwd: from, nodir: true, follow: true, dot: true });
|
|
727
|
-
|
|
728
|
-
// })
|
|
729
|
-
|
|
730
|
-
// return Promise.resolve()
|
|
731
|
-
// .then(() => {
|
|
732
|
-
// const fileContent = tools.getJsonFileContent(path.join(process.cwd(), 'packages', 'devops-metadata', 'cc-task-centre-eui10-remote-el-ui-versions-metadata.json'));
|
|
733
|
-
// let out = '';
|
|
734
|
-
// const versions = fileContent.versions.filter(v => v.duration !== undefined).map((v) => {
|
|
735
|
-
// out += `${v.date.substring(0,8)},${v.duration/1000}\n`;
|
|
736
|
-
// })
|
|
737
|
-
// tools.writeFileContent(path.join(process.cwd(), 'extract.txt'), out);
|
|
738
|
-
// })
|
|
739
644
|
|
|
740
645
|
|
|
741
646
|
// Promise.resolve()
|
|
@@ -864,16 +769,6 @@ const versionUtils = require('./scripts/csdr/version/version-utils');
|
|
|
864
769
|
|
|
865
770
|
|
|
866
771
|
|
|
867
|
-
// const pkg = configUtils.packages.getPackage('opsys-epc-esub-bo-ui', true);
|
|
868
|
-
|
|
869
|
-
// Promise.resolve()
|
|
870
|
-
// .then(() => {
|
|
871
|
-
// return metadataUtils.package.getPackageVersionsByMajor(pkg, '9', false)
|
|
872
|
-
// })
|
|
873
|
-
// .then((versions) => {
|
|
874
|
-
// console.log(versions);
|
|
875
|
-
// console.log(versions.splice(-1)[0].version);
|
|
876
|
-
// })
|
|
877
772
|
|
|
878
773
|
|
|
879
774
|
// PROJECT VERSION CSDR BUILD TESTING (à la carte way === MWP / PMO MOBILE / SEDIA)
|
|
@@ -959,3 +854,176 @@ const versionUtils = require('./scripts/csdr/version/version-utils');
|
|
|
959
854
|
// const version = configUtils.packages.getRemoteEuiVersion(pkg);
|
|
960
855
|
// const versionNumber = version.split('.')[0];
|
|
961
856
|
// console.log(versionNumber);
|
|
857
|
+
|
|
858
|
+
|
|
859
|
+
// return Promise.resolve()
|
|
860
|
+
// .then(() => {
|
|
861
|
+
// const prj = configUtils.projects.getProject('my-workplace-host-playground');
|
|
862
|
+
// return installUtils.projects.getDeps(prj);
|
|
863
|
+
// })
|
|
864
|
+
// .then((deps) => {
|
|
865
|
+
// console.log(deps);
|
|
866
|
+
// })
|
|
867
|
+
|
|
868
|
+
|
|
869
|
+
// const prjName = 'sfc-fo';
|
|
870
|
+
// const prj = configUtils.projects.getCsdrProject(prjName);
|
|
871
|
+
|
|
872
|
+
// return Promise.resolve()
|
|
873
|
+
// .then(() => {
|
|
874
|
+
// return metadataUtils.appEnvs.getMetadata(prj);
|
|
875
|
+
// })
|
|
876
|
+
// .then((envsMetadata) => {
|
|
877
|
+
// console.log(envsMetadata);
|
|
878
|
+
|
|
879
|
+
// return installUtils.projects.getDeps(prj);
|
|
880
|
+
// })
|
|
881
|
+
// .then((deps) => {
|
|
882
|
+
// console.log(deps);
|
|
883
|
+
// })
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
// const migrateConfig = () => {
|
|
887
|
+
// const config = configUtils.global.getCsdrConfig(true);
|
|
888
|
+
|
|
889
|
+
// const prjCount = Object.keys(config.projects);
|
|
890
|
+
// console.log('projects : ' + prjCount.length);
|
|
891
|
+
// const pkgCount = Object.keys(config.packages);
|
|
892
|
+
// console.log('packages : ' + pkgCount.length);
|
|
893
|
+
// }
|
|
894
|
+
|
|
895
|
+
// migrateConfig();
|
|
896
|
+
|
|
897
|
+
|
|
898
|
+
|
|
899
|
+
// const pkg = configUtils.packages.getPackage('ppxms-core-ui', true);
|
|
900
|
+
|
|
901
|
+
// Promise.resolve()
|
|
902
|
+
// .then(() => {
|
|
903
|
+
// return metadataUtils.package.getPackageVersionsByMajor(pkg, '1')
|
|
904
|
+
// })
|
|
905
|
+
// .then((versions) => {
|
|
906
|
+
// console.log(versions);
|
|
907
|
+
// console.log(versions.splice(-1)[0].version);
|
|
908
|
+
// })
|
|
909
|
+
|
|
910
|
+
// return Promise.resolve()
|
|
911
|
+
// .then(() => {
|
|
912
|
+
// const a = configUtils.packages.getCsdrRemotePackages(10, 'sedia')
|
|
913
|
+
// .map((p) => {
|
|
914
|
+
// return { name: p.name, npmPkg: p.npmPkg }
|
|
915
|
+
// });
|
|
916
|
+
// console.log(tools.sortArray(a, 'name'));
|
|
917
|
+
// })
|
|
918
|
+
|
|
919
|
+
// Promise.resolve()
|
|
920
|
+
// .then(() => {
|
|
921
|
+
// const prj = configUtils.projects.getCsdrProject('my-workplace-host-playground');
|
|
922
|
+
// return installUtils.projects.getLocalProjectRemoteDeps(prj);
|
|
923
|
+
// })
|
|
924
|
+
|
|
925
|
+
// Promise.resolve()
|
|
926
|
+
// .then(() => {
|
|
927
|
+
|
|
928
|
+
// })
|
|
929
|
+
|
|
930
|
+
|
|
931
|
+
|
|
932
|
+
|
|
933
|
+
|
|
934
|
+
|
|
935
|
+
// STYLES AUDIT TESTS
|
|
936
|
+
|
|
937
|
+
Promise.resolve()
|
|
938
|
+
.then(() => {
|
|
939
|
+
const { pkg } = tools.getArgs();
|
|
940
|
+
const p = configUtils.packages.getPackage(pkg, true);
|
|
941
|
+
return auditUtils.styles.audit(p);
|
|
942
|
+
})
|
|
943
|
+
|
|
944
|
+
// const installPackages = async packages => {
|
|
945
|
+
// const promises = packages.map(async p => {
|
|
946
|
+
// const pkg = configUtils.packages.getPackageByNpmPkg(p.npmPkg, true);
|
|
947
|
+
// await gitUtils.cloneRepo(pkg.repository, pkg.paths.root, false, true);
|
|
948
|
+
// })
|
|
949
|
+
|
|
950
|
+
// await Promise.all(promises);
|
|
951
|
+
// }
|
|
952
|
+
|
|
953
|
+
|
|
954
|
+
// Promise.resolve()
|
|
955
|
+
// .then(() => {
|
|
956
|
+
// return metadataUtils.common.getDevopsMetadata();
|
|
957
|
+
// })
|
|
958
|
+
// .then((metadata) => {
|
|
959
|
+
// let packages = metadata.packages.filter((p) => {
|
|
960
|
+
// return moment(p.date, 'YYYYMMDD-H24:mm') > moment().subtract(12, 'months');
|
|
961
|
+
// }).filter((p) => {
|
|
962
|
+
// return p.name.indexOf('ui') > -1 &&
|
|
963
|
+
// p.name.indexOf('remote') === -1 && p.npmPkg !== undefined &&
|
|
964
|
+
// p.name.indexOf('sfc') === -1 && p.name.indexOf('sedia') === -1;
|
|
965
|
+
// })
|
|
966
|
+
|
|
967
|
+
// console.log(packages);
|
|
968
|
+
// console.log(packages.length);
|
|
969
|
+
|
|
970
|
+
// packages = packages.filter((p) => {
|
|
971
|
+
// return !tools.isDirExists(path.join(process.cwd(), 'packages', p.name));
|
|
972
|
+
// })
|
|
973
|
+
|
|
974
|
+
// console.log(packages.length);
|
|
975
|
+
|
|
976
|
+
// // installPackages(packages);
|
|
977
|
+
// })
|
|
978
|
+
|
|
979
|
+
// Promise.resolve()
|
|
980
|
+
// .then(() => {
|
|
981
|
+
// let folders = tools.getFolders(path.join(process.cwd(), 'packages'));
|
|
982
|
+
// folders = folders.filter((f) => {
|
|
983
|
+
// const scopes = ['cc','csdr','eac','opsys','mywp','sygma','redress','ppams','ppxms','urf'];
|
|
984
|
+
// return scopes.some((s) => {
|
|
985
|
+
// return f.includes(s);
|
|
986
|
+
// })
|
|
987
|
+
// })
|
|
988
|
+
// .filter((f) => {
|
|
989
|
+
// return tools.isFileExists(path.join(process.cwd(), 'packages', f, 'dependencies-composite.json'));
|
|
990
|
+
// })
|
|
991
|
+
|
|
992
|
+
// const JSONResult = [];
|
|
993
|
+
// folders.forEach((f) => {
|
|
994
|
+
// const pkg = configUtils.packages.getPackage(f, true);
|
|
995
|
+
// const report = auditUtils.styles.runStylesAudit(pkg);
|
|
996
|
+
// JSONResult.push(report);
|
|
997
|
+
// })
|
|
998
|
+
|
|
999
|
+
// const sumarryResult = JSONResult.map((p) => {
|
|
1000
|
+
// return {
|
|
1001
|
+
// package: p.package,
|
|
1002
|
+
// score: p.score,
|
|
1003
|
+
// total: p.total,
|
|
1004
|
+
// pcScore: p.pcScore
|
|
1005
|
+
// }
|
|
1006
|
+
// })
|
|
1007
|
+
|
|
1008
|
+
// const finalResult = {
|
|
1009
|
+
// summary: tools.sortArray(sumarryResult, 'pcScore', 'desc'),
|
|
1010
|
+
// details: JSONResult
|
|
1011
|
+
// }
|
|
1012
|
+
|
|
1013
|
+
// tools.writeJsonFileSync(path.join(process.cwd(), 'audit-styles.json'), finalResult);
|
|
1014
|
+
// tools.writeJsonFileSync(path.join(process.cwd(), 'audit-styles-summary.json'), sumarryResult);
|
|
1015
|
+
|
|
1016
|
+
|
|
1017
|
+
// // folders.forEach((f) => {
|
|
1018
|
+
// // try {
|
|
1019
|
+
// // const pPath = path.join(process.cwd(), 'packages', f);
|
|
1020
|
+
// // console.log(pPath);
|
|
1021
|
+
|
|
1022
|
+
// // execa.shellSync(`git pull`, { cwd: pPath, stdio: 'inherit' });
|
|
1023
|
+
// // execa.shellSync(`git checkout next/eui10`, { cwd: pPath, stdio: 'inherit' });
|
|
1024
|
+
// // } catch(e) {
|
|
1025
|
+
// // console.log(e);
|
|
1026
|
+
// // }
|
|
1027
|
+
// // })
|
|
1028
|
+
|
|
1029
|
+
// })
|
|
@@ -1,100 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// LOCAL
|
|
8
|
-
const tools = require('../../utils/tools');
|
|
9
|
-
const notificationUtils = require('../../utils/notification/notification-utils');
|
|
10
|
-
|
|
11
|
-
const { dryRun } = tools.getArgs();
|
|
12
|
-
|
|
13
|
-
const getVulnerabilitiesList = () => {
|
|
14
|
-
let auditContent;
|
|
15
|
-
const auditFile = path.join(process.cwd(), 'audit.json');
|
|
16
|
-
|
|
17
|
-
if (tools.isFileExists(auditFile)) {
|
|
18
|
-
auditContent = tools.getFileContent(auditFile);
|
|
19
|
-
} else {
|
|
20
|
-
tools.logWarning(`${auditFile} not found... unable to precess audit content`);
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
let auditContentArray = [];
|
|
25
|
-
let vulnerabilitiesFound = {};
|
|
26
|
-
|
|
27
|
-
// yarn audit output uses a specific json-lines format, we need to split it first
|
|
28
|
-
auditContentArray = auditContent.split('\n');
|
|
29
|
-
|
|
30
|
-
// extracting the audit summary lines
|
|
31
|
-
auditContentArray.forEach((c) => {
|
|
32
|
-
try {
|
|
33
|
-
const parsedContent = JSON.parse(c);
|
|
34
|
-
if (parsedContent && parsedContent.type === 'auditSummary') {
|
|
35
|
-
vulnerabilitiesFound = parsedContent.data.vulnerabilities;
|
|
36
|
-
}
|
|
37
|
-
} catch(e) {} // it can fail
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
return vulnerabilitiesFound;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
module.exports.audit = (pkg) => {
|
|
45
|
-
if (dryRun) return;
|
|
46
|
-
|
|
47
|
-
return Promise.resolve()
|
|
48
|
-
|
|
49
|
-
// first pass to display the visual report into the CI logs
|
|
50
|
-
.then(() => {
|
|
51
|
-
return Promise.resolve()
|
|
52
|
-
.then(() => {
|
|
53
|
-
return execa.shellSync('yarn audit --level high', { cwd: process.cwd(), stdio: 'inherit' });
|
|
54
|
-
})
|
|
55
|
-
.catch((e) => {}) // it can fail
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
// second pass to extract the audit summary lines
|
|
59
|
-
.then(() => {
|
|
60
|
-
return Promise.resolve()
|
|
61
|
-
.then(() => {
|
|
62
|
-
const auditFile = path.join(process.cwd(), 'audit.json');
|
|
63
|
-
tools.logInfo(`Creating audit file`)
|
|
64
|
-
return execa.shellSync(`yarn audit --level high --json > ${auditFile}`, { cwd: process.cwd(), stdio: 'inherit' });
|
|
65
|
-
})
|
|
66
|
-
.then(() => {
|
|
67
|
-
tools.logSuccess();
|
|
68
|
-
return null;
|
|
69
|
-
})
|
|
70
|
-
.catch((e) => {
|
|
71
|
-
tools.logError('Auditing detected vulnerabilities in dependencies');
|
|
72
|
-
return getVulnerabilitiesList();
|
|
73
|
-
})
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
// sending output to slack channel
|
|
77
|
-
.then((vulnerabilityReport) => {
|
|
78
|
-
if (!vulnerabilityReport) {
|
|
79
|
-
tools.logSuccess('OK, no vulnerabilities detected');
|
|
80
|
-
|
|
81
|
-
return notificationUtils.package.sendPackageMessage({
|
|
82
|
-
package: pkg,
|
|
83
|
-
text: 'Dependencies audit : NO vulnerabilities detected'
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
} else {
|
|
87
|
-
tools.logWarning(JSON.stringify(vulnerabilityReport));
|
|
88
|
-
|
|
89
|
-
let message = '';
|
|
90
|
-
Object.entries(vulnerabilityReport).forEach((v) => {
|
|
91
|
-
message += `${v[0]}:*${v[1]}* `;
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
return notificationUtils.package.sendPackageMessage({
|
|
95
|
-
package: pkg,
|
|
96
|
-
text: `Dependencies audit detected vulnerabilities : ${message}`
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
})
|
|
100
|
-
}
|
|
3
|
+
module.exports.yarn = require('./yarn');
|
|
4
|
+
module.exports.deps = require('./deps');
|
|
5
|
+
module.exports.styles = require('./styles');
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// GLOBAL
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const glob = require('glob');
|
|
6
|
+
|
|
7
|
+
// LOCAL
|
|
8
|
+
const tools = require('../../utils/tools');
|
|
9
|
+
const notificationUtils = require('../../utils/notification/notification-utils');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
module.exports.audit = (pkg) => {
|
|
13
|
+
tools.logTitle('Auditiing package internal dependencies complexity');
|
|
14
|
+
|
|
15
|
+
return Promise.resolve()
|
|
16
|
+
.then(() => {
|
|
17
|
+
var depsFound = [];
|
|
18
|
+
var files = glob.sync('**/*.ts', { cwd: pkg.paths.pkgLibFolder, nodir: true, follow: true, dot: true });
|
|
19
|
+
files.forEach(file => {
|
|
20
|
+
const filePath = path.join(pkg.paths.pkgLibFolder, file);
|
|
21
|
+
const fileContent = tools.getFileContent(filePath);
|
|
22
|
+
var regex = /@cc\/|@mywp\/|@opsys\/|@sfc\//gi, result, indices = [];
|
|
23
|
+
while ( (result = regex.exec(fileContent)) ) {
|
|
24
|
+
indices.push(result.index);
|
|
25
|
+
}
|
|
26
|
+
if (indices.length !== 0) {
|
|
27
|
+
// tools.logInfo(`Number of occurences found : ${indices.length}`);
|
|
28
|
+
indices.forEach((i) => {
|
|
29
|
+
const endPos = fileContent.substr(i, 40).indexOf("'");
|
|
30
|
+
const dep = fileContent.substr(i, endPos);
|
|
31
|
+
if (endPos > -1) {
|
|
32
|
+
// tools.logInfo(`dep found on : ${dep}`);
|
|
33
|
+
depsFound.push(dep);
|
|
34
|
+
|
|
35
|
+
} else {
|
|
36
|
+
tools.logInfo(`Potential wrong import detected on file : ${file}`);
|
|
37
|
+
const subContent = fileContent.substr(i, 40);
|
|
38
|
+
const detectMultiSlashes = subContent.match(/\//g);
|
|
39
|
+
if (detectMultiSlashes.length > 0) {
|
|
40
|
+
tools.logError('Multislashes on import : ');
|
|
41
|
+
console.log(subContent);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
depsFound = tools.removeArrayDuplicates(depsFound);
|
|
48
|
+
tools.logWarning(`Dependencies found : ${depsFound.length}`);
|
|
49
|
+
console.log(depsFound);
|
|
50
|
+
|
|
51
|
+
return depsFound;
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
.then((depsFound) => {
|
|
55
|
+
var depsLevel;
|
|
56
|
+
|
|
57
|
+
switch(true) {
|
|
58
|
+
case (depsFound.length === 1):
|
|
59
|
+
depsLevel = 'LOW (1)';
|
|
60
|
+
break;
|
|
61
|
+
case (depsFound.length > 1 && depsFound.length <= 3):
|
|
62
|
+
depsLevel = 'MEDIUM (between 1 and 3)';
|
|
63
|
+
break;
|
|
64
|
+
case (depsFound.length > 3 && depsFound.length <= 5):
|
|
65
|
+
depsLevel = 'HIGH (between 3 and 5)';
|
|
66
|
+
break;
|
|
67
|
+
case (depsFound.length > 5):
|
|
68
|
+
depsLevel = 'VERY HIGH (>5)';
|
|
69
|
+
break;
|
|
70
|
+
default:
|
|
71
|
+
depsLevel = 'NONE';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
var message = `Internal dependencies detected : ${depsFound.length} - deps level: ${depsLevel}\n`;
|
|
75
|
+
message += depsFound.join('\n');
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
return notificationUtils.package.sendPackageMessage({
|
|
79
|
+
package: pkg,
|
|
80
|
+
text: message
|
|
81
|
+
});
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
.catch((e) => {
|
|
85
|
+
console.log(e);
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
}
|
|
89
|
+
|