@mnci/cli 4.50.0 → 4.52.0
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 +38 -0
- package/dist/cli.js +509 -111
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -507,6 +507,44 @@ from File`), and the curated root scripts.
|
|
|
507
507
|
4. Installs the chosen **stack** (see below), `husky` + `@commitlint/*` for
|
|
508
508
|
real, so versions resolve at generation time.
|
|
509
509
|
|
|
510
|
+
## A whole shape in one step (`mnci new --preset`)
|
|
511
|
+
|
|
512
|
+
Everything else in mnci is per project. `mnci new my-shop --preset web-api` also scaffolds a wired-together shape, so the
|
|
513
|
+
result is a starting point that already runs rather than three projects to connect:
|
|
514
|
+
|
|
515
|
+
| Preset | Adds | Wiring |
|
|
516
|
+
|---|---|---|
|
|
517
|
+
| `web-api` | `libs/shared` (an internal library), `apps/api` (Express) and `apps/web` (React) | the API answers `GET /api/greeting` with the shared library's `greet`; the frontend asks that route and types the answer with the shared `Greeting`; both declare `@<scope>/shared`; Vite forwards `/api` to the API in development |
|
|
518
|
+
|
|
519
|
+
Each project is added through `mnci add`, so it is exactly what `add` makes, and the preset then edits them into one shape:
|
|
520
|
+
the API and the frontend drop their own copy of the sample use case and contract (the library owns them now), each gets a
|
|
521
|
+
spec that matches (written without a mock library, so it runs under Jest or Vitest), and one install, one `nx sync` and one
|
|
522
|
+
format finish it. `mnci dev web api` starts both servers, and asking the frontend's origin for `/api/greeting` returns the
|
|
523
|
+
API's answer through the proxy.
|
|
524
|
+
|
|
525
|
+
A misspelt preset is refused before the workspace is generated, and the wiring edits fail with the file named, not
|
|
526
|
+
silently, if a generator's output ever stops having the text they change. A preset is a starting point to edit: delete what
|
|
527
|
+
you do not need. New presets are an entry in `workspace-presets/preset-catalog.config.ts` plus their wiring.
|
|
528
|
+
|
|
529
|
+
The `web-api preset` e2e section generates one and checks lint, typecheck, test and build for all three projects, the
|
|
530
|
+
specs under Vitest, and the proxied request while both servers run.
|
|
531
|
+
|
|
532
|
+
## Starting projects together (`mnci dev`)
|
|
533
|
+
|
|
534
|
+
`<name>:start` starts one project. `mnci dev web api` starts several at once, the usual case being a frontend and the
|
|
535
|
+
API it calls: `mnci dev` with no names asks which (or `--all` starts every one that can be started, and `--dry-run`
|
|
536
|
+
prints what would run). A script with no terminal must name them, and a name that is a library, or a typo, is refused
|
|
537
|
+
with the list that can be started.
|
|
538
|
+
|
|
539
|
+
Each project runs the Nx target its own start script names. That is not always `start`: a React or Node app's
|
|
540
|
+
`<name>:start` runs its `serve` target, a Go app's runs `start`, so `nx run-many -t start` would find nothing for the
|
|
541
|
+
first two. Output is shown with a `[project]` prefix. The projects run until the **first one stops**; then the others
|
|
542
|
+
are stopped too, so a crashed API does not leave a frontend quietly talking to nothing, and Ctrl+C stops them all
|
|
543
|
+
(`taskkill /T` on Windows, the process group elsewhere). The command exits with the status of the first to stop.
|
|
544
|
+
|
|
545
|
+
The `dev up` e2e section starts a real Vite server and an Express API together, talks to both, and checks that stopping
|
|
546
|
+
the command frees both ports.
|
|
547
|
+
|
|
510
548
|
## Container images (`mnci add container <name> --app <app>`)
|
|
511
549
|
|
|
512
550
|
`container` is a kind that wraps an app you already have, so the app keeps its own kind and the image is a project
|