@mnci/cli 4.16.0 → 4.17.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 +42 -1
- package/dist/cli.js +581 -380
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -65,7 +65,7 @@ named here because the next reader deserves to know before opening them:
|
|
|
65
65
|
|
|
66
66
|
| Path | Rule waived | Why, and removal condition |
|
|
67
67
|
|---|---|---|
|
|
68
|
-
| `workspace-overlay/overlay.use-case.ts` | one responsibility per file | ~
|
|
68
|
+
| `workspace-overlay/overlay.use-case.ts` | one responsibility per file | ~5k lines covering CI YAML for two providers (including the native-app job), `.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. |
|
|
69
69
|
| `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. |
|
|
70
70
|
|
|
71
71
|
`rollup-library/` exists because of the own-the-concept rule. Its contents used
|
|
@@ -104,6 +104,7 @@ mnci add python-vendor shared --lib core # wire core's module into shared's bui
|
|
|
104
104
|
mnci add go-app api # executable -> apps/ (binary, zipped into the drop)
|
|
105
105
|
mnci add go-app cli --release # ...released: tag + per-platform zips on the GitHub Release
|
|
106
106
|
mnci add go-app tray --cgo # needs a C toolchain: built on a runner of each OS
|
|
107
|
+
mnci add go-app site --web web # embeds and serves the React app apps/web in one binary
|
|
107
108
|
mnci add go-function-app fn # serverless handler -> apps/
|
|
108
109
|
mnci add go-lib core # publishable (by git tag) -> packages/
|
|
109
110
|
mnci add go-internal-lib util # private shared package -> libs/
|
|
@@ -1355,6 +1356,11 @@ get `react-app-<name>-dev` / `-uat` / `-prod`, and the classic release pipeline
|
|
|
1355
1356
|
deploys each environment from its own artifact + tag. Need different
|
|
1356
1357
|
environments? Edit `REACT_ENVIRONMENTS` in the generator.
|
|
1357
1358
|
|
|
1359
|
+
**A React app can also ship inside a Go binary**, for an app that serves its own UI
|
|
1360
|
+
(`mnci add go-app <name> --web <react-app>`): the default `build` is what gets
|
|
1361
|
+
embedded, not the per-environment ones, so the app should call its API on the same
|
|
1362
|
+
origin (`/api/...`). See _Serving a React app from a Go app_ in the Go section.
|
|
1363
|
+
|
|
1358
1364
|
## Python (`@mnci/nx-python-pip` — pip + Ruff + pytest + PyPA `build`/`twine`, no uv)
|
|
1359
1365
|
|
|
1360
1366
|
Python is the first non-JS language, and follows the same philosophy as every
|
|
@@ -1574,6 +1580,41 @@ pipeline installs `golangci-lint` itself (see below).
|
|
|
1574
1580
|
OS's zip to the same GitHub Release, so one release collects a zip from every
|
|
1575
1581
|
runner. Azure Pipelines has no GitHub Release to attach to and stops at the
|
|
1576
1582
|
artifact.
|
|
1583
|
+
- **Serving a React app from a Go app (`mnci add go-app <name> --web <react-app>`).**
|
|
1584
|
+
For an app that runs a local server and is used in a browser, shipped as one
|
|
1585
|
+
self-contained binary. `//go:embed` cannot reach outside its package directory,
|
|
1586
|
+
and a React app builds into its own `apps/<react-app>/dist`, so the Go app needs
|
|
1587
|
+
wiring mnci writes for you (the React app has to exist first):
|
|
1588
|
+
- **`stage-web`** copies that `dist` into `apps/<name>/web/`, after the React
|
|
1589
|
+
app's `build`, and the directory is git-ignored (an `apps/<name>/.gitignore`).
|
|
1590
|
+
Its output is declared and its inputs are the React build's outputs, so Nx
|
|
1591
|
+
caches it and a change to the React code reaches the binary.
|
|
1592
|
+
- **Every target that compiles Go depends on it**: `build`, `test`, `lint`,
|
|
1593
|
+
`start`, `build-all` and `build-native` (`package*` reach it through those).
|
|
1594
|
+
`//go:embed` fails at compile time without its files, so on a fresh checkout
|
|
1595
|
+
`go vet`, `go test` and `golangci-lint` fail as well as `go build`. A committed
|
|
1596
|
+
placeholder was rejected: staging replaces the directory, so git would show it
|
|
1597
|
+
modified for ever. The cost is that a Go-only change waits for a React build
|
|
1598
|
+
on a cold cache, and your editor shows the embed error until the first
|
|
1599
|
+
`nx run <name>:stage-web`.
|
|
1600
|
+
- **The project graph knows**: `implicitDependencies` makes the React app a
|
|
1601
|
+
dependency, so changing it marks the Go app affected, while changing the Go
|
|
1602
|
+
app does not rebuild the React app.
|
|
1603
|
+
- **The sources**: `main.go` becomes a small server (`ADDR`, default
|
|
1604
|
+
`127.0.0.1:8080`) that logs the stamped `version`, `web.go` embeds the staged
|
|
1605
|
+
files and serves them (an unknown path falls back to `index.html`, so a
|
|
1606
|
+
client-side route survives a reload), and `main_test.go` checks the embed holds
|
|
1607
|
+
a page. They replace the generated hello world.
|
|
1608
|
+
- **`nx run <name>:dev`** starts the Vite dev server and the Go server together.
|
|
1609
|
+
`add` adds `server.proxy: { '/api': 'http://127.0.0.1:8080' }` to the React
|
|
1610
|
+
app's Vite config (and tells you what to add if it cannot find a `server`
|
|
1611
|
+
block), so the browser talks to Vite and `/api` reaches Go.
|
|
1612
|
+
- **Releasing one.** `package-all` stages once and builds six binaries from the
|
|
1613
|
+
same copy. A native (`--cgo`) app is built on a runner per OS, and **each leg
|
|
1614
|
+
rebuilds the React app**: sharing one frontend build between runners is not
|
|
1615
|
+
done yet.
|
|
1616
|
+
- Types shared between Go and TypeScript (OpenAPI, generated types) are out of
|
|
1617
|
+
scope.
|
|
1577
1618
|
- **Releasing a Go app is an opt-in: `mnci add go-app <name> --release`.** The
|
|
1578
1619
|
app is tagged `release:go`, which `release.projects` selects by tag (as it
|
|
1579
1620
|
does for a VS Code extension, so `mnci upgrade` keeps it). Without the flag
|