@magmonium/cli 0.7.8
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 +392 -0
- package/bin/README.md +244 -0
- package/bin/cli.js +55 -0
- package/bin/commands/assets-wc.js +249 -0
- package/bin/commands/assets.js +943 -0
- package/bin/commands/build.js +242 -0
- package/bin/commands/clean.js +621 -0
- package/bin/commands/compile-i18n.js +91 -0
- package/bin/commands/config-ci.js +266 -0
- package/bin/commands/configure-wc.js +167 -0
- package/bin/commands/connect.js +188 -0
- package/bin/commands/create-app.js +946 -0
- package/bin/commands/deploy.js +100 -0
- package/bin/commands/fix-i18n.js +40 -0
- package/bin/commands/generate.js +765 -0
- package/bin/commands/init/config-files.js +1114 -0
- package/bin/commands/init/mag-assets.js +541 -0
- package/bin/commands/init/mag-cli-config.js +120 -0
- package/bin/commands/init/monorepo-structure.js +735 -0
- package/bin/commands/init/package-json.js +308 -0
- package/bin/commands/init/project-structure.js +189 -0
- package/bin/commands/init/pwa-files.js +204 -0
- package/bin/commands/init/source-files.js +2596 -0
- package/bin/commands/init.js +591 -0
- package/bin/commands/lib.js +508 -0
- package/bin/commands/patch-wc-env.js +136 -0
- package/bin/commands/refractor.js +51 -0
- package/bin/commands/sanitize-i18n.js +41 -0
- package/bin/commands/translate.js +32 -0
- package/bin/commands/zip.js +540 -0
- package/package.json +53 -0
- package/src/compilers/button-group-compiler.d.ts +18 -0
- package/src/compilers/button-group-compiler.d.ts.map +1 -0
- package/src/compilers/button-group-compiler.js +151 -0
- package/src/compilers/button-group-compiler.js.map +1 -0
- package/src/compilers/copy-compiler.d.ts +14 -0
- package/src/compilers/copy-compiler.d.ts.map +1 -0
- package/src/compilers/copy-compiler.js +170 -0
- package/src/compilers/copy-compiler.js.map +1 -0
- package/src/compilers/field-compiler.d.ts +15 -0
- package/src/compilers/field-compiler.d.ts.map +1 -0
- package/src/compilers/field-compiler.js +153 -0
- package/src/compilers/field-compiler.js.map +1 -0
- package/src/compilers/form-compiler.d.ts +15 -0
- package/src/compilers/form-compiler.d.ts.map +1 -0
- package/src/compilers/form-compiler.js +220 -0
- package/src/compilers/form-compiler.js.map +1 -0
- package/src/compilers/logo-compiler.d.ts +14 -0
- package/src/compilers/logo-compiler.d.ts.map +1 -0
- package/src/compilers/logo-compiler.js +114 -0
- package/src/compilers/logo-compiler.js.map +1 -0
- package/src/compilers/options-compiler.d.ts +46 -0
- package/src/compilers/options-compiler.d.ts.map +1 -0
- package/src/compilers/options-compiler.js +329 -0
- package/src/compilers/options-compiler.js.map +1 -0
- package/src/compilers/pwa-build.d.ts +7 -0
- package/src/compilers/pwa-build.d.ts.map +1 -0
- package/src/compilers/pwa-build.js +62 -0
- package/src/compilers/pwa-build.js.map +1 -0
- package/src/compilers/svg-compiler.d.ts +12 -0
- package/src/compilers/svg-compiler.d.ts.map +1 -0
- package/src/compilers/svg-compiler.js +123 -0
- package/src/compilers/svg-compiler.js.map +1 -0
- package/src/compilers/tabs-compiler.d.ts +25 -0
- package/src/compilers/tabs-compiler.d.ts.map +1 -0
- package/src/compilers/tabs-compiler.js +422 -0
- package/src/compilers/tabs-compiler.js.map +1 -0
- package/src/compilers/theme-compiler.d.ts +14 -0
- package/src/compilers/theme-compiler.d.ts.map +1 -0
- package/src/compilers/theme-compiler.js +144 -0
- package/src/compilers/theme-compiler.js.map +1 -0
- package/src/compilers/translation-compiler.d.ts +17 -0
- package/src/compilers/translation-compiler.d.ts.map +1 -0
- package/src/compilers/translation-compiler.js +232 -0
- package/src/compilers/translation-compiler.js.map +1 -0
- package/src/compilers/web-component/index.d.ts +3 -0
- package/src/compilers/web-component/index.d.ts.map +1 -0
- package/src/compilers/web-component/index.js +6 -0
- package/src/compilers/web-component/index.js.map +1 -0
- package/src/compilers/web-component/lib/builder.d.ts +45 -0
- package/src/compilers/web-component/lib/builder.d.ts.map +1 -0
- package/src/compilers/web-component/lib/builder.js +341 -0
- package/src/compilers/web-component/lib/builder.js.map +1 -0
- package/src/compilers/web-component/lib/class-name.d.ts +4 -0
- package/src/compilers/web-component/lib/class-name.d.ts.map +1 -0
- package/src/compilers/web-component/lib/class-name.js +24 -0
- package/src/compilers/web-component/lib/class-name.js.map +1 -0
- package/src/compilers/web-component/lib/config-data.d.ts +9 -0
- package/src/compilers/web-component/lib/config-data.d.ts.map +1 -0
- package/src/compilers/web-component/lib/config-data.js +14 -0
- package/src/compilers/web-component/lib/config-data.js.map +1 -0
- package/src/compilers/web-component/lib/ng-build.d.ts +8 -0
- package/src/compilers/web-component/lib/ng-build.d.ts.map +1 -0
- package/src/compilers/web-component/lib/ng-build.js +685 -0
- package/src/compilers/web-component/lib/ng-build.js.map +1 -0
- package/src/compilers/web-component/lib/resource-inliner.d.ts +9 -0
- package/src/compilers/web-component/lib/resource-inliner.d.ts.map +1 -0
- package/src/compilers/web-component/lib/resource-inliner.js +355 -0
- package/src/compilers/web-component/lib/resource-inliner.js.map +1 -0
- package/src/compilers/web-component/lib/web-component-name.d.ts +3 -0
- package/src/compilers/web-component/lib/web-component-name.d.ts.map +1 -0
- package/src/compilers/web-component/lib/web-component-name.js +47 -0
- package/src/compilers/web-component/lib/web-component-name.js.map +1 -0
- package/src/compilers/web-component/lib/web-component-wrapper.d.ts +3 -0
- package/src/compilers/web-component/lib/web-component-wrapper.d.ts.map +1 -0
- package/src/compilers/web-component/lib/web-component-wrapper.js +335 -0
- package/src/compilers/web-component/lib/web-component-wrapper.js.map +1 -0
- package/src/compilers/web-component/model/type.d.ts +29 -0
- package/src/compilers/web-component/model/type.d.ts.map +1 -0
- package/src/compilers/web-component/model/type.js +3 -0
- package/src/compilers/web-component/model/type.js.map +1 -0
- package/src/compilers/worker-compiler.d.ts +12 -0
- package/src/compilers/worker-compiler.d.ts.map +1 -0
- package/src/compilers/worker-compiler.js +123 -0
- package/src/compilers/worker-compiler.js.map +1 -0
- package/src/compilers/yaml-compiler.d.ts +18 -0
- package/src/compilers/yaml-compiler.d.ts.map +1 -0
- package/src/compilers/yaml-compiler.js +139 -0
- package/src/compilers/yaml-compiler.js.map +1 -0
- package/src/core/base-compiler.d.ts +17 -0
- package/src/core/base-compiler.d.ts.map +1 -0
- package/src/core/base-compiler.js +78 -0
- package/src/core/base-compiler.js.map +1 -0
- package/src/core/config.d.ts +640 -0
- package/src/core/config.d.ts.map +1 -0
- package/src/core/config.js +432 -0
- package/src/core/config.js.map +1 -0
- package/src/core/file-watcher.d.ts +23 -0
- package/src/core/file-watcher.d.ts.map +1 -0
- package/src/core/file-watcher.js +63 -0
- package/src/core/file-watcher.js.map +1 -0
- package/src/index.d.ts +31 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +34 -0
- package/src/index.js.map +1 -0
- package/src/types/asset-configs.d.ts +189 -0
- package/src/types/asset-configs.d.ts.map +1 -0
- package/src/types/asset-configs.js +7 -0
- package/src/types/asset-configs.js.map +1 -0
- package/src/types/theme.d.ts +67 -0
- package/src/types/theme.d.ts.map +1 -0
- package/src/types/theme.js +3 -0
- package/src/types/theme.js.map +1 -0
- package/src/utils/file-utils.d.ts +16 -0
- package/src/utils/file-utils.d.ts.map +1 -0
- package/src/utils/file-utils.js +58 -0
- package/src/utils/file-utils.js.map +1 -0
- package/src/utils/i18n-compile-validator.d.ts +20 -0
- package/src/utils/i18n-compile-validator.d.ts.map +1 -0
- package/src/utils/i18n-compile-validator.js +198 -0
- package/src/utils/i18n-compile-validator.js.map +1 -0
- package/src/utils/i18n-fixer.d.ts +39 -0
- package/src/utils/i18n-fixer.d.ts.map +1 -0
- package/src/utils/i18n-fixer.js +396 -0
- package/src/utils/i18n-fixer.js.map +1 -0
- package/src/utils/i18n-sanitizer.d.ts +17 -0
- package/src/utils/i18n-sanitizer.d.ts.map +1 -0
- package/src/utils/i18n-sanitizer.js +101 -0
- package/src/utils/i18n-sanitizer.js.map +1 -0
- package/src/utils/i18n-utils.d.ts +21 -0
- package/src/utils/i18n-utils.d.ts.map +1 -0
- package/src/utils/i18n-utils.js +89 -0
- package/src/utils/i18n-utils.js.map +1 -0
- package/src/utils/interactive-translator.d.ts +18 -0
- package/src/utils/interactive-translator.d.ts.map +1 -0
- package/src/utils/interactive-translator.js +401 -0
- package/src/utils/interactive-translator.js.map +1 -0
- package/src/utils/llama-cpp-translator.d.ts +33 -0
- package/src/utils/llama-cpp-translator.d.ts.map +1 -0
- package/src/utils/llama-cpp-translator.js +267 -0
- package/src/utils/llama-cpp-translator.js.map +1 -0
- package/src/utils/logger.d.ts +14 -0
- package/src/utils/logger.d.ts.map +1 -0
- package/src/utils/logger.js +42 -0
- package/src/utils/logger.js.map +1 -0
- package/src/utils/ollama-translator.d.ts +38 -0
- package/src/utils/ollama-translator.d.ts.map +1 -0
- package/src/utils/ollama-translator.js +371 -0
- package/src/utils/ollama-translator.js.map +1 -0
- package/src/utils/option-utils.d.ts +58 -0
- package/src/utils/option-utils.d.ts.map +1 -0
- package/src/utils/option-utils.js +123 -0
- package/src/utils/option-utils.js.map +1 -0
- package/src/utils/platform-utils.d.ts +33 -0
- package/src/utils/platform-utils.d.ts.map +1 -0
- package/src/utils/platform-utils.js +114 -0
- package/src/utils/platform-utils.js.map +1 -0
- package/src/utils/pwa-utils.d.ts +28 -0
- package/src/utils/pwa-utils.d.ts.map +1 -0
- package/src/utils/pwa-utils.js +48 -0
- package/src/utils/pwa-utils.js.map +1 -0
- package/src/utils/translation-manager.d.ts +43 -0
- package/src/utils/translation-manager.d.ts.map +1 -0
- package/src/utils/translation-manager.js +302 -0
- package/src/utils/translation-manager.js.map +1 -0
- package/src/utils/web-translation-providers.d.ts +53 -0
- package/src/utils/web-translation-providers.d.ts.map +1 -0
- package/src/utils/web-translation-providers.js +190 -0
- package/src/utils/web-translation-providers.js.map +1 -0
- package/src/utils/yaml-utils.d.ts +9 -0
- package/src/utils/yaml-utils.d.ts.map +1 -0
- package/src/utils/yaml-utils.js +26 -0
- package/src/utils/yaml-utils.js.map +1 -0
- package/templates/mag-compile.config.js +77 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
|
|
3
|
+
async function createPackageJson(
|
|
4
|
+
projectName,
|
|
5
|
+
companyName = null,
|
|
6
|
+
technology = 'angular'
|
|
7
|
+
) {
|
|
8
|
+
// If companyName is provided, this is a child app in a monorepo
|
|
9
|
+
const isMonorepoApp = !!companyName;
|
|
10
|
+
|
|
11
|
+
if (technology === 'react') {
|
|
12
|
+
await createReactPackageJson(projectName, companyName, isMonorepoApp);
|
|
13
|
+
} else {
|
|
14
|
+
await createAngularPackageJson(projectName, companyName, isMonorepoApp);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async function createAngularPackageJson(
|
|
19
|
+
projectName,
|
|
20
|
+
companyName = null,
|
|
21
|
+
isMonorepoApp = false
|
|
22
|
+
) {
|
|
23
|
+
if (isMonorepoApp) {
|
|
24
|
+
// Angular app in monorepo - use peer dependencies and enhanced scripts
|
|
25
|
+
const packageJson = {
|
|
26
|
+
name: `@${companyName}/${projectName}`,
|
|
27
|
+
version: '0.0.0',
|
|
28
|
+
description: `${projectName} Angular micro frontend app`,
|
|
29
|
+
private: true,
|
|
30
|
+
scripts: {
|
|
31
|
+
ng: 'ng',
|
|
32
|
+
start: 'ng serve',
|
|
33
|
+
build: 'mag-cli dist-clean && ng build',
|
|
34
|
+
watch: 'ng build --watch --configuration development',
|
|
35
|
+
test: 'ng test',
|
|
36
|
+
lint: 'ng lint',
|
|
37
|
+
'serve:pwa:watch': `concurrently "ng build --watch --configuration development" "npx live-server ../../dist/${companyName}/${projectName}/browser --port=8080 --no-cache --cors"`,
|
|
38
|
+
assets: 'mag-cli assets',
|
|
39
|
+
'assets:watch': 'mag-cli assets --watch',
|
|
40
|
+
'build:full': 'mag-cli build',
|
|
41
|
+
zip: 'mag-cli zip',
|
|
42
|
+
clean: 'mag-cli clean',
|
|
43
|
+
'clean:dist': 'mag-cli dist-clean',
|
|
44
|
+
},
|
|
45
|
+
keywords: [
|
|
46
|
+
'micro-frontend',
|
|
47
|
+
'angular',
|
|
48
|
+
'pwa',
|
|
49
|
+
'native-federation',
|
|
50
|
+
companyName,
|
|
51
|
+
],
|
|
52
|
+
author: companyName,
|
|
53
|
+
license: 'MIT',
|
|
54
|
+
engines: {
|
|
55
|
+
node: '>=20.19.0',
|
|
56
|
+
npm: '>=10.0.0',
|
|
57
|
+
},
|
|
58
|
+
peerDependencies: {
|
|
59
|
+
'@angular/animations': '^20.0.4',
|
|
60
|
+
'@angular/common': '^20.0.4',
|
|
61
|
+
'@angular/compiler': '^20.0.4',
|
|
62
|
+
'@angular/core': '^20.0.4',
|
|
63
|
+
'@angular/forms': '^20.0.4',
|
|
64
|
+
'@angular/platform-browser': '^20.0.4',
|
|
65
|
+
'@angular/platform-browser-dynamic': '^20.0.4',
|
|
66
|
+
'@angular/router': '^20.0.4',
|
|
67
|
+
'@angular/service-worker': '^20.0.4',
|
|
68
|
+
rxjs: '~7.8.0',
|
|
69
|
+
tslib: '^2.3.0',
|
|
70
|
+
'zone.js': '~0.15.0',
|
|
71
|
+
'@softarc/native-federation': '^3.0.2',
|
|
72
|
+
'@softarc/native-federation-esbuild': '^3.0.2',
|
|
73
|
+
typescript: '~5.8.2',
|
|
74
|
+
},
|
|
75
|
+
devDependencies: {
|
|
76
|
+
'@angular-devkit/build-angular': '^20.0.3',
|
|
77
|
+
'@angular/cli': '^20.0.3',
|
|
78
|
+
'@angular/compiler-cli': '^20.0.4',
|
|
79
|
+
typescript: '~5.8.2',
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
fs.writeFileSync('package.json', JSON.stringify(packageJson, null, 2));
|
|
84
|
+
} else {
|
|
85
|
+
// Standalone Angular app
|
|
86
|
+
const packageJson = {
|
|
87
|
+
name: projectName,
|
|
88
|
+
version: '0.0.0',
|
|
89
|
+
description: `${projectName} PWA`,
|
|
90
|
+
private: true,
|
|
91
|
+
scripts: {
|
|
92
|
+
ng: 'ng',
|
|
93
|
+
start: 'ng serve',
|
|
94
|
+
build: 'mag-cli dist-clean && ng build',
|
|
95
|
+
watch: 'ng build --watch --configuration development',
|
|
96
|
+
test: 'ng test',
|
|
97
|
+
lint: 'ng lint',
|
|
98
|
+
'serve:pwa': 'npx http-server dist/browser -p 8080 -c-1 --cors',
|
|
99
|
+
'serve:pwa:watch':
|
|
100
|
+
'concurrently "ng build --watch --configuration development" "npx live-server dist/browser --port=8080 --no-cache --cors"',
|
|
101
|
+
'serve:pwa-python': 'cd dist/browser && python3 -m http.server 8080',
|
|
102
|
+
'serve:pwa-live':
|
|
103
|
+
'npx live-server dist/browser --port=8080 --no-cache --cors',
|
|
104
|
+
'serve:pwa-full':
|
|
105
|
+
'npx http-server dist/browser -p 8080 -c-1 --cors -o --gzip',
|
|
106
|
+
assets: 'mag-cli assets',
|
|
107
|
+
'assets:watch': 'mag-cli assets --watch',
|
|
108
|
+
'build:full': 'mag-cli build',
|
|
109
|
+
zip: 'mag-cli zip',
|
|
110
|
+
clean: 'mag-cli clean',
|
|
111
|
+
'clean:dist': 'mag-cli dist-clean',
|
|
112
|
+
},
|
|
113
|
+
keywords: ['micro-frontend', 'angular', 'pwa', 'native-federation'],
|
|
114
|
+
author: 'Your Name',
|
|
115
|
+
license: 'MIT',
|
|
116
|
+
engines: {
|
|
117
|
+
node: '>=20.19.0',
|
|
118
|
+
npm: '>=10.0.0',
|
|
119
|
+
},
|
|
120
|
+
dependencies: {
|
|
121
|
+
'@angular/animations': '^20.0.4',
|
|
122
|
+
'@angular/common': '^20.0.4',
|
|
123
|
+
'@angular/compiler': '^20.0.4',
|
|
124
|
+
'@angular/core': '^20.0.4',
|
|
125
|
+
'@angular/forms': '^20.0.4',
|
|
126
|
+
'@angular/platform-browser': '^20.0.4',
|
|
127
|
+
'@angular/platform-browser-dynamic': '^20.0.4',
|
|
128
|
+
'@angular/router': '^20.0.4',
|
|
129
|
+
'@angular/service-worker': '^20.0.4',
|
|
130
|
+
rxjs: '~7.8.0',
|
|
131
|
+
tslib: '^2.3.0',
|
|
132
|
+
'zone.js': '~0.15.0',
|
|
133
|
+
'@softarc/native-federation': '^3.0.2',
|
|
134
|
+
'@softarc/native-federation-esbuild': '^3.0.2',
|
|
135
|
+
},
|
|
136
|
+
devDependencies: {
|
|
137
|
+
'@angular-devkit/build-angular': '^20.0.3',
|
|
138
|
+
'@angular/cli': '^20.0.3',
|
|
139
|
+
'@angular/compiler-cli': '^20.0.4',
|
|
140
|
+
'@types/jasmine': '~5.1.0',
|
|
141
|
+
'jasmine-core': '~5.1.0',
|
|
142
|
+
karma: '~6.4.0',
|
|
143
|
+
'karma-chrome-launcher': '~3.2.0',
|
|
144
|
+
'karma-coverage': '~2.2.0',
|
|
145
|
+
'karma-jasmine': '~5.1.0',
|
|
146
|
+
'karma-jasmine-html-reporter': '~2.1.0',
|
|
147
|
+
typescript: '~5.8.2',
|
|
148
|
+
concurrently: '^8.2.2',
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
fs.writeFileSync('package.json', JSON.stringify(packageJson, null, 2));
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
async function createReactPackageJson(
|
|
157
|
+
projectName,
|
|
158
|
+
companyName = null,
|
|
159
|
+
isMonorepoApp = false
|
|
160
|
+
) {
|
|
161
|
+
if (isMonorepoApp) {
|
|
162
|
+
// React app in monorepo - use peer dependencies and enhanced scripts (matching ludo structure)
|
|
163
|
+
const packageJson = {
|
|
164
|
+
name: `@${companyName}/${projectName}`,
|
|
165
|
+
version: '0.0.0',
|
|
166
|
+
description: `${projectName} React micro frontend app`,
|
|
167
|
+
private: true,
|
|
168
|
+
scripts: {
|
|
169
|
+
start: `concurrently "npm run build:watch" "npx serve ../../dist/${companyName}/${projectName} -l 3000 --cors --single"`,
|
|
170
|
+
build: 'mag-cli dist-clean && node build.js',
|
|
171
|
+
'build:watch': 'node build.js --watch',
|
|
172
|
+
'build:webapp':
|
|
173
|
+
'REACT_APP_WEBAPP_MODE=true mag-cli dist-clean && node build.js',
|
|
174
|
+
'build:standalone':
|
|
175
|
+
'REACT_APP_WEBAPP_MODE=false mag-cli dist-clean && node build.js',
|
|
176
|
+
test: 'jest',
|
|
177
|
+
'test:watch': 'jest --watch',
|
|
178
|
+
'type-check': 'tsc --noEmit',
|
|
179
|
+
lint: 'eslint src --ext .ts,.tsx',
|
|
180
|
+
'lint:fix': 'eslint src --ext .ts,.tsx --fix',
|
|
181
|
+
'serve:pwa': `npx serve ../../dist/${companyName}/${projectName} -l 8080 --cors --single`,
|
|
182
|
+
'serve:pwa:watch': `concurrently "npm run build:watch" "npx serve ../../dist/${companyName}/${projectName} -l 8080 --cors --single"`,
|
|
183
|
+
'serve:pwa-python': `cd ../../dist/${companyName}/${projectName} && python3 -m http.server 8080`,
|
|
184
|
+
'serve:pwa-live': `npx serve ../../dist/${companyName}/${projectName} -l 8080 --cors --single`,
|
|
185
|
+
'serve:pwa-full': `npx serve ../../dist/${companyName}/${projectName} -l 8080 --cors --single`,
|
|
186
|
+
assets: 'mag-cli assets',
|
|
187
|
+
'assets:watch': 'mag-cli assets --watch',
|
|
188
|
+
'build:full': 'mag-cli build',
|
|
189
|
+
zip: 'mag-cli zip',
|
|
190
|
+
clean: 'mag-cli clean',
|
|
191
|
+
'clean:dist': 'mag-cli dist-clean',
|
|
192
|
+
},
|
|
193
|
+
keywords: [
|
|
194
|
+
'micro-frontend',
|
|
195
|
+
'react',
|
|
196
|
+
'pwa',
|
|
197
|
+
'native-federation',
|
|
198
|
+
companyName,
|
|
199
|
+
],
|
|
200
|
+
author: companyName,
|
|
201
|
+
license: 'MIT',
|
|
202
|
+
engines: {
|
|
203
|
+
node: '>=20.19.0',
|
|
204
|
+
npm: '>=10.0.0',
|
|
205
|
+
},
|
|
206
|
+
peerDependencies: {
|
|
207
|
+
react: '^18.2.0',
|
|
208
|
+
'react-dom': '^18.2.0',
|
|
209
|
+
'react-router-dom': '^6.8.0',
|
|
210
|
+
'@reduxjs/toolkit': '^2.0.0',
|
|
211
|
+
'react-redux': '^9.0.0',
|
|
212
|
+
'@types/react': '^18.2.0',
|
|
213
|
+
'@types/react-dom': '^18.2.0',
|
|
214
|
+
typescript: '^5.0.0',
|
|
215
|
+
'@softarc/native-federation': '^3.0.2',
|
|
216
|
+
'@softarc/native-federation-esbuild': '^3.0.2',
|
|
217
|
+
esbuild: '^0.20.0',
|
|
218
|
+
sass: '^1.89.2',
|
|
219
|
+
},
|
|
220
|
+
devDependencies: {
|
|
221
|
+
'@types/react': '^18.2.0',
|
|
222
|
+
'@types/react-dom': '^18.2.0',
|
|
223
|
+
typescript: '^5.0.0',
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
fs.writeFileSync('package.json', JSON.stringify(packageJson, null, 2));
|
|
228
|
+
} else {
|
|
229
|
+
// Standalone React app (matching ludo structure for consistency)
|
|
230
|
+
const packageJson = {
|
|
231
|
+
name: projectName,
|
|
232
|
+
version: '0.0.0',
|
|
233
|
+
description: `${projectName} React micro frontend app`,
|
|
234
|
+
private: true,
|
|
235
|
+
scripts: {
|
|
236
|
+
start:
|
|
237
|
+
'concurrently "npm run build:watch" "npx serve dist -l 3000 --cors --single"',
|
|
238
|
+
build: 'mag-cli dist-clean && node build.js',
|
|
239
|
+
'build:watch': 'node build.js --watch',
|
|
240
|
+
'build:webapp':
|
|
241
|
+
'REACT_APP_WEBAPP_MODE=true mag-cli dist-clean && node build.js',
|
|
242
|
+
'build:standalone':
|
|
243
|
+
'REACT_APP_WEBAPP_MODE=false mag-cli dist-clean && node build.js',
|
|
244
|
+
test: 'jest',
|
|
245
|
+
'test:watch': 'jest --watch',
|
|
246
|
+
'type-check': 'tsc --noEmit',
|
|
247
|
+
lint: 'eslint src --ext .ts,.tsx',
|
|
248
|
+
'lint:fix': 'eslint src --ext .ts,.tsx --fix',
|
|
249
|
+
'serve:pwa': 'npx serve dist -l 8080 --cors --single',
|
|
250
|
+
'serve:pwa:watch':
|
|
251
|
+
'concurrently "npm run build:watch" "npx serve dist -l 8080 --cors --single"',
|
|
252
|
+
'serve:pwa-python': 'cd dist && python3 -m http.server 8080',
|
|
253
|
+
'serve:pwa-live': 'npx serve dist -l 8080 --cors --single',
|
|
254
|
+
'serve:pwa-full': 'npx serve dist -l 8080 --cors --single',
|
|
255
|
+
assets: 'mag-cli assets',
|
|
256
|
+
'assets:watch': 'mag-cli assets --watch',
|
|
257
|
+
'build:full': 'mag-cli build',
|
|
258
|
+
zip: 'mag-cli zip',
|
|
259
|
+
clean: 'mag-cli clean',
|
|
260
|
+
'clean:dist': 'mag-cli dist-clean',
|
|
261
|
+
},
|
|
262
|
+
keywords: ['micro-frontend', 'react', 'pwa', 'native-federation'],
|
|
263
|
+
author: 'magmonium',
|
|
264
|
+
license: 'MIT',
|
|
265
|
+
engines: {
|
|
266
|
+
node: '>=20.19.0',
|
|
267
|
+
npm: '>=10.0.0',
|
|
268
|
+
},
|
|
269
|
+
dependencies: {
|
|
270
|
+
react: '^18.2.0',
|
|
271
|
+
'react-dom': '^18.2.0',
|
|
272
|
+
'react-router-dom': '^6.8.0',
|
|
273
|
+
'@reduxjs/toolkit': '^2.0.0',
|
|
274
|
+
'react-redux': '^9.0.0',
|
|
275
|
+
'@softarc/native-federation': '^3.0.2',
|
|
276
|
+
'@softarc/native-federation-esbuild': '^3.0.2',
|
|
277
|
+
esbuild: '^0.20.0',
|
|
278
|
+
sass: '^1.89.2',
|
|
279
|
+
'workbox-webpack-plugin': '^7.0.0',
|
|
280
|
+
'workbox-window': '^7.0.0',
|
|
281
|
+
'es-module-shims': '^1.5.12',
|
|
282
|
+
},
|
|
283
|
+
devDependencies: {
|
|
284
|
+
'@types/react': '^18.2.0',
|
|
285
|
+
'@types/react-dom': '^18.2.0',
|
|
286
|
+
'@types/jest': '^29.5.0',
|
|
287
|
+
'@types/node': '^20.19.0',
|
|
288
|
+
'@testing-library/react': '^14.0.0',
|
|
289
|
+
'@testing-library/jest-dom': '^5.16.0',
|
|
290
|
+
'@testing-library/user-event': '^14.4.0',
|
|
291
|
+
eslint: '^8.36.0',
|
|
292
|
+
'@typescript-eslint/eslint-plugin': '^5.55.0',
|
|
293
|
+
'@typescript-eslint/parser': '^5.55.0',
|
|
294
|
+
'eslint-plugin-react': '^7.32.0',
|
|
295
|
+
'eslint-plugin-react-hooks': '^4.6.0',
|
|
296
|
+
jest: '^29.5.0',
|
|
297
|
+
'jest-environment-jsdom': '^29.5.0',
|
|
298
|
+
'ts-jest': '^29.1.0',
|
|
299
|
+
typescript: '^5.0.0',
|
|
300
|
+
concurrently: '^8.2.2',
|
|
301
|
+
},
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
fs.writeFileSync('package.json', JSON.stringify(packageJson, null, 2));
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
module.exports = createPackageJson;
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
|
|
3
|
+
async function createProjectStructure(projectName, technology = 'angular') {
|
|
4
|
+
const baseDirectories = ['public', '.vscode'];
|
|
5
|
+
|
|
6
|
+
let techSpecificDirectories = [];
|
|
7
|
+
|
|
8
|
+
if (technology === 'react') {
|
|
9
|
+
// FSD (Feature-Sliced Design) architecture for React
|
|
10
|
+
techSpecificDirectories = [
|
|
11
|
+
// App layer - Application initialization and configuration
|
|
12
|
+
'src/app/providers',
|
|
13
|
+
'src/app/styles',
|
|
14
|
+
'src/app/store',
|
|
15
|
+
|
|
16
|
+
// Pages layer - Application routes/pages
|
|
17
|
+
'src/pages/home/ui',
|
|
18
|
+
'src/pages/home/model',
|
|
19
|
+
'src/pages/home/api',
|
|
20
|
+
'src/pages/home/lib',
|
|
21
|
+
|
|
22
|
+
// Widgets layer - Standalone UI components
|
|
23
|
+
'src/widgets/header/ui',
|
|
24
|
+
'src/widgets/header/model',
|
|
25
|
+
'src/widgets/header/lib',
|
|
26
|
+
'src/widgets/footer/ui',
|
|
27
|
+
'src/widgets/footer/model',
|
|
28
|
+
'src/widgets/footer/lib',
|
|
29
|
+
'src/widgets/navigation/ui',
|
|
30
|
+
'src/widgets/navigation/model',
|
|
31
|
+
'src/widgets/navigation/lib',
|
|
32
|
+
|
|
33
|
+
// Features layer - User interactions with business value
|
|
34
|
+
'src/features/auth/ui',
|
|
35
|
+
'src/features/auth/model',
|
|
36
|
+
'src/features/auth/api',
|
|
37
|
+
'src/features/auth/lib',
|
|
38
|
+
'src/features/theme-toggle/ui',
|
|
39
|
+
'src/features/theme-toggle/model',
|
|
40
|
+
'src/features/theme-toggle/lib',
|
|
41
|
+
|
|
42
|
+
// Entities layer - Business entities
|
|
43
|
+
'src/entities/user/ui',
|
|
44
|
+
'src/entities/user/model',
|
|
45
|
+
'src/entities/user/api',
|
|
46
|
+
'src/entities/user/lib',
|
|
47
|
+
'src/entities/session/model',
|
|
48
|
+
'src/entities/session/api',
|
|
49
|
+
'src/entities/session/lib',
|
|
50
|
+
|
|
51
|
+
// Shared layer - Reusable components and utilities
|
|
52
|
+
'src/shared/ui/button',
|
|
53
|
+
'src/shared/ui/input',
|
|
54
|
+
'src/shared/ui/modal',
|
|
55
|
+
'src/shared/ui/loader',
|
|
56
|
+
'src/shared/ui/icon',
|
|
57
|
+
'src/shared/lib/utils',
|
|
58
|
+
'src/shared/lib/hooks',
|
|
59
|
+
'src/shared/lib/constants',
|
|
60
|
+
'src/shared/api',
|
|
61
|
+
'src/shared/config',
|
|
62
|
+
'src/shared/types',
|
|
63
|
+
'src/shared/mag_assets/buttons',
|
|
64
|
+
'src/shared/mag_assets/button_groups',
|
|
65
|
+
'src/shared/mag_assets/fields',
|
|
66
|
+
'src/shared/mag_assets/forms',
|
|
67
|
+
'src/shared/mag_assets/options',
|
|
68
|
+
'src/shared/mag_assets/navs',
|
|
69
|
+
'src/shared/mag_assets/icons',
|
|
70
|
+
'src/shared/mag_assets/logo',
|
|
71
|
+
'src/shared/mag_assets/theme',
|
|
72
|
+
'src/shared/mag_assets/i18n',
|
|
73
|
+
'src/shared/mag_assets/images',
|
|
74
|
+
'src/shared/mag_assets/workers',
|
|
75
|
+
|
|
76
|
+
// Tests
|
|
77
|
+
'src/__tests__',
|
|
78
|
+
'src/__tests__/utils',
|
|
79
|
+
'src/__tests__/mocks',
|
|
80
|
+
];
|
|
81
|
+
} else {
|
|
82
|
+
// FSD (Feature-Sliced Design) architecture for Angular
|
|
83
|
+
techSpecificDirectories = [
|
|
84
|
+
// App layer - Application initialization and configuration
|
|
85
|
+
'src/app/providers',
|
|
86
|
+
'src/app/styles',
|
|
87
|
+
'src/app/store',
|
|
88
|
+
'src/app/guards',
|
|
89
|
+
'src/app/interceptors',
|
|
90
|
+
|
|
91
|
+
// Pages layer - Application routes/pages
|
|
92
|
+
'src/pages/home/ui',
|
|
93
|
+
'src/pages/home/model',
|
|
94
|
+
'src/pages/home/api',
|
|
95
|
+
'src/pages/home/lib',
|
|
96
|
+
'src/pages/about/ui',
|
|
97
|
+
'src/pages/about/model',
|
|
98
|
+
'src/pages/about/lib',
|
|
99
|
+
'src/pages/not-found/ui',
|
|
100
|
+
|
|
101
|
+
// Widgets layer - Standalone UI components
|
|
102
|
+
'src/widgets/header/ui',
|
|
103
|
+
'src/widgets/header/model',
|
|
104
|
+
'src/widgets/header/lib',
|
|
105
|
+
'src/widgets/footer/ui',
|
|
106
|
+
'src/widgets/footer/model',
|
|
107
|
+
'src/widgets/footer/lib',
|
|
108
|
+
'src/widgets/navigation/ui',
|
|
109
|
+
'src/widgets/navigation/model',
|
|
110
|
+
'src/widgets/navigation/lib',
|
|
111
|
+
'src/widgets/sidebar/ui',
|
|
112
|
+
'src/widgets/sidebar/model',
|
|
113
|
+
'src/widgets/sidebar/lib',
|
|
114
|
+
|
|
115
|
+
// Features layer - User interactions with business value
|
|
116
|
+
'src/features/auth/ui',
|
|
117
|
+
'src/features/auth/model',
|
|
118
|
+
'src/features/auth/api',
|
|
119
|
+
'src/features/auth/lib',
|
|
120
|
+
'src/features/theme-toggle/ui',
|
|
121
|
+
'src/features/theme-toggle/model',
|
|
122
|
+
'src/features/theme-toggle/lib',
|
|
123
|
+
'src/features/search/ui',
|
|
124
|
+
'src/features/search/model',
|
|
125
|
+
'src/features/search/api',
|
|
126
|
+
'src/features/search/lib',
|
|
127
|
+
|
|
128
|
+
// Entities layer - Business entities
|
|
129
|
+
'src/entities/user/ui',
|
|
130
|
+
'src/entities/user/model',
|
|
131
|
+
'src/entities/user/api',
|
|
132
|
+
'src/entities/user/lib',
|
|
133
|
+
'src/entities/session/model',
|
|
134
|
+
'src/entities/session/api',
|
|
135
|
+
'src/entities/session/lib',
|
|
136
|
+
'src/entities/product/ui',
|
|
137
|
+
'src/entities/product/model',
|
|
138
|
+
'src/entities/product/api',
|
|
139
|
+
'src/entities/product/lib',
|
|
140
|
+
|
|
141
|
+
// Shared layer - Reusable components and utilities
|
|
142
|
+
'src/shared/ui/button',
|
|
143
|
+
'src/shared/ui/input',
|
|
144
|
+
'src/shared/ui/modal',
|
|
145
|
+
'src/shared/ui/loader',
|
|
146
|
+
'src/shared/ui/icon',
|
|
147
|
+
'src/shared/ui/card',
|
|
148
|
+
'src/shared/ui/dropdown',
|
|
149
|
+
'src/shared/ui/form-field',
|
|
150
|
+
'src/shared/lib/utils',
|
|
151
|
+
'src/shared/lib/validators',
|
|
152
|
+
'src/shared/lib/constants',
|
|
153
|
+
'src/shared/lib/decorators',
|
|
154
|
+
'src/shared/api/base',
|
|
155
|
+
'src/shared/api/interceptors',
|
|
156
|
+
'src/shared/config',
|
|
157
|
+
'src/shared/types',
|
|
158
|
+
'src/shared/mag_assets/buttons',
|
|
159
|
+
'src/shared/mag_assets/button_groups',
|
|
160
|
+
'src/shared/mag_assets/fields',
|
|
161
|
+
'src/shared/mag_assets/forms',
|
|
162
|
+
'src/shared/mag_assets/options',
|
|
163
|
+
'src/shared/mag_assets/navs',
|
|
164
|
+
'src/shared/mag_assets/icons',
|
|
165
|
+
'src/shared/mag_assets/logo',
|
|
166
|
+
'src/shared/mag_assets/theme',
|
|
167
|
+
'src/shared/mag_assets/i18n',
|
|
168
|
+
'src/shared/mag_assets/images',
|
|
169
|
+
'src/shared/mag_assets/workers',
|
|
170
|
+
'src/shared/directives',
|
|
171
|
+
'src/shared/pipes',
|
|
172
|
+
'src/shared/services',
|
|
173
|
+
|
|
174
|
+
// Tests
|
|
175
|
+
'src/__tests__',
|
|
176
|
+
'src/__tests__/utils',
|
|
177
|
+
'src/__tests__/mocks',
|
|
178
|
+
'src/__tests__/fixtures',
|
|
179
|
+
];
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const allDirectories = [...baseDirectories, ...techSpecificDirectories];
|
|
183
|
+
|
|
184
|
+
allDirectories.forEach((dir) => {
|
|
185
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
module.exports = createProjectStructure;
|