@eui/cli 17.3.0 → 17.3.1-snapshot-1711320784876

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
- 17.3.0
1
+ 17.3.1-snapshot-1711320784876
package/lib/build.js CHANGED
@@ -1,9 +1,11 @@
1
- const tools = require('@eui/tools/scripts/utils/tools');
1
+ const fileSystem = require('fs');
2
+ const { rimrafSync } = require('rimraf')
2
3
  const path = require('path');
3
4
  const utils = require('./utils');
4
5
  const config = require('./config');
5
6
  const childProcess = require('child_process');
6
7
  const execa = require('execa');
8
+ const chalk = require('chalk');
7
9
  const execSync = childProcess.execSync;
8
10
 
9
11
  module.exports.start = (options) => {
@@ -27,11 +29,11 @@ const build = (cliConfig, targetPath) => {
27
29
  let target = targetPath;
28
30
  console.log(`--cleaning target : ${target}`);
29
31
 
30
- if (!tools.isDirEmpty(target)) {
31
- tools.logError(`Target directory : ${target} is not empty, execute eUI CLI in a blank directory... quitting`);
32
+ if (fileSystem.readdirSync(target).length > 0) {
33
+ printErrorLog(`Target directory : ${target} is not empty, execute eUI CLI in a blank directory... quitting`);
32
34
  throw new Error('DIR_NOT_EMPTY');
33
35
  } else {
34
- return tools.rimraf(`${target}/**/*`);
36
+ return rimrafSync(`${target}/**/*`);
35
37
  }
36
38
  })
37
39
 
@@ -56,7 +58,7 @@ const build = (cliConfig, targetPath) => {
56
58
  return Promise.resolve()
57
59
  .then(() => {
58
60
  console.log('--building web-maven');
59
- return tools.copydir(config.webMavenPath, targetPath);
61
+ return copyDirectory(config.webMavenPath, targetPath, true);
60
62
  })
61
63
  .then(() => {
62
64
  const angularPath = utils.getAngularPath(targetPath, appName, appType);
@@ -107,7 +109,7 @@ const build = (cliConfig, targetPath) => {
107
109
  throw e;
108
110
  })
109
111
  .finally(() => {
110
- return tools.rimraf(`${targetPath}/.git`);
112
+ return rimrafSync(`${targetPath}/.git`);
111
113
  })
112
114
  }
113
115
 
@@ -127,11 +129,11 @@ const copyAngular = (targetPath, cliConfig, overwrite = true) => {
127
129
  const {angularBasePath} = config;
128
130
  const sourcePath = angularBasePath;
129
131
 
130
- return tools.copydir(sourcePath, targetPath, overwrite);
132
+ return copyDirectory(sourcePath, targetPath, overwrite);
131
133
  })
132
134
  .then(() => {
133
135
  if (cliConfig.appType === 'mobile') {
134
- return tools.copydir(config.angularBaseMobilePath, targetPath, overwrite);
136
+ return copyDirectory(config.angularBaseMobilePath, targetPath, overwrite);
135
137
  }
136
138
  })
137
139
  .then(() => {
@@ -139,20 +141,20 @@ const copyAngular = (targetPath, cliConfig, overwrite = true) => {
139
141
  cliConfig.appOptions.forEach((item) => {
140
142
  if (item !== 'ecl') {
141
143
  console.log('Applying option : ' + item);
142
- tools.copydir(config.optionsPath[item], targetPath, true);
144
+ copyDirectory(config.optionsPath[item], targetPath, true);
143
145
  }
144
146
  })
145
147
  if (cliConfig.appOptions.includes('ecl') && cliConfig.appOptionsEclTheme) {
146
148
  console.log(`eUI ECL theme selected : ` + cliConfig.appOptionsEclTheme);
147
- tools.copydir(config.optionsPath[cliConfig.appOptionsEclTheme], targetPath, true);
149
+ copyDirectory(config.optionsPath[cliConfig.appOptionsEclTheme], targetPath, true);
148
150
  }
149
151
  }
150
152
  return Promise.resolve();
151
153
  })
152
154
  .then(() => {
153
- const allAvaiableOptionsCount = Object.keys(config.optionsPath).length - 1;
155
+ const allAvailableOptionsCount = Object.keys(config.optionsPath).length - 1;
154
156
  if (cliConfig.appOptions && cliConfig.appOptions.length === allAvaiableOptionsCount) {
155
- tools.copydir(config.optionsPath["ecl-openid-jwt"], targetPath, true);
157
+ copyDirectory(config.optionsPath["ecl-openid-jwt"], targetPath, true);
156
158
  console.log('Applying options merge : ecl-openid-jwt');
157
159
  }
158
160
  return Promise.resolve();
@@ -161,3 +163,42 @@ const copyAngular = (targetPath, cliConfig, overwrite = true) => {
161
163
  throw e;
162
164
  })
163
165
  }
166
+
167
+ const printErrorLog = (msg) => {
168
+ const now = new Date();
169
+ const currentDateTime = now.getHours().toString().padStart(2, '0') + ':' +
170
+ now.getMinutes().toString().padStart(2, '0') + ':' +
171
+ now.getSeconds().toString().padStart(2, '0');
172
+ console.info(chalk.red(`${currentDateTime} - ${'❯'.repeat(6)} ${msg}`));
173
+ }
174
+
175
+ const copyDirectory = (source, destination, overwrite = false) => {
176
+ // Create destination directory if it doesn't exist
177
+ if (!fileSystem.existsSync(destination)) {
178
+ fileSystem.mkdirSync(destination);
179
+ }
180
+
181
+ // Get list of files and directories in the source directory
182
+ const files = fileSystem.readdirSync(source);
183
+
184
+ // Iterate through each file/directory
185
+ files.forEach((file) => {
186
+ const sourcePath = path.join(source, file);
187
+ const destinationPath = path.join(destination, file);
188
+
189
+ // Check if it's a directory
190
+ if (fileSystem.lstatSync(sourcePath).isDirectory()) {
191
+ // Recursively copy subdirectory
192
+ copyDirectory(sourcePath, destinationPath, overwrite);
193
+ } else {
194
+ // Check if the file already exists in the destination directory
195
+ if (fileSystem.existsSync(destinationPath) && overwrite) {
196
+ // Overwrite existing file
197
+ fileSystem.copyFileSync(sourcePath, destinationPath);
198
+ } else if (!fileSystem.existsSync(destinationPath)) {
199
+ // Copy file if it doesn't exist in the destination or if overwrite is true
200
+ fileSystem.copyFileSync(sourcePath, destinationPath);
201
+ }
202
+ }
203
+ });
204
+ }
package/lib/install.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const childProcess = require('child_process');
2
2
  const execSync = childProcess.execSync;
3
3
  const path = require('path');
4
- const tools = require('@eui/tools/scripts/utils/tools');
4
+ const fileSystem = require('fs');
5
5
  const utils = require('./utils');
6
6
  const chalk = require('chalk');
7
7
 
@@ -27,13 +27,13 @@ const install = (cliConfig, targetPath) => {
27
27
 
28
28
  console.log('');
29
29
  console.log('');
30
- console.log('*****************************************************');
30
+ console.log('*'.repeat(65));
31
31
  console.log(chalk.cyan(' Installing app dependencies... PLEASE WAIT....'));
32
- console.log('*****************************************************');
32
+ console.log('*'.repeat(65));
33
33
 
34
34
  return Promise.resolve()
35
35
  .then(() => {
36
- return tools.remove(path.join(wd, 'yarn.lock'));
36
+ return fileSystem.unlinkSync(path.join(wd, 'yarn.lock'));
37
37
  })
38
38
  .then(() => {
39
39
  return execSync("yarn", { cwd: wd, stdio: "inherit" });
@@ -41,9 +41,9 @@ const install = (cliConfig, targetPath) => {
41
41
  .then(() => {
42
42
  console.log('');
43
43
  console.log('');
44
- console.log('*****************************************************************');
44
+ console.log('*'.repeat(65));
45
45
  console.log(chalk.cyan(' Starting eUI app... browser will open soon on localhost:4200'));
46
- console.log('*****************************************************************');
46
+ console.log('*'.repeat(65));
47
47
 
48
48
  return execSync("npm start", { cwd: wd, stdio: "inherit" });
49
49
  })
package/lib/post-build.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const path = require('path');
2
- const tools = require('@eui/tools/scripts/utils/tools');
2
+ const fileSystem = require('fs');
3
3
 
4
4
  const utils = require('./utils');
5
5
 
@@ -24,7 +24,13 @@ const postBuild = (cliConfig, targetPath) => {
24
24
  .then(() => {
25
25
  console.log('--renaming .gitignore');
26
26
  const angularPath = utils.getAngularPath(targetPath, appName, appType, artifactId);
27
- return tools.move(path.join(angularPath, 'gitignore_TO_REPLACE'), path.join(angularPath, '.gitignore'));
27
+ // With flag 'w' should create the file if it doesn't exist.
28
+ // If the file already exists, it will be replaced with the new content.
29
+ return fileSystem.writeFileSync(
30
+ path.join(angularPath, '.gitignore'),
31
+ fileSystem.readFileSync(path.join(angularPath, 'gitignore_TO_REPLACE')),
32
+ { flag: 'w' }
33
+ )
28
34
  })
29
35
 
30
36
  .catch((e) => {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eui-angular-app",
3
- "version": "17.3.0",
3
+ "version": "17.3.1-snapshot-1711320784876",
4
4
  "license": "EUPL-1.1",
5
5
  "scripts": {
6
6
  "ng": "ng",
@@ -20,6 +20,6 @@
20
20
  },
21
21
  "private": true,
22
22
  "dependencies": {
23
- "@eui/deps-base": "17.3.0"
23
+ "@eui/deps-base": "17.3.1-snapshot-1711320784876"
24
24
  }
25
25
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eui-angular-app",
3
- "version": "17.3.0",
3
+ "version": "17.3.1-snapshot-1711320784876",
4
4
  "license": "EUPL-1.1",
5
5
  "scripts": {
6
6
  "ng": "ng",
@@ -21,7 +21,7 @@
21
21
  "private": true,
22
22
  "dependencies": {
23
23
  "@eui/deps-base": "16.2.15",
24
- "@eui/mobile-core": "16.7.0",
25
- "@eui/mobile-styles": "16.7.0"
24
+ "@eui/mobile-core": "16.8.0",
25
+ "@eui/mobile-styles": "16.8.0"
26
26
  }
27
27
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eui-angular-app",
3
- "version": "17.3.0",
3
+ "version": "17.3.1-snapshot-1711320784876",
4
4
  "license": "EUPL-1.1",
5
5
  "scripts": {
6
6
  "ng": "ng",
@@ -21,6 +21,6 @@
21
21
  },
22
22
  "private": true,
23
23
  "dependencies": {
24
- "@eui/deps-base": "17.3.0"
24
+ "@eui/deps-base": "17.3.1-snapshot-1711320784876"
25
25
  }
26
26
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eui-angular-app",
3
- "version": "17.3.0",
3
+ "version": "17.3.1-snapshot-1711320784876",
4
4
  "license": "EUPL-1.1",
5
5
  "scripts": {
6
6
  "ng": "ng",
@@ -18,6 +18,6 @@
18
18
  },
19
19
  "private": true,
20
20
  "dependencies": {
21
- "@eui/deps-base": "17.3.0"
21
+ "@eui/deps-base": "17.3.1-snapshot-1711320784876"
22
22
  }
23
23
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eui-angular-app",
3
- "version": "17.3.0",
3
+ "version": "17.3.1-snapshot-1711320784876",
4
4
  "license": "EUPL-1.1",
5
5
  "description": "eUI JEE Symfony app scripts",
6
6
  "scripts": {
@@ -19,6 +19,6 @@
19
19
  },
20
20
  "private": true,
21
21
  "dependencies": {
22
- "@eui/deps-base": "17.3.0"
22
+ "@eui/deps-base": "17.3.1-snapshot-1711320784876"
23
23
  }
24
24
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eui/cli",
3
- "version": "17.3.0",
4
- "tag": "latest",
3
+ "version": "17.3.1-snapshot-1711320784876",
4
+ "tag": "snapshot",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI CLI app generator",
7
7
  "bin": {
@@ -13,15 +13,13 @@
13
13
  "url": "https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui"
14
14
  },
15
15
  "dependencies": {
16
- "@eui/tools": "6.16.1"
17
- },
18
- "peerDependencies": {
19
- "@eui/tools": "^6.0.0",
20
16
  "chalk": "^4.1.0",
21
17
  "figlet": "^1.7.0",
22
18
  "replace-in-file": "^7.1.0",
23
19
  "execa": "^5.1.1",
24
- "inquirer": "^8.1.0"
20
+ "inquirer": "^8.1.0",
21
+ "rimraf": "^5.0.5",
22
+ "@eui/tools": "6.16.3"
25
23
  },
26
24
  "preferGlobal": true,
27
25
  "homepage": "https://eui.ecdevops.eu",