@mnci/cli 4.47.0 → 4.49.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 +49 -1
- package/dist/cli.js +601 -324
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,7 +36,9 @@ plays (`.use-case`, `.client`, `.repository`, `.algorithm`, `.validator`,
|
|
|
36
36
|
src/
|
|
37
37
|
main.ts the CLI transport — decodes argv, calls one use case
|
|
38
38
|
workspace-overlay/ the config files mnci owns and rewrites
|
|
39
|
-
workspace-creation/ mnci new
|
|
39
|
+
workspace-creation/ mnci new
|
|
40
|
+
interactive-wizard/ bare mnci: every command and option, asked from the command's own description
|
|
41
|
+
repository-adoption/ mnci adopt — bringing an existing repository under mnci, step by step
|
|
40
42
|
workspace-upgrade/ mnci upgrade
|
|
41
43
|
workspace-diagnostics/ mnci doctor
|
|
42
44
|
project-scaffolding/ mnci add — one use case per kind, plus post-generation repairs
|
|
@@ -505,6 +507,52 @@ from File`), and the curated root scripts.
|
|
|
505
507
|
4. Installs the chosen **stack** (see below), `husky` + `@commitlint/*` for
|
|
506
508
|
real, so versions resolve at generation time.
|
|
507
509
|
|
|
510
|
+
## A paired Playwright project (`mnci add react-app web --e2e`)
|
|
511
|
+
|
|
512
|
+
`--e2e` scaffolds `apps/<name>-e2e` beside a React app with `@nx/react:app --e2eTestRunner=playwright`. It is
|
|
513
|
+
opt-in, and for React apps only: it adds Playwright to the workspace, and a Node API has no page to drive.
|
|
514
|
+
|
|
515
|
+
- **The test.** Nx's sample looks for an `h1` containing "Welcome", which mnci's greeting app does not render, so it
|
|
516
|
+
is replaced by `src/greeting.e2e.spec.ts`: open `/` and expect the app's own greeting.
|
|
517
|
+
- **What CI verifies.** The project has `lint` and `typecheck` (both pass, and CI's `lint,typecheck,test,build` run
|
|
518
|
+
picks them up); it has no `test` or `build`. Its `e2e` target is **not** part of CI's verify, because it needs a
|
|
519
|
+
browser, and installing one on every agent would cost every run. Run it where a browser exists:
|
|
520
|
+
`npx playwright install chromium`, then `npx nx run <name>-e2e:e2e -- --project=chromium` (the `--` hands the
|
|
521
|
+
flag to Playwright, not to Nx).
|
|
522
|
+
- **Commands.** `npm run <name>-e2e:qa` is lint and typecheck. There is no `:build` or `:start`.
|
|
523
|
+
- **No per-project ESLint config.** None is generated (`--linter=none`), and the usual sweep covers the directory.
|
|
524
|
+
|
|
525
|
+
The `react e2e project` e2e section generates one, checks CI's targets, installs Chromium and runs the test against
|
|
526
|
+
the built app.
|
|
527
|
+
|
|
528
|
+
## ES module Node apps (`mnci add node-app|node-function-app --esm`)
|
|
529
|
+
|
|
530
|
+
Generated Node apps are CommonJS by default, and `npm-lib` packages are ESM-only. `--esm` makes an app an ES module
|
|
531
|
+
too: its `package.json` gets `"type": "module"` and its esbuild target builds `esm`; every relative import in its
|
|
532
|
+
sources names its file the way `nodenext` resolution needs (`./hello` becomes `./hello/index.js`, which TypeScript
|
|
533
|
+
reports as TS2835 otherwise); and its `jest.config.cts` gets a `moduleNameMapper` that resolves `./x.js` back to the
|
|
534
|
+
`./x.ts` Jest transforms. It applies to `node-app` (Express, Koa or no framework) and `node-function-app`; Fastify
|
|
535
|
+
and Nest keep the layout their framework mandates (autoloaded routes, decorators), so `--esm` is refused with them,
|
|
536
|
+
and on any other kind.
|
|
537
|
+
|
|
538
|
+
Measured on generated apps rather than assumed (the `node esm apps` e2e section): lint, typecheck, test and build are
|
|
539
|
+
green; the built bundle is ES module syntax and runs; `prune` keeps `"type": "module"` in the pruned manifest, so
|
|
540
|
+
`dist` still runs afterwards; and a **CommonJS** app that depends on an ESM-only library typechecks, builds and runs,
|
|
541
|
+
including from `dist` after `prune` and an install there, because Node loads the ES module through `require`
|
|
542
|
+
(unflagged from Node 22.12; the e2e says so and skips on older Node).
|
|
543
|
+
|
|
544
|
+
## The interactive wizard (`mnci` with no arguments)
|
|
545
|
+
|
|
546
|
+
Bare `mnci` lists **every command** (inside a workspace the Projects and Dependencies sections come first, outside
|
|
547
|
+
one the Workspace section does), asks the command's arguments and then the options that apply, prints the command
|
|
548
|
+
line it is about to run, and runs it through the same program the flags go through. It reads the commands from the
|
|
549
|
+
program itself, so a command or option added to `main.ts` is offered without a wizard change. Two groupings are
|
|
550
|
+
kept by hand and checked by a spec: `add` offers the flags of the kind just chosen, and `adopt` asks which step
|
|
551
|
+
first (report, baseline tags, toolchain, project kinds, dependencies, overlay) and offers that step's own flags.
|
|
552
|
+
`wizard-coverage.integration.spec.ts` fails when a command is missing from the menu, an `adopt` flag belongs to no
|
|
553
|
+
step, an `add` flag is reachable for no kind, or the line the wizard builds for an option is not one the program
|
|
554
|
+
accepts.
|
|
555
|
+
|
|
508
556
|
## `mnci adopt`: reading an existing repository before changing it
|
|
509
557
|
|
|
510
558
|
`mnci adopt` is the start of bringing a repository that already has history, tooling and published
|