@mnci/cli 4.13.1 → 4.15.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 +99 -0
- package/dist/cli.js +676 -238
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -102,6 +102,8 @@ mnci add python-vendor shared --lib core # wire core's module into shared's bui
|
|
|
102
102
|
|
|
103
103
|
# Go (@nx-go/nx-go — one root go.mod, golangci-lint + go test)
|
|
104
104
|
mnci add go-app api # executable -> apps/ (binary, zipped into the drop)
|
|
105
|
+
mnci add go-app cli --release # ...released: tag + per-platform zips on the GitHub Release
|
|
106
|
+
mnci add go-app tray --cgo # needs a C toolchain: built on a runner of each OS
|
|
105
107
|
mnci add go-function-app fn # serverless handler -> apps/
|
|
106
108
|
mnci add go-lib core # publishable (by git tag) -> packages/
|
|
107
109
|
mnci add go-internal-lib util # private shared package -> libs/
|
|
@@ -693,6 +695,7 @@ copy is discarded.
|
|
|
693
695
|
| ------------------ | -------------------------------------------------------------- | -------------------------------------- |
|
|
694
696
|
| `apps/` | React / Node / Python / Go / Flutter apps (plain or Functions) | Never (packed into the drop) |
|
|
695
697
|
| `apps/` (tagged) | VS Code extensions (`type:vscode-extension`) | Yes — `nx release`, `vsce publish` |
|
|
698
|
+
| `apps/` (tagged) | Go apps added with `--release` (`release:go`) | Yes — `nx release` tag, zips on the GitHub Release |
|
|
696
699
|
| `packages/` | Publishable npm libraries, plus Go and Dart packages | Yes — `nx release`, per-package tags |
|
|
697
700
|
| `python-packages/` | Publishable Python packages (hatchling wheels) | Yes — `twine upload` (Azure Artifacts) |
|
|
698
701
|
| `libs/` | Internal libraries (TS, Python, Go or Dart), never published | Never |
|
|
@@ -719,6 +722,11 @@ rewritten by every `mnci upgrade`, so a hand-added `apps/my-extension` would be
|
|
|
719
722
|
lost, while a tag matcher is the same on every upgrade and covers every extension
|
|
720
723
|
there will ever be.
|
|
721
724
|
|
|
725
|
+
The third is an opt-in: a **Go app** added with `mnci add go-app <name> --release`
|
|
726
|
+
is tagged `release:go` and joins the release the same way. Without the flag an app
|
|
727
|
+
stays unreleased, because most Go apps are internal tools. See _Releasing a Go
|
|
728
|
+
app_ in the Go section.
|
|
729
|
+
|
|
722
730
|
Every kind builds to its own Nx-default output location (`apps/<name>/dist`,
|
|
723
731
|
`packages/<name>/dist`, ...) — no post-generation build-output rewiring for
|
|
724
732
|
any kind. `mnci add` is pure delegation to the official generators; each
|
|
@@ -1410,6 +1418,16 @@ pipeline installs `golangci-lint` itself (see below).
|
|
|
1410
1418
|
per-project `go.mod` — which single-module mode does not have, so nothing
|
|
1411
1419
|
is inferred. mnci writes them into `project.json` instead, as it already
|
|
1412
1420
|
does for most kinds.
|
|
1421
|
+
- **The project graph is still inferred, so `affected` is correct.** What the
|
|
1422
|
+
plugin does not infer is targets; it still derives the _graph_ from imports.
|
|
1423
|
+
An app that imports `libs/<name>/<slice>` depends on that lib, transitively,
|
|
1424
|
+
and every app sharing a lib is affected when it changes (measured on
|
|
1425
|
+
`@nx-go/nx-go` 4.1.1 with Nx 23.2.0, including a dependency created only by a
|
|
1426
|
+
test file's import). That matters because the pipeline verifies only the
|
|
1427
|
+
affected projects on a pull request: a missing edge would let a lib change
|
|
1428
|
+
pass without testing the apps that use it. The e2e pins the edges and the
|
|
1429
|
+
affected sets (russoedu/MoNecromanCi#260), since they are the plugin's
|
|
1430
|
+
behaviour rather than mnci's.
|
|
1413
1431
|
- **Lint is `golangci-lint`, pinned deliberately.** The plugin's `lint`
|
|
1414
1432
|
executor defaults to `go fmt`, which only reformats — a green lint step
|
|
1415
1433
|
with that default would mean nothing. The generated target passes
|
|
@@ -1422,6 +1440,87 @@ pipeline installs `golangci-lint` itself (see below).
|
|
|
1422
1440
|
`nx-release-publish` target is written: there is nothing to push. The only
|
|
1423
1441
|
real difference between `go-lib` and `go-internal-lib` is intent, recorded
|
|
1424
1442
|
in the `type:go-lib` tag and the `packages/` location.
|
|
1443
|
+
- **Pure-Go apps are cross-compiled; an app that needs a C toolchain is not
|
|
1444
|
+
(`mnci add go-app <name> --cgo`).** `build-all` builds six static binaries from
|
|
1445
|
+
one machine with `CGO_ENABLED=0`, which is right until the app needs cgo: a
|
|
1446
|
+
system-tray icon (Cocoa on macOS, GTK on Linux), a native GUI toolkit, a cgo
|
|
1447
|
+
database driver. Those can only be built where the C toolchain and the target
|
|
1448
|
+
OS's libraries are, so a `--cgo` app is tagged `build:cgo` and gets
|
|
1449
|
+
`build-native` and `package-native` (this machine only, `CGO_ENABLED=1`, the
|
|
1450
|
+
same `VERSION` stamp and `-trimpath`, the zip named as `package-all` names a
|
|
1451
|
+
platform's) **instead of** `package`, `build-all` and `package-all`. It keeps
|
|
1452
|
+
`build`, `test`, `lint` and `start` for local work.
|
|
1453
|
+
- **A `native` job, only when such an app exists.** The generated pipeline
|
|
1454
|
+
gains a job with one leg each on `windows-latest`, `macos-latest` and
|
|
1455
|
+
`ubuntu-latest` (GitHub Actions: a matrix; Azure Pipelines: a matrix of
|
|
1456
|
+
`vmImage`s, with the original job moved under `jobs:`). Each leg lints,
|
|
1457
|
+
tests, builds and packages the native apps and publishes its zips as an
|
|
1458
|
+
artifact. The single-agent verify excludes them (`--exclude=tag:build:cgo`),
|
|
1459
|
+
because it cannot build them. A workspace with no native app keeps a
|
|
1460
|
+
pipeline byte-identical to the one it had: the job is decided when the file is
|
|
1461
|
+
written, since neither provider can skip a whole job on a file's existence.
|
|
1462
|
+
- **Run `mnci upgrade` after adding one.** `add` does not rewrite the
|
|
1463
|
+
pipeline files, so until then CI would verify the app on the one agent that
|
|
1464
|
+
cannot build it. `mnci add` says so, and `mnci doctor` fails while a
|
|
1465
|
+
pipeline lacks the job, and while no C compiler is installed on the machine
|
|
1466
|
+
(it reads `CC`, then `gcc`, `clang`, `cc`).
|
|
1467
|
+
- **Linux prerequisites are yours to finish.** The leg installs a C compiler
|
|
1468
|
+
and `pkg-config`, which is all mnci can know. The `-dev` packages your app
|
|
1469
|
+
links (`libgtk-3-dev` and `libayatana-appindicator3-dev` for a tray icon) go
|
|
1470
|
+
on that one marked line in the pipeline. The macOS runner ships Xcode's tools,
|
|
1471
|
+
and the Windows leg relies on the hosted image's MinGW-w64 `gcc`: the nightly
|
|
1472
|
+
e2e builds a cgo app on `windows-latest`, and says so loudly if it finds no
|
|
1473
|
+
compiler there rather than passing.
|
|
1474
|
+
- **Architectures: one per OS, the runner's own.** `windows-latest` and
|
|
1475
|
+
`ubuntu-latest` are amd64 and `macos-latest` is arm64, so a native app ships
|
|
1476
|
+
`windows-amd64`, `linux-amd64` and `darwin-arm64`. `darwin-amd64`,
|
|
1477
|
+
`linux-arm64` and `windows-arm64` are not built: they need an Intel macOS
|
|
1478
|
+
runner, an arm Linux runner or a cross-compiler. The legs are fixed in the
|
|
1479
|
+
generated pipeline today, so adding one means editing a file `mnci upgrade`
|
|
1480
|
+
rewrites (russoedu/MoNecromanCi#269 is about giving that a safe place).
|
|
1481
|
+
- **Releasing one.** With `--release` as well, each leg, on a push to main and
|
|
1482
|
+
after the `ci` job has tagged, runs
|
|
1483
|
+
`node tools/go-app-release.cjs assets --native`, which builds
|
|
1484
|
+
`package-native` with `VERSION` set to the tag's version and uploads that
|
|
1485
|
+
OS's zip to the same GitHub Release, so one release collects a zip from every
|
|
1486
|
+
runner. Azure Pipelines has no GitHub Release to attach to and stops at the
|
|
1487
|
+
artifact.
|
|
1488
|
+
- **Releasing a Go app is an opt-in: `mnci add go-app <name> --release`.** The
|
|
1489
|
+
app is tagged `release:go`, which `release.projects` selects by tag (as it
|
|
1490
|
+
does for a VS Code extension, so `mnci upgrade` keeps it). Without the flag
|
|
1491
|
+
an app is never released.
|
|
1492
|
+
- **Versioned from its git tag, with no manifest.** Nx's default
|
|
1493
|
+
`versionActions` reads a `package.json`, and a project without one aborts
|
|
1494
|
+
the release for the whole workspace, so the app carries a project-level
|
|
1495
|
+
`release.version` pointing at `tools/go-app-release.cjs` and resolving its
|
|
1496
|
+
current version from the tag (`<name>@<version>`). The same file is the
|
|
1497
|
+
`versionActions`: it declares no manifest and writes nothing, which fits
|
|
1498
|
+
because mnci releases never commit. `mnci upgrade` rewrites it, so local
|
|
1499
|
+
edits do not survive.
|
|
1500
|
+
- **The first release is `0.0.1`.** With no tag yet, the base is `0.0.0` and
|
|
1501
|
+
Nx bumps it by its own rule for a `0.x` version. To start somewhere else,
|
|
1502
|
+
push a `<name>@<version>` tag before the first release (`mvd-cli@0.9.0`),
|
|
1503
|
+
or set `RELEASE_SPECIFIER` to an exact version.
|
|
1504
|
+
- **It carries a publish target that publishes nothing.** `nx release` tags
|
|
1505
|
+
first and publishes last, and a project matched for publishing without an
|
|
1506
|
+
`nx-release-publish` target made it exit 1 _after_ the tag existed
|
|
1507
|
+
(measured). Publishing a Go app is its tag.
|
|
1508
|
+
- **The platform zips are attached to the GitHub Release, GitHub Actions only.**
|
|
1509
|
+
After `nx release`, the generated workflow runs
|
|
1510
|
+
`node tools/go-app-release.cjs assets`: for each app tagged by this run it
|
|
1511
|
+
builds `package-all` with `VERSION` set to the new version, so the binary
|
|
1512
|
+
reports it, and uploads `dist/drop/go-app-<name>-<goos>-<goarch>.zip` with
|
|
1513
|
+
`gh release upload --clobber`, so a re-run is harmless. A run that released
|
|
1514
|
+
nothing uploads nothing. Azure Pipelines (and `--ci both`'s Azure side)
|
|
1515
|
+
creates the tag but has no GitHub Release to attach to, so it attaches
|
|
1516
|
+
nothing.
|
|
1517
|
+
- **A change to a library the app imports releases it too.** Nx counts the
|
|
1518
|
+
commits that touch an app's dependencies, not only its own folder (measured:
|
|
1519
|
+
a `fix:` touching only an imported `go-internal-lib` produced a patch
|
|
1520
|
+
release of the app), which is right for a binary that links the library in.
|
|
1521
|
+
- An app that needs a C toolchain is released from several runners instead:
|
|
1522
|
+
see _Pure-Go apps are cross-compiled_ above. This step builds all six
|
|
1523
|
+
platforms on one runner, which is what `CGO_ENABLED=0` allows.
|
|
1425
1524
|
- **No publish-time dependency injection**, unlike Python's vendoring: `go
|
|
1426
1525
|
build` links statically, so the binary in the drop already contains
|
|
1427
1526
|
everything it needs.
|