@mnci/cli 1.19.6 → 1.19.8

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/dist/cli.js CHANGED
@@ -1411,6 +1411,10 @@ function devcontainerJson(workspaceName, linter) {
1411
1411
  // `npm ci` first: every guard after it runs through the workspace's own
1412
1412
  // scripts and Nx, which do not exist until the install completes.
1413
1413
  postCreateCommand: [
1414
+ // Same pin the workflow applies, for the same reason — a container whose
1415
+ // npm major differs from CI's resolves dependencies differently, which is
1416
+ // precisely the drift this file exists to remove.
1417
+ `npm install -g npm@${NPM_VERSION}`,
1414
1418
  "npm ci",
1415
1419
  "npm run python:install",
1416
1420
  GOLANGCI_LINT_INSTALL_GUARD,
@@ -1441,7 +1445,24 @@ var ROOT_LINT_TARGET = {
1441
1445
  };
1442
1446
  var ESLINT_PEER_OVERRIDES = {
1443
1447
  "eslint-plugin-jsx-a11y": { eslint: "$eslint" },
1448
+ // Scoped to EACH named parent, not top-level and not `nx` alone.
1449
+ //
1450
+ // `nx` alone was the first attempt and it did not work: the e2e's audit step
1451
+ // still reported all six advisories in a freshly generated workspace, because
1452
+ // `@nx/js`, `@nx/eslint`, `@nx/eslint-plugin` and `@nx/workspace` are their own
1453
+ // dependents there, and an override scoped to `nx` never reaches a sibling's
1454
+ // dependencies. Those four are exactly the packages npm audit named.
1455
+ //
1456
+ // Top-level would be worse than wrong. A tree with `minimatch@3` legitimately
1457
+ // carries `brace-expansion@1.1.18` (and `@2.1.4` elsewhere) — this repo has
1458
+ // both — and forcing those to v5 breaks them. So the blast radius is one
1459
+ // dependency edge per named parent, and a test asserts there is no top-level
1460
+ // entry.
1444
1461
  nx: { "brace-expansion": "^5.0.9" },
1462
+ "@nx/js": { "brace-expansion": "^5.0.9" },
1463
+ "@nx/eslint": { "brace-expansion": "^5.0.9" },
1464
+ "@nx/eslint-plugin": { "brace-expansion": "^5.0.9" },
1465
+ "@nx/workspace": { "brace-expansion": "^5.0.9" },
1445
1466
  // `postcss` → `nanoid` reaches a generated workspace through `@nx/rollup`,
1446
1467
  // which every publishable `npm-lib` gets. GHSA-2v37-7h3g-55p8 is high, fixed in
1447
1468
  // 3.3.18, and the fix is a patch — so unlike the entry above this one is not
@@ -1767,6 +1788,7 @@ var GO_TOOL_PATH_AZURE = `node -e "${GO_TOOL_PATH_PRELUDE}console.log('##vso[tas
1767
1788
  var GO_TOOL_PATH_GITHUB = `node -e "${GO_TOOL_PATH_PRELUDE}if(!process.env.GITHUB_PATH){console.log('Not running in GitHub Actions - skipping.');process.exit(0)}fs.appendFileSync(process.env.GITHUB_PATH,bin+${String.raw`'\n'`})"`;
1768
1789
  var FLUTTER_SDK_VERSION = "3.44.8";
1769
1790
  var NODE_VERSION = "24";
1791
+ var NPM_VERSION = "11";
1770
1792
  var FLUTTER_SDK_DIRECTORY_EXPRESSION = `require('node:path').join(require('node:os').homedir(),'.mnci-flutter-${FLUTTER_SDK_VERSION}')`;
1771
1793
  var FLUTTER_SDK_INSTALL_GUARD = `node -e "const fs=require('node:fs'),cp=require('node:child_process');if(!fs.existsSync('pubspec.yaml')){console.log('No Flutter projects - skipping.');process.exit(0)}if(cp.spawnSync('flutter',['--version'],{stdio:'ignore',shell:process.platform==='win32'}).status===0){console.log('Flutter SDK already on PATH - skipping.');process.exit(0)}const sdk=${FLUTTER_SDK_DIRECTORY_EXPRESSION};if(fs.existsSync(sdk)){console.log('Flutter SDK already installed at '+sdk+' - skipping.');process.exit(0)}process.exit(cp.spawnSync('git',['clone','--depth','1','--branch','${FLUTTER_SDK_VERSION}','https://github.com/flutter/flutter.git',sdk],{stdio:'inherit'}).status ?? 1)"`;
1772
1794
  var FLUTTER_TOOL_PATH_PRELUDE = `const fs=require('node:fs'),path=require('node:path');if(!fs.existsSync('pubspec.yaml')){console.log('No Flutter projects - skipping.');process.exit(0)}const sdk=${FLUTTER_SDK_DIRECTORY_EXPRESSION};if(!fs.existsSync(sdk)){console.log('Flutter SDK was not installed by mnci (already on PATH) - skipping.');process.exit(0)}const bin=path.join(sdk,'bin');`;
@@ -2071,6 +2093,13 @@ jobs:
2071
2093
  # dependency change misses the cache and a no-op change hits it.
2072
2094
  cache: npm
2073
2095
 
2096
+ # setup-node installs whatever npm the Node image bundles, and npm's major
2097
+ # is part of the contract: npm 11 reuses an already-installed tree instead
2098
+ # of re-resolving, so it applies \`overrides\` differently from npm 10. See
2099
+ # NPM_VERSION's remarks for the measurement.
2100
+ - run: npm install -g npm@${NPM_VERSION}
2101
+ name: Pin npm to the major mnci verifies against
2102
+
2074
2103
  - run: npm ci
2075
2104
  name: Install dependencies
2076
2105
  env:
@@ -2582,6 +2611,7 @@ var import_node_path15 = require("path");
2582
2611
  var import_prompts8 = require("@inquirer/prompts");
2583
2612
 
2584
2613
  // src/commands/new.ts
2614
+ var import_node_fs8 = require("fs");
2585
2615
  var import_node_path13 = require("path");
2586
2616
  function nxCloudProviderValue(ci) {
2587
2617
  return ci === "azure" ? "azure" : "github";
@@ -2654,6 +2684,8 @@ async function runNew(name, options) {
2654
2684
  "Applying MoNecromanCI overlay (VS Code workspace, release config, .npmrc, commitlint, pipeline, stack)"
2655
2685
  );
2656
2686
  applyOverlay(workspaceRoot, { workspaceName, scope, registry, agent, variableGroup, ci, stack });
2687
+ (0, import_node_fs8.rmSync)((0, import_node_path13.join)(workspaceRoot, "node_modules"), { recursive: true, force: true });
2688
+ (0, import_node_fs8.rmSync)((0, import_node_path13.join)(workspaceRoot, "package-lock.json"), { force: true });
2657
2689
  logger.step("Installing the toolchain (commitlint + husky + linting/formatting)");
2658
2690
  const installStatus = runShell(
2659
2691
  "npm",
@@ -2685,7 +2717,7 @@ async function runNew(name, options) {
2685
2717
  }
2686
2718
 
2687
2719
  // src/commands/upgrade.ts
2688
- var import_node_fs8 = require("fs");
2720
+ var import_node_fs9 = require("fs");
2689
2721
  var import_node_path14 = require("path");
2690
2722
  function resolveRegistry2(options, persisted) {
2691
2723
  if (options.registry === "azure-artifacts" || options.organization && options.artifactsFeed) {
@@ -2715,7 +2747,7 @@ function resolveWorkspaceName(workspaceRoot, persisted) {
2715
2747
  return persisted.workspaceName;
2716
2748
  }
2717
2749
  try {
2718
- const existing = (0, import_node_fs8.readdirSync)(workspaceRoot).find(
2750
+ const existing = (0, import_node_fs9.readdirSync)(workspaceRoot).find(
2719
2751
  (file) => file.endsWith(".code-workspace") && file !== "undefined.code-workspace"
2720
2752
  );
2721
2753
  if (existing) {
@@ -2800,7 +2832,7 @@ async function runInteractive() {
2800
2832
  }
2801
2833
 
2802
2834
  // src/util/versionChecker.ts
2803
- var import_node_fs9 = require("fs");
2835
+ var import_node_fs10 = require("fs");
2804
2836
  var import_node_path16 = require("path");
2805
2837
  var import_cross_spawn2 = __toESM(require("cross-spawn"));
2806
2838
  var PACKAGE_NAME = "@mnci/cli";
@@ -2858,7 +2890,7 @@ function releaseTriple(version) {
2858
2890
  function readCliVersion(packageDirectory) {
2859
2891
  try {
2860
2892
  const manifestPath = (0, import_node_path16.join)(packageDirectory, "..", "package.json");
2861
- const manifest = JSON.parse((0, import_node_fs9.readFileSync)(manifestPath, "utf8"));
2893
+ const manifest = JSON.parse((0, import_node_fs10.readFileSync)(manifestPath, "utf8"));
2862
2894
  return manifest.version ?? "0.0.0";
2863
2895
  } catch {
2864
2896
  return "0.0.0";