@eui/tools 6.20.17 → 6.20.18

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.
@@ -1 +1 @@
1
- 6.20.17
1
+ 6.20.18
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 6.20.18 (2024-08-11)
2
+
3
+ ##### Chores
4
+
5
+ * **other:**
6
+ * adapted for stanadlone host build - package standalone and within csdr local playground - EUI-9788 [EUI-9788](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-9788) ([82aae2cb](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/82aae2cbeded6602ff7b4812179f4650d91caaa7))
7
+
8
+ * * *
9
+ * * *
1
10
  ## 6.20.17 (2024-08-09)
2
11
 
3
12
  ##### Chores
package/init.js CHANGED
@@ -11,7 +11,9 @@ const nmSrcPath = path.join(process.cwd(), 'node_modules');
11
11
 
12
12
  // for testing purpose standalone mode locally
13
13
  // const nmSrcPath = path.join('d:/gitlab/zzz-test-package-ui', 'node_modules');
14
+ // const nmSrcPath = path.join('d:/gitlab/baep-sample-host-shell-ui', 'node_modules');
14
15
  // const nmSrcPath = path.join('d:/gitlab/zzz-test-remote-eui18', 'node_modules');
16
+ // const nmSrcPath = path.join('d:/gitlab/baep-playground', 'node_modules');
15
17
 
16
18
  const euiNmToolsPath = path.join(nmSrcPath, '@eui', 'tools');
17
19
  const eUIToolsPath = path.join(process.cwd(), 'packages', 'eui-tools');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "6.20.17",
3
+ "version": "6.20.18",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
@@ -5,18 +5,34 @@ const path = require('path');
5
5
 
6
6
  // LOCAL
7
7
  const tools = require('../../utils/tools');
8
+ const gitUtils = require('../../utils/git-utils');
8
9
 
9
10
  // INNER MODULES
10
11
  const innerPackages = require('./packages');
11
12
  const innerProjects = require('./projects');
12
13
 
13
14
 
15
+ module.exports.cloneConfig = () => {
16
+ return Promise.resolve()
17
+ .then(() => {
18
+ return gitUtils.cloneRepoStandalone(
19
+ 'csdr-config',
20
+ path.join(process.cwd(), '.config')
21
+ );
22
+ })
23
+
24
+ .catch((e) => {
25
+ throw e;
26
+ })
27
+ }
28
+
29
+
14
30
 
