@eui/cli 22.0.0-alpha.8 → 22.0.0-alpha.81
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.
- package/README.md +357 -88
- package/bin/eui-cli.js +26 -0
- package/bin/scripts/migrate.js +5 -0
- package/lib/app-utils/build.js +26 -0
- package/lib/app-utils/migrate.js +610 -0
- package/lib/app-utils/serve.js +32 -0
- package/lib/build.js +28 -7
- package/lib/cli.js +16 -2
- package/lib/config.js +10 -1
- package/lib/skeletons/_angular/base/mock/app/routes/{index.js → index.cjs} +1 -1
- package/lib/skeletons/_angular/base/mock/app/routes/{user_routes.js → user_routes.cjs} +1 -1
- package/lib/skeletons/_angular/base/mock/{server.js → server.cjs} +1 -1
- package/lib/skeletons/_angular/base/package.json +4 -3
- package/lib/skeletons/_angular/base/src/app/app-starter.service.ts +0 -1
- package/lib/skeletons/_angular/base/src/app/app.component.spec.ts +1 -1
- package/lib/skeletons/_angular/base/src/app/features/home/home.component.ts +0 -4
- package/lib/skeletons/_angular/base/tsconfig.json +1 -2
- package/lib/skeletons/_angular/base-mobile/package.json +5 -4
- package/lib/skeletons/_angular/base-mobile/src/app/features/about/opensource-licences/opensource-licences.component.ts +0 -1
- package/lib/skeletons/_angular/options/ecl-ec/angular.json +2 -2
- package/lib/skeletons/_angular/options/ecl-ec/src/app/app.component.html +2 -2
- package/lib/skeletons/_angular/options/ecl-ec/src/app/app.component.ts +4 -6
- package/lib/skeletons/_angular/options/ecl-ec/src/app/features/home/home.component.ts +0 -4
- package/lib/skeletons/_angular/options/ecl-eu/angular.json +2 -2
- package/lib/skeletons/_angular/options/ecl-eu/src/app/app.component.html +2 -2
- package/lib/skeletons/_angular/options/ecl-eu/src/app/app.component.ts +4 -6
- package/lib/skeletons/_angular/options/ecl-eu/src/app/features/home/home.component.ts +0 -4
- package/lib/skeletons/_angular/options/eds/src/app/app.component.html +35 -0
- package/lib/skeletons/_angular/options/eds/src/app/app.component.spec.ts +56 -0
- package/lib/skeletons/_angular/options/eds/src/app/app.component.ts +44 -0
- package/lib/skeletons/_angular/options/eds/src/index.html +21 -0
- package/lib/skeletons/_angular/options/pnpm/package.json +98 -48
- package/lib/skeletons/_react/base/README.md +65 -0
- package/lib/skeletons/_react/base/eslint.config.mjs +17 -0
- package/lib/skeletons/_react/base/gitignore_TO_REPLACE +34 -0
- package/lib/skeletons/_react/base/index.html +13 -0
- package/lib/skeletons/_react/base/mock/app/models/user.cjs +6 -0
- package/lib/skeletons/_react/base/mock/app/routes/index.cjs +5 -0
- package/lib/skeletons/_react/base/mock/app/routes/user_routes.cjs +44 -0
- package/lib/skeletons/_react/base/mock/db/db.json +10 -0
- package/lib/skeletons/_react/base/mock/server.cjs +23 -0
- package/lib/skeletons/_react/base/package.json +29 -0
- package/lib/skeletons/_react/base/public/.gitkeep +0 -0
- package/lib/skeletons/_react/base/src/App.tsx +73 -0
- package/lib/skeletons/_react/base/src/main.tsx +30 -0
- package/lib/skeletons/_react/base/src/pages/about.tsx +27 -0
- package/lib/skeletons/_react/base/src/pages/home.tsx +50 -0
- package/lib/skeletons/_react/base/src/routes.ts +18 -0
- package/lib/skeletons/_react/base/src/styles.css +37 -0
- package/lib/skeletons/_react/base/src/vite-env.d.ts +1 -0
- package/lib/skeletons/_react/base/tsconfig.app.json +18 -0
- package/lib/skeletons/_react/base/tsconfig.json +7 -0
- package/lib/skeletons/_react/base/tsconfig.node.json +15 -0
- package/lib/skeletons/_react/base/vite.config.ts +77 -0
- package/lib/skeletons/_react/options/pnpm/package.json +46 -0
- package/lib/utils.js +26 -2
- package/package.json +1 -1
- package/sonar-project.properties +0 -14
- /package/lib/skeletons/_angular/base/mock/app/models/{user.js → user.cjs} +0 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* App-specific styles. The EDS design tokens (--eds-* custom properties) come from
|
|
3
|
+
* @eui/eds-styles (loaded in main.tsx) and are available anywhere under the `eui-21` scope set
|
|
4
|
+
* on <body> in index.html. Prefer the eds-u-* utility classes for layout; use this file only
|
|
5
|
+
* for app-level chrome.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
html,
|
|
9
|
+
body,
|
|
10
|
+
#root {
|
|
11
|
+
height: 100%;
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.app-page {
|
|
16
|
+
padding: var(--eds-sp-l);
|
|
17
|
+
max-width: 960px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.app-page__title {
|
|
21
|
+
font: var(--eds-f-heading-l);
|
|
22
|
+
color: var(--eds-c-foreground);
|
|
23
|
+
margin: 0 0 var(--eds-sp-s);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.app-page__intro {
|
|
27
|
+
font: var(--eds-f-paragraph-m);
|
|
28
|
+
color: var(--eds-c-foreground-subtle);
|
|
29
|
+
margin: 0 0 var(--eds-sp-l);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.app-page code {
|
|
33
|
+
font-family: monospace;
|
|
34
|
+
background: var(--eds-c-surface-elevation-sunken);
|
|
35
|
+
border-radius: var(--eds-br-xs);
|
|
36
|
+
padding: 0 var(--eds-sp-3xs);
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ES2022",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"isolatedModules": true,
|
|
12
|
+
"verbatimModuleSyntax": true,
|
|
13
|
+
"noUnusedLocals": true,
|
|
14
|
+
"noUnusedParameters": true,
|
|
15
|
+
"noFallthroughCasesInSwitch": true
|
|
16
|
+
},
|
|
17
|
+
"include": ["src"]
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ES2022",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"lib": ["ES2022"],
|
|
7
|
+
"strict": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"noEmit": true,
|
|
10
|
+
"isolatedModules": true,
|
|
11
|
+
"verbatimModuleSyntax": true,
|
|
12
|
+
"types": ["node"]
|
|
13
|
+
},
|
|
14
|
+
"include": ["vite.config.ts"]
|
|
15
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { defineConfig, type Plugin } from 'vite';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname, join, resolve } from 'node:path';
|
|
4
|
+
import { cpSync, createReadStream, existsSync, statSync } from 'node:fs';
|
|
5
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
6
|
+
|
|
7
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const outDir = resolve(here, 'dist');
|
|
9
|
+
|
|
10
|
+
// EDS design assets (icon sprites, fonts, the shared eds-components.json catalog) ship inside the
|
|
11
|
+
// installed `@eui/eds-styles` package. `EdsIcon` resolves sprites from
|
|
12
|
+
// `${assetsBase}/eds/icons/sprites/{set}.svg`, so the package's `dist/assets` folder is exposed
|
|
13
|
+
// under `/assets/eds` for both the dev server and the built output.
|
|
14
|
+
const edsStylesAssets = resolve(here, 'node_modules/@eui/eds-styles/dist/assets');
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Serve + emit the EDS assets under `/assets/eds` so icon sprites resolve in dev and in the
|
|
18
|
+
* built bundle. Do NOT commit the sprite/font binaries into the app — they always come from the
|
|
19
|
+
* `@eui/eds-styles` package.
|
|
20
|
+
*/
|
|
21
|
+
function edsAssetsPlugin(assetsDir: string): Plugin {
|
|
22
|
+
const mime: Record<string, string> = {
|
|
23
|
+
'.svg': 'image/svg+xml',
|
|
24
|
+
'.json': 'application/json',
|
|
25
|
+
'.woff2': 'font/woff2',
|
|
26
|
+
'.woff': 'font/woff',
|
|
27
|
+
};
|
|
28
|
+
return {
|
|
29
|
+
name: 'eds-assets',
|
|
30
|
+
configureServer(server) {
|
|
31
|
+
server.middlewares.use((req: IncomingMessage, res: ServerResponse, next: () => void) => {
|
|
32
|
+
const url = (req.url ?? '').split('?')[0];
|
|
33
|
+
const prefix = '/assets/eds/';
|
|
34
|
+
if (!url.startsWith(prefix)) {
|
|
35
|
+
return next();
|
|
36
|
+
}
|
|
37
|
+
const file = join(assetsDir, url.slice(prefix.length));
|
|
38
|
+
if (!existsSync(file) || !statSync(file).isFile()) {
|
|
39
|
+
return next();
|
|
40
|
+
}
|
|
41
|
+
const ext = file.slice(file.lastIndexOf('.'));
|
|
42
|
+
res.setHeader('Content-Type', mime[ext] ?? 'application/octet-stream');
|
|
43
|
+
createReadStream(file).pipe(res);
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
closeBundle() {
|
|
47
|
+
if (existsSync(assetsDir)) {
|
|
48
|
+
cpSync(assetsDir, join(outDir, 'assets', 'eds'), { recursive: true });
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Relative asset base (`./`) so the built app works under any deploy sub-path. JSX uses Vite's
|
|
55
|
+
// built-in esbuild automatic runtime (no @vitejs/plugin-react needed).
|
|
56
|
+
export default defineConfig({
|
|
57
|
+
root: here,
|
|
58
|
+
base: './',
|
|
59
|
+
publicDir: resolve(here, 'public'),
|
|
60
|
+
esbuild: { jsx: 'automatic' },
|
|
61
|
+
plugins: [edsAssetsPlugin(edsStylesAssets)],
|
|
62
|
+
build: {
|
|
63
|
+
outDir,
|
|
64
|
+
emptyOutDir: true,
|
|
65
|
+
},
|
|
66
|
+
server: {
|
|
67
|
+
port: 4200,
|
|
68
|
+
open: '/',
|
|
69
|
+
// Proxy API calls to the mock json-server (started in parallel via `npm start`).
|
|
70
|
+
proxy: {
|
|
71
|
+
'/api': {
|
|
72
|
+
target: 'http://localhost:3000',
|
|
73
|
+
changeOrigin: true,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "eui-react-app",
|
|
3
|
+
"version": "22.0.0-alpha.81",
|
|
4
|
+
"license": "EUPL-1.1",
|
|
5
|
+
"private": true,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"start-mock-server": "nodemon --watch ./mock ./mock/server.cjs",
|
|
9
|
+
"start-serve": "eui-cli serve-app",
|
|
10
|
+
"start": "npm-run-all --parallel start-mock-server start-serve",
|
|
11
|
+
"start-local": "eui-cli serve-app",
|
|
12
|
+
"build": "tsc -b && eui-cli build-app",
|
|
13
|
+
"preview": "vite preview",
|
|
14
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
15
|
+
"test": "vitest run"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"react": "19.3.0",
|
|
19
|
+
"react-dom": "19.3.0",
|
|
20
|
+
"react-router-dom": "7.18.4",
|
|
21
|
+
"luxon": "3.7.2",
|
|
22
|
+
"@eui/eds-styles": "22.0.0-alpha.81",
|
|
23
|
+
"@eui/eds-react": "22.0.0-alpha.81",
|
|
24
|
+
"@eui/eds-shared": "22.0.0-alpha.81"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@eui/cli": "22.0.0-alpha.81",
|
|
28
|
+
"typescript": "6.0.3",
|
|
29
|
+
"@types/react": "19.3.0",
|
|
30
|
+
"@types/react-dom": "19.3.0",
|
|
31
|
+
"@types/luxon": "3.7.2",
|
|
32
|
+
"vitest": "4.1.11",
|
|
33
|
+
"@vitest/ui": "4.1.11",
|
|
34
|
+
"@vitest/coverage-v8": "4.1.11",
|
|
35
|
+
"@vitest/coverage-istanbul": "4.1.11",
|
|
36
|
+
"eslint": "9.39.1",
|
|
37
|
+
"typescript-eslint": "8.63.0",
|
|
38
|
+
"@eslint/js": "9.39.1",
|
|
39
|
+
"npm-run-all": "4.1.5",
|
|
40
|
+
"json-server": "1.0.0-beta.3",
|
|
41
|
+
"nodemon": "3.1.11",
|
|
42
|
+
"lowdb": "1.0.0",
|
|
43
|
+
"body-parser": "1.20.3",
|
|
44
|
+
"express": "4.21.2"
|
|
45
|
+
}
|
|
46
|
+
}
|
package/lib/utils.js
CHANGED
|
@@ -9,6 +9,7 @@ module.exports.getAngularPath = (targetPath, appName, appType, artifactId) => {
|
|
|
9
9
|
switch(appType) {
|
|
10
10
|
case 'angular':
|
|
11
11
|
case 'mobile':
|
|
12
|
+
case 'react':
|
|
12
13
|
return targetPath;
|
|
13
14
|
case 'web-maven':
|
|
14
15
|
return `${targetPath}/src/main/angular`;
|
|
@@ -16,10 +17,33 @@ module.exports.getAngularPath = (targetPath, appName, appType, artifactId) => {
|
|
|
16
17
|
return `${targetPath}/${artifactId}-web/src/main/angular`;
|
|
17
18
|
case 'web-symfony':
|
|
18
19
|
return `${targetPath}/client`;
|
|
20
|
+
default:
|
|
21
|
+
throw new Error(`Unknown appType: "${appType}"`);
|
|
19
22
|
}
|
|
20
23
|
}
|
|
21
24
|
|
|
22
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Detects the toolchain of the app in `cwd`. A generated eUI app is either an Angular app
|
|
27
|
+
* (has `angular.json`) or a standalone Vite React app (has `vite.config.ts`/`.js` and no
|
|
28
|
+
* `angular.json`). Returns `'vite'` or `'angular'` so the serve/build commands can dispatch to
|
|
29
|
+
* the right tool while keeping a single `eui-cli serve-app` / `build-app` command surface.
|
|
30
|
+
*/
|
|
31
|
+
module.exports.detectAppTool = (cwd = process.cwd()) => {
|
|
32
|
+
if (isFileExists(path.join(cwd, 'angular.json'))) {
|
|
33
|
+
return 'angular';
|
|
34
|
+
}
|
|
35
|
+
if (
|
|
36
|
+
isFileExists(path.join(cwd, 'vite.config.ts')) ||
|
|
37
|
+
isFileExists(path.join(cwd, 'vite.config.js')) ||
|
|
38
|
+
isFileExists(path.join(cwd, 'vite.config.mjs'))
|
|
39
|
+
) {
|
|
40
|
+
return 'vite';
|
|
41
|
+
}
|
|
42
|
+
// Default to Angular for backward compatibility with existing generated apps.
|
|
43
|
+
return 'angular';
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const getArgs = module.exports.getArgs = () => {
|
|
23
47
|
const argv = {};
|
|
24
48
|
const processArgs = process.env._CSDR_ARGS;
|
|
25
49
|
|
|
@@ -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
package/sonar-project.properties
DELETED
|
@@ -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/**/*
|
|
File without changes
|