@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,735 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
async function createMonorepoStructure(
|
|
5
|
+
companyName,
|
|
6
|
+
monorepoPath,
|
|
7
|
+
technology = 'angular'
|
|
8
|
+
) {
|
|
9
|
+
// Create monorepo directories
|
|
10
|
+
fs.mkdirSync(monorepoPath, { recursive: true });
|
|
11
|
+
fs.mkdirSync(path.join(monorepoPath, 'apps'), { recursive: true });
|
|
12
|
+
fs.mkdirSync(path.join(monorepoPath, 'libs'), { recursive: true });
|
|
13
|
+
fs.mkdirSync(path.join(monorepoPath, 'tools'), { recursive: true });
|
|
14
|
+
|
|
15
|
+
// Create base dependencies for the technology
|
|
16
|
+
let dependencies = {};
|
|
17
|
+
let devDependencies = {
|
|
18
|
+
concurrently: '^8.2.2',
|
|
19
|
+
lerna: '^8.1.2',
|
|
20
|
+
typescript: '~5.8.2',
|
|
21
|
+
};
|
|
22
|
+
const keywords = ['monorepo', 'micro-frontends', 'pwa', 'module-federation'];
|
|
23
|
+
|
|
24
|
+
if (technology === 'react') {
|
|
25
|
+
// React dependencies
|
|
26
|
+
dependencies = {
|
|
27
|
+
'@softarc/native-federation': '^3.0.2',
|
|
28
|
+
'@softarc/native-federation-esbuild': '^3.0.2',
|
|
29
|
+
esbuild: '^0.20.0',
|
|
30
|
+
react: '^18.2.0',
|
|
31
|
+
'react-dom': '^18.2.0',
|
|
32
|
+
'react-router-dom': '^6.8.0',
|
|
33
|
+
'workbox-webpack-plugin': '^7.0.0',
|
|
34
|
+
'workbox-window': '^7.0.0',
|
|
35
|
+
'es-module-shims': '^1.5.12',
|
|
36
|
+
};
|
|
37
|
+
devDependencies = {
|
|
38
|
+
...devDependencies,
|
|
39
|
+
'@types/react': '^18.2.0',
|
|
40
|
+
'@types/react-dom': '^18.2.0',
|
|
41
|
+
'@types/jest': '^29.5.0',
|
|
42
|
+
'@types/node': '^20.19.0',
|
|
43
|
+
'@testing-library/react': '^14.0.0',
|
|
44
|
+
'@testing-library/jest-dom': '^5.16.0',
|
|
45
|
+
'@testing-library/user-event': '^14.4.0',
|
|
46
|
+
eslint: '^8.36.0',
|
|
47
|
+
'@typescript-eslint/eslint-plugin': '^5.55.0',
|
|
48
|
+
'@typescript-eslint/parser': '^5.55.0',
|
|
49
|
+
'eslint-plugin-react': '^7.32.0',
|
|
50
|
+
'eslint-plugin-react-hooks': '^4.6.0',
|
|
51
|
+
jest: '^29.5.0',
|
|
52
|
+
'jest-environment-jsdom': '^29.5.0',
|
|
53
|
+
'ts-jest': '^29.1.0',
|
|
54
|
+
};
|
|
55
|
+
keywords.push('react');
|
|
56
|
+
} else {
|
|
57
|
+
// Angular dependencies (default)
|
|
58
|
+
dependencies = {
|
|
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/elements': '^20.0.4',
|
|
64
|
+
'@angular/forms': '^20.0.4',
|
|
65
|
+
'@angular/platform-browser': '^20.0.4',
|
|
66
|
+
'@angular/platform-browser-dynamic': '^20.0.4',
|
|
67
|
+
'@angular/router': '^20.0.4',
|
|
68
|
+
'@angular/service-worker': '^20.0.4',
|
|
69
|
+
'@softarc/native-federation-node': '^2.0.10',
|
|
70
|
+
'es-module-shims': '^1.5.12',
|
|
71
|
+
rxjs: '~7.8.0',
|
|
72
|
+
tslib: '^2.3.0',
|
|
73
|
+
'zone.js': '~0.15.0',
|
|
74
|
+
};
|
|
75
|
+
devDependencies = {
|
|
76
|
+
...devDependencies,
|
|
77
|
+
'@angular-architects/native-federation': '^20.0.1',
|
|
78
|
+
'@angular-devkit/build-angular': '^20.0.3',
|
|
79
|
+
'@angular/cli': '^20.0.3',
|
|
80
|
+
'@angular/compiler-cli': '^20.0.4',
|
|
81
|
+
'@angular/pwa': '^20.0.3',
|
|
82
|
+
'@types/jasmine': '~5.1.0',
|
|
83
|
+
'jasmine-core': '~5.5.0',
|
|
84
|
+
karma: '~6.4.0',
|
|
85
|
+
'karma-chrome-launcher': '~3.2.0',
|
|
86
|
+
'karma-coverage': '~2.2.0',
|
|
87
|
+
'karma-jasmine': '~5.1.0',
|
|
88
|
+
'karma-jasmine-html-reporter': '~2.1.0',
|
|
89
|
+
};
|
|
90
|
+
keywords.push('angular');
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Create root package.json for monorepo
|
|
94
|
+
const rootPackageJson = {
|
|
95
|
+
name: `${companyName}-monorepo`,
|
|
96
|
+
version: '1.0.0',
|
|
97
|
+
description: `${companyName} micro frontends monorepo`,
|
|
98
|
+
private: true,
|
|
99
|
+
engines: {
|
|
100
|
+
node: '>=20.19.0',
|
|
101
|
+
npm: '>=10.0.0',
|
|
102
|
+
},
|
|
103
|
+
workspaces: ['apps/*'],
|
|
104
|
+
scripts: {
|
|
105
|
+
'install:all': 'npm install',
|
|
106
|
+
'build:all': 'npm run build --workspaces',
|
|
107
|
+
'start:all': 'npm run start --workspaces',
|
|
108
|
+
'test:all': 'npm run test --workspaces',
|
|
109
|
+
'lint:all': 'npm run lint --workspaces',
|
|
110
|
+
'assets:all': 'npm run assets --workspaces',
|
|
111
|
+
'serve:federation': 'npx http-server dist -p 8080 -c-1 --cors -o',
|
|
112
|
+
'serve:pwa-all': 'npm run serve:federation',
|
|
113
|
+
clean: 'mag-cli clean',
|
|
114
|
+
'clean:dist': 'mag-cli dist-clean',
|
|
115
|
+
'clean:raw':
|
|
116
|
+
'npx rimraf node_modules apps/*/node_modules dist apps/*/*.zip *.tsbuildinfo apps/*/tsconfig.tsbuildinfo',
|
|
117
|
+
'clean:dist-raw': 'npx rimraf dist apps/*/*.zip',
|
|
118
|
+
'clean:deps': 'npx rimraf node_modules apps/*/node_modules',
|
|
119
|
+
'clean:cache':
|
|
120
|
+
'npx rimraf *.tsbuildinfo apps/*/tsconfig.tsbuildinfo .angular/* apps/*/.angular/*',
|
|
121
|
+
},
|
|
122
|
+
dependencies,
|
|
123
|
+
devDependencies,
|
|
124
|
+
keywords,
|
|
125
|
+
author: companyName,
|
|
126
|
+
license: 'MIT',
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
fs.writeFileSync(
|
|
130
|
+
path.join(monorepoPath, 'package.json'),
|
|
131
|
+
JSON.stringify(rootPackageJson, null, 2)
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
// Create root-level tsconfig.json for path mappings
|
|
135
|
+
const rootTsConfig = {
|
|
136
|
+
compileOnSave: false,
|
|
137
|
+
compilerOptions: {
|
|
138
|
+
baseUrl: '.',
|
|
139
|
+
target: 'ES2022',
|
|
140
|
+
module: 'ES2022',
|
|
141
|
+
lib: ['ES2022', 'dom'],
|
|
142
|
+
moduleResolution: 'bundler',
|
|
143
|
+
esModuleInterop: true,
|
|
144
|
+
skipLibCheck: true,
|
|
145
|
+
strict: true,
|
|
146
|
+
experimentalDecorators: true,
|
|
147
|
+
importHelpers: true,
|
|
148
|
+
sourceMap: true,
|
|
149
|
+
declaration: true,
|
|
150
|
+
declarationMap: true,
|
|
151
|
+
paths: {
|
|
152
|
+
// Library path mappings will be added here by 'mag-cli lib' command
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
include: [],
|
|
156
|
+
exclude: ['node_modules', 'dist', '**/*.spec.ts'],
|
|
157
|
+
angularCompilerOptions: {
|
|
158
|
+
enableI18nLegacyMessageIdFormat: false,
|
|
159
|
+
strictInjectionParameters: true,
|
|
160
|
+
strictInputAccessModifiers: true,
|
|
161
|
+
strictTemplates: true,
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
fs.writeFileSync(
|
|
166
|
+
path.join(monorepoPath, 'tsconfig.json'),
|
|
167
|
+
JSON.stringify(rootTsConfig, null, 2)
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
// Create monorepo README
|
|
171
|
+
const monorepoReadme = `# ${
|
|
172
|
+
companyName.charAt(0).toUpperCase() + companyName.slice(1)
|
|
173
|
+
} Monorepo
|
|
174
|
+
|
|
175
|
+
This is a monorepo for ${companyName} micro frontend applications built with Angular, Module Federation, and PWA capabilities.
|
|
176
|
+
|
|
177
|
+
## Structure
|
|
178
|
+
|
|
179
|
+
\`\`\`
|
|
180
|
+
${companyName}-monorepo/
|
|
181
|
+
├── dist/ # Shared build output directory
|
|
182
|
+
│ ├── app1/ # Built app1 (browser/, server/, etc.)
|
|
183
|
+
│ │ ├── remoteEntry.json # Module federation manifest
|
|
184
|
+
│ │ ├── main-[hash].js # App bundle
|
|
185
|
+
│ │ └── ... # Other assets
|
|
186
|
+
│ └── server/ # Server-side build (if applicable)
|
|
187
|
+
├── apps/ # Individual micro frontend applications
|
|
188
|
+
│ ├── app1/ # First micro frontend app
|
|
189
|
+
│ ├── app2/ # Second micro frontend app
|
|
190
|
+
│ └── ... # Additional apps
|
|
191
|
+
├── libs/ # Shared libraries (optional)
|
|
192
|
+
├── tools/ # Build tools and scripts
|
|
193
|
+
├── package.json # Root package.json with workspaces
|
|
194
|
+
└── README.md # This file
|
|
195
|
+
\`\`\`
|
|
196
|
+
|
|
197
|
+
## Module Federation Architecture
|
|
198
|
+
|
|
199
|
+
All apps compile to a **shared \`dist/\` directory** at the monorepo root. This enables:
|
|
200
|
+
|
|
201
|
+
- **Efficient Module Sharing**: Apps can easily import/export modules between each other
|
|
202
|
+
- **Single Serve Point**: The entire microfrontend ecosystem can be served from one location
|
|
203
|
+
- **Federation Discovery**: Apps can discover and connect to each other automatically
|
|
204
|
+
- **Development Efficiency**: Simplified serving and testing of the complete system
|
|
205
|
+
|
|
206
|
+
### Build Output Structure
|
|
207
|
+
|
|
208
|
+
\`\`\`
|
|
209
|
+
dist/
|
|
210
|
+
├── app1/
|
|
211
|
+
│ ├── browser/ # Client-side build
|
|
212
|
+
│ │ ├── remoteEntry.json # Module federation manifest
|
|
213
|
+
│ │ ├── main-[hash].js # App bundle
|
|
214
|
+
│ │ └── ... # Other assets
|
|
215
|
+
│ └── server/ # Server-side build (if applicable)
|
|
216
|
+
├── app2/
|
|
217
|
+
│ ├── browser/
|
|
218
|
+
│ │ ├── remoteEntry.json
|
|
219
|
+
│ │ └── ...
|
|
220
|
+
│ └── server/
|
|
221
|
+
└── ...
|
|
222
|
+
\`\`\`
|
|
223
|
+
|
|
224
|
+
## Getting Started
|
|
225
|
+
|
|
226
|
+
### Prerequisites
|
|
227
|
+
|
|
228
|
+
- Node.js 18+ and npm
|
|
229
|
+
- Angular CLI: \`npm install -g @angular/cli\`
|
|
230
|
+
- Magmonium CLI: \`npm install -g @magmonium/cli\`
|
|
231
|
+
|
|
232
|
+
### Installation
|
|
233
|
+
|
|
234
|
+
\`\`\`bash
|
|
235
|
+
# Install all dependencies for all apps
|
|
236
|
+
npm run install:all
|
|
237
|
+
\`\`\`
|
|
238
|
+
|
|
239
|
+
### Development
|
|
240
|
+
|
|
241
|
+
\`\`\`bash
|
|
242
|
+
# Start all applications
|
|
243
|
+
npm run start:all
|
|
244
|
+
|
|
245
|
+
# Start a specific app
|
|
246
|
+
cd apps/<app-name>
|
|
247
|
+
npm start
|
|
248
|
+
|
|
249
|
+
# Build all applications to shared dist/
|
|
250
|
+
npm run build:all
|
|
251
|
+
|
|
252
|
+
# Run tests for all apps
|
|
253
|
+
npm run test:all
|
|
254
|
+
\`\`\`
|
|
255
|
+
|
|
256
|
+
### Module Federation Development
|
|
257
|
+
|
|
258
|
+
Each app can expose and consume modules from other apps:
|
|
259
|
+
|
|
260
|
+
\`\`\`bash
|
|
261
|
+
# Build all apps to shared dist/
|
|
262
|
+
npm run build:all
|
|
263
|
+
|
|
264
|
+
# Serve the entire federation from dist/
|
|
265
|
+
cd dist
|
|
266
|
+
npx http-server . -p 8080 --cors
|
|
267
|
+
|
|
268
|
+
# Or serve individual apps for PWA testing
|
|
269
|
+
cd apps/app1
|
|
270
|
+
npm run serve:pwa # Serves from ../../dist/app1/
|
|
271
|
+
\`\`\`
|
|
272
|
+
|
|
273
|
+
### Creating New Apps
|
|
274
|
+
|
|
275
|
+
To add a new micro frontend app to this monorepo:
|
|
276
|
+
|
|
277
|
+
\`\`\`bash
|
|
278
|
+
# From the monorepo root
|
|
279
|
+
mag-cli init <new-app-name>
|
|
280
|
+
\`\`\`
|
|
281
|
+
|
|
282
|
+
This will automatically detect the monorepo and create the new app in the \`apps/\` directory with builds going to \`dist/\`.
|
|
283
|
+
|
|
284
|
+
### Asset Management
|
|
285
|
+
|
|
286
|
+
Each app has its own \`src/shared/mag_assets/\` directory for:
|
|
287
|
+
- PWA icons and manifests
|
|
288
|
+
- Custom styles and components
|
|
289
|
+
- Localization files
|
|
290
|
+
- Other static assets
|
|
291
|
+
|
|
292
|
+
\`\`\`bash
|
|
293
|
+
# Compile assets for all apps
|
|
294
|
+
npm run assets:all
|
|
295
|
+
|
|
296
|
+
# Compile assets for specific app
|
|
297
|
+
cd apps/<app-name>
|
|
298
|
+
mag-cli assets
|
|
299
|
+
mag-cli assets --watch # Watch mode for development
|
|
300
|
+
\`\`\`
|
|
301
|
+
|
|
302
|
+
### Module Federation Configuration
|
|
303
|
+
|
|
304
|
+
Each app in this monorepo is configured for Module Federation:
|
|
305
|
+
- Apps can expose components to other apps via \`federation.config.js\`
|
|
306
|
+
- Apps can consume components from other apps
|
|
307
|
+
- Shared dependencies are optimized across apps
|
|
308
|
+
- Module discovery works via \`remoteEntry.json\` files in \`dist/\`
|
|
309
|
+
|
|
310
|
+
Example federation setup:
|
|
311
|
+
|
|
312
|
+
\`\`\`javascript
|
|
313
|
+
// apps/shell/federation.config.js
|
|
314
|
+
module.exports = withNativeFederation({
|
|
315
|
+
name: 'shell',
|
|
316
|
+
remotes: {
|
|
317
|
+
'mfe1': 'http://localhost:8080/dist/mfe1/remoteEntry.json',
|
|
318
|
+
'mfe2': 'http://localhost:8080/dist/mfe2/remoteEntry.json',
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
// apps/mfe1/federation.config.js
|
|
323
|
+
module.exports = withNativeFederation({
|
|
324
|
+
name: 'mfe1',
|
|
325
|
+
exposes: {
|
|
326
|
+
'./Component': './src/app/my-component/my-component.component.ts',
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
\`\`\`
|
|
330
|
+
|
|
331
|
+
## Shared Libraries
|
|
332
|
+
|
|
333
|
+
This monorepo supports shared libraries in the \`libs/\` directory:
|
|
334
|
+
|
|
335
|
+
\`\`\`bash
|
|
336
|
+
# Create a new shared library
|
|
337
|
+
mag-cli lib <library-name>
|
|
338
|
+
|
|
339
|
+
# Example: Create a UI components library
|
|
340
|
+
mag-cli lib ui-components
|
|
341
|
+
\`\`\`
|
|
342
|
+
|
|
343
|
+
Libraries are automatically configured with:
|
|
344
|
+
- TypeScript path mappings for absolute imports
|
|
345
|
+
- Angular build configuration
|
|
346
|
+
- Scoped package names (\`@${companyName}/<library-name>\`)
|
|
347
|
+
|
|
348
|
+
### Using Libraries
|
|
349
|
+
|
|
350
|
+
\`\`\`typescript
|
|
351
|
+
// Import from any app
|
|
352
|
+
import { UiComponentsService } from '@${companyName}/ui-components';
|
|
353
|
+
import { SomeComponent } from '@${companyName}/ui-components';
|
|
354
|
+
\`\`\`
|
|
355
|
+
|
|
356
|
+
### PWA Features
|
|
357
|
+
|
|
358
|
+
All apps are configured as Progressive Web Apps with:
|
|
359
|
+
- Service Workers for offline functionality
|
|
360
|
+
- Web App Manifests for installation
|
|
361
|
+
- PWA icons in multiple sizes
|
|
362
|
+
- Update notifications
|
|
363
|
+
- Install prompts
|
|
364
|
+
|
|
365
|
+
### Deployment
|
|
366
|
+
|
|
367
|
+
#### Single Federation Deployment
|
|
368
|
+
|
|
369
|
+
Deploy the entire \`dist/\` folder to serve all microfrontends:
|
|
370
|
+
|
|
371
|
+
\`\`\`bash
|
|
372
|
+
# Build all apps
|
|
373
|
+
npm run build:all
|
|
374
|
+
|
|
375
|
+
# Deploy entire dist/ folder to web server
|
|
376
|
+
# All apps will be available at:
|
|
377
|
+
# - https://yourhost.com/app1/
|
|
378
|
+
# - https://yourhost.com/app2/
|
|
379
|
+
# etc.
|
|
380
|
+
\`\`\`
|
|
381
|
+
|
|
382
|
+
#### Individual App Deployment
|
|
383
|
+
|
|
384
|
+
Each app can also be deployed independently:
|
|
385
|
+
|
|
386
|
+
\`\`\`bash
|
|
387
|
+
# Build and create deployment zip for specific app
|
|
388
|
+
cd apps/<app-name>
|
|
389
|
+
mag-cli build
|
|
390
|
+
mag-cli zip
|
|
391
|
+
|
|
392
|
+
# This creates a zip from ../../dist/<app-name>/
|
|
393
|
+
\`\`\`
|
|
394
|
+
|
|
395
|
+
### Workspace Commands
|
|
396
|
+
|
|
397
|
+
\`\`\`bash
|
|
398
|
+
# Install dependencies for all apps
|
|
399
|
+
npm run install:all
|
|
400
|
+
|
|
401
|
+
# Build all apps to shared dist/
|
|
402
|
+
npm run build:all
|
|
403
|
+
|
|
404
|
+
# Start all apps (development)
|
|
405
|
+
npm run start:all
|
|
406
|
+
|
|
407
|
+
# Test all apps
|
|
408
|
+
npm run test:all
|
|
409
|
+
|
|
410
|
+
# Lint all apps
|
|
411
|
+
npm run lint:all
|
|
412
|
+
|
|
413
|
+
# Compile assets for all apps
|
|
414
|
+
npm run assets:all
|
|
415
|
+
|
|
416
|
+
# Build all libraries
|
|
417
|
+
npm run build:libs
|
|
418
|
+
|
|
419
|
+
# Test all libraries
|
|
420
|
+
npm run test:libs
|
|
421
|
+
|
|
422
|
+
# Intelligent context-aware clean (recommended)
|
|
423
|
+
npm run clean # Full clean using mag-cli
|
|
424
|
+
npm run clean:dist # Dist-only clean using mag-cli
|
|
425
|
+
|
|
426
|
+
# Raw clean commands (alternative)
|
|
427
|
+
npm run clean:raw # Full clean using raw rm commands
|
|
428
|
+
npm run clean:dist-raw # Dist-only clean using raw rm commands
|
|
429
|
+
npm run clean:deps # Dependencies only
|
|
430
|
+
npm run clean:cache # Build cache only
|
|
431
|
+
\`\`\`
|
|
432
|
+
|
|
433
|
+
## App-Specific Operations
|
|
434
|
+
|
|
435
|
+
Each app in \`apps/\` directory has its own:
|
|
436
|
+
- \`package.json\` for version tracking and app-specific scripts
|
|
437
|
+
- \`src/shared/mag_assets/\` for asset development
|
|
438
|
+
- \`federation.config.js\` for Module Federation configuration
|
|
439
|
+
- PWA configuration and icons
|
|
440
|
+
|
|
441
|
+
To work on a specific app:
|
|
442
|
+
|
|
443
|
+
\`\`\`bash
|
|
444
|
+
cd apps/<app-name>
|
|
445
|
+
npm start # Start development server
|
|
446
|
+
npm run build # Build to ../../dist/<app-name>/
|
|
447
|
+
npm run serve:pwa # Test PWA features from dist/
|
|
448
|
+
mag-cli assets # Compile assets
|
|
449
|
+
mag-cli build # Full build with assets
|
|
450
|
+
mag-cli zip # Create deployment zip from dist/
|
|
451
|
+
npm run clean # Clean app-specific artifacts
|
|
452
|
+
npm run clean:dist # Clean only app's dist folder
|
|
453
|
+
\`\`\`
|
|
454
|
+
|
|
455
|
+
## Library Operations
|
|
456
|
+
|
|
457
|
+
Each library in \`libs/\` directory has its own:
|
|
458
|
+
- \`package.json\` for version tracking and library metadata
|
|
459
|
+
- TypeScript path mappings for absolute imports
|
|
460
|
+
- Angular build configuration
|
|
461
|
+
|
|
462
|
+
To work on a specific library:
|
|
463
|
+
|
|
464
|
+
\`\`\`bash
|
|
465
|
+
cd libs/<library-name>
|
|
466
|
+
npm run build # Build library
|
|
467
|
+
npm run test # Test library
|
|
468
|
+
npm run lint # Lint library code
|
|
469
|
+
\`\`\`
|
|
470
|
+
|
|
471
|
+
## Federation Serving
|
|
472
|
+
|
|
473
|
+
To test the complete federation locally:
|
|
474
|
+
|
|
475
|
+
\`\`\`bash
|
|
476
|
+
# Build all apps
|
|
477
|
+
npm run build:all
|
|
478
|
+
|
|
479
|
+
# Serve the entire federation
|
|
480
|
+
cd dist
|
|
481
|
+
npx http-server . -p 8080 --cors
|
|
482
|
+
|
|
483
|
+
# Apps will be available at:
|
|
484
|
+
# http://localhost:8080/app1/
|
|
485
|
+
# http://localhost:8080/app2/
|
|
486
|
+
# etc.
|
|
487
|
+
\`\`\`
|
|
488
|
+
|
|
489
|
+
## Best Practices
|
|
490
|
+
|
|
491
|
+
1. **Shared Dist**: All apps build to the shared \`dist/\` folder for optimal federation
|
|
492
|
+
2. **Independent Apps**: Each app should be independently deployable
|
|
493
|
+
3. **Shared Dependencies**: Use the root package.json for shared dependencies
|
|
494
|
+
4. **Asset Organization**: Keep app-specific assets in each app's \`src/shared/mag_assets/\`
|
|
495
|
+
5. **Federation Design**: Design for loose coupling between federated modules
|
|
496
|
+
6. **PWA Testing**: Test PWA features with \`npm run serve:pwa\` from app directories
|
|
497
|
+
7. **Versioning**: Use semantic versioning for each app and library
|
|
498
|
+
8. **Module Contracts**: Define clear interfaces for exposed/consumed modules
|
|
499
|
+
9. **Library Design**: Keep libraries focused and reusable across multiple apps
|
|
500
|
+
10. **Path Mappings**: Use absolute imports with \`@${companyName}/<library-name>\` for libraries
|
|
501
|
+
|
|
502
|
+
## Contributing
|
|
503
|
+
|
|
504
|
+
1. Create new apps using \`mag-cli init <app-name>\`
|
|
505
|
+
2. Create new libraries using \`mag-cli lib <library-name>\`
|
|
506
|
+
3. Follow the established directory structure
|
|
507
|
+
4. Use consistent naming conventions
|
|
508
|
+
5. Test both standalone and federated functionality
|
|
509
|
+
6. Update this README when adding new patterns or conventions
|
|
510
|
+
7. Ensure apps work both independently and as part of the federation
|
|
511
|
+
8. Design libraries for reusability across multiple apps
|
|
512
|
+
`;
|
|
513
|
+
|
|
514
|
+
fs.writeFileSync(path.join(monorepoPath, 'README.md'), monorepoReadme);
|
|
515
|
+
|
|
516
|
+
// Create .gitignore for monorepo
|
|
517
|
+
const monorepoGitignore = `# Dependencies
|
|
518
|
+
node_modules/
|
|
519
|
+
apps/*/node_modules/
|
|
520
|
+
libs/*/node_modules/
|
|
521
|
+
|
|
522
|
+
# Build outputs
|
|
523
|
+
dist/
|
|
524
|
+
apps/*/dist/
|
|
525
|
+
libs/*/dist/
|
|
526
|
+
*.tsbuildinfo
|
|
527
|
+
|
|
528
|
+
# PWA
|
|
529
|
+
apps/*/*.zip
|
|
530
|
+
|
|
531
|
+
# IDE
|
|
532
|
+
.vscode/
|
|
533
|
+
.idea/
|
|
534
|
+
*.swp
|
|
535
|
+
*.swo
|
|
536
|
+
|
|
537
|
+
# OS
|
|
538
|
+
.DS_Store
|
|
539
|
+
Thumbs.db
|
|
540
|
+
|
|
541
|
+
# Logs
|
|
542
|
+
npm-debug.log*
|
|
543
|
+
yarn-debug.log*
|
|
544
|
+
yarn-error.log*
|
|
545
|
+
|
|
546
|
+
# Runtime data
|
|
547
|
+
pids
|
|
548
|
+
*.pid
|
|
549
|
+
*.seed
|
|
550
|
+
*.pid.lock
|
|
551
|
+
|
|
552
|
+
# Coverage
|
|
553
|
+
coverage/
|
|
554
|
+
.nyc_output/
|
|
555
|
+
|
|
556
|
+
# Environment
|
|
557
|
+
.env
|
|
558
|
+
.env.local
|
|
559
|
+
.env.development.local
|
|
560
|
+
.env.test.local
|
|
561
|
+
.env.production.local
|
|
562
|
+
`;
|
|
563
|
+
|
|
564
|
+
fs.writeFileSync(path.join(monorepoPath, '.gitignore'), monorepoGitignore);
|
|
565
|
+
|
|
566
|
+
// Create lerna.json for better monorepo management
|
|
567
|
+
const lernaConfig = {
|
|
568
|
+
version: 'independent',
|
|
569
|
+
packages: ['apps/*', 'libs/*'],
|
|
570
|
+
npmClient: 'npm',
|
|
571
|
+
command: {
|
|
572
|
+
bootstrap: {
|
|
573
|
+
ignore: 'component-*',
|
|
574
|
+
npmClientArgs: ['--no-package-lock'],
|
|
575
|
+
},
|
|
576
|
+
},
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
fs.writeFileSync(
|
|
580
|
+
path.join(monorepoPath, 'lerna.json'),
|
|
581
|
+
JSON.stringify(lernaConfig, null, 2)
|
|
582
|
+
);
|
|
583
|
+
|
|
584
|
+
// Create workspace configuration
|
|
585
|
+
const workspaceConfig = {
|
|
586
|
+
extends: './tsconfig.json',
|
|
587
|
+
compilerOptions: {
|
|
588
|
+
composite: true,
|
|
589
|
+
declaration: true,
|
|
590
|
+
declarationMap: true,
|
|
591
|
+
},
|
|
592
|
+
references: [],
|
|
593
|
+
};
|
|
594
|
+
|
|
595
|
+
fs.writeFileSync(
|
|
596
|
+
path.join(monorepoPath, 'tsconfig.workspace.json'),
|
|
597
|
+
JSON.stringify(workspaceConfig, null, 2)
|
|
598
|
+
);
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
// New function to add React dependencies to existing monorepo
|
|
602
|
+
async function addReactDependenciesToMonorepo(monorepoRootPath) {
|
|
603
|
+
const packageJsonPath = path.join(monorepoRootPath, 'package.json');
|
|
604
|
+
|
|
605
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
606
|
+
throw new Error(`package.json not found at ${packageJsonPath}`);
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
610
|
+
|
|
611
|
+
// React dependencies to add
|
|
612
|
+
const reactDependencies = {
|
|
613
|
+
'@reduxjs/toolkit': '^2.0.0',
|
|
614
|
+
'@softarc/native-federation': '^3.0.2',
|
|
615
|
+
'@softarc/native-federation-esbuild': '^3.0.2',
|
|
616
|
+
esbuild: '^0.20.0',
|
|
617
|
+
react: '^18.2.0',
|
|
618
|
+
'react-dom': '^18.2.0',
|
|
619
|
+
'react-redux': '^9.0.0',
|
|
620
|
+
'react-router-dom': '^6.8.0',
|
|
621
|
+
'workbox-webpack-plugin': '^7.0.0',
|
|
622
|
+
'workbox-window': '^7.0.0',
|
|
623
|
+
sass: '^1.89.2',
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
const reactDevDependencies = {
|
|
627
|
+
'@types/react': '^18.2.0',
|
|
628
|
+
'@types/react-dom': '^18.2.0',
|
|
629
|
+
'@types/jest': '^29.5.0',
|
|
630
|
+
'@types/node': '^20.19.0',
|
|
631
|
+
'@testing-library/react': '^14.0.0',
|
|
632
|
+
'@testing-library/jest-dom': '^5.16.0',
|
|
633
|
+
'@testing-library/user-event': '^14.4.0',
|
|
634
|
+
eslint: '^8.36.0',
|
|
635
|
+
'@typescript-eslint/eslint-plugin': '^5.55.0',
|
|
636
|
+
'@typescript-eslint/parser': '^5.55.0',
|
|
637
|
+
'eslint-plugin-react': '^7.32.0',
|
|
638
|
+
'eslint-plugin-react-hooks': '^4.6.0',
|
|
639
|
+
jest: '^29.5.0',
|
|
640
|
+
'jest-environment-jsdom': '^29.5.0',
|
|
641
|
+
'ts-jest': '^29.1.0',
|
|
642
|
+
};
|
|
643
|
+
|
|
644
|
+
// Merge dependencies (without overwriting existing ones)
|
|
645
|
+
packageJson.dependencies = {
|
|
646
|
+
...packageJson.dependencies,
|
|
647
|
+
...reactDependencies,
|
|
648
|
+
};
|
|
649
|
+
|
|
650
|
+
packageJson.devDependencies = {
|
|
651
|
+
...packageJson.devDependencies,
|
|
652
|
+
...reactDevDependencies,
|
|
653
|
+
};
|
|
654
|
+
|
|
655
|
+
// Add 'react' to keywords if not already present
|
|
656
|
+
if (packageJson.keywords && !packageJson.keywords.includes('react')) {
|
|
657
|
+
packageJson.keywords.push('react');
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
// Write updated package.json
|
|
661
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
|
662
|
+
|
|
663
|
+
console.log('✅ Added React dependencies to monorepo root package.json');
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
// New function to add Angular dependencies to existing monorepo
|
|
667
|
+
async function addAngularDependenciesToMonorepo(monorepoRootPath) {
|
|
668
|
+
const packageJsonPath = path.join(monorepoRootPath, 'package.json');
|
|
669
|
+
|
|
670
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
671
|
+
throw new Error(`package.json not found at ${packageJsonPath}`);
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
675
|
+
|
|
676
|
+
// Angular dependencies to add
|
|
677
|
+
const angularDependencies = {
|
|
678
|
+
'@angular/animations': '^20.0.4',
|
|
679
|
+
'@angular/common': '^20.0.4',
|
|
680
|
+
'@angular/compiler': '^20.0.4',
|
|
681
|
+
'@angular/core': '^20.0.4',
|
|
682
|
+
'@angular/elements': '^20.0.4',
|
|
683
|
+
'@angular/forms': '^20.0.4',
|
|
684
|
+
'@angular/platform-browser': '^20.0.4',
|
|
685
|
+
'@angular/platform-browser-dynamic': '^20.0.4',
|
|
686
|
+
'@angular/router': '^20.0.4',
|
|
687
|
+
'@angular/service-worker': '^20.0.4',
|
|
688
|
+
'@softarc/native-federation-node': '^2.0.10',
|
|
689
|
+
rxjs: '~7.8.0',
|
|
690
|
+
tslib: '^2.3.0',
|
|
691
|
+
'zone.js': '~0.15.0',
|
|
692
|
+
};
|
|
693
|
+
|
|
694
|
+
const angularDevDependencies = {
|
|
695
|
+
'@angular-architects/native-federation': '^20.0.1',
|
|
696
|
+
'@angular-devkit/build-angular': '^20.0.3',
|
|
697
|
+
'@angular/cli': '^20.0.3',
|
|
698
|
+
'@angular/compiler-cli': '^20.0.4',
|
|
699
|
+
'@angular/pwa': '^20.0.3',
|
|
700
|
+
'@types/jasmine': '~5.1.0',
|
|
701
|
+
'jasmine-core': '~5.5.0',
|
|
702
|
+
karma: '~6.4.0',
|
|
703
|
+
'karma-chrome-launcher': '~3.2.0',
|
|
704
|
+
'karma-coverage': '~2.2.0',
|
|
705
|
+
'karma-jasmine': '~5.1.0',
|
|
706
|
+
'karma-jasmine-html-reporter': '~2.1.0',
|
|
707
|
+
};
|
|
708
|
+
|
|
709
|
+
// Merge dependencies (without overwriting existing ones)
|
|
710
|
+
packageJson.dependencies = {
|
|
711
|
+
...packageJson.dependencies,
|
|
712
|
+
...angularDependencies,
|
|
713
|
+
};
|
|
714
|
+
|
|
715
|
+
packageJson.devDependencies = {
|
|
716
|
+
...packageJson.devDependencies,
|
|
717
|
+
...angularDevDependencies,
|
|
718
|
+
};
|
|
719
|
+
|
|
720
|
+
// Add 'angular' to keywords if not already present
|
|
721
|
+
if (packageJson.keywords && !packageJson.keywords.includes('angular')) {
|
|
722
|
+
packageJson.keywords.push('angular');
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
// Write updated package.json
|
|
726
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
|
727
|
+
|
|
728
|
+
console.log('✅ Added Angular dependencies to monorepo root package.json');
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
module.exports = {
|
|
732
|
+
createMonorepoStructure,
|
|
733
|
+
addReactDependenciesToMonorepo,
|
|
734
|
+
addAngularDependenciesToMonorepo,
|
|
735
|
+
};
|