@mnci/cli 4.12.1 → 4.12.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 CHANGED
@@ -1460,7 +1460,10 @@ extension:
1460
1460
  command. Tagged `type:vscode-extension`, and `nx.name` pins the Nx project name
1461
1461
  to the folder, so `name` (the Marketplace id is `<publisher>.<name>`) and
1462
1462
  `displayName` are yours to change: packages stay `<project>[-<target>].vsix`
1463
- and every script, task and launch entry keeps working.
1463
+ and every script, task and launch entry keeps working. Run `npm install` after a
1464
+ rename and commit the lock with it: `apps/*` is an npm workspace, the lock records
1465
+ the app by `name`, and CI's `npm ci` refuses a lock that names a package no
1466
+ manifest does (`mnci add` refreshes it for the name it writes, #251).
1464
1467
  - **`src/main.ts`**, not `extension.ts`: the slice rules allow only `index` and
1465
1468
  `main` at the root of `src`.
1466
1469
  - **Unit tests run against a stub of `vscode`**, `test/vscode.stub.ts`, mapped by
package/dist/cli.js CHANGED
@@ -2331,6 +2331,7 @@ const VERSION_TAG = /<Version>([^<]*)<\\/Version>/
2331
2331
  */
2332
2332
  function findCsproj (tree, root) {
2333
2333
  const name = tree.children(root).find((entry) => entry.endsWith('.csproj'))
2334
+
2334
2335
  return name ? posix.join(root, name) : null
2335
2336
  }
2336
2337
 
@@ -3815,6 +3816,9 @@ var VSCODE_SIDECAR_TARGETS = {
3815
3816
  "darwin-x64": "darwin-amd64",
3816
3817
  "darwin-arm64": "darwin-arm64"
3817
3818
  };
3819
+ function scriptObjectLiteral(map) {
3820
+ return `{ ${Object.entries(map).map(([key, value]) => `'${key}': '${value}'`).join(", ")} }`;
3821
+ }
3818
3822
  var VSCODE_EXTENSION_SCRIPT = String.raw`#!/usr/bin/env node
3819
3823
  // Written by mnci: 'mnci add vscode-extension' creates it and 'mnci upgrade'
3820
3824
  // rewrites it, so local edits do not survive an upgrade.
@@ -3830,7 +3834,7 @@ const { spawnSync } = require('node:child_process')
3830
3834
  const { cpSync, existsSync, mkdirSync, readFileSync, rmSync } = require('node:fs')
3831
3835
  const { basename, dirname, join, resolve } = require('node:path')
3832
3836
 
3833
- const TARGETS = ${JSON.stringify(VSCODE_SIDECAR_TARGETS)}
3837
+ const TARGETS = ${scriptObjectLiteral(VSCODE_SIDECAR_TARGETS)}
3834
3838
  const DROP = resolve('dist/drop')
3835
3839
  const VSCE_FLAGS = ['--no-dependencies', '--skip-license', '--allow-missing-repository']
3836
3840
 
@@ -3908,7 +3912,7 @@ const manifest = JSON.parse(readFileSync(join(projectRoot, 'package.json'), 'utf
3908
3912
  const project = basename(resolve(projectRoot))
3909
3913
  // nx release --dry-run hands the publish target --dryRun=true and sets NX_DRY_RUN
3910
3914
  // (measured on Nx 23), so a dry run never reaches the Marketplace, token or not.
3911
- const dryRun = rest.some(argument => /^--dry-?run(=true)?$/i.test(argument)) || process.env.NX_DRY_RUN === 'true'
3915
+ const dryRun = rest.some(argument => /^--dry-?run(?:=true)?$/i.test(argument)) || process.env.NX_DRY_RUN === 'true'
3912
3916
  if (command === 'package') packageExtension(projectRoot, manifest, sidecar)
3913
3917
  else if (command === 'publish') publishExtension(manifest, sidecar, dryRun)
3914
3918
  else fail('Unknown command ' + command + ' - expected package or publish.')
@@ -4154,6 +4158,11 @@ function pinVscodeExtensionProjectNames(workspaceRoot) {
4154
4158
  }
4155
4159
  return updated;
4156
4160
  }
4161
+ function refreshLockFile(workspaceRoot, name) {
4162
+ if (runShell("npm", ["install", "--package-lock-only", "--no-audit", "--no-fund"], workspaceRoot) !== 0) {
4163
+ logger.warn(`Could not refresh package-lock.json after reshaping ${name}'s manifest. Run 'npm install' before committing.`);
4164
+ }
4165
+ }
4157
4166
  function addVscodeExtension(workspaceRoot, name, stack, options = {}) {
4158
4167
  const { sidecar } = options;
4159
4168
  if (sidecar !== void 0 && !fileExists((0, import_node_path15.join)(workspaceRoot, "apps", sidecar, "project.json"))) {
@@ -4179,6 +4188,7 @@ function addVscodeExtension(workspaceRoot, name, stack, options = {}) {
4179
4188
  removeGeneratedEslintConfig(workspaceRoot, `apps/${name}`);
4180
4189
  registerProjectCommands(workspaceRoot, name, { build: true });
4181
4190
  addDebugLaunch(workspaceRoot, name);
4191
+ refreshLockFile(workspaceRoot, name);
4182
4192
  }
4183
4193
 
4184
4194
  // src/dependency-management/sync-dependencies.use-case.ts