@eui/tools 5.3.89 → 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 +34 -0
  3. package/package.json +1 -1
  4. package/sandbox.js +39 -90
  5. package/scripts/csdr/config/angular.js +27 -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.89
1
+ 6.1.0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,37 @@
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
+ * * *
26
+ ## 5.3.90 (2022-11-03)
27
+
28
+ ##### Bug Fixes
29
+
30
+ * **other:**
31
+ * missing angularpackage def for registration - EUI-6448 [EUI-6448](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-6448) ([b84f5db0](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/b84f5db0f8dcc1d7633e734bbb7d71561a8db2f2))
32
+
33
+ * * *
34
+ * * *
1
35
  ## 5.3.89 (2022-10-31)
2
36
 
3
37
  ##### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "5.3.89",
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 {
@@ -27,6 +27,7 @@ const {
27
27
  angularPackageSubEntryDef,
28
28
  angularPackageDefV13,
29
29
  angularPackageDefV14,
30
+ angularPackageDefV15,
30
31
  angularElementProjectDef,
31
32
  tsConfigDef,
32
33
  tsConfigSpecDef,
@@ -75,14 +76,7 @@ module.exports.registerAngularPackage = (pkg, isReset) => {
75
76
  pathBase = 'packages/' + pkg.parentPkg + '/packages';
76
77
  }
77
78
 
78
- let packageEuiVersion;
79
-
80
- if (pkg.build && pkg.build.euiVersion) {
81
- packageEuiVersion = pkg.build.euiVersion;
82
-
83
- } else {
84
- packageEuiVersion = innerPackages.getPackageEuiVersion(pkg);
85
- }
79
+ const packageEuiVersion = innerPackages.getPackageEuiVersion(pkg);
86
80
 
87
81
  let projectDef = JSON.stringify(angularPackageDef);
88
82
 
@@ -118,12 +112,7 @@ module.exports.registerAngularPackageSubEntry = (subEntryName, subEntryPath, pkg
118
112
  const file = path.join(process.cwd(), 'angular.json');
119
113
  const jsonFile = require(file);
120
114
 
121
- let packageEuiVersion;
122
- if (pkg.build && pkg.build.euiVersion) {
123
- packageEuiVersion = pkg.build.euiVersion;
124
- } else {
125
- packageEuiVersion = innerPackages.getPackageEuiVersion(pkg);
126
- }
115
+ const packageEuiVersion = innerPackages.getPackageEuiVersion(pkg);
127
116
 
128
117
  let projectDef = JSON.stringify(angularPackageSubEntryDef);
129
118
 
@@ -174,11 +163,23 @@ module.exports.registerAngularPackageSubEntry = (subEntryName, subEntryPath, pkg
174
163
 
175
164
 
176
165
 
177
- module.exports.registerAngularProjectDef = (project, build = false) => {
166
+ module.exports.registerAngularProjectDef = (project, build = false, element = false) => {
167
+ tools.logInfo('Registering angular project definition...');
178
168
 
179
169
  // checking if root angular.json exists, create if not
180
170
  const file = path.join(process.cwd(), 'angular.json');
181
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
+
182
183
  if (!tools.isFileExists(file)) {
183
184
  tools.writeJsonFileSync(file, angularConfigDef);
184
185
  }
@@ -188,7 +189,9 @@ module.exports.registerAngularProjectDef = (project, build = false) => {
188
189
 
189
190
  if (tools.isFileExists(path.join(project.paths.angularPath, 'angular-config.json'))) {
190
191
  tools.logInfo(`Registering project angular config...`);
191
- 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);
192
195
  }
193
196
 
194
197
  if (angularConfigFile) {
@@ -204,18 +207,18 @@ module.exports.registerAngularProjectDef = (project, build = false) => {
204
207
  tools.logInfo('Processing angular config...');
205
208
  let projectDef;
206
209
  if (project.csdrFullSkeleton) {
207
- if (project.build && project.build.euiVersion === '13.x') {
210
+ if (euiVersion === '13.x') {
208
211
  projectDef = JSON.stringify(angularProjectDefFullSkeletonV13);
209
- } else if (project.build && (project.build.euiVersion === '14.x' || project.build.euiVersion === '15.x')) {
212
+ } else if (euiVersion === '14.x' || euiVersion === '15.x') {
210
213
  projectDef = JSON.stringify(angularProjectDefFullSkeletonV14);
211
214
  } else {
212
215
  projectDef = JSON.stringify(angularProjectDefFullSkeleton);
213
216
  }
214
217
 
215
218
  } else {
216
- if (project.build && project.build.euiVersion === '13.x') {
219
+ if (euiVersion === '13.x') {
217
220
  projectDef = JSON.stringify(angularProjectDefV13);
218
- } else if (project.build && (project.build.euiVersion === '14.x' || project.build.euiVersion === '15.x')) {
221
+ } else if (euiVersion === '14.x' || euiVersion === '15.x') {
219
222
  projectDef = JSON.stringify(angularProjectDefV14);
220
223
  } else {
221
224
  if (project.build && project.build.csdrFileReplacement === true) {
@@ -226,6 +229,9 @@ module.exports.registerAngularProjectDef = (project, build = false) => {
226
229
  }
227
230
  }
228
231
  let replaceProject = tools.replaceAll(projectDef, '@project.name@', project.name);
232
+ if (project.virtual && project.host) {
233
+ replaceProject = tools.replaceAll(replaceProject, 'apps/', 'hosts/');
234
+ }
229
235
  replaceProject = JSON.parse(replaceProject);
230
236
 
231
237
  jsonFile['projects'][project.name] = replaceProject;
@@ -372,8 +378,6 @@ module.exports.registerModulePaths = (pkg, isReset) => {
372
378
  jsonFileBuildSpec['compilerOptions']['paths'] = {};
373
379
  }
374
380
 
375
- console.log(pkg);
376
-
377
381
  if (!pkg.paths || tools.isDirExists(pkg.paths.pkgSrc)) {
378
382
  if (pkg.paths) {
379
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(() => {