@multisystemsuite/create-mf-app 1.0.13 → 1.0.15

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 (3) hide show
  1. package/README.md +77 -3
  2. package/dist/index.js +2814 -2315
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -61,6 +61,7 @@ npx create-mf-app my-platform --type=parent --children=billing,orders --shared=c
61
61
  npm run build
62
62
  node dist/index.js my-platform --control-plane -y
63
63
  node dist/index.js my-platform --type=parent --children=admin,billing --shared=corelib -y
64
+ node dist/index.js add-child analytics --cwd=./my-platform --port=4205 -y
64
65
  ```
65
66
 
66
67
  **Global install** (optional):
@@ -257,11 +258,24 @@ npm run release:major
257
258
 
258
259
  ### Add a new remote after scaffold
259
260
 
260
- Use the built-in MF CLI (recommended):
261
+ **Recommended use `create-mf-app add-child`** (fully wires federation, host routes, `mf.json`, env ports, and npm scripts):
262
+
263
+ ```bash
264
+ npx create-mf-app add-child analytics --cwd=./my-platform --port=4205 -y
265
+ ```
266
+
267
+ From the CLI repo during development:
268
+
269
+ ```bash
270
+ node dist/index.js add-child analytics --cwd=./mf-structure-test --port=4205 -y
271
+ ```
272
+
273
+ This scaffolds `apps/analytics/`, updates the host router (`/analytics/*`), corelib registries, `remote-manifest.json`, root `package.json` scripts (`npm run analytics`), and `.env` port entries — the same wiring as children created at initial scaffold time.
274
+
275
+ **Alternative — MF CLI inside the monorepo** (minimal scaffold; manual federation wiring may still be needed):
261
276
 
262
277
  ```bash
263
278
  npm run mf -- generate app inventory
264
- # wires federation, port, mf.json, and npm scripts
265
279
  ```
266
280
 
267
281
  Or copy an existing child app folder and update `mf.json`, `federation.config.ts`, host routes, and root `package.json` scripts manually.
@@ -270,6 +284,8 @@ Or copy an existing child app folder and update `mf.json`, `federation.config.ts
270
284
 
271
285
  ## CLI reference (create-mf-app)
272
286
 
287
+ ### Create a new project
288
+
273
289
  ```bash
274
290
  npx create-mf-app <project-name> [options]
275
291
  ```
@@ -287,9 +303,64 @@ npx create-mf-app <project-name> [options]
287
303
  | `--federation=true\|false` | Module Federation (default: `true`) |
288
304
  | `--control-plane` | Workflow Designer & Monitoring preset (6 apps + corelib, control-plane API, mf-* packages) |
289
305
  | `--federation-os` | Full Enterprise Federation OS preset (10 apps + corelib, runtime, observability stack) |
306
+ | `--lite` | **Faster install** — skip ESLint/Vitest/Husky stack and optional SDK packages |
290
307
  | `-y`, `--yes` | Non-interactive (use defaults where applicable) |
291
308
  | `-h`, `--help` | Show help |
292
309
 
310
+ **Faster install (`--lite`):**
311
+
312
+ ```bash
313
+ npx create-mf-app my-platform --type=parent --children=billing,orders --shared=corelib --lite -y
314
+ ```
315
+
316
+ Skips ESLint, Prettier, Stylelint, Vitest, Husky, commitlint, and optional SDK packages (`api-client`, `sdk-core`, `websocket-sdk`). Federation, apps, `corelib`, and `query-client` are still included — typical install drops from ~850 to ~400 packages.
317
+
318
+ **Other ways to speed up install:**
319
+
320
+ - Exclude the project folder from Windows Defender real-time scan
321
+ - Second `npm install` is much faster (npm cache)
322
+ - Use `HUSKY=0 npm install` to skip git hooks on any scaffold
323
+ - Fewer `--children` = fewer apps = less to resolve
324
+
325
+ ### Add a child to an existing parent workspace
326
+
327
+ ```bash
328
+ npx create-mf-app add-child <child-name> --cwd=./my-platform [options]
329
+ ```
330
+
331
+ | Option | Description |
332
+ |--------|-------------|
333
+ | `--cwd=./my-platform` | Parent monorepo root (must contain `mf.json`; default: current directory) |
334
+ | `--port=4205` | Dev/preview port for the new remote (default: next free port after existing apps) |
335
+ | `-y`, `--yes` | Non-interactive |
336
+ | `-h`, `--help` | Show add-child help |
337
+
338
+ **Example:**
339
+
340
+ ```bash
341
+ npx create-mf-app add-child analytics --cwd=./my-platform --port=4205 -y
342
+ cd my-platform
343
+ npm run analytics
344
+ ```
345
+
346
+ **What gets updated:**
347
+
348
+ - `apps/<child-name>/` — full enterprise child remote scaffold
349
+ - `mf.json` — project registry + federation remotes
350
+ - `apps/main` — host routes, federation config, remote type declarations
351
+ - `apps/corelib` — permission/module/feature registries, sidebar menu
352
+ - `runtime-config/remote-manifest.json` — remote entry map
353
+ - Root `package.json` — `npm run <child>`, watch/preview/build scripts
354
+ - `.env` / env variants — port and remoteEntry URLs
355
+ - `docker-compose.yml` and `infrastructure/` — when present in the workspace
356
+
357
+ **Rules:**
358
+
359
+ - Workspace must be an existing **parent monorepo** with `mf.json`
360
+ - Child name: letters, numbers, dashes only (`^[a-z0-9-]+$`)
361
+ - Do not use `main` or the shared lib name (e.g. `corelib`)
362
+ - Child must not already exist under `apps/`
363
+
293
364
  **Parent mode rules:**
294
365
 
295
366
  - `main` is **always** created as the host — never pass it in `--children` or `--shared`
@@ -1376,6 +1447,8 @@ Node 18 will fail on Vite 7 commands.
1376
1447
  | `Cannot find module 'billing/App'` | Add federation `.d.ts` declarations in host |
1377
1448
  | `Task not found: live-reload` | Root `"live-reload": "node live-reload.js"` |
1378
1449
  | Vite binary missing after install | Clean reinstall (see below) |
1450
+ | **`npm install` very slow (~2 min+)** | Use `--lite` for faster scaffold; exclude project from antivirus scan; second install uses npm cache |
1451
+ | **`npm run local` fails on `api-client` build** | Update to latest CLI (smart-build skips source-only packages) or patch `smart-build.js` |
1379
1452
  | Sidebar overlaps main content | Use generated flex sidebar in corelib |
1380
1453
  | **Text invisible on dark header/sidebar** | Clear `localStorage` key `mf-enterprise-config`; hard refresh |
1381
1454
  | `provider support react(undefined)` / `useState` null | Rebuild all apps after federation config change; host uses exact `version: "19.0.0"`, remotes use `requiredVersion: "^19.0.0"` |
@@ -1416,6 +1489,7 @@ node dist/index.js my-platform --control-plane -y
1416
1489
  node dist/index.js my-platform --type=parent --children=admin,billing --shared=corelib -y
1417
1490
  node dist/index.js my-federation-platform --federation-os -y
1418
1491
  node dist/index.js test-app --type=child --port=3001 --template=tsx
1492
+ node dist/index.js add-child analytics --cwd=./mf-structure-test --port=4205 -y
1419
1493
 
1420
1494
  # patch in-repo test workspaces (mf-test-jsx, my-platform-cp) after pillar changes
1421
1495
  node scripts/patch-architect-level-test-repos.js
@@ -1457,7 +1531,7 @@ npm publish --access public
1457
1531
  | **Federation OS preset** | `--federation-os` → full runtime, governance, observability stack |
1458
1532
  | **Daily dev** | `npm run local` (all apps) or `npm run billing` (one module) |
1459
1533
  | **Shared UI / theme** | Import from `corelib/*` federation exposes |
1460
- | **New remote** | `npm run mf -- generate app <name>` |
1534
+ | **New remote** | `npx create-mf-app add-child <name> --cwd=./my-platform` or `npm run mf -- generate app <name>` |
1461
1535
  | **Enterprise modules** | Flags: `--auth`, `--charts`, `--i18n`, … |
1462
1536
  | **Architect pillars** | 10 enterprise audits — start with `npm run architect-level:audit` |
1463
1537
  | **Monorepo platform** | `mf graph`, `mf affected build`, `mf doctor` |