@multisystemsuite/create-mf-app 1.0.13 → 1.0.14

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 +59 -3
  2. package/dist/index.js +2712 -2255
  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
  ```
@@ -290,6 +306,45 @@ npx create-mf-app <project-name> [options]
290
306
  | `-y`, `--yes` | Non-interactive (use defaults where applicable) |
291
307
  | `-h`, `--help` | Show help |
292
308
 
309
+ ### Add a child to an existing parent workspace
310
+
311
+ ```bash
312
+ npx create-mf-app add-child <child-name> --cwd=./my-platform [options]
313
+ ```
314
+
315
+ | Option | Description |
316
+ |--------|-------------|
317
+ | `--cwd=./my-platform` | Parent monorepo root (must contain `mf.json`; default: current directory) |
318
+ | `--port=4205` | Dev/preview port for the new remote (default: next free port after existing apps) |
319
+ | `-y`, `--yes` | Non-interactive |
320
+ | `-h`, `--help` | Show add-child help |
321
+
322
+ **Example:**
323
+
324
+ ```bash
325
+ npx create-mf-app add-child analytics --cwd=./my-platform --port=4205 -y
326
+ cd my-platform
327
+ npm run analytics
328
+ ```
329
+
330
+ **What gets updated:**
331
+
332
+ - `apps/<child-name>/` — full enterprise child remote scaffold
333
+ - `mf.json` — project registry + federation remotes
334
+ - `apps/main` — host routes, federation config, remote type declarations
335
+ - `apps/corelib` — permission/module/feature registries, sidebar menu
336
+ - `runtime-config/remote-manifest.json` — remote entry map
337
+ - Root `package.json` — `npm run <child>`, watch/preview/build scripts
338
+ - `.env` / env variants — port and remoteEntry URLs
339
+ - `docker-compose.yml` and `infrastructure/` — when present in the workspace
340
+
341
+ **Rules:**
342
+
343
+ - Workspace must be an existing **parent monorepo** with `mf.json`
344
+ - Child name: letters, numbers, dashes only (`^[a-z0-9-]+$`)
345
+ - Do not use `main` or the shared lib name (e.g. `corelib`)
346
+ - Child must not already exist under `apps/`
347
+
293
348
  **Parent mode rules:**
294
349
 
295
350
  - `main` is **always** created as the host — never pass it in `--children` or `--shared`
@@ -1416,6 +1471,7 @@ node dist/index.js my-platform --control-plane -y
1416
1471
  node dist/index.js my-platform --type=parent --children=admin,billing --shared=corelib -y
1417
1472
  node dist/index.js my-federation-platform --federation-os -y
1418
1473
  node dist/index.js test-app --type=child --port=3001 --template=tsx
1474
+ node dist/index.js add-child analytics --cwd=./mf-structure-test --port=4205 -y
1419
1475
 
1420
1476
  # patch in-repo test workspaces (mf-test-jsx, my-platform-cp) after pillar changes
1421
1477
  node scripts/patch-architect-level-test-repos.js
@@ -1457,7 +1513,7 @@ npm publish --access public
1457
1513
  | **Federation OS preset** | `--federation-os` → full runtime, governance, observability stack |
1458
1514
  | **Daily dev** | `npm run local` (all apps) or `npm run billing` (one module) |
1459
1515
  | **Shared UI / theme** | Import from `corelib/*` federation exposes |
1460
- | **New remote** | `npm run mf -- generate app <name>` |
1516
+ | **New remote** | `npx create-mf-app add-child <name> --cwd=./my-platform` or `npm run mf -- generate app <name>` |
1461
1517
  | **Enterprise modules** | Flags: `--auth`, `--charts`, `--i18n`, … |
1462
1518
  | **Architect pillars** | 10 enterprise audits — start with `npm run architect-level:audit` |
1463
1519
  | **Monorepo platform** | `mf graph`, `mf affected build`, `mf doctor` |