@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.
Files changed (55) hide show
  1. package/.version.properties +1 -1
  2. package/CHANGELOG.md +40 -0
  3. package/bin/eui-scripts.js +2 -0
  4. package/bin/scripts/audit-package.js +10 -0
  5. package/bin/scripts/csdr-upgrade-deps.js +1 -4
  6. package/package.json +1 -1
  7. package/sandbox.js +176 -108
  8. package/scripts/csdr/audit/audit-utils.js +3 -98
  9. package/scripts/csdr/audit/deps.js +89 -0
  10. package/scripts/csdr/audit/styles.js +457 -0
  11. package/scripts/csdr/audit/yarn.js +105 -0
  12. package/scripts/csdr/config/angular.js +26 -23
  13. package/scripts/csdr/config/global.js +18 -18
  14. package/scripts/csdr/config/packages.js +86 -14
  15. package/scripts/csdr/config/projects.js +54 -6
  16. package/scripts/csdr/config/sync.js +15 -1
  17. package/scripts/csdr/init/global.js +122 -0
  18. package/scripts/csdr/init/init-utils.js +8 -296
  19. package/scripts/csdr/init/init.js +44 -14
  20. package/scripts/csdr/init/meta.js +3 -2
  21. package/scripts/csdr/init/packages.js +142 -0
  22. package/scripts/csdr/init/projects.js +112 -0
  23. package/scripts/csdr/init/remotes.js +21 -0
  24. package/scripts/csdr/init/repos.js +5 -31
  25. package/scripts/csdr/install/common.js +43 -385
  26. package/scripts/csdr/install/local-dev.js +55 -46
  27. package/scripts/csdr/install/packages.js +183 -3
  28. package/scripts/csdr/install/projects.js +202 -2
  29. package/scripts/csdr/release/package/release-package.js +26 -56
  30. package/scripts/csdr/release/package/ui.js +6 -85
  31. package/scripts/csdr/sync/sync-utils.js +8 -8
  32. package/scripts/csdr/version/app-default.js +0 -3
  33. package/scripts/csdr/version/package-common.js +2 -4
  34. package/scripts/csdr/version/package-remote.js +0 -4
  35. package/scripts/index.js +0 -2
  36. package/scripts/utils/build/package/build-package-utils.js +5 -13
  37. package/scripts/utils/build/package/maven.js +6 -12
  38. package/scripts/utils/build/package/nodeJs.js +0 -1
  39. package/scripts/utils/build/package/postcss.config.js +0 -2
  40. package/scripts/utils/build/package/styles.js +1 -0
  41. package/scripts/utils/changelog-utils.js +4 -2
  42. package/scripts/utils/git-utils.js +46 -0
  43. package/scripts/utils/pre-build/elements.js +1 -1
  44. package/scripts/utils/pre-build/injection/config.js +21 -134
  45. package/scripts/utils/pre-build/injection/externals.js +135 -90
  46. package/scripts/utils/pre-build/injection/routes-replacement.js +67 -15
  47. package/scripts/utils/pre-build/injection/skeletons.js +3 -2
  48. package/scripts/utils/pre-build/projects.js +1 -3
  49. package/scripts/utils/publish/npm.js +1 -2
  50. package/scripts/utils/serve/element.js +17 -2
  51. package/scripts/utils/svg-utils.js +2 -3
  52. package/scripts/utils/test/test-utils.js +5 -49
  53. package/scripts/utils/tools.js +4 -1
  54. package/scripts/utils/build/package/nestJs.js +0 -45
  55. package/scripts/utils/build/package/stencil.js +0 -13
@@ -23,7 +23,7 @@ module.exports.run = () => {
23
23
 
24
24
  // checking if the package can be retrieved from args
25
25
  if (!pkg.name) {
26
- tools.logError('ERROR : "package" NOT PROVIDED as argument !!!');
26
+ utils.tools.logError('ERROR : "package" NOT PROVIDED as argument !!!');
27
27
  process.exit(1);
28
28
  }
29
29
 
@@ -54,16 +54,12 @@ module.exports.run = () => {
54
54
 
55
55
  // FOR UI and REMOTES clone metadata repositories
56
56
  .then(() => {
57
- if (!pkg.backend) {
58
- return innerCommon.cloneMetadataRepos();
59
- }
57
+ return innerCommon.cloneMetadataRepos();
60
58
  })
61
59
 
62
60
  // PRE-RELEASE & COMMON CHECKS
63
61
  .then(() => {
64
- if (!pkg.backend) {
65
- return innerCommon.preReleaseChecks(pkg);
66
- }
62
+ return innerCommon.preReleaseChecks(pkg);
67
63
  })
68
64
 
69
65
  // FETCHING COMMITS METADATA
@@ -94,9 +90,6 @@ module.exports.run = () => {
94
90
  if (pkg.remote) {
95
91
  return innerRemote.install(pkg, envTarget, compositeType);
96
92
 
97
- } else if (pkg.backend) {
98
- return {};
99
-
100
93
  } else {
101
94
  return innerUi.install(pkg, branches.isMaster);
102
95
  }
@@ -161,59 +154,36 @@ module.exports.run = () => {
161
154
  })
162
155
 
163
156
 
164
- .then(() => {
165
- if (pkg.backend) {
166
157
 
167
- return Promise.resolve()
168
- // STORING CENTRALIZED METADATA
169
- .then(() => {
170
- // get run duration
171
- const duration = utils.pipeline.getTimerDuration();
172
- return innerCommon.storeMetadata(pkg, newVersion, pkgMetadata, pkgCompositeDeps, duration, envTarget);
173
- })
158
+ // GIT OPERATIONS
159
+ .then(() => {
160
+ return innerCommon.runGitOperations(pkg, newVersion);
161
+ })
174
162
 
175
- // GIT OPERATIONS
176
- .then(() => {
177
- return innerCommon.runGitOperations(pkg, newVersion);
178
- })
163
+ // STORING CENTRALIZED METADATA
164
+ .then(() => {
165
+ // get run duration
166
+ const duration = utils.pipeline.getTimerDuration();
167
+ return innerCommon.storeMetadata(pkg, newVersion, pkgMetadata, pkgCompositeDeps, duration, envTarget);
168
+ })
179
169
 
180
- .catch((e) => {
181
- throw e;
182
- })
170
+ // STORING PACKAGE HISTORY
171
+ .then(() => {
172
+ if (branches.isMaster && pkg.remote) {
173
+ return innerCommon.generateDiffReport(pkg, newVersion);
174
+ }
175
+ })
183
176
 
184
- } else {
177
+ // COMMITING METADATA
178
+ .then(() => {
179
+ return innerCommon.commitMetadata(pkg, newVersion);
180
+ })
185
181
 
186
- return Promise.resolve()
187
- // GIT OPERATIONS
188
- .then(() => {
189
- return innerCommon.runGitOperations(pkg, newVersion);
190
- })
191
-
192
- // STORING CENTRALIZED METADATA
193
- .then(() => {
194
- // get run duration
195
- const duration = utils.pipeline.getTimerDuration();
196
- return innerCommon.storeMetadata(pkg, newVersion, pkgMetadata, pkgCompositeDeps, duration, envTarget);
197
- })
198
-
199
- // STORING PACKAGE HISTORY
200
- .then(() => {
201
- if (branches.isMaster && pkg.remote) {
202
- return innerCommon.generateDiffReport(pkg, newVersion);
203
- }
204
- })
205
-
206
- // COMMITING METADATA
207
- .then(() => {
208
- return innerCommon.commitMetadata(pkg, newVersion);
209
- })
210
-
211
- .catch((e) => {
212
- throw e;
213
- })
214
- }
182
+ .catch((e) => {
183
+ throw e;
215
184
  })
216
185
 
186
+
217
187
  // EXPORT ADDITIONAL PIPELINE VARIABLES
218
188
  .then(() => {
219
189
  return innerCommon.exportPipelineVariables(pkg, compositeType);
@@ -8,7 +8,6 @@ const glob = require('glob');
8
8
  const installUtils = require('../../install/install-utils');
9
9
  const configUtils = require('../../config/config-utils');
10
10
  const auditUtils = require('../../audit/audit-utils');
11
- const notificationUtils = require('../../../utils/notification/notification-utils');
12
11
  const tools = require('../../../utils/tools');
13
12
 
14
13
 
@@ -26,16 +25,19 @@ module.exports.install = (pkg, isMaster) => {
26
25
  return installUtils.buildPackage.installPackage(prj, pkg, isMaster);
27
26
  })
28
27
 
29
-
30
28
  // CHECK INTERNAL DEPENDENCIES
31
29
  .then(() => {
32
- return checkDeps(pkg);
30
+ return auditUtils.deps.audit(pkg);
33
31
  })
34
32
 
33
+ // CHECK STYLES USAGE
34
+ .then(() => {
35
+ return auditUtils.styles.audit(pkg);
36
+ })
35
37
 
36
38
  // AUDIT DEPENDENCIES
37
39
  .then(() => {
38
- return auditUtils.audit(pkg);
40
+ return auditUtils.yarn.audit(pkg);
39
41
  })
40
42
 
41
43
 
@@ -63,84 +65,3 @@ module.exports.installOnly = (pkg) => {
63
65
  throw e;
64
66
  })
65
67
  }
66
-
67
-
68
-
69
- const checkDeps = (pkg) => {
70
- tools.logTitle('Checking package internal dependencies');
71
-
72
- return Promise.resolve()
73
- .then(() => {
74
- var depsFound = [];
75
- var files = glob.sync('**/*.ts', { cwd: pkg.paths.pkgLibFolder, nodir: true, follow: true, dot: true });
76
- files.forEach(file => {
77
- const filePath = path.join(pkg.paths.pkgLibFolder, file);
78
- const fileContent = tools.getFileContent(filePath);
79
- var regex = /@cc\/|@mywp\/|@opsys\/|@sfc\//gi, result, indices = [];
80
- while ( (result = regex.exec(fileContent)) ) {
81
- indices.push(result.index);
82
- }
83
- if (indices.length !== 0) {
84
- // tools.logInfo(`Number of occurences found : ${indices.length}`);
85
- indices.forEach((i) => {
86
- const endPos = fileContent.substr(i, 40).indexOf("'");
87
- const dep = fileContent.substr(i, endPos);
88
- if (endPos > -1) {
89
- // tools.logInfo(`dep found on : ${dep}`);
90
- depsFound.push(dep);
91
-
92
- } else {
93
- tools.logInfo(`Potential wrong import detected on file : ${file}`);
94
- const subContent = fileContent.substr(i, 40);
95
- const detectMultiSlashes = subContent.match(/\//g);
96
- if (detectMultiSlashes.length > 0) {
97
- tools.logError('Multislashes on import : ');
98
- console.log(subContent);
99
- }
100
- }
101
- })
102
- }
103
- });
104
- depsFound = tools.removeArrayDuplicates(depsFound);
105
- tools.logWarning(`Dependencies found : ${depsFound.length}`);
106
- console.log(depsFound);
107
-
108
- return depsFound;
109
- })
110
-
111
- .then((depsFound) => {
112
- var depsLevel;
113
-
114
- switch(true) {
115
- case (depsFound.length === 1):
116
- depsLevel = 'LOW (1)';
117
- break;
118
- case (depsFound.length > 1 && depsFound.length <= 3):
119
- depsLevel = 'MEDIUM (between 1 and 3)';
120
- break;
121
- case (depsFound.length > 3 && depsFound.length <= 5):
122
- depsLevel = 'HIGH (between 3 and 5)';
123
- break;
124
- case (depsFound.length > 5):
125
- depsLevel = 'VERY HIGH (>5)';
126
- break;
127
- default:
128
- depsLevel = 'NONE';
129
- }
130
-
131
- var message = `Internal dependencies detected : ${depsFound.length} - deps level: ${depsLevel}\n`;
132
- message += depsFound.join('\n');
133
-
134
-
135
- return notificationUtils.package.sendPackageMessage({
136
- package: pkg,
137
- text: message
138
- });
139
- })
140
-
141
- .catch((e) => {
142
- console.log(e);
143
- })
144
-
145
- }
146
-
@@ -36,31 +36,31 @@ module.exports.sync = () => {
36
36
  return configUtils.sync.run();
37
37
  })
38
38
  .then(() => {
39
- return initUtils.importScripts();
39
+ return initUtils.packages.importPackages({reset: true});
40
40
  })
41
41
  .then(() => {
42
- return initUtils.importPackages({reset: true});
42
+ return initUtils.projects.importScripts();
43
43
  })
44
44
  .then(() => {
45
- return initUtils.importExtraTsConfig();
45
+ return initUtils.projects.importExtraTsConfig();
46
46
  })
47
47
  .then(() => {
48
- return initUtils.importExternalFeatures();
48
+ return initUtils.projects.importExternalFeatures();
49
49
  })
50
50
  .then(() => {
51
- return initUtils.importExternalSources();
51
+ return initUtils.projects.importExternalSources();
52
52
  })
53
53
  .then(() => {
54
- return initUtils.importExternalMock();
54
+ return initUtils.projects.importExternalMock();
55
55
  })
56
56
  .then(() => {
57
57
  return initUtils.meta.init();
58
58
  })
59
59
  .then(() => {
60
- return initUtils.processLocalEuiVersions();
60
+ return initUtils.global.processLocalEuiVersions();
61
61
  })
62
62
  .then(() => {
63
- return initUtils.processResolutionsForNodeVersion();
63
+ return initUtils.global.processResolutionsForNodeVersion();
64
64
  })
65
65
  .catch((e) => {
66
66
  throw e;
@@ -3,9 +3,6 @@
3
3
  // externals
4
4
  const semver = require('semver');
5
5
  const path = require('path');
6
- const execa = require('execa');
7
- const fs = require('fs');
8
- const moment = require('moment');
9
6
 
10
7
  // local
11
8
  const tools = require('../../utils/tools');
@@ -1,10 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  // externals
4
- const semver = require('semver');
5
4
  const path = require('path');
6
5
  const execa = require('execa');
7
- const fs = require('fs');
8
6
 
9
7
  // local
10
8
  const tools = require('../../utils/tools');
@@ -130,10 +128,10 @@ const writePomXml = (pkg, newVersion, isSnapshot, isForceTimestamp = true) => {
130
128
  // timestamp file is forced to have at least one file to commit, as snapshot release
131
129
  // for backend can keep the same version until its latest
132
130
  const tsversionFile = path.resolve(pkg.paths.pkgDirectory, '.tsversion');
133
- fs.writeFileSync(tsversionFile, Date.now().toString());
131
+ tools.writeFileContent(tsversionFile, Date.now().toString());
134
132
 
135
133
  const versionFile = path.resolve(pkg.paths.pkgDirectory, '.version.properties');
136
- fs.writeFileSync(versionFile, newVersion);
134
+ tools.writeFileContent(versionFile, newVersion);
137
135
  }
138
136
  })
139
137
  .then(() => {
@@ -1,10 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  // externals
4
- const semver = require('semver');
5
- const path = require('path');
6
- const execa = require('execa');
7
- const fs = require('fs');
8
4
 
9
5
  // local
10
6
  const tools = require('../../utils/tools');
package/scripts/index.js CHANGED
@@ -20,10 +20,8 @@ module.exports.buildPackageUtils = require('./utils/build/package/build-package-
20
20
  module.exports.buildPackageUtils = require('./utils/build/package/build-package-utils')
21
21
  module.exports.buildPackageElement = require('./utils/build/package/element')
22
22
  module.exports.buildPackageMaven = require('./utils/build/package/maven')
23
- module.exports.buildPackageNestJs = require('./utils/build/package/nestJs')
24
23
  module.exports.buildPackageNodeJs = require('./utils/build/package/nodeJs')
25
24
  module.exports.buildPackagePostCssConfig = require('./utils/build/package/postcss.config')
26
- module.exports.buildPackageStencil = require('./utils/build/package/stencil')
27
25
  module.exports.buildPackageStyles = require('./utils/build/package/styles')
28
26
 
29
27
  // utils - clean
@@ -11,7 +11,6 @@ const configUtils = require('../../../csdr/config/config-utils');
11
11
 
12
12
  // INNER MODULES
13
13
  const innerNodeJs = require('./nodeJs');
14
- const innerNestJs = require('./nestJs');
15
14
  const innerMaven = require('./maven');
16
15
  const innerStyles = require('./styles');
17
16
  const innerAngular = require('./angular');
@@ -29,10 +28,7 @@ const buildBackend = (pkg, isMaster) => {
29
28
 
30
29
  return Promise.resolve()
31
30
  .then(() => {
32
- if (pkg.build.nestJs) {
33
- return innerNestJs.build(pkg, isMaster);
34
-
35
- } else if (pkg.build.nodeJs) {
31
+ if (pkg.build.nodeJs) {
36
32
  return innerNodeJs.build(pkg, isMaster);
37
33
 
38
34
  } else {
@@ -222,16 +218,12 @@ module.exports.buildSubEntry = (pkg, subEntry) => {
222
218
  }
223
219
  })
224
220
  .then(() => {
225
- let packageEuiVersion;
226
- if (pkg.build && pkg.build.euiVersion) {
227
- packageEuiVersion = pkg.build.euiVersion;
228
- } else {
229
- packageEuiVersion = configUtils.packages.getPackageEuiVersion(pkg);
230
- }
221
+ let packageEuiVersion = configUtils.packages.getPackageEuiVersion(pkg);
231
222
 
232
- if(packageEuiVersion === '15.x') {
223
+ if (packageEuiVersion === '15.x') {
233
224
  const { skipTest } = tools.getArgs();
234
- if(!skipTest) {
225
+
226
+ if (!skipTest) {
235
227
  tools.logInfo('Testing...');
236
228
  const ng = path.resolve(process.cwd(), 'node_modules', '@angular', 'cli', 'bin', 'ng');
237
229
  let args = ['--max_old_space_size=8096', ng, 'test', subEntry, '--code-coverage', '--watch=false'];
@@ -4,9 +4,6 @@ const tools = require('../../tools');
4
4
  const mavenUtils = require('../../maven-utils');
5
5
  const notificationUtils = require('../../notification/notification-utils');
6
6
 
7
- // FETCH ARGS
8
- let { deps, skipClean, skipLint, skipTest, skipCompile, skipDoc } = tools.getArgs();
9
-
10
7
 
11
8
  module.exports.build = (pkg, isMaster) => {
12
9
  tools.logTitle('Building maven backend package...');
@@ -14,15 +11,12 @@ module.exports.build = (pkg, isMaster) => {
14
11
  return Promise.resolve()
15
12
  .then(() => {
16
13
  tools.logInfo('Executing maven build...');
17
- // if (isMaster) {
18
- // return mavenUtils.execute(pkg.paths.pkgDirectory, 'clean package -DskipTests');
19
- // } else {
20
- if (pkg.build && pkg.build.mavenTestCommand) {
21
- return mavenUtils.execute(pkg.paths.pkgDirectory, pkg.build.mavenTestCommand);
22
- } else {
23
- return mavenUtils.execute(pkg.paths.pkgDirectory, 'clean test package');
24
- }
25
- // }
14
+
15
+ if (pkg.build && pkg.build.mavenTestCommand) {
16
+ return mavenUtils.execute(pkg.paths.pkgDirectory, pkg.build.mavenTestCommand);
17
+ } else {
18
+ return mavenUtils.execute(pkg.paths.pkgDirectory, 'clean test package');
19
+ }
26
20
  })
27
21
 
28
22
  .then(() => {
@@ -24,7 +24,6 @@ module.exports.build = (pkg, isMaster) => {
24
24
  return Promise.resolve()
25
25
  .then(() => {
26
26
  if (!skipTest) {
27
- // return testUtils.runJest(pkg);
28
27
  return testUtils.runMocha(pkg);
29
28
  }
30
29
  })
@@ -5,8 +5,6 @@ module.exports = {
5
5
  browsers: [
6
6
  "> 0.5% in alt-eu",
7
7
  "last 2 version",
8
- "ie 11",
9
- "not dead",
10
8
  "not op_mini all"
11
9
  ]
12
10
  }
@@ -182,6 +182,7 @@ const compileSassFile = (pkg, folder, filename, isNodeSassTildeImporterActive) =
182
182
  pkg.build.euiVersion === '15.x'
183
183
  )) {
184
184
  return compileSassFileDartSass(folder, filename);
185
+
185
186
  } else {
186
187
  return compileSassFileNodeSass(folder, filename, isNodeSassTildeImporterActive);
187
188
  }
@@ -124,14 +124,15 @@ module.exports.writeChangelog = (changelogContent, outputPath) => {
124
124
  .then(() => {
125
125
  tools.logInfo('writing changelog markdown...');
126
126
 
127
- var changelogFile;
127
+ let changelogFile;
128
+
128
129
  if (!outputPath) {
129
130
  changelogFile = path.join(process.cwd(), 'CHANGELOG.md');
130
131
  } else {
131
132
  changelogFile = path.join(outputPath, 'CHANGELOG.md');
132
133
  }
133
134
 
134
- if (fs.existsSync(changelogFile)) {
135
+ if (tools.isFileExists(changelogFile)) {
135
136
  const data = fs.readFileSync(changelogFile);
136
137
  const fd = fs.openSync(changelogFile, 'w+');
137
138
  const buffer = new Buffer(changelogContent);
@@ -139,6 +140,7 @@ module.exports.writeChangelog = (changelogContent, outputPath) => {
139
140
  fs.writeSync(fd, buffer, 0, buffer.length, 0);
140
141
  fs.writeSync(fd, data, 0, data.length, buffer.length);
141
142
  fs.close(fd);
143
+
142
144
  } else {
143
145
  fs.writeFileSync(changelogFile, changelogContent);
144
146
  }
@@ -362,6 +362,51 @@ const checkout = (branch, folder) => {
362
362
  }
363
363
 
364
364
 
365
+ const cloneAndCheckout = (repoUri, folder, branch) => {
366
+ tools.logInfo(`cloning ${repoUri} in ${folder} on branch ${branch}`);
367
+
368
+ return Promise.resolve()
369
+ .then(() => {
370
+ return cloneRepo(repoUri, folder);
371
+ })
372
+
373
+ .then(() => {
374
+ if (!tools.isDirExists(folder)) {
375
+ return;
376
+ }
377
+
378
+ return Promise.resolve()
379
+ .then(() => {
380
+ return checkout(branch, folder);
381
+ })
382
+ .catch((e) => {
383
+ tools.logError(`Branch ${branch} NOT FOUND, retrying on develop`);
384
+
385
+ return Promise.resolve()
386
+ .then(() => {
387
+ return checkout('develop', folder);
388
+ })
389
+ .catch((e2) => {
390
+ tools.logError(`Branch develop NOT FOUND, retrying on master`);
391
+
392
+ return Promise.resolve()
393
+ .then(() => {
394
+ return checkout('master', folder);
395
+ })
396
+ .catch((e3) => {
397
+ throw e3;
398
+ })
399
+ })
400
+ })
401
+ })
402
+
403
+ .catch((e) => {
404
+ throw e;
405
+ })
406
+ }
407
+
408
+
409
+
365
410
  const getLastCommitAuthor = (folder) => {
366
411
  return Promise.resolve()
367
412
  .then(() => {
@@ -393,6 +438,7 @@ module.exports.mergeMasterToDevelop = mergeMasterToDevelop;
393
438
  module.exports.mergeSupportToSupportDevelop = mergeSupportToSupportDevelop;
394
439
  module.exports.cloneRepo = cloneRepo;
395
440
  module.exports.checkout = checkout;
441
+ module.exports.cloneAndCheckout = cloneAndCheckout;
396
442
  module.exports.getLastCommitAuthor = getLastCommitAuthor;
397
443
  module.exports.isLastCommitAuthorValid = isLastCommitAuthorValid;
398
444
 
@@ -16,7 +16,7 @@ module.exports.preBuild = (pkg, build = false) => {
16
16
 
17
17
  .then(() => {
18
18
  tools.logInfo('Registering angular project definition...');
19
- return configUtils.angular.registerAngularProjectDef(pkg);
19
+ return configUtils.angular.registerAngularProjectDef(pkg, build, true);
20
20
  })
21
21
 
22
22
  // inject external app sources declaration