15
31
  module.exports.getCsdrConfig = (full = true) => {
16
32
  let globalConfig, appsConfig, packagesConfig, remotesConfig;
17
33
 
18
34
  if (tools.isDirExists(path.join(process.cwd(), '.config'))) {
19
- globalConfig = require(path.join(process.cwd(), '.config', '.euirc-config.json'));
35
+ globalConfig = require(path.join(process.cwd(), '.euirc-config.json'));
20
36
  appsConfig = require(path.join(process.cwd(), '.config', '.euirc-apps.json'));
21
37
  packagesConfig = require(path.join(process.cwd(), '.config', '.euirc-packages.json'));
22
38
  remotesConfig = require(path.join(process.cwd(), '.config', 'remotes', '.euirc-remotes.json'));
@@ -576,3 +592,8 @@ module.exports.isSonarEnabled = () => {
576
592
 
577
593
  return false;
578
594
  }
595
+
596
+
597
+ module.exports.isCsdr = () => {
598
+ return tools.isDirExists(path.join(process.cwd(), '.csdr'));
599
+ }
@@ -20,101 +20,88 @@ const {
20
20
 
21
21
 
22
22
  module.exports.init = () => {
23
- // Initializing a common response
24
- const initialResponse = {
25
- project: project || null,
26
- team: team || 'all',
27
- pkg: pkg || null,
28
- remote: remote || null,
29
- virtual: virtual || false,
30
- euiVersion: euiVersion || null,
31
- branch: branch || 'develop',
32
- configOnly: configOnly || false,
33
- skipClone: skipClone || false,
34
- reset: reset || false,
35
- pkgOnly: pkgOnly || false,
36
- prjOnly: prjOnly || false,
37
- remoteOnly: remoteOnly || false,
38
- build: build || false,
39
- containerOnly: containerOnly || false,
40
- skipAppContainers: skipAppContainers || false,
41
- custom: custom || false,
42
- projectsGroup: projectsGroup || null,
43
- }
44
-
45
- // converting inputs args
46
- initialResponse.branch = tools.convertStringArg(initialResponse.branch, 'develop');
47
- initialResponse.euiVersion = tools.convertStringArg(initialResponse.euiVersion);
48
23
 
49
- // setting project to null if forced to NONE
50
- if (initialResponse.project === 'NONE') {
51
- initialResponse.project = null;
24
+ // check known init types
25
+ if (!project && !pkg && !remote && !custom && !projectsGroup ) {
26
+ tools.logError('****************************************');
27
+ tools.logError('*************** ERROR ******************');
28
+ tools.logError('****************************************\n');
29
+ tools.logError('At least "pkg" or "project" or "remote" type should be used for init, for example :\n');
30
+ tools.logError('npm run init -- --pkg PKG_NAME [--branch BRANCH_NAME|default develop] [--git local] [--pkgOnly] [--skipInstall]');
31
+ tools.logError('npm run init -- --project PROJECT_NAME [--branch BRANCH_NAME|default develop] [--git local] [--prjOnly] [--skipInstall]');
32
+ tools.logError('npm run init -- --remote VIRTUAL_REMOTE_NAME [--remoteOnly] [--skipInstall]');
33
+ tools.logError('npm run init -- --custom [--skipInstall] [--git local]');
34
+ process.exit(0);
52
35
  }
53
36
 
54
- // checking if provided PKG (from gitlab) is a virtual remote (new remote kind as of v15 (and sedia v10))
55
- const isVirtualRemote = configUtils.remotes.isVirtualRemote(initialResponse.pkg);
56
- if (isVirtualRemote) {
57
- initialResponse.remote = initialResponse.pkg;
58
- initialResponse.virtual = true;
59
- initialResponse.pkg = null;
60
- }
61
-
62
- // Storing the response for propagation
63
- let finalResponse;
64
-
65
37
  return Promise.resolve()
38
+ // check if csdr default root, if not cloning specific config repo (CSDR v2 2024)
66
39
  .then(() => {
67
-
68
- // if no project has been provided we prompt for project and team selection
69
- if (!project && !pkg && !remote && !custom && !projectsGroup ) {
70
- // TODO refactor to handle dynamic mywp-host-playground install (pre-remotes install etc...)
71
- // return initUtils.prompt.start();
72
- tools.logError('****************************************');
73
- tools.logError('*************** ERROR ******************');
74
- tools.logError('****************************************\n');
75
- tools.logError('At least "pkg" or "project" or "remote" type should be used for init, for example :\n');
76
- tools.logError('npm run init -- --pkg PKG_NAME [--branch BRANCH_NAME|default develop] [--git local] [--pkgOnly] [--skipInstall]');
77
- tools.logError('npm run init -- --project PROJECT_NAME [--branch BRANCH_NAME|default develop] [--git local] [--prjOnly] [--skipInstall]');
78
- tools.logError('npm run init -- --remote VIRTUAL_REMOTE_NAME [--remoteOnly] [--skipInstall]');
79
- tools.logError('npm run init -- --custom [--skipInstall] [--git local]');
80
- process.exit(0);
81
-
82
- // if provided, we are on automated mode, we use the initialized response
83
- } else {
84
- return initialResponse;
40
+ if (!configUtils.global.isCsdr()) {
41
+ return configUtils.global.cloneConfig();
85
42
  }
86
43
  })
87
44
 
88
- // merge with response found from prompts
89
- .then((response) => {
90
- finalResponse = { ...initialResponse, ...response };
45
+ .then(() => {
46
+ // Initializing a common response
47
+ const initialResponse = {
48
+ project: project || null,
49
+ team: team || 'all',
50
+ pkg: pkg || null,
51
+ remote: remote || null,
52
+ virtual: virtual || false,
53
+ euiVersion: euiVersion || null,
54
+ branch: branch || 'develop',
55
+ configOnly: configOnly || false,
56
+ skipClone: skipClone || false,
57
+ reset: reset || false,
58
+ pkgOnly: pkgOnly || false,
59
+ prjOnly: prjOnly || false,
60
+ remoteOnly: remoteOnly || false,
61
+ build: build || false,
62
+ containerOnly: containerOnly || false,
63
+ skipAppContainers: skipAppContainers || false,
64
+ custom: custom || false,
65
+ projectsGroup: projectsGroup || null,
66
+ }
67
+
68
+ // converting inputs args
69
+ initialResponse.branch = tools.convertStringArg(initialResponse.branch, 'develop');
70
+ initialResponse.euiVersion = tools.convertStringArg(initialResponse.euiVersion);
71
+
72
+ // setting project to null if forced to NONE
73
+ if (initialResponse.project === 'NONE') {
74
+ initialResponse.project = null;
75
+ }
76
+
77
+ // checking if provided PKG (from gitlab) is a virtual remote (new remote kind as of v15 (and sedia v10))
78
+ const isVirtualRemote = configUtils.remotes.isVirtualRemote(initialResponse.pkg);
79
+ if (isVirtualRemote) {
80
+ initialResponse.remote = initialResponse.pkg;
81
+ initialResponse.virtual = true;
82
+ initialResponse.pkg = null;
83
+ }
91
84
 
92
85
  tools.logInfo('Configuration generated based on provided args:');
93
- console.log(finalResponse);
94
- })
86
+ console.log(initialResponse);
95
87
 
96
- .then(() => {
97
- if (finalResponse.project) {
98
- return innerInitProject.init(finalResponse);
88
+ if (initialResponse.project) {
89
+ return innerInitProject.init(initialResponse);
99
90
 
100
- } else if (finalResponse.pkg) {
101
- return innerInitPackage.init(finalResponse);
91
+ } else if (initialResponse.pkg) {
92
+ return innerInitPackage.init(initialResponse);
102
93
 
103
- } else if (finalResponse.remote) {
104
- return innerInitRemote.init(finalResponse);
94
+ } else if (initialResponse.remote) {
95
+ return innerInitRemote.init(initialResponse);
105
96
 
106
- } else if (finalResponse.custom) {
107
- return innerInitCustom.init(finalResponse);
97
+ } else if (initialResponse.custom) {
98
+ return innerInitCustom.init(initialResponse);
108
99
 
109
- } else if (finalResponse.projectsGroup) {
110
- return innerInitProjectsGroup.init(finalResponse);
100
+ } else if (initialResponse.projectsGroup) {
101
+ return innerInitProjectsGroup.init(initialResponse);
111
102
  }
112
103
  })
113
104
 
114
- .then(() => {
115
- tools.logSuccess('OK => Project successfully initialized');
116
- })
117
-
118
105
  .catch((e) => {
119
106
  throw e;
120
107
  });
@@ -36,7 +36,11 @@ module.exports.init = () => {
36
36
  const packages = configUtils.packages.getPackages();
37
37
  packages.forEach((pkg) => {
38
38
  if (pkg) {
39
- content.projects['packages/' + pkg.name] = pkg.repository;
39
+ if (configUtils.global.isCsdr()) {
40
+ content.projects['packages/' + pkg.name] = pkg.repository;
41
+ } else {
42
+ content.projects['packages/' + pkg.name] = pkg.name;
43
+ }
40
44
  }
41
45
  });
42
46
 
@@ -88,7 +88,11 @@ module.exports.cloneHostPackage = (projectName) => {
88
88
  if (!pkg) {
89
89
  throw new Error('Invalid host package provided / unknown to CSDR config');
90
90
  }
91
- return gitUtils.cloneAndCheckout(pkg.repository, path.join(process.cwd(), 'packages', pkg.name), 'master');
91
+ if (configUtils.global.isCsdr()) {
92
+ return gitUtils.cloneAndCheckout(pkg.repository, path.join(process.cwd(), 'packages', pkg.name), 'master');
93
+ } else {
94
+ return gitUtils.cloneRepoStandalone(pkg.name, path.join(process.cwd(), 'packages', pkg.name));
95
+ }
92
96
  })
93
97
 
94
98
  .then(() => {
@@ -58,20 +58,6 @@ const cloneRemotesConfig = module.exports.cloneRemotesConfig = () => {
58
58
  }
59
59
 
60
60
 
61
- const cloneRemotesConfigStandalone = module.exports.cloneRemotesConfigStandalone = () => {
62
- return Promise.resolve()
63
- .then(() => {
64
- return gitUtils.cloneRepoStandalone(
65
- 'csdr-config',
66
- path.join(process.cwd(), '.config')
67
- );
68
- })
69
-
70
- .catch((e) => {
71
- throw e;
72
- })
73
- }
74
-
75
61
 
76
62
 
77
63
  module.exports.generateVirtualRemote = (remoteName, cloneRemotesConfigFlag = true, standalone = false) => {
@@ -89,7 +75,7 @@ module.exports.generateVirtualRemote = (remoteName, cloneRemotesConfigFlag = tru
89
75
  .then(() => {
90
76
  if (cloneRemotesConfigFlag) {
91
77
  if (standalone) {
92
- return cloneRemotesConfigStandalone();
78
+ return configUtils.global.cloneConfig();
93
79
  } else {
94
80
  if (tools.isDirExists(path.join(process.cwd(), '.csdr'))) {
95
81
  return cloneRemotesConfig();