@eui/cli 22.0.0-alpha.9 → 22.0.0-alpha.90

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 (72) hide show
  1. package/README.md +357 -88
  2. package/bin/eui-cli.js +26 -0
  3. package/bin/scripts/migrate.js +5 -0
  4. package/lib/app-utils/build.js +26 -0
  5. package/lib/app-utils/migrate.js +610 -0
  6. package/lib/app-utils/serve.js +32 -0
  7. package/lib/build.js +28 -7
  8. package/lib/cli.js +16 -2
  9. package/lib/config.js +10 -1
  10. package/lib/skeletons/_angular/base/mock/app/routes/{index.js → index.cjs} +1 -1
  11. package/lib/skeletons/_angular/base/mock/app/routes/{user_routes.js → user_routes.cjs} +1 -1
  12. package/lib/skeletons/_angular/base/mock/{server.js → server.cjs} +1 -1
  13. package/lib/skeletons/_angular/base/package.json +9 -13
  14. package/lib/skeletons/_angular/base/src/app/app-starter.service.ts +10 -2
  15. package/lib/skeletons/_angular/base/src/app/app.component.spec.ts +1 -1
  16. package/lib/skeletons/_angular/base/src/app/features/home/home.component.ts +0 -4
  17. package/lib/skeletons/_angular/base/src/config/global.ts +4 -1
  18. package/lib/skeletons/_angular/base/tsconfig.json +1 -2
  19. package/lib/skeletons/_angular/base-mobile/package.json +6 -19
  20. package/lib/skeletons/_angular/base-mobile/src/app/app-starter.service.ts +10 -1
  21. package/lib/skeletons/_angular/base-mobile/src/app/features/about/opensource-licences/opensource-licences.component.ts +0 -1
  22. package/lib/skeletons/_angular/base-mobile/src/config/global.ts +4 -1
  23. package/lib/skeletons/_angular/options/ecl-ec/angular.json +2 -2
  24. package/lib/skeletons/_angular/options/ecl-ec/src/app/app.component.html +2 -2
  25. package/lib/skeletons/_angular/options/ecl-ec/src/app/app.component.ts +4 -6
  26. package/lib/skeletons/_angular/options/ecl-ec/src/app/features/home/home.component.ts +0 -4
  27. package/lib/skeletons/_angular/options/ecl-ec/src/config/global.ts +4 -1
  28. package/lib/skeletons/_angular/options/ecl-eu/angular.json +2 -2
  29. package/lib/skeletons/_angular/options/ecl-eu/src/app/app.component.html +2 -2
  30. package/lib/skeletons/_angular/options/ecl-eu/src/app/app.component.ts +4 -6
  31. package/lib/skeletons/_angular/options/ecl-eu/src/app/features/home/home.component.ts +0 -4
  32. package/lib/skeletons/_angular/options/ecl-eu/src/config/global.ts +4 -1
  33. package/lib/skeletons/_angular/options/eds/src/app/app.component.html +35 -0
  34. package/lib/skeletons/_angular/options/eds/src/app/app.component.spec.ts +56 -0
  35. package/lib/skeletons/_angular/options/eds/src/app/app.component.ts +44 -0
  36. package/lib/skeletons/_angular/options/eds/src/index.html +21 -0
  37. package/lib/skeletons/_angular/options/pnpm/package.json +91 -48
  38. package/lib/skeletons/_react/base/README.md +65 -0
  39. package/lib/skeletons/_react/base/eslint.config.mjs +17 -0
  40. package/lib/skeletons/_react/base/gitignore_TO_REPLACE +34 -0
  41. package/lib/skeletons/_react/base/index.html +13 -0
  42. package/lib/skeletons/_react/base/mock/app/models/user.cjs +6 -0
  43. package/lib/skeletons/_react/base/mock/app/routes/index.cjs +5 -0
  44. package/lib/skeletons/_react/base/mock/app/routes/user_routes.cjs +44 -0
  45. package/lib/skeletons/_react/base/mock/db/db.json +10 -0
  46. package/lib/skeletons/_react/base/mock/server.cjs +23 -0
  47. package/lib/skeletons/_react/base/package.json +29 -0
  48. package/lib/skeletons/_react/base/public/.gitkeep +0 -0
  49. package/lib/skeletons/_react/base/src/App.tsx +73 -0
  50. package/lib/skeletons/_react/base/src/main.tsx +30 -0
  51. package/lib/skeletons/_react/base/src/pages/about.tsx +27 -0
  52. package/lib/skeletons/_react/base/src/pages/home.tsx +50 -0
  53. package/lib/skeletons/_react/base/src/routes.ts +18 -0
  54. package/lib/skeletons/_react/base/src/styles.css +37 -0
  55. package/lib/skeletons/_react/base/src/vite-env.d.ts +1 -0
  56. package/lib/skeletons/_react/base/tsconfig.app.json +18 -0
  57. package/lib/skeletons/_react/base/tsconfig.json +7 -0
  58. package/lib/skeletons/_react/base/tsconfig.node.json +15 -0
  59. package/lib/skeletons/_react/base/vite.config.ts +77 -0
  60. package/lib/skeletons/_react/options/pnpm/package.json +46 -0
  61. package/lib/skeletons/web-maven/pom.xml +2 -2
  62. package/lib/skeletons/web-spring-boot/myapp-web/pom.xml +4 -5
  63. package/lib/skeletons/web-spring-boot/myapp-web-rest/pom.xml +2 -4
  64. package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/security/FakeAuthenticationFilter.java +0 -2
  65. package/lib/skeletons/web-spring-boot/pom.xml +1 -1
  66. package/lib/utils/fs-extra.js +38 -0
  67. package/lib/utils/glob.js +144 -0
  68. package/lib/utils/rimraf.js +14 -0
  69. package/lib/utils.js +39 -15
  70. package/package.json +2 -7
  71. package/sonar-project.properties +0 -14
  72. /package/lib/skeletons/_angular/base/mock/app/models/{user.js → user.cjs} +0 -0
package/lib/utils.js CHANGED
@@ -1,14 +1,14 @@
1
1
  const fs = require('fs');
2
- const fse = require('fs-extra');
3
- const glob = require('glob');
2
+ const fse = require('./utils/fs-extra');
3
+ const glob = require('./utils/glob');
4
4
  const path = require('path');
5
- const figlet = require('figlet');
6
- const rimraf = require('rimraf');
5
+ const rimraf = require('./utils/rimraf');
7
6
 
8
7
  module.exports.getAngularPath = (targetPath, appName, appType, artifactId) => {
9
8
  switch(appType) {
10
9
  case 'angular':
11
10
  case 'mobile':
11
+ case 'react':
12
12
  return targetPath;
13
13
  case 'web-maven':
14
14
  return `${targetPath}/src/main/angular`;
@@ -16,10 +16,33 @@ module.exports.getAngularPath = (targetPath, appName, appType, artifactId) => {
16
16
  return `${targetPath}/${artifactId}-web/src/main/angular`;
17
17
  case 'web-symfony':
18
18
  return `${targetPath}/client`;
19
+ default:
20
+ throw new Error(`Unknown appType: "${appType}"`);
19
21
  }
20
22
  }
21
23
 
22
- module.exports.getArgs = () => {
24
+ /**
25
+ * Detects the toolchain of the app in `cwd`. A generated eUI app is either an Angular app
26
+ * (has `angular.json`) or a standalone Vite React app (has `vite.config.ts`/`.js` and no
27
+ * `angular.json`). Returns `'vite'` or `'angular'` so the serve/build commands can dispatch to
28
+ * the right tool while keeping a single `eui-cli serve-app` / `build-app` command surface.
29
+ */
30
+ module.exports.detectAppTool = (cwd = process.cwd()) => {
31
+ if (isFileExists(path.join(cwd, 'angular.json'))) {
32
+ return 'angular';
33
+ }
34
+ if (
35
+ isFileExists(path.join(cwd, 'vite.config.ts')) ||
36
+ isFileExists(path.join(cwd, 'vite.config.js')) ||
37
+ isFileExists(path.join(cwd, 'vite.config.mjs'))
38
+ ) {
39
+ return 'vite';
40
+ }
41
+ // Default to Angular for backward compatibility with existing generated apps.
42
+ return 'angular';
43
+ };
44
+
45
+ const getArgs = module.exports.getArgs = () => {
23
46
  const argv = {};
24
47
  const processArgs = process.env._CSDR_ARGS;
25
48
 
@@ -79,8 +102,9 @@ module.exports.getArgs = () => {
79
102
 
80
103
 
81
104
  module.exports.logBigTitle = (text) => {
105
+ const line = '='.repeat(text.length + 8);
82
106
  console.log('\n\n');
83
- console.log('\x1b[33m', figlet.textSync(text, { horizontalLayout: 'full' }) ,'\x1b[0m');
107
+ console.log('\x1b[33m', `${line}\n ${text.toUpperCase()} \n${line}` ,'\x1b[0m');
84
108
  console.log('\n');
85
109
  }
86
110
 
@@ -138,7 +162,7 @@ module.exports.logDebugResponse = (response) => {
138
162
 
139
163
  module.exports.isDirEmpty = (path) => {
140
164
  try {
141
- var files = fse.readdirSync(path);
165
+ var files = fs.readdirSync(path);
142
166
 
143
167
  if (files.length === 0) {
144
168
  return true;
@@ -234,13 +258,13 @@ module.exports.rimraf = (inputPath) => {
234
258
 
235
259
  module.exports.getFilesGlob = (from, fileGlob) => {
236
260
  return new Promise((resolve, reject) => {
237
- glob(fileGlob, { ignore: ['dist/**'], cwd: from, nodir: true, follow: true, dot: true }, (err, files) => {
238
- if (err) {
239
- logError(err);
240
- reject(err);
241
- }
242
- return resolve(files);
243
- })
261
+ try {
262
+ const files = glob.sync(fileGlob, { ignore: ['dist/**'], cwd: from, nodir: true, follow: true, dot: true });
263
+ resolve(files);
264
+ } catch (err) {
265
+ logError(err);
266
+ reject(err);
267
+ }
244
268
  });
245
269
  }
246
270
 
@@ -287,4 +311,4 @@ const log = (msg, type) => {
287
311
  msgContent = `${msg}`;
288
312
  console.info(msgContent);
289
313
  }
290
- }
314
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/cli",
3
- "version": "22.0.0-alpha.9",
3
+ "version": "22.0.0-alpha.90",
4
4
  "tag": "next",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI CLI app generator & tools",
@@ -13,13 +13,8 @@
13
13
  "url": "https://sdlc.webcloud.ec.europa.eu/csdr/eui/eui.git"
14
14
  },
15
15
  "dependencies": {
16
- "figlet": "1.11.4",
17
16
  "enquirer": "2.4.1",
18
- "commander": "15.0.0",
19
- "fs-extra": "11.4.0",
20
- "glob": "13.0.6",
21
- "rimraf": "6.1.3",
22
- "cross-spawn": "7.0.6"
17
+ "commander": "15.1.0"
23
18
  },
24
19
  "preferGlobal": true,
25
20
  "homepage": "https://eui.ecdevops.eu",
@@ -1,14 +0,0 @@
1
- sonar.projectKey=CSDR-EUI-CLI
2
- sonar.projectName=EUI-CLI
3
- sonar.projectVersion=375ec32
4
-
5
-
6
- sonar.sources=/builds/csdr/eui/eui/packages/cli
7
- sonar.sourceEncoding=UTF-8
8
-
9
- sonar.test.inclusions=**/*.spec.ts
10
-
11
- sonar.ts.tslint.configPath=tslint.json
12
- sonar.typescript.lcov.reportPaths=/builds/csdr/eui/eui/packages/cli/test/reports/coverage-lcov/lcov.info
13
-
14
- sonar.exclusions=**/*.js, **/mock/**/*, **/mocks/**/*