@mnci/cli 4.1.5 → 4.2.1

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 CHANGED
@@ -653,16 +653,22 @@ Pushes to `main` then:
653
653
  from the artifact). A classic Azure release/CD pipeline keys its trigger off
654
654
  these; GitHub Actions has no equivalent mechanism, so the `drop` artifact
655
655
  (one zip per app inside it) is the portable substitute there.
656
- - **Release — version, tag and publish** — one `npx nx release --yes` for both
657
- npm (`packages/*`) and Python (`python-packages/*`): version bump from
658
- conventional commits → `{projectName}@{version}` git tag pushed to `main`
659
- (tag-only, never a commit) → publish to the feed (npm via `.npmrc`, Python via
660
- `twine` when an Azure feed is configured — installed from the generated
661
- `requirements-dev.txt`, no uv, no Poetry). Reuses the base64 `PAT`, decoded to
662
- the raw token twine needs for the Python publish. Skipped cleanly when there
663
- is nothing to release. A guarded step installs the fixed Python toolchain
664
- (`ruff`/`pytest`/`build`/`twine`/`pip-audit`) before any Python target runs,
665
- skipped cleanly on a workspace with no Python projects. On a `--ci=github`
656
+ - **Release — version, tag and publish** — one `npx nx release --yes` covering
657
+ npm (`packages/*`), Python (`python-packages/*`) and C# (a `csharp-lib`'s
658
+ NuGet publish): version bump from conventional commits →
659
+ `{projectName}@{version}` git tag pushed to `main` (tag-only, never a
660
+ commit) → publish to the feed (npm via `.npmrc`, Python via `twine` when an
661
+ Azure feed is configured — installed from the generated
662
+ `requirements-dev.txt`, no uv, no Poetry — and a `csharp-lib`'s own
663
+ `nx-release-publish` target running `dotnet pack`/`dotnet nuget push` when
664
+ `NUGET_PAT` is set, self-gating to a no-op otherwise). Reuses the base64
665
+ `PAT`, decoded to the raw token twine needs for the Python publish and to
666
+ the raw token NuGet's `%NUGET_PAT%` substitution needs. Skipped cleanly
667
+ when there is nothing to release. A guarded step installs the fixed Python
668
+ toolchain (`ruff`/`pytest`/`build`/`twine`/`pip-audit`) before any Python
669
+ target runs, skipped cleanly on a workspace with no Python projects. Go and
670
+ Flutter libraries publish by git tag only — see their own sections below —
671
+ so neither needs a step here. On a `--ci=github`
666
672
  workspace this same step also creates a **GitHub Release per project**, with
667
673
  a changelog Nx generates from conventional commits — `nx release` pushes the
668
674
  tag itself here (needs `GITHUB_TOKEN`, which GitHub Actions provides for
@@ -1264,4 +1270,74 @@ build agents, so the generated pipeline installs it itself (see below).
1264
1270
  and pub workspaces need Dart 3.6+. Three guarded steps precede the build —
1265
1271
  install, add to `PATH`, and one root `flutter pub get` — and all three skip
1266
1272
  cleanly when the workspace has no root `pubspec.yaml`; the install also skips
1273
+
1274
+ ## C# (`dotnet new` directly — `@nx/dotnet` is inference-only)
1275
+
1276
+ Requires the **.NET SDK** on the machine and on the build agent; `mnci add
1277
+ csharp-*` fails fast with an install link when `dotnet` is not on the `PATH`.
1278
+ There is no third-party Nx plugin here the way there is for Go or Flutter:
1279
+ `@nx/dotnet` was checked directly (packed and read, not assumed maintained) and
1280
+ ships **no `generators.json`** — it is inference-only, reading an existing
1281
+ `.csproj` rather than creating one. So every kind below scaffolds via
1282
+ `dotnet new` and writes its own `project.json` explicitly, the same posture Go
1283
+ already takes for its single-module layout.
1284
+
1285
+ | Kind | Location | Build / deploy |
1286
+ | ---------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------ |
1287
+ | `csharp-app` | `apps/<name>` | `dotnet build`/`publish` into `dist/apps/<name>/`, zipped into `dist/drop/csharp-app-<name>.zip` |
1288
+ | `csharp-function-app` | `apps/<name>` | Azure Functions, .NET **isolated worker**; same build, zipped into `dist/drop/csharp-function-app-<name>.zip` |
1289
+ | `csharp-lib` | `packages/<name>` | publishable to **NuGet** — see below; build + test targets |
1290
+ | `csharp-internal-lib` | `libs/<name>` | private shared code, build + test only, consumed via a real MSBuild `<ProjectReference>` |
1291
+
1292
+ - **`nx release` needed no new npm package.** Nx's own version-actions
1293
+ resolution (`resolveVersionActionsPath`, read directly from its source
1294
+ rather than assumed) tries `require.resolve` as a package specifier first,
1295
+ then falls back to a **workspace-relative** path. So `csharp-lib` gets a
1296
+ plain `tools/csharp-version-actions.cjs` written into the generated
1297
+ workspace itself, extending Nx's real `VersionActions` and reading/writing
1298
+ the sole `.csproj`'s `<Version>` element — no publish, no registry, nothing
1299
+ beyond a file already sitting in the workspace tree.
1300
+ - **The `nx-release-publish` target is always present, and gates itself at
1301
+ runtime.** Nx throws for the whole release group if *zero* projects carry
1302
+ the literal `nx-release-publish` target name, so `csharp-lib` always gets
1303
+ one (`dotnet pack` then `dotnet nuget push`), regardless of registry
1304
+ choice. It checks `process.env.NUGET_PAT` only when it actually runs,
1305
+ printing "NuGet publish is not configured for this registry choice —
1306
+ skipping" and exiting 0 when unset, rather than the target being
1307
+ conditional at generation time.
1308
+ - **`nuget.config` mirrors `.npmrc`'s design.** A `--registry npm` workspace
1309
+ gets `nuget.org` only, with no credentials — same honest "there is nothing
1310
+ to route" reasoning the npm variant uses. A `--registry azure-artifacts`
1311
+ workspace registers the feed under the fixed source key `AzureArtifacts`
1312
+ (never the real feed name, so the publish target needs no registry
1313
+ specifics baked in at generation time) with `packageSourceCredentials`
1314
+ referencing `%NUGET_PAT%` — NuGet's environment-variable substitution
1315
+ syntax on every platform (`${VAR}`/`$VAR` resolve on none of
1316
+ nuget.exe/dotnet.exe/Windows/Mac; verified against Microsoft's own docs).
1317
+ The same base64 `PAT` secret npm and twine already use is decoded to the
1318
+ raw token NuGet needs.
1319
+ - **Cross-project references are real MSBuild, not a workspace trick.** A
1320
+ `csharp-app` or `csharp-internal-lib` consumer adds a sibling with
1321
+ `dotnet add <proj> reference <sibling proj>`, which writes an ordinary
1322
+ `<ProjectReference Include="..." />` element — there is no npm-style
1323
+ symlinking or a Dart pub workspace's shared resolution to lean on here.
1324
+ - **`mnci sync`/`mnci up` cover NuGet too.** `<PackageReference>` versions are
1325
+ read from every `.csproj`, and the latest-version lookup shells out to
1326
+ `dotnet package search --exact-match --format json` — consulting whatever
1327
+ sources the workspace's own `nuget.config` resolves, the same
1328
+ "go through the ecosystem's own tool" rule `npm view`/`pip index versions`
1329
+ already follow, so a private feed's auth just works with no extra code.
1330
+ Unlike npm or pub, NuGet has no single workspace-wide resolved version to
1331
+ report: each `.csproj` restores independently into its own
1332
+ `obj/project.assets.json`, so `mnci sync`'s "resolved version" column is
1333
+ honestly empty for this ecosystem.
1334
+ - **`build` and `test` are pure `@nx/dotnet` inference, not mnci-written
1335
+ targets** — the plugin discovers both live from each `.csproj`, the same
1336
+ way `lint`/`typecheck` are inferred for TS projects from `eslint.config.mjs`
1337
+ and `tsconfig.json`. C# has neither a `lint` nor a `typecheck` target: the
1338
+ workspace's `nx run-many -t lint,typecheck,test,build` step simply skips
1339
+ both for a C# project the same clean way it already skips `typecheck` for
1340
+ a Go or Flutter one — `dotnet build`'s own compiler is the correctness
1341
+ check. `PACK_APPS_GUARD` detects `.csproj`-based apps for the drop-zip step
1342
+ the same way it detects Go and Node ones.
1267
1343
  when an SDK is already available.