@eui/tools 5.3.90 → 6.1.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.
Files changed (41) hide show
  1. package/.version.properties +1 -1
  2. package/CHANGELOG.md +25 -0
  3. package/package.json +1 -1
  4. package/sandbox.js +39 -90
  5. package/scripts/csdr/config/angular.js +26 -23
  6. package/scripts/csdr/config/global.js +1 -1
  7. package/scripts/csdr/config/packages.js +19 -9
  8. package/scripts/csdr/config/projects.js +42 -4
  9. package/scripts/csdr/config/sync.js +16 -1
  10. package/scripts/csdr/init/init-utils.js +62 -0
  11. package/scripts/csdr/init/init.js +29 -6
  12. package/scripts/csdr/init/meta.js +3 -2
  13. package/scripts/csdr/init/repos.js +5 -31
  14. package/scripts/csdr/install/common.js +33 -10
  15. package/scripts/csdr/install/local-dev.js +5 -0
  16. package/scripts/csdr/install/projects.js +11 -0
  17. package/scripts/csdr/release/package/release-package.js +26 -56
  18. package/scripts/csdr/version/app-default.js +0 -3
  19. package/scripts/csdr/version/package-common.js +2 -4
  20. package/scripts/csdr/version/package-remote.js +0 -4
  21. package/scripts/index.js +0 -2
  22. package/scripts/utils/build/package/build-package-utils.js +5 -13
  23. package/scripts/utils/build/package/maven.js +6 -12
  24. package/scripts/utils/build/package/nodeJs.js +0 -1
  25. package/scripts/utils/build/package/postcss.config.js +0 -2
  26. package/scripts/utils/build/package/styles.js +1 -0
  27. package/scripts/utils/changelog-utils.js +4 -2
  28. package/scripts/utils/git-utils.js +46 -0
  29. package/scripts/utils/pre-build/elements.js +1 -1
  30. package/scripts/utils/pre-build/injection/config.js +21 -134
  31. package/scripts/utils/pre-build/injection/externals.js +135 -90
  32. package/scripts/utils/pre-build/injection/routes-replacement.js +67 -15
  33. package/scripts/utils/pre-build/injection/skeletons.js +3 -2
  34. package/scripts/utils/pre-build/projects.js +1 -3
  35. package/scripts/utils/publish/npm.js +1 -2
  36. package/scripts/utils/serve/element.js +17 -2
  37. package/scripts/utils/svg-utils.js +2 -3
  38. package/scripts/utils/test/test-utils.js +5 -49
  39. package/scripts/utils/tools.js +4 -1
  40. package/scripts/utils/build/package/nestJs.js +0 -45
  41. package/scripts/utils/build/package/stencil.js +0 -13
@@ -1 +1 @@
1
- 5.3.90
1
+ 6.1.0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,28 @@
1
+ ## 6.1.0 (2022-11-04)
2
+
3
+ ##### Chores
4
+
5
+ * **other:**
6
+ * 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))
7
+ * 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))
8
+ * 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))
9
+ * 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))
10
+ * 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))
11
+ ##### New Features
12
+
13
+ * **other:**
14
+ * 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))
15
+ ##### Bug Fixes
16
+
17
+ * **other:**
18
+ * 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))
19
+ * 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))
20
+ * 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))
21
+ * 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))
22
+ * 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))
23
+
24
+ * * *
25
+ * * *
1
26
  ## 5.3.90 (2022-11-03)
2
27
 
3
28
  ##### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "5.3.90",
3
+ "version": "6.1.0",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
package/sandbox.js CHANGED
@@ -442,13 +442,6 @@ const versionUtils = require('./scripts/csdr/version/version-utils');
442
442
  // return mailUtils.send();
443
443
  // })
444
444
 
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
445
 
453
446
  // return Promise.resolve()
454
447
  // .then(() => {
@@ -639,37 +632,6 @@ const versionUtils = require('./scripts/csdr/version/version-utils');
639
632
 
640
633
 
641
634
 
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
635
  // return Promise.resolve()
674
636
  // .then(() => {
675
637
  // const pkg = configUtils.packages.getPackageByNpmPkg('@csdr/core', true);
@@ -683,59 +645,7 @@ const versionUtils = require('./scripts/csdr/version/version-utils');
683
645
  // );
684
646
  // })
685
647
 
686
- // return Promise.resolve()
687
- // .then(() => {
688
- // const prjName = 'my-workplace';
689
- // const prj = configUtils.projects.getCsdrProject(prjName);
690
648
 
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
649
 
740
650
 
741
651
  // Promise.resolve()
@@ -959,3 +869,42 @@ const versionUtils = require('./scripts/csdr/version/version-utils');
959
869
  // const version = configUtils.packages.getRemoteEuiVersion(pkg);
960
870
  // const versionNumber = version.split('.')[0];
961
871
  // console.log(versionNumber);
872
+
873
+
874
+ // return Promise.resolve()
875
+ // .then(() => {
876
+ // const prj = configUtils.projects.getProject('my-workplace-host-playground');
877
+ // return installUtils.projects.getDeps(prj);
878
+ // })
879
+ // .then((deps) => {
880
+ // console.log(deps);
881
+ // })
882
+
883
+
884
+ // const prjName = 'sfc-fo';
885
+ // const prj = configUtils.projects.getCsdrProject(prjName);
886
+
887
+ // return Promise.resolve()
888
+ // .then(() => {
889
+ // return metadataUtils.appEnvs.getMetadata(prj);
890
+ // })
891
+ // .then((envsMetadata) => {
892
+ // console.log(envsMetadata);
893
+
894
+ // return installUtils.projects.getDeps(prj);
895
+ // })
896
+ // .then((deps) => {
897
+ // console.log(deps);
898
+ // })
899
+
900
+
901
+ // const migrateConfig = () => {
902
+ // const config = configUtils.global.getCsdrConfig(true);
903
+
904
+ // const prjCount = Object.keys(config.projects);
905
+ // console.log('projects : ' + prjCount.length);
906
+ // const pkgCount = Object.keys(config.packages);
907
+ // console.log('packages : ' + pkgCount.length);
908
+ // }
909
+
910
+ // migrateConfig();
@@ -7,7 +7,7 @@ const path = require('path');
7
7
  const tools = require('../../utils/tools');
8
8
 
9
9
  const innerPackages = require('./packages');
10
-
10
+ const innerProjects = require('./projects');
11
11
 
12
12
  // CONFIGS skeletons
13
13
  const {
@@ -76,14 +76,7 @@ module.exports.registerAngularPackage = (pkg, isReset) => {
76
76
  pathBase = 'packages/' + pkg.parentPkg + '/packages';
77
77
  }
78
78
 
79
- let packageEuiVersion;
80
-
81
- if (pkg.build && pkg.build.euiVersion) {
82
- packageEuiVersion = pkg.build.euiVersion;
83
-
84
- } else {
85
- packageEuiVersion = innerPackages.getPackageEuiVersion(pkg);
86
- }
79
+ const packageEuiVersion = innerPackages.getPackageEuiVersion(pkg);
87
80
 
88
81
  let projectDef = JSON.stringify(angularPackageDef);
89
82
 
@@ -119,12 +112,7 @@ module.exports.registerAngularPackageSubEntry = (subEntryName, subEntryPath, pkg
119
112
  const file = path.join(process.cwd(), 'angular.json');
120
113
  const jsonFile = require(file);
121
114
 
122
- let packageEuiVersion;
123
- if (pkg.build && pkg.build.euiVersion) {
124
- packageEuiVersion = pkg.build.euiVersion;
125
- } else {
126
- packageEuiVersion = innerPackages.getPackageEuiVersion(pkg);
127
- }
115
+ const packageEuiVersion = innerPackages.getPackageEuiVersion(pkg);
128
116
 
129
117
  let projectDef = JSON.stringify(angularPackageSubEntryDef);
130
118
 
@@ -175,11 +163,23 @@ module.exports.registerAngularPackageSubEntry = (subEntryName, subEntryPath, pkg
175
163
 
176
164
 
177
165
 
178
- module.exports.registerAngularProjectDef = (project, build = false) => {
166
+ module.exports.registerAngularProjectDef = (project, build = false, element = false) => {
167
+ tools.logInfo('Registering angular project definition...');
179
168
 
180
169
  // checking if root angular.json exists, create if not
181
170
  const file = path.join(process.cwd(), 'angular.json');
182
171
 
172
+ // getting the eUI version of the project
173
+ let euiVersion;
174
+ if (element) {
175
+ euiVersion = innerPackages.getRemoteEuiVersion(project);
176
+ } else {
177
+ euiVersion = innerProjects.getProjectEuiVersion(project);
178
+ }
179
+
180
+
181
+ tools.logInfo(`Registering angular project for eUI version : ${euiVersion}`);
182
+
183
183
  if (!tools.isFileExists(file)) {
184
184
  tools.writeJsonFileSync(file, angularConfigDef);
185
185
  }
@@ -189,7 +189,9 @@ module.exports.registerAngularProjectDef = (project, build = false) => {
189
189
 
190
190
  if (tools.isFileExists(path.join(project.paths.angularPath, 'angular-config.json'))) {
191
191
  tools.logInfo(`Registering project angular config...`);
192
- angularConfigFile = require(path.join(project.paths.angularPath, 'angular-config.json'));
192
+ const angularConfigFilePath = path.join(project.paths.angularPath, 'angular-config.json');
193
+ delete require.cache[angularConfigFilePath];
194
+ angularConfigFile = require(angularConfigFilePath);
193
195
  }
194
196
 
195
197
  if (angularConfigFile) {
@@ -205,18 +207,18 @@ module.exports.registerAngularProjectDef = (project, build = false) => {
205
207
  tools.logInfo('Processing angular config...');
206
208
  let projectDef;
207
209
  if (project.csdrFullSkeleton) {
208
- if (project.build && project.build.euiVersion === '13.x') {
210
+ if (euiVersion === '13.x') {
209
211
  projectDef = JSON.stringify(angularProjectDefFullSkeletonV13);
210
- } else if (project.build && (project.build.euiVersion === '14.x' || project.build.euiVersion === '15.x')) {
212
+ } else if (euiVersion === '14.x' || euiVersion === '15.x') {
211
213
  projectDef = JSON.stringify(angularProjectDefFullSkeletonV14);
212
214
  } else {
213
215
  projectDef = JSON.stringify(angularProjectDefFullSkeleton);
214
216
  }
215
217
 
216
218
  } else {
217
- if (project.build && project.build.euiVersion === '13.x') {
219
+ if (euiVersion === '13.x') {
218
220
  projectDef = JSON.stringify(angularProjectDefV13);
219
- } else if (project.build && (project.build.euiVersion === '14.x' || project.build.euiVersion === '15.x')) {
221
+ } else if (euiVersion === '14.x' || euiVersion === '15.x') {
220
222
  projectDef = JSON.stringify(angularProjectDefV14);
221
223
  } else {
222
224
  if (project.build && project.build.csdrFileReplacement === true) {
@@ -227,6 +229,9 @@ module.exports.registerAngularProjectDef = (project, build = false) => {
227
229
  }
228
230
  }
229
231
  let replaceProject = tools.replaceAll(projectDef, '@project.name@', project.name);
232
+ if (project.virtual && project.host) {
233
+ replaceProject = tools.replaceAll(replaceProject, 'apps/', 'hosts/');
234
+ }
230
235
  replaceProject = JSON.parse(replaceProject);
231
236
 
232
237
  jsonFile['projects'][project.name] = replaceProject;
@@ -373,8 +378,6 @@ module.exports.registerModulePaths = (pkg, isReset) => {
373
378
  jsonFileBuildSpec['compilerOptions']['paths'] = {};
374
379
  }
375
380
 
376
- console.log(pkg);
377
-
378
381
  if (!pkg.paths || tools.isDirExists(pkg.paths.pkgSrc)) {
379
382
  if (pkg.paths) {
380
383
  tools.logInfo(`${pkg.paths.pkgSrc} exists => pointing to /src folder`);
@@ -171,7 +171,7 @@ module.exports.getConfig = () => {
171
171
 
172
172
 
173
173
 
174
- module.exports.updateConfig = (project, packages, reset) => {
174
+ module.exports.updateConfig = (project, packages, reset = false) => {
175
175
  const configFile = path.join(process.cwd(), '.csdr', '.euirc.json');
176
176
 
177
177
  let newConfig = {};
@@ -2,7 +2,6 @@
2
2
 
3
3
  // GLOBAL
4
4
  const path = require('path');
5
- const fs = require('fs');
6
5
 
7
6
  // LOCAL
8
7
  const tools = require('../../utils/tools');
@@ -133,21 +132,21 @@ module.exports.getPackage = (pkgName, fromCsdrConfig, optional) => {
133
132
 
134
133
 
135
134
  module.exports.getPackagePaths = (pkg) => {
136
- const rootDirectory = fs.realpathSync(process.cwd());
135
+ const rootDirectory = process.cwd();
137
136
  const resolvePath = relativePath => path.resolve(rootDirectory, relativePath);
138
137
 
139
138
  const packagesBasePath = 'packages';
140
139
 
141
140
  const folder = pkg.folder || pkg.name;
142
141
 
143
- var packagesPath;
142
+ let packagesPath;
144
143
  if (pkg.child) {
145
144
  packagesPath = path.join(packagesBasePath, pkg.parentPkg, packagesBasePath);
146
145
  } else {
147
146
  packagesPath = packagesBasePath;
148
147
  }
149
148
 
150
- var publishFolder = '';
149
+ let publishFolder = '';
151
150
  if (pkg.tsPackage !== false) {
152
151
  publishFolder = '/dist';
153
152
  } else {
@@ -158,6 +157,7 @@ module.exports.getPackagePaths = (pkg) => {
158
157
  }
159
158
  }
160
159
 
160
+ // Remotes specific, to switch install root dir to the remote folder itself (independent dependencies / angular & eUI version, etc...)
161
161
  var repoNodeModules, remoteNodeModules = false;
162
162
  const depsBaseFile = path.join(resolvePath(packagesPath + '/' + folder), 'dependencies-base.json');
163
163
  const depsCompositeFile = path.join(resolvePath(packagesPath + '/' + folder), 'dependencies-composite.json');
@@ -168,19 +168,28 @@ module.exports.getPackagePaths = (pkg) => {
168
168
  repoNodeModules = resolvePath('node_modules');
169
169
  }
170
170
 
171
+
172
+ // Central gathering for pkg paths, always refer to this when fetching pkg paths in code, single sources of truth
171
173
  const paths = {
172
174
  rootDirectory,
173
- repoPackageJson: resolvePath('package.json'),
174
175
  repoNodeModules: repoNodeModules,
175
176
  remoteNodeModules: remoteNodeModules,
176
177
  packages: resolvePath(packagesBasePath),
178
+ root: resolvePath(packagesPath + '/' + folder),
179
+ dist: resolvePath(packagesPath + '/' + folder + '/dist'),
180
+ publish: resolvePath(packagesPath + '/' + folder + publishFolder),
181
+ src: resolvePath(packagesPath + '/' + folder + '/src'),
182
+ lib: resolvePath(packagesPath + '/' + folder + '/src/lib'),
183
+ tsConfig: this.getTSConfigPath(resolvePath, packagesPath + '/' + folder),
184
+
185
+ // deprecated TODO remove from scripts
186
+ repoPackageJson: resolvePath('package.json'),
177
187
  pkgFromRoot: packagesPath + '/' + folder,
188
+ pkgBuild: resolvePath(packagesPath + '/' + folder + '/dist'),
178
189
  pkgRootDirectory: resolvePath(packagesPath + '/' + folder),
179
190
  angularPath: resolvePath(packagesPath + '/' + folder),
180
191
  pkgDirectory: resolvePath(packagesPath + '/' + folder),
181
- pkgBuild: resolvePath(packagesPath + '/' + folder + '/dist'),
182
192
  pkgPublish: resolvePath(packagesPath + '/' + folder + publishFolder),
183
- pkgJson: resolvePath(packagesPath + '/' + folder + '/package.json'),
184
193
  pkgSrc: resolvePath(packagesPath + '/' + folder + '/src'),
185
194
  pkgLibFolder: resolvePath(packagesPath + '/' + folder + '/src/lib'),
186
195
  tsConfig: this.getTSConfigPath(resolvePath, packagesPath + '/' + folder),
@@ -344,9 +353,10 @@ module.exports.getLocalPackagesEuiVersion = () => {
344
353
  }
345
354
 
346
355
  module.exports.getTSConfigPath = (resolvePath, packagePath) => {
347
- const path = resolvePath(`${packagePath}/tsconfig.json`);
356
+ const tsPath = resolvePath(`${packagePath}/tsconfig.json`);
348
357
  const oldPath = resolvePath(`${packagePath}/tsconfig.lib.json`);
349
- return fs.existsSync(path) ? path : oldPath;
358
+
359
+ return tools.isDirExists(tsPath) ? tsPath : oldPath;
350
360
  }
351
361
 
352
362
  module.exports.getTSConfigFileName = (tsConfigPath) => {
@@ -220,6 +220,43 @@ module.exports.getBaseHref = (prj, version, providedBaseHref) => {
220
220
  }
221
221
 
222
222
 
223
+ const getEuiVersionCore = (project) => {
224
+ let version;
225
+
226
+ const depsCompositeFile = path.join(project.folder, 'dependencies-composite.json');
227
+ tools.logInfo(`Try fetching version from ${depsCompositeFile}`);
228
+
229
+ if (!tools.isFileExists(depsCompositeFile)) {
230
+ tools.logInfo('---- no dependencies-composite.json file found');
231
+
232
+ } else {
233
+ const jsonFileContnet = JSON.parse(tools.getFileContent(depsCompositeFile));
234
+ const deps = jsonFileContnet.dependencies;
235
+ const euiDepsBase = deps['@eui/deps-base'];
236
+
237
+ if (euiDepsBase) {
238
+ let euiVersion = euiDepsBase.split('.')[0];
239
+
240
+ if (euiVersion.substr(0,1) === '^') {
241
+ euiVersion = euiVersion.substr(1);
242
+ }
243
+ version = `${euiVersion}.x`;
244
+
245
+ if (version === '7.x') {
246
+ version = 'DEFAULT';
247
+ }
248
+ }
249
+ }
250
+
251
+ return version;
252
+ }
253
+
254
+
255
+ module.exports.getProjectEuiVersion = (project) => {
256
+ return getEuiVersionCore(project);
257
+ }
258
+
259
+
223
260
  module.exports.getLocalProjectsEuiVersion = () => {
224
261
  tools.logInfo('getting local projects installed eUI version...');
225
262
 
@@ -229,11 +266,12 @@ module.exports.getLocalProjectsEuiVersion = () => {
229
266
  prjs.forEach((p) => {
230
267
  let version = 'DEFAULT';
231
268
 
232
- if (p.build) {
233
- if (p.build.euiVersion) {
234
- version = p.build.euiVersion;
235
- }
269
+ if (p.build && p.build.euiVersion) {
270
+ version = p.build.euiVersion;
271
+ } else {
272
+ version = getEuiVersionCore(p);
236
273
  }
274
+
237
275
  tools.logInfo(`checking ${p.name} - version found : ${version}`);
238
276
  versionsFound.push(version);
239
277
  })
@@ -3,7 +3,6 @@
3
3
 
4
4
  // GLOBAL
5
5
  const path = require('path');
6
- const fs = require('fs');
7
6
 
8
7
  // LOCAL
9
8
  const tools = require('../../utils/tools');
@@ -27,6 +26,7 @@ module.exports.run = () => {
27
26
 
28
27
  const pkgFolders = tools.getFolders(path.join(process.cwd(), 'packages'));
29
28
  const prjFolders = tools.getFolders(path.join(process.cwd(), 'apps'));
29
+ const hostFolders = tools.getFolders(path.join(process.cwd(), 'hosts'));
30
30
 
31
31
  const csdrProjects = innerProjects.getCsdrProjects();
32
32
 
@@ -36,6 +36,10 @@ module.exports.run = () => {
36
36
  tools.logInfo('Project folders found:');
37
37
  console.log(prjFolders);
38
38
 
39
+ tools.logInfo('Host projects folders found:');
40
+ console.log(hostFolders);
41
+
42
+
39
43
  // for projects, we need to take the known rootName based on the folder from the CSDR global config
40
44
  let projects = [];
41
45
  prjFolders.forEach((prjFolder) => {
@@ -48,6 +52,17 @@ module.exports.run = () => {
48
52
  }
49
53
  })
50
54
 
55
+ // for projects, we need to take the known rootName based on the folder from the CSDR global config
56
+ hostFolders.forEach((hostFolder) => {
57
+ const csdrPrj = csdrProjects.filter((prj) => {
58
+ return prj.name === hostFolder;
59
+ })[0];
60
+
61
+ if (csdrPrj) {
62
+ projects.push(csdrPrj.rootName);
63
+ }
64
+ })
65
+
51
66
  tools.logInfo('Project folder remapped to CSDR project config');
52
67
  console.log(projects);
53
68
 
@@ -7,6 +7,8 @@ const path = require('path');
7
7
  const tools = require('../../utils/tools');
8
8
  const injectionUtils = require('../../utils/pre-build/injection/injection-utils');
9
9
  const configUtils = require('../config/config-utils');
10
+ const gitUtils = require('../../utils/git-utils');
11
+ const installUtils = require('../install/install-utils');
10
12
 
11
13
  // INNER MODULES
12
14
  const innerPrompt = require('./prompt');
@@ -32,6 +34,8 @@ const importPackage = (pkg, args) => {
32
34
  .then(() => {
33
35
  if (!pkg.element) {
34
36
  return configUtils.angular.registerAngularPackage(pkg, args.reset);
37
+ } else if (pkg.element) {
38
+ return configUtils.angular.registerAngularProjectDef(pkg, args.reset, true);
35
39
  } else {
36
40
  return configUtils.angular.registerAngularProjectDef(pkg, args.reset);
37
41
  }
@@ -89,6 +93,64 @@ module.exports.importPackages = (args = {}) => {
89
93
  }
90
94
 
91
95
 
96
+ module.exports.cloneHostPackage = (projectName) => {
97
+ tools.logTitle('Installing host package');
98
+
99
+ let pkg;
100
+
101
+ return Promise.resolve()
102
+ .then(() => {
103
+ const project = configUtils.projects.getProject(projectName);
104
+
105
+ if (!project.hostPackage) {
106
+ tools.logInfo('project hostPackage not defined...skipping');
107
+
108
+ } else {
109
+ pkg = configUtils.packages.getPackageByNpmPkg(project.hostPackage, true);
110
+ if (!pkg) {
111
+ throw new Error('Invalid host package provided / unknown to CSDR config');
112
+ }
113
+ return gitUtils.cloneAndCheckout(pkg.repository, path.join(process.cwd(), 'packages', pkg.name), 'develop');
114
+ }
115
+ })
116
+
117
+ .then(() => {
118
+ const newPackages = [];
119
+ newPackages.push(pkg.name);
120
+ return configUtils.global.updateConfig(null, newPackages);
121
+ })
122
+
123
+ .catch((e) => {
124
+ throw e;
125
+ })
126
+ }
127
+
128
+
129
+ module.exports.installHostPackage = (projectName) => {
130
+ tools.logTitle('Installing host package');
131
+
132
+ return Promise.resolve()
133
+ .then(() => {
134
+ const project = configUtils.projects.getProject(projectName);
135
+
136
+ if (!project.hostPackage) {
137
+ tools.logInfo('project hostPackage not defined...skipping');
138
+
139
+ } else {
140
+ const pkg = configUtils.packages.getPackageByNpmPkg(project.hostPackage, true);
141
+ if (!pkg) {
142
+ throw new Error('Invalid host package provided / unknown to CSDR config');
143
+ }
144
+ return installUtils.projects.installHostPackage(project, pkg.npmPkg);
145
+ }
146
+ })
147
+
148
+ .catch((e) => {
149
+ throw e;
150
+ })
151
+ }
152
+
153
+
92
154
  module.exports.importScripts = () => {
93
155
  return Promise.resolve()
94
156
  .then(() => {
@@ -7,7 +7,7 @@ const configUtils = require('../config/config-utils');
7
7
 
8
8
  // Getting arguments if they are provided for the CI/CD pipeline
9
9
  const {
10
- project, team, pkg, branch, configOnly, skipClone, reset, pkgOnly, prjOnly,
10
+ project, team, pkg, branch, configOnly, skipClone, skipInstall, reset, pkgOnly, prjOnly,
11
11
  build, containerOnly, skipAppContainers
12
12
  } = tools.getArgs();
13
13
 
@@ -51,15 +51,27 @@ module.exports.init = () => {
51
51
  }
52
52
  })
53
53
 
54
- // Initializing .euirc.json local file - the core of CSDR operations
54
+ // merge with response found from prompts
55
55
  .then((response) => {
56
- // merge with response found from prompts
57
56
  finalResponse = { ...initialResponse, ...response };
57
+ })
58
58
 
59
+ // Initializing .euirc.json local file - the core of CSDR operations
60
+ .then(() => {
59
61
  // Initialize config
60
62
  return configUtils.init.run(finalResponse);
61
63
  })
62
64
 
65
+ // clone or install linked host package to project if any
66
+ .then(() => {
67
+ if (finalResponse.project && !build) {
68
+ return initUtils.cloneHostPackage(finalResponse.project);
69
+
70
+ } else if (finalResponse.project && build) {
71
+ return initUtils.installHostPackage(finalResponse.project);
72
+ }
73
+ })
74
+
63
75
  // Initializing .meta based on .euirc.json for local respoisitories cloning
64
76
  .then(() => {
65
77
  return initUtils.meta.init();
@@ -77,6 +89,13 @@ module.exports.init = () => {
77
89
  return initUtils.importPackages(finalResponse);
78
90
  })
79
91
 
92
+ // Importing external sources
93
+ .then(() => {
94
+ if (finalResponse.project) {
95
+ return initUtils.importExternalSources();
96
+ }
97
+ })
98
+
80
99
  // adapt and inject particular root data/config for eUI version detected on project
81
100
  // if multiple versions of eUI are detected on the same project, an exception is thrown
82
101
  .then(() => {
@@ -92,8 +111,12 @@ module.exports.init = () => {
92
111
  .then(() => {
93
112
  // this is only executed for local dev installation,
94
113
  // in case of release the initialisation is managed by the application / package themselves
95
- if (!build) {
96
- return installUtils.localDev.install();
114
+ if (!build && !skipInstall) {
115
+ if (finalResponse.pkgOnly) {
116
+ return installUtils.localDev.install(pkg);
117
+ } else {
118
+ return installUtils.localDev.install();
119
+ }
97
120
  }
98
121
  })
99
122
 
@@ -124,7 +147,7 @@ module.exports.init = () => {
124
147
 
125
148
  // Attaching external mock repo for project
126
149
  .then(() => {
127
- if (finalResponse.project && !build) {
150
+ if (finalResponse.project && !build && !prjOnly) {
128
151
  return initUtils.importExternalMock();
129
152
  }
130
153
  })