@mnci/cli 4.3.2 → 4.3.3
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 +51 -5
- package/dist/cli.js +1829 -1805
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,6 +24,52 @@ first-party (or established community) Nx equivalent:
|
|
|
24
24
|
| Hand-written Azure Function templates | `@nx/node:application` (plain Node app) + a thin Azure Functions v4 overlay |
|
|
25
25
|
| doctor/drift sync of tool-owned files | Nothing to drift: this CLI owns 5 small files, Nx owns the rest |
|
|
26
26
|
|
|
27
|
+
## How this package is organised
|
|
28
|
+
|
|
29
|
+
Source is arranged in **vertical slices**: one folder per outcome, each with an
|
|
30
|
+
`index.ts` that is its whole public API. A sibling is reached only through that
|
|
31
|
+
barrel, never by a path into its files, and a file's suffix says what role it
|
|
32
|
+
plays (`.use-case`, `.client`, `.repository`, `.algorithm`, `.validator`,
|
|
33
|
+
`.handler`). Tests sit beside what they test.
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
src/
|
|
37
|
+
cli.handler.ts the CLI transport — decodes argv, calls one use case
|
|
38
|
+
workspace-overlay/ the config files mnci owns and rewrites
|
|
39
|
+
workspace-creation/ mnci new, and the interactive wizard
|
|
40
|
+
workspace-upgrade/ mnci upgrade
|
|
41
|
+
workspace-diagnostics/ mnci doctor
|
|
42
|
+
project-scaffolding/ mnci add — one use case per kind, plus post-generation repairs
|
|
43
|
+
rollup-library/ what a rollup-bundled library needs repaired to build, type and publish
|
|
44
|
+
dependency-management/ mnci sync / mnci up, and the manifest + registry + semver machinery
|
|
45
|
+
nx-workspace/ runs the Nx and npm CLIs, always via an argv array
|
|
46
|
+
terminal/ prompts in, coloured status out
|
|
47
|
+
file-system/ JSON, JSONC workspace files, ensured writes
|
|
48
|
+
project-name/ name validation
|
|
49
|
+
cli-version/ the update check
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The dependency graph is acyclic and flows one way: `cli.handler` → the command
|
|
53
|
+
slices → the infrastructure slices → `file-system` as a leaf. That is checked,
|
|
54
|
+
not assumed.
|
|
55
|
+
|
|
56
|
+
### Exceptions, and when they go away
|
|
57
|
+
|
|
58
|
+
Two places hold more than the one responsibility their name claims, and are
|
|
59
|
+
named here because the next reader deserves to know before opening them:
|
|
60
|
+
|
|
61
|
+
| Path | Rule waived | Why, and removal condition |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| `workspace-overlay/overlay.use-case.ts` | one responsibility per file | ~3.5k lines covering CI YAML for two providers, `.npmrc`, `nuget.config`, the VS Code workspace, release config and the CI guard scripts. Splitting it is a decomposition, not a move, so it was deliberately kept out of the change that created these slices. **Temporary** — removed when that decomposition lands. |
|
|
64
|
+
| `rollup-library/repair-rollup-config.use-case.spec.ts` | a test takes its subject's basename | It also holds the `withUpgradedDeclarationSpecifierPlugin` describe, whose subject is `rollup-config.algorithm.ts`. That transform shares three fixtures with the repairs that apply it (`OLD_DTS_PLUGIN_CONFIG`, `EXTENSION_ONLY_DTS_PLUGIN_CONFIG`, `loadWriteBundle`), and duplicating them across two spec files is the worse trade. **Permanent** unless those fixtures stop being shared. |
|
|
65
|
+
|
|
66
|
+
`rollup-library/` exists because of the own-the-concept rule. Its contents used
|
|
67
|
+
to live in `project-scaffolding`, which meant `workspace-diagnostics` and
|
|
68
|
+
`workspace-upgrade` depended on the scaffolding slice **only** to reach repair
|
|
69
|
+
helpers — they have no interest in adding a project. The concept now sits in its
|
|
70
|
+
own slice that depends on nothing above it (`file-system` alone), and all three
|
|
71
|
+
consumers point at it.
|
|
72
|
+
|
|
27
73
|
## Commands (deliberately just six)
|
|
28
74
|
|
|
29
75
|
```sh
|
|
@@ -301,7 +347,7 @@ each a single cross-platform command:
|
|
|
301
347
|
## Every `add` also wires local-dev commands
|
|
302
348
|
|
|
303
349
|
Every `mnci add` (and the inline `internal-lib` case) finishes by calling
|
|
304
|
-
`registerProjectCommands` (`
|
|
350
|
+
`registerProjectCommands` (`project-scaffolding/post-generation.use-case.ts`), which writes up to three
|
|
305
351
|
root `package.json` scripts for the project just added:
|
|
306
352
|
|
|
307
353
|
| Script | Runs | When it's added |
|
|
@@ -401,7 +447,7 @@ from File`), and the curated root scripts.
|
|
|
401
447
|
|
|
402
448
|
## `mnci upgrade`: re-applying the overlay to an existing workspace
|
|
403
449
|
|
|
404
|
-
Every fix to `overlay.ts` — a release-config correction, a CI guard rewritten,
|
|
450
|
+
Every fix to `workspace-overlay/overlay.use-case.ts` — a release-config correction, a CI guard rewritten,
|
|
405
451
|
a new Windows code path — only ever reached _future_ `mnci new` calls until
|
|
406
452
|
this existed; nothing let an already-generated workspace pick one up.
|
|
407
453
|
`mnci upgrade`, run from the workspace root, closes that gap: it resolves the
|
|
@@ -611,7 +657,7 @@ default `azure`): `azure` writes `azure-pipelines.yml`, `github` writes
|
|
|
611
657
|
`.github/workflows/ci.yml`, `both` writes both — pick `github` for a
|
|
612
658
|
GitHub-hosted repo, or `both` while migrating between the two. Whichever
|
|
613
659
|
provider(s), the pipeline does the **exact same thing**: both files are built
|
|
614
|
-
from the same shared guard scripts (`overlay.ts`'s `PYTHON_INSTALL_GUARD`,
|
|
660
|
+
from the same shared guard scripts (`workspace-overlay/overlay.use-case.ts`'s `PYTHON_INSTALL_GUARD`,
|
|
615
661
|
`PACK_APPS_GUARD`, `releaseGuard`, `AFFECTED_OR_ALL_GUARD`), so they can never
|
|
616
662
|
drift on what CI actually runs — only the provider's own syntax differs. That
|
|
617
663
|
matters most for the last of those: the two providers detect a pull request
|
|
@@ -855,7 +901,7 @@ is base64-encoded throughout — that's the raw value Azure Artifacts' "Connect
|
|
|
855
901
|
to feed" instructions give you. npm's `.npmrc` `_password` field expects
|
|
856
902
|
exactly that pre-encoded form, so it's used as-is. `twine`/pypi basic auth, by
|
|
857
903
|
contrast, wants the **raw** token — so the shared `releaseGuard` fragment
|
|
858
|
-
(`overlay.ts`, used by both `azurePipelinesYaml` and `githubActionsYaml`)
|
|
904
|
+
(`workspace-overlay/overlay.use-case.ts`, used by both `azurePipelinesYaml` and `githubActionsYaml`)
|
|
859
905
|
explicitly _decodes_ the same `PAT`
|
|
860
906
|
(`Buffer.from(process.env.PAT, 'base64').toString()`) before handing it to
|
|
861
907
|
`TWINE_PASSWORD`. Both are correct for their protocol today, but it's an easy
|
|
@@ -1185,7 +1231,7 @@ pipeline installs `golangci-lint` itself (see below).
|
|
|
1185
1231
|
| `go-internal-lib` | `libs/<name>` | private shared code, lint + test only — a non-`main` package produces no binary |
|
|
1186
1232
|
|
|
1187
1233
|
- **One root `go.mod`**, matching how TS uses one root `package.json` and
|
|
1188
|
-
Python one root `requirements-dev.txt`. `
|
|
1234
|
+
Python one root `requirements-dev.txt`. `project-scaffolding/go.use-case.ts` bootstraps it on the
|
|
1189
1235
|
first Go `add` by running the plugin's `init` then `convert-to-one-mod`
|
|
1190
1236
|
generators, in that order — `convert-to-one-mod` refuses once `go.work`
|
|
1191
1237
|
lists any module, so it has to happen before the first Go project exists.
|