@mnci/cli 4.11.0 → 4.12.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
@@ -111,6 +111,11 @@ mnci add flutter-app hello # Flutter web app -> apps/ (bundle, zipped in
111
111
  mnci add flutter-lib shared # publishable (by git tag) -> packages/
112
112
  mnci add flutter-internal-lib core # private shared package -> libs/
113
113
 
114
+ # VS Code extensions (@nx/node + vsce — bundled, packaged per platform, published by nx release)
115
+ mnci add vscode-extension editor # one universal .vsix -> dist/drop/
116
+ mnci add vscode-extension editor --sidecar api # one .vsix per platform, go-app api's binary in bin/
117
+ mnci add vscode-extension editor --publisher acme # Marketplace publisher (default: the scope without @)
118
+
114
119
  mnci upgrade # re-apply the latest overlay (see below)
115
120
  mnci upgrade --agent windows-latest # ...with an explicit override
116
121
 
@@ -687,6 +692,7 @@ copy is discarded.
687
692
  | Directory | Contents | Released? |
688
693
  | ------------------ | -------------------------------------------------------------- | -------------------------------------- |
689
694
  | `apps/` | React / Node / Python / Go / Flutter apps (plain or Functions) | Never (packed into the drop) |
695
+ | `apps/` (tagged) | VS Code extensions (`type:vscode-extension`) | Yes — `nx release`, `vsce publish` |
690
696
  | `packages/` | Publishable npm libraries, plus Go and Dart packages | Yes — `nx release`, per-package tags |
691
697
  | `python-packages/` | Publishable Python packages (hatchling wheels) | Yes — `twine upload` (Azure Artifacts) |
692
698
  | `libs/` | Internal libraries (TS, Python, Go or Dart), never published | Never |
@@ -705,6 +711,14 @@ reads it. Publishable Python packages get their own
705
711
  `python-packages/` dir so the npm `nx release` (`packages/*`) is never entangled
706
712
  with Python publishing.
707
713
 
714
+ The second exception goes the other way: a **VS Code extension** lives in
715
+ `apps/` (it is an application, and the slice lint treats it as one) but is
716
+ versioned and published like a package. `release.projects` matches it by its tag,
717
+ `tag:type:vscode-extension`, rather than by path: the array is mnci's and is
718
+ rewritten by every `mnci upgrade`, so a hand-added `apps/my-extension` would be
719
+ lost, while a tag matcher is the same on every upgrade and covers every extension
720
+ there will ever be.
721
+
708
722
  Every kind builds to its own Nx-default output location (`apps/<name>/dist`,
709
723
  `packages/<name>/dist`, ...) — no post-generation build-output rewiring for
710
724
  any kind. `mnci add` is pure delegation to the official generators; each
@@ -1429,6 +1443,56 @@ build` links statically, so the binary in the drop already contains
1429
1443
  workspace has no root `go.mod`, and the linter install also skips when the
1430
1444
  agent already provides it.
1431
1445
 
1446
+ ## VS Code extensions (`@nx/node:application` + `vsce`)
1447
+
1448
+ `mnci add vscode-extension <name>` scaffolds with the plain `@nx/node:application`
1449
+ generator (your test runner, esbuild) and turns the result into a Marketplace
1450
+ extension:
1451
+
1452
+ - **Bundled.** `bundle: true`, `thirdParty: true`, `external: ['vscode']`. A `.vsix`
1453
+ ships no `node_modules`, so the generator's un-bundled mirror of the source tree
1454
+ could not run in the extension host; `vscode` is the host's own module.
1455
+ - **A manifest `vsce` accepts.** Unscoped `name` (`vsce` rejects scopes),
1456
+ `publisher` (`--publisher`, default the workspace scope without `@`),
1457
+ `engines.vscode` pinned to the installed `@types/vscode` (`vsce` refuses types
1458
+ newer than the engine range), `main: ./dist/main.js`, empty `activationEvents`
1459
+ (VS Code activates on a contributed command by itself since 1.74) and one sample
1460
+ command. Tagged `type:vscode-extension`, and `nx.name` pins the Nx project name
1461
+ to the folder, so `name` (the Marketplace id is `<publisher>.<name>`) and
1462
+ `displayName` are yours to change: packages stay `<project>[-<target>].vsix`
1463
+ and every script, task and launch entry keeps working.
1464
+ - **`src/main.ts`**, not `extension.ts`: the slice rules allow only `index` and
1465
+ `main` at the root of `src`.
1466
+ - **Unit tests run against a stub of `vscode`**, `test/vscode.stub.ts`, mapped by
1467
+ Jest's `moduleNameMapper` or Vitest's `alias`. The real module exists only
1468
+ inside the extension host. The stub covers the sample and grows with your code.
1469
+ - **`package`** writes `dist/drop/<name>.vsix` with `vsce package
1470
+ --no-dependencies` (mandatory with hoisted npm workspaces).
1471
+ - **`--sidecar <go-app>`** ships a native binary. `package` then runs the Go app's
1472
+ `build-all` with `VERSION` set to the extension's version, and writes one `.vsix`
1473
+ per Marketplace target, `dist/drop/<name>-<target>.vsix`, with that platform's
1474
+ binary in `bin/`: `win32-x64`, `win32-arm64`, `linux-x64`, `linux-arm64`,
1475
+ `darwin-x64`, `darwin-arm64`, plus `alpine-x64`/`alpine-arm64` from the static
1476
+ Linux binaries. Unix file modes survive into the package, so the binary stays
1477
+ executable. Resolve it at runtime from `context.extensionPath` + `bin/`.
1478
+ - **`nx-release-publish`** runs `vsce publish --packagePath <every vsix>
1479
+ --skip-duplicate` when `VSCE_PAT` is set (a Marketplace personal access token, as
1480
+ a CI secret) and skips with a message otherwise. It depends on `package`, so it
1481
+ ships the version `nx release` just wrote. The CI release step passes `VSCE_PAT`
1482
+ through in both providers.
1483
+ - **Debugging**: an `<name>: debug` launch entry (`extensionHost`) opens a second
1484
+ VS Code window with the extension loaded, after the `<name>: build (development)`
1485
+ task, which keeps source maps.
1486
+
1487
+ Both targets run `tools/vscode-extension.cjs`, a workspace file mnci owns (like
1488
+ `tools/csharp-version-actions.cjs`): `mnci add vscode-extension` writes it and
1489
+ `mnci upgrade` rewrites it. It resolves `vsce` and `nx` through their own
1490
+ `package.json` `bin` and runs them with `node`, with no shell, so a workspace path
1491
+ containing spaces works on Windows.
1492
+
1493
+ Not built yet: integration tests through `@vscode/test-cli` (they download VS Code
1494
+ and need a display, so they would be gated like the Go and Flutter sections).
1495
+
1432
1496
  ## Flutter (`@mnci/nx-flutter` — one root `pubspec.yaml` pub workspace)
1433
1497
 
1434
1498
  Requires the **Flutter SDK** (3.27+, for Dart 3.6+ pub workspaces) on the