@mnci/cli 4.49.0 → 4.51.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 +45 -0
- package/dist/cli.js +605 -237
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -507,6 +507,51 @@ 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
|
+
## Starting projects together (`mnci dev`)
|
|
511
|
+
|
|
512
|
+
`<name>:start` starts one project. `mnci dev web api` starts several at once, the usual case being a frontend and the
|
|
513
|
+
API it calls: `mnci dev` with no names asks which (or `--all` starts every one that can be started, and `--dry-run`
|
|
514
|
+
prints what would run). A script with no terminal must name them, and a name that is a library, or a typo, is refused
|
|
515
|
+
with the list that can be started.
|
|
516
|
+
|
|
517
|
+
Each project runs the Nx target its own start script names. That is not always `start`: a React or Node app's
|
|
518
|
+
`<name>:start` runs its `serve` target, a Go app's runs `start`, so `nx run-many -t start` would find nothing for the
|
|
519
|
+
first two. Output is shown with a `[project]` prefix. The projects run until the **first one stops**; then the others
|
|
520
|
+
are stopped too, so a crashed API does not leave a frontend quietly talking to nothing, and Ctrl+C stops them all
|
|
521
|
+
(`taskkill /T` on Windows, the process group elsewhere). The command exits with the status of the first to stop.
|
|
522
|
+
|
|
523
|
+
The `dev up` e2e section starts a real Vite server and an Express API together, talks to both, and checks that stopping
|
|
524
|
+
the command frees both ports.
|
|
525
|
+
|
|
526
|
+
## Container images (`mnci add container <name> --app <app>`)
|
|
527
|
+
|
|
528
|
+
`container` is a kind that wraps an app you already have, so the app keeps its own kind and the image is a project
|
|
529
|
+
of its own beside it: `mnci add container api-image --app api --port 3000`. It writes `apps/<name>/` with a
|
|
530
|
+
`Dockerfile`, a `Dockerfile.dockerignore`, a `files/` directory for anything the image copies from beside the build
|
|
531
|
+
context, and a manifest tagged `type:container` with two targets. `image` builds `<name>:<VERSION>` and
|
|
532
|
+
`<name>:latest` after the app's own output target (`VERSION` is `dev` when unset, as in the Go builds), and `start`
|
|
533
|
+
runs the image, publishing the port. The project declares the app as an implicit dependency, so `nx affected`
|
|
534
|
+
knows a change to the app affects its image. `npm run <name>:image` and `<name>:start` are registered; `:qa` builds
|
|
535
|
+
the image.
|
|
536
|
+
|
|
537
|
+
One recipe per app kind, each a plain image of what the app already produces:
|
|
538
|
+
|
|
539
|
+
| App | Build context | Image |
|
|
540
|
+
|---|---|---|
|
|
541
|
+
| `node-app` | the app's pruned output (`prune` target) | `node:24-alpine`, production dependencies installed, runs as `node`, `HOST=0.0.0.0` so a published port is reachable |
|
|
542
|
+
| `react-app` | its production `dist` | `nginx` with a server block that falls back to `index.html` for client-side routes |
|
|
543
|
+
| `go-app` | the static `linux-amd64` binary from `build-all` | `distroless/static`, non-root |
|
|
544
|
+
|
|
545
|
+
An Azure Functions app is refused, because its image is the Functions host's own and needs its own entry point.
|
|
546
|
+
|
|
547
|
+
The target is called `image`, not `build`, **on purpose**: CI runs every project's `build`, and building an image needs a
|
|
548
|
+
Docker engine that an agent may not have (a Windows agent cannot run Linux images at all). Adding a container project
|
|
549
|
+
therefore does not change what CI verifies; building and publishing images is a step you add in a pipeline slot where
|
|
550
|
+
the agent has Docker. `mnci upgrade` rewrites `tools/container-image.cjs`, the small helper both targets run.
|
|
551
|
+
|
|
552
|
+
The `container images` e2e section builds a Node, a React and a Go image and talks to the running containers. It needs
|
|
553
|
+
a Docker engine, so it skips where there is none and runs in CI's Linux `e2e-containers` job (nightly and on demand).
|
|
554
|
+
|
|
510
555
|
## A paired Playwright project (`mnci add react-app web --e2e`)
|
|
511
556
|
|
|
512
557
|
`--e2e` scaffolds `apps/<name>-e2e` beside a React app with `@nx/react:app --e2eTestRunner=playwright`. It is
|