@mnci/cli 4.37.0 → 4.38.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/dist/cli.js CHANGED
@@ -340,18 +340,81 @@ function runAudit(workspaceRoot, dependencies = {}) {
340
340
  }
341
341
 
342
342
  // src/ci-pipeline/native.use-case.ts
343
+ var import_node_fs6 = require("fs");
344
+ var import_node_path5 = require("path");
345
+
346
+ // src/native-build-config/native-build.contract.ts
347
+ var DEFAULT_NATIVE_RUNNERS = ["windows-latest", "macos-latest", "ubuntu-latest"];
348
+
349
+ // src/native-build-config/read-native-build-config.use-case.ts
350
+ var import_node_fs3 = require("fs");
351
+ var import_node_path2 = require("path");
352
+ var PACKAGE_NAME = /^[a-z0-9][a-z0-9+.-]*$/;
353
+ var RUNNER_NAME = /^[A-Z0-9][\w.-]*$/i;
354
+ function readNativeBuildConfig(workspaceRoot) {
355
+ const settings = {
356
+ config: { linuxPackages: [], runners: [...DEFAULT_NATIVE_RUNNERS] },
357
+ problems: []
358
+ };
359
+ const raw = readNativeEntry(workspaceRoot);
360
+ if (raw === void 0) {
361
+ return settings;
362
+ }
363
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
364
+ settings.problems.push("mnci.native must be an object");
365
+ return settings;
366
+ }
367
+ const entry = raw;
368
+ const packages = validList(entry.linuxPackages, "mnci.native.linuxPackages", PACKAGE_NAME, settings.problems);
369
+ const runners = validList(entry.runners, "mnci.native.runners", RUNNER_NAME, settings.problems);
370
+ if (packages !== void 0) {
371
+ settings.config.linuxPackages = packages;
372
+ }
373
+ if (runners !== void 0 && runners.length > 0) {
374
+ settings.config.runners = runners;
375
+ }
376
+ return settings;
377
+ }
378
+ function readNativeEntry(workspaceRoot) {
379
+ const path = (0, import_node_path2.join)(workspaceRoot, "nx.json");
380
+ if (!(0, import_node_fs3.existsSync)(path)) {
381
+ return void 0;
382
+ }
383
+ try {
384
+ const nxJson = JSON.parse((0, import_node_fs3.readFileSync)(path, "utf8"));
385
+ return nxJson.mnci?.native;
386
+ } catch {
387
+ return void 0;
388
+ }
389
+ }
390
+ function validList(value, label, pattern, problems) {
391
+ if (value === void 0) {
392
+ return void 0;
393
+ }
394
+ if (!Array.isArray(value)) {
395
+ problems.push(`${label} must be a list of strings`);
396
+ return void 0;
397
+ }
398
+ const valid = [];
399
+ for (const item of value) {
400
+ if (typeof item === "string" && pattern.test(item)) {
401
+ valid.push(item);
402
+ } else {
403
+ problems.push(`${label} has an invalid entry: ${JSON.stringify(item)}`);
404
+ }
405
+ }
406
+ return valid;
407
+ }
408
+
409
+ // src/workspace-overlay/overlay.use-case.ts
343
410
  var import_node_fs5 = require("fs");
344
411
  var import_node_path4 = require("path");
345
412
 
346
- // src/workspace-overlay/overlay.use-case.ts
413
+ // src/file-system/file-system.client.ts
347
414
  var import_node_fs4 = require("fs");
348
415
  var import_node_path3 = require("path");
349
-
350
- // src/file-system/file-system.client.ts
351
- var import_node_fs3 = require("fs");
352
- var import_node_path2 = require("path");
353
416
  function readJson(path) {
354
- return JSON.parse((0, import_node_fs3.readFileSync)(path, "utf8"));
417
+ return JSON.parse((0, import_node_fs4.readFileSync)(path, "utf8"));
355
418
  }
356
419
  function stripJsonComments(text) {
357
420
  let result = "";
@@ -408,7 +471,7 @@ function stripJsonComments(text) {
408
471
  }
409
472
  function readCodeWorkspace(path) {
410
473
  try {
411
- const withoutComments = stripJsonComments((0, import_node_fs3.readFileSync)(path, "utf8"));
474
+ const withoutComments = stripJsonComments((0, import_node_fs4.readFileSync)(path, "utf8"));
412
475
  return JSON.parse(withoutComments.replaceAll(/,(\s*[}\]])/g, "$1"));
413
476
  } catch {
414
477
  return void 0;
@@ -419,14 +482,14 @@ function toJson(value) {
419
482
  `;
420
483
  }
421
484
  function writeFileEnsured(path, content) {
422
- (0, import_node_fs3.mkdirSync)((0, import_node_path2.dirname)(path), { recursive: true });
423
- (0, import_node_fs3.writeFileSync)(path, content);
485
+ (0, import_node_fs4.mkdirSync)((0, import_node_path3.dirname)(path), { recursive: true });
486
+ (0, import_node_fs4.writeFileSync)(path, content);
424
487
  }
425
488
  function markExecutable(path) {
426
- (0, import_node_fs3.chmodSync)(path, 493);
489
+ (0, import_node_fs4.chmodSync)(path, 493);
427
490
  }
428
491
  function fileExists(path) {
429
- return (0, import_node_fs3.existsSync)(path);
492
+ return (0, import_node_fs4.existsSync)(path);
430
493
  }
431
494
 
432
495
  // src/pipeline-customization/pipeline-markers.algorithm.ts
@@ -694,9 +757,9 @@ var VSCODE_EXTENSION_TAG = "type:vscode-extension";
694
757
  var GO_RELEASE_TAG = "release:go";
695
758
  var GO_CGO_TAG = "build:cgo";
696
759
  function hasNativeGoApp(workspaceRoot) {
697
- return (0, import_node_fs4.globSync)("apps/*/project.json", { cwd: workspaceRoot }).some((projectJson) => {
760
+ return (0, import_node_fs5.globSync)("apps/*/project.json", { cwd: workspaceRoot }).some((projectJson) => {
698
761
  try {
699
- const { tags } = JSON.parse((0, import_node_fs4.readFileSync)((0, import_node_path3.join)(workspaceRoot, projectJson), "utf8"));
762
+ const { tags } = JSON.parse((0, import_node_fs5.readFileSync)((0, import_node_path4.join)(workspaceRoot, projectJson), "utf8"));
700
763
  return (tags ?? []).includes(GO_CGO_TAG);
701
764
  } catch {
702
765
  return false;
@@ -1044,15 +1107,15 @@ function isUnmodifiedMnciEslintConfig(content) {
1044
1107
  return code.length === 2 && code[0] === "import mnci from '@mnci/eslint-config'" && code[1] === "export default mnci({ workspaceRoot: import.meta.dirname })";
1045
1108
  }
1046
1109
  function writePipeline(path, onProgress, generated) {
1047
- const { text, notes } = mergePipeline((0, import_node_fs4.existsSync)(path) ? (0, import_node_fs4.readFileSync)(path, "utf8") : void 0, generated);
1110
+ const { text, notes } = mergePipeline((0, import_node_fs5.existsSync)(path) ? (0, import_node_fs5.readFileSync)(path, "utf8") : void 0, generated);
1048
1111
  for (const note of notes) {
1049
1112
  onProgress(` ${note}`);
1050
1113
  }
1051
1114
  writeFileEnsured(path, text);
1052
1115
  }
1053
1116
  function writeEslintEntryPoint(workspaceRoot, onProgress) {
1054
- const path = (0, import_node_path3.join)(workspaceRoot, ESLINT_USER_FILENAME);
1055
- if ((0, import_node_fs4.existsSync)(path) && !isUnmodifiedMnciEslintConfig((0, import_node_fs4.readFileSync)(path, "utf8"))) {
1117
+ const path = (0, import_node_path4.join)(workspaceRoot, ESLINT_USER_FILENAME);
1118
+ if ((0, import_node_fs5.existsSync)(path) && !isUnmodifiedMnciEslintConfig((0, import_node_fs5.readFileSync)(path, "utf8"))) {
1056
1119
  onProgress(`${ESLINT_USER_FILENAME} \u2014 kept as it is, it is yours`);
1057
1120
  return;
1058
1121
  }
@@ -1220,7 +1283,7 @@ function mnciConfig(options) {
1220
1283
  };
1221
1284
  }
1222
1285
  function readMnciConfig(workspaceRoot) {
1223
- const nxJson = readJson((0, import_node_path3.join)(workspaceRoot, "nx.json"));
1286
+ const nxJson = readJson((0, import_node_path4.join)(workspaceRoot, "nx.json"));
1224
1287
  return nxJson.mnci ?? {};
1225
1288
  }
1226
1289
  function pythonPublishUrl(registry) {
@@ -1305,8 +1368,7 @@ var DOTNET_SDK_VERSION = "10.0.x";
1305
1368
  var DOTNET_DETECT_AZURE = `node -e "const fs=require('node:fs');const has=[...fs.globSync('apps/*/*.csproj'),...fs.globSync('packages/*/*.csproj'),...fs.globSync('libs/*/*.csproj')].length>0;console.log('##vso[task.setvariable variable=hasDotnetProjects]'+has)"`;
1306
1369
  var VERIFY_TARGETS = "lint,typecheck,test,build";
1307
1370
  var NATIVE_TARGETS = "lint,test,build-native,package-native";
1308
- var NATIVE_LINUX_PREREQUISITES = "sudo apt-get update && sudo apt-get install -y gcc pkg-config";
1309
- function githubNativeJob(npmAuthName, npmAuthValue) {
1371
+ function githubNativeJob(npmAuthName, npmAuthValue, runners) {
1310
1372
  return `
1311
1373
  # Apps that need a C toolchain (mnci add go-app --cgo) cannot be cross-compiled
1312
1374
  # from the job above, so each is linted, tested, built and packaged here, on a
@@ -1318,7 +1380,7 @@ function githubNativeJob(npmAuthName, npmAuthValue) {
1318
1380
  strategy:
1319
1381
  fail-fast: false
1320
1382
  matrix:
1321
- os: [windows-latest, macos-latest, ubuntu-latest]
1383
+ os: [${runners.join(", ")}]
1322
1384
  steps:
1323
1385
  - uses: actions/checkout@${ACTION_VERSIONS["actions/checkout"]}
1324
1386
  with:
@@ -1346,15 +1408,9 @@ function githubNativeJob(npmAuthName, npmAuthValue) {
1346
1408
  - run: npx mnci ci setup
1347
1409
  name: Set up the Go toolchain
1348
1410
 
1349
- # A C compiler and pkg-config, which is all mnci can know a cgo app needs.
1350
- # Add the -dev packages your app links to this line, for example
1351
- # libgtk-3-dev and libayatana-appindicator3-dev for a system-tray icon.
1352
- # macOS and Windows runners ship their toolchains.
1353
- - run: ${NATIVE_LINUX_PREREQUISITES}
1354
- name: Install native prerequisites (Linux)
1355
- if: \${{ runner.os == 'Linux' }}
1356
-
1357
- # Lints, tests, builds and packages the native apps on this OS. On a push to
1411
+ # Lints, tests, builds and packages the native apps on this OS. On a Linux leg it
1412
+ # first installs a C compiler, pkg-config and the packages of mnci.native.linuxPackages
1413
+ # in nx.json (for a tray icon: libgtk-3-dev, libayatana-appindicator3-dev). On a push to
1358
1414
  # main, a releasable native app (--cgo with --release) also gets this OS's zip
1359
1415
  # attached to the GitHub Release the ci job just created, stamped with the
1360
1416
  # tag's version.
@@ -1374,7 +1430,7 @@ function indentYaml(text, spaces) {
1374
1430
  const pad = " ".repeat(spaces);
1375
1431
  return text.split("\n").map((line) => line === "" ? line : pad + line).join("\n");
1376
1432
  }
1377
- function withAzureNativeJob(document, nativeSteps) {
1433
+ function withAzureNativeJob(document, nativeSteps, runners) {
1378
1434
  const poolAt = document.indexOf("\npool:\n");
1379
1435
  const variablesAt = document.indexOf("\nvariables:\n");
1380
1436
  const stepsAt = document.indexOf("\nsteps:\n");
@@ -1385,7 +1441,7 @@ function withAzureNativeJob(document, nativeSteps) {
1385
1441
  const pool2 = document.slice(poolAt + "\npool:\n".length, variablesAt).replace(/\n+$/, "");
1386
1442
  const variables = document.slice(variablesAt + 1, stepsAt).replace(/\n+$/, "");
1387
1443
  const steps = document.slice(stepsAt + "\nsteps:\n".length).replace(/\n+$/, "");
1388
- const matrix = Object.entries({ windows: "windows-latest", macos: "macos-latest", linux: "ubuntu-latest" }).map(([leg, image]) => ` ${leg}:
1444
+ const matrix = runners.map((image) => ({ leg: image.replaceAll(/\W/g, "_"), image })).map(({ leg, image }) => ` ${leg}:
1389
1445
  legName: ${leg}
1390
1446
  vmImage: ${image}`).join("\n");
1391
1447
  return `${head}${variables}
@@ -1424,7 +1480,7 @@ function npmAuthEnvVariable(registryKind, variableReference) {
1424
1480
  function poolBlock(agent) {
1425
1481
  return /^(?:ubuntu|windows|macos)-/i.test(agent) ? ` vmImage: ${agent}` : ` name: ${agent}`;
1426
1482
  }
1427
- function azurePipelinesYaml(agent, variableGroup, pythonPublishUrl2, registryKind = "azure-artifacts", nugetFeedUrl2, npmAuth = "pat", nativeApps = false) {
1483
+ function azurePipelinesYaml(agent, variableGroup, pythonPublishUrl2, registryKind = "azure-artifacts", nugetFeedUrl2, npmAuth = "pat", nativeApps = false, nativeRunners = DEFAULT_NATIVE_RUNNERS) {
1428
1484
  const onMain = "and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI'), eq(variables['Build.SourceBranchName'], 'main'))";
1429
1485
  const [npmAuthName, npmAuthValue] = npmAuthEnvVariable(registryKind, (name) => `$(${name})`);
1430
1486
  const buildIdentity = npmAuth === "build-identity" && registryKind === "azure-artifacts";
@@ -1686,14 +1742,9 @@ ${npmAuthenticateStep} - script: npm ci
1686
1742
  - script: npx mnci ci setup
1687
1743
  displayName: Set up the Go toolchain
1688
1744
 
1689
- # A C compiler and pkg-config, which is all mnci can know a cgo app needs. Add the
1690
- # -dev packages your app links to this line, for example libgtk-3-dev and
1691
- # libayatana-appindicator3-dev for a system-tray icon. macOS and Windows agents
1692
- # ship their toolchains.
1693
- - script: ${NATIVE_LINUX_PREREQUISITES}
1694
- displayName: Install native prerequisites (Linux)
1695
- condition: eq(variables['Agent.OS'], 'Linux')
1696
-
1745
+ # On a Linux leg this first installs a C compiler, pkg-config and the packages of
1746
+ # mnci.native.linuxPackages in nx.json (for a tray icon: libgtk-3-dev,
1747
+ # libayatana-appindicator3-dev). macOS and Windows agents ship their toolchains.
1697
1748
  - script: npx mnci ci native
1698
1749
  displayName: Lint, test, build and package the native apps
1699
1750
 
@@ -1703,9 +1754,9 @@ ${npmAuthenticateStep} - script: npm ci
1703
1754
  PathtoPublish: $(Build.SourcesDirectory)/dist/drop
1704
1755
  ArtifactName: native-$(legName)
1705
1756
  `;
1706
- return withAzureNativeJob(document, nativeSteps);
1757
+ return withAzureNativeJob(document, nativeSteps, nativeRunners);
1707
1758
  }
1708
- function githubActionsYaml(agent, pythonPublishUrl2, registryKind = "azure-artifacts", ci = "github", nugetFeedUrl2, nativeApps = false) {
1759
+ function githubActionsYaml(agent, pythonPublishUrl2, registryKind = "azure-artifacts", ci = "github", nugetFeedUrl2, nativeApps = false, nativeRunners = DEFAULT_NATIVE_RUNNERS) {
1709
1760
  const onMain = "github.event_name == 'push' && github.ref_name == 'main'";
1710
1761
  const [npmAuthName, npmAuthValue] = npmAuthEnvVariable(
1711
1762
  registryKind,
@@ -1891,7 +1942,7 @@ ${phaseStart("release", " ".repeat(6))}
1891
1942
  ${phaseEnd("release", " ".repeat(6))}
1892
1943
 
1893
1944
  ${slotMarkers("after-release", " ".repeat(6))}
1894
- ${nativeApps ? githubNativeJob(npmAuthName, npmAuthValue) : ""}`;
1945
+ ${nativeApps ? githubNativeJob(npmAuthName, npmAuthValue, nativeRunners) : ""}`;
1895
1946
  }
1896
1947
  var PIP_PROJECT_GLOBS = ["apps", "python-packages", "libs"];
1897
1948
  var PUB_PROJECT_GLOBS = ["apps", "packages", "libs"];
@@ -1901,12 +1952,12 @@ var ECOSYSTEM_MANIFESTS = {
1901
1952
  };
1902
1953
  function hasEcosystemProject(workspaceRoot, roots, manifests) {
1903
1954
  return roots.some((root) => {
1904
- const base = (0, import_node_path3.join)(workspaceRoot, root);
1905
- if (!(0, import_node_fs4.existsSync)(base)) {
1955
+ const base = (0, import_node_path4.join)(workspaceRoot, root);
1956
+ if (!(0, import_node_fs5.existsSync)(base)) {
1906
1957
  return false;
1907
1958
  }
1908
- return (0, import_node_fs4.readdirSync)(base, { withFileTypes: true }).some(
1909
- (entry) => entry.isDirectory() && manifests.some((manifest) => (0, import_node_fs4.existsSync)((0, import_node_path3.join)(base, entry.name, manifest)))
1959
+ return (0, import_node_fs5.readdirSync)(base, { withFileTypes: true }).some(
1960
+ (entry) => entry.isDirectory() && manifests.some((manifest) => (0, import_node_fs5.existsSync)((0, import_node_path4.join)(base, entry.name, manifest)))
1910
1961
  );
1911
1962
  });
1912
1963
  }
@@ -1984,11 +2035,11 @@ var LOCAL_REGISTRY_SCAFFOLDING = {
1984
2035
  rootTarget: "local-registry"
1985
2036
  };
1986
2037
  function removeLocalRegistryScaffolding(workspaceRoot) {
1987
- (0, import_node_fs4.rmSync)((0, import_node_path3.join)(workspaceRoot, LOCAL_REGISTRY_SCAFFOLDING.directory), {
2038
+ (0, import_node_fs5.rmSync)((0, import_node_path4.join)(workspaceRoot, LOCAL_REGISTRY_SCAFFOLDING.directory), {
1988
2039
  recursive: true,
1989
2040
  force: true
1990
2041
  });
1991
- const manifestPath = (0, import_node_path3.join)(workspaceRoot, "package.json");
2042
+ const manifestPath = (0, import_node_path4.join)(workspaceRoot, "package.json");
1992
2043
  if (!fileExists(manifestPath)) return;
1993
2044
  const manifest = readJson(manifestPath);
1994
2045
  if (manifest.devDependencies?.[LOCAL_REGISTRY_SCAFFOLDING.devDependency] !== void 0) {
@@ -2004,23 +2055,23 @@ function removeLocalRegistryScaffolding(workspaceRoot) {
2004
2055
  }
2005
2056
  function removeNxScaffolding(workspaceRoot) {
2006
2057
  for (const entry of NX_SCAFFOLDING_TO_REMOVE) {
2007
- (0, import_node_fs4.rmSync)((0, import_node_path3.join)(workspaceRoot, entry), { recursive: true, force: true });
2058
+ (0, import_node_fs5.rmSync)((0, import_node_path4.join)(workspaceRoot, entry), { recursive: true, force: true });
2008
2059
  }
2009
2060
  removeNxAuthoredAgentFiles(workspaceRoot);
2010
2061
  removeProjectEslintConfigs(workspaceRoot);
2011
2062
  }
2012
2063
  function removeNxAuthoredAgentFiles(workspaceRoot) {
2013
- (0, import_node_fs4.rmSync)((0, import_node_path3.join)(workspaceRoot, NX_CLAUDE_SETTINGS), { force: true });
2014
- const claudeDirectory = (0, import_node_path3.join)(workspaceRoot, (0, import_node_path3.dirname)(NX_CLAUDE_SETTINGS));
2015
- if ((0, import_node_fs4.existsSync)(claudeDirectory) && (0, import_node_fs4.readdirSync)(claudeDirectory).length === 0) {
2016
- (0, import_node_fs4.rmSync)(claudeDirectory, { recursive: true, force: true });
2064
+ (0, import_node_fs5.rmSync)((0, import_node_path4.join)(workspaceRoot, NX_CLAUDE_SETTINGS), { force: true });
2065
+ const claudeDirectory = (0, import_node_path4.join)(workspaceRoot, (0, import_node_path4.dirname)(NX_CLAUDE_SETTINGS));
2066
+ if ((0, import_node_fs5.existsSync)(claudeDirectory) && (0, import_node_fs5.readdirSync)(claudeDirectory).length === 0) {
2067
+ (0, import_node_fs5.rmSync)(claudeDirectory, { recursive: true, force: true });
2017
2068
  }
2018
2069
  for (const name of NX_AUTHORED_AGENT_FILES) {
2019
- const path = (0, import_node_path3.join)(workspaceRoot, name);
2020
- if (!(0, import_node_fs4.existsSync)(path)) continue;
2021
- const kept = withoutNxAgentRules((0, import_node_fs4.readFileSync)(path, "utf8"));
2070
+ const path = (0, import_node_path4.join)(workspaceRoot, name);
2071
+ if (!(0, import_node_fs5.existsSync)(path)) continue;
2072
+ const kept = withoutNxAgentRules((0, import_node_fs5.readFileSync)(path, "utf8"));
2022
2073
  if (kept === void 0) continue;
2023
- if (kept.trim() === "") (0, import_node_fs4.rmSync)(path, { force: true });
2074
+ if (kept.trim() === "") (0, import_node_fs5.rmSync)(path, { force: true });
2024
2075
  else writeFileEnsured(path, kept);
2025
2076
  }
2026
2077
  }
@@ -2035,14 +2086,14 @@ function withoutNxAgentRules(content) {
2035
2086
  return `${content.slice(0, start)}${rest}`.replace(/^[\r\n]+/, "");
2036
2087
  }
2037
2088
  function removeIfPresent(path) {
2038
- (0, import_node_fs4.rmSync)(path, { recursive: true, force: true });
2089
+ (0, import_node_fs5.rmSync)(path, { recursive: true, force: true });
2039
2090
  }
2040
2091
  function ensureEslintCacheIgnored(workspaceRoot) {
2041
- const gitignorePath = (0, import_node_path3.join)(workspaceRoot, ".gitignore");
2092
+ const gitignorePath = (0, import_node_path4.join)(workspaceRoot, ".gitignore");
2042
2093
  if (!fileExists(gitignorePath)) {
2043
2094
  return;
2044
2095
  }
2045
- const current = (0, import_node_fs4.readFileSync)(gitignorePath, "utf8");
2096
+ const current = (0, import_node_fs5.readFileSync)(gitignorePath, "utf8");
2046
2097
  if (current.split("\n").some((line) => line.trim() === ".eslintcache")) {
2047
2098
  return;
2048
2099
  }
@@ -2057,18 +2108,18 @@ function ensureEslintCacheIgnored(workspaceRoot) {
2057
2108
  }
2058
2109
  var PYTHON_ARTEFACT_IGNORES = ["__pycache__/", "*.py[cod]"];
2059
2110
  function ensurePythonArtefactsIgnored(workspaceRoot) {
2060
- const gitignorePath = (0, import_node_path3.join)(workspaceRoot, ".gitignore");
2111
+ const gitignorePath = (0, import_node_path4.join)(workspaceRoot, ".gitignore");
2061
2112
  if (!fileExists(gitignorePath)) {
2062
2113
  return;
2063
2114
  }
2064
- const hasPython = (0, import_node_fs4.globSync)(
2115
+ const hasPython = (0, import_node_fs5.globSync)(
2065
2116
  ["python-packages/*/pyproject.toml", "apps/*/pyproject.toml", "libs/*/pyproject.toml"],
2066
2117
  { cwd: workspaceRoot }
2067
2118
  ).length > 0;
2068
2119
  if (!hasPython) {
2069
2120
  return;
2070
2121
  }
2071
- const current = (0, import_node_fs4.readFileSync)(gitignorePath, "utf8");
2122
+ const current = (0, import_node_fs5.readFileSync)(gitignorePath, "utf8");
2072
2123
  const present = new Set(current.split("\n").map((line) => line.trim()));
2073
2124
  const missing = PYTHON_ARTEFACT_IGNORES.filter((line) => !present.has(line));
2074
2125
  if (missing.length === 0) {
@@ -2088,16 +2139,16 @@ ${missing.join("\n")}
2088
2139
  );
2089
2140
  }
2090
2141
  function removeProjectEslintConfigs(workspaceRoot) {
2091
- const matches = (0, import_node_fs4.globSync)("{apps,libs,packages}/*/eslint.config.{js,mjs,cjs,ts,mts,cts}", {
2142
+ const matches = (0, import_node_fs5.globSync)("{apps,libs,packages}/*/eslint.config.{js,mjs,cjs,ts,mts,cts}", {
2092
2143
  cwd: workspaceRoot
2093
2144
  });
2094
2145
  for (const match of matches) {
2095
- (0, import_node_fs4.rmSync)((0, import_node_path3.join)(workspaceRoot, match), { force: true });
2146
+ (0, import_node_fs5.rmSync)((0, import_node_path4.join)(workspaceRoot, match), { force: true });
2096
2147
  }
2097
2148
  }
2098
2149
  function applyOverlay(workspaceRoot, options, onProgress = () => {
2099
2150
  }) {
2100
- const nxJsonPath = (0, import_node_path3.join)(workspaceRoot, "nx.json");
2151
+ const nxJsonPath = (0, import_node_path4.join)(workspaceRoot, "nx.json");
2101
2152
  const nxJson = readJson(nxJsonPath);
2102
2153
  const generators = {
2103
2154
  ...nxJson.generators,
@@ -2105,7 +2156,7 @@ function applyOverlay(workspaceRoot, options, onProgress = () => {
2105
2156
  };
2106
2157
  const sync = { ...nxJson.sync, ...SYNC_CONFIG };
2107
2158
  const mnci = { ...nxJson.mnci, ...mnciConfig(options) };
2108
- const rootManifest = readJson((0, import_node_path3.join)(workspaceRoot, "package.json"));
2159
+ const rootManifest = readJson((0, import_node_path4.join)(workspaceRoot, "package.json"));
2109
2160
  const hasPythonPlugin = (rootManifest.devDependencies ?? {})["@mnci/nx-python-pip"] !== void 0 || (rootManifest.dependencies ?? {})["@mnci/nx-python-pip"] !== void 0;
2110
2161
  const withRelease = withReleaseConfig(nxJson, options.ci);
2111
2162
  const patched = withPythonGraphPlugin(
@@ -2115,7 +2166,7 @@ function applyOverlay(workspaceRoot, options, onProgress = () => {
2115
2166
  onProgress("nx.json \u2014 release, sync, generators, shared inputs, mnci block");
2116
2167
  writeFileEnsured(nxJsonPath, toJson({ ...patched, generators, sync, mnci }));
2117
2168
  onProgress("package.json \u2014 root scripts, TS compilers, ESLint toolchain, overrides");
2118
- const manifestPath = (0, import_node_path3.join)(workspaceRoot, "package.json");
2169
+ const manifestPath = (0, import_node_path4.join)(workspaceRoot, "package.json");
2119
2170
  const manifest = readJson(manifestPath);
2120
2171
  const scripts = {
2121
2172
  ...manifest.scripts,
@@ -2167,32 +2218,32 @@ function applyOverlay(workspaceRoot, options, onProgress = () => {
2167
2218
  `.npmrc \u2014 ${options.registry.kind === "azure-artifacts" ? "Azure Artifacts feed routing and credentials" : "public npm registry auth"}`
2168
2219
  );
2169
2220
  writeFileEnsured(
2170
- (0, import_node_path3.join)(workspaceRoot, ".npmrc"),
2221
+ (0, import_node_path4.join)(workspaceRoot, ".npmrc"),
2171
2222
  npmrcContent(options.registry, options.scope, options.npmAuth)
2172
2223
  );
2173
2224
  onProgress("commitlint.config.mjs and .husky/commit-msg \u2014 conventional commit enforcement");
2174
- writeFileEnsured((0, import_node_path3.join)(workspaceRoot, "commitlint.config.mjs"), COMMITLINT_CONFIG);
2175
- const hookPath = (0, import_node_path3.join)(workspaceRoot, ".husky/commit-msg");
2225
+ writeFileEnsured((0, import_node_path4.join)(workspaceRoot, "commitlint.config.mjs"), COMMITLINT_CONFIG);
2226
+ const hookPath = (0, import_node_path4.join)(workspaceRoot, ".husky/commit-msg");
2176
2227
  writeFileEnsured(hookPath, COMMIT_MSG_HOOK);
2177
2228
  markExecutable(hookPath);
2178
2229
  onProgress(`${ESLINT_MNCI_FILENAME} \u2014 the shared lint AND formatting opinion`);
2179
- writeFileEnsured((0, import_node_path3.join)(workspaceRoot, ESLINT_MNCI_FILENAME), ESLINT_MNCI_CONFIG);
2230
+ writeFileEnsured((0, import_node_path4.join)(workspaceRoot, ESLINT_MNCI_FILENAME), ESLINT_MNCI_CONFIG);
2180
2231
  writeEslintEntryPoint(workspaceRoot, onProgress);
2181
2232
  ensureEslintCacheIgnored(workspaceRoot);
2182
2233
  ensurePythonArtefactsIgnored(workspaceRoot);
2183
2234
  for (const retired of RETIRED_FORMATTER_FILES) {
2184
- removeIfPresent((0, import_node_path3.join)(workspaceRoot, retired));
2235
+ removeIfPresent((0, import_node_path4.join)(workspaceRoot, retired));
2185
2236
  }
2186
2237
  onProgress(".devcontainer/devcontainer.json \u2014 a local toolchain matching CI");
2187
2238
  writeFileEnsured(
2188
- (0, import_node_path3.join)(workspaceRoot, ".devcontainer/devcontainer.json"),
2239
+ (0, import_node_path4.join)(workspaceRoot, ".devcontainer/devcontainer.json"),
2189
2240
  devcontainerJson(options.workspaceName)
2190
2241
  );
2191
2242
  removeNxScaffolding(workspaceRoot);
2192
2243
  onProgress(
2193
2244
  `${options.workspaceName}.code-workspace \u2014 settings, extensions, launch configs`
2194
2245
  );
2195
- const codeWorkspacePath = (0, import_node_path3.join)(workspaceRoot, `${options.workspaceName}.code-workspace`);
2246
+ const codeWorkspacePath = (0, import_node_path4.join)(workspaceRoot, `${options.workspaceName}.code-workspace`);
2196
2247
  const existing = readCodeWorkspace(codeWorkspacePath);
2197
2248
  writeFileEnsured(
2198
2249
  codeWorkspacePath,
@@ -2204,15 +2255,16 @@ function applyOverlay(workspaceRoot, options, onProgress = () => {
2204
2255
  )
2205
2256
  );
2206
2257
  if (options.workspaceName !== "undefined") {
2207
- (0, import_node_fs4.rmSync)((0, import_node_path3.join)(workspaceRoot, "undefined.code-workspace"), { force: true });
2258
+ (0, import_node_fs5.rmSync)((0, import_node_path4.join)(workspaceRoot, "undefined.code-workspace"), { force: true });
2208
2259
  }
2209
2260
  const publishUrl = pythonPublishUrl(options.registry);
2210
2261
  const nugetUrl = nugetFeedUrl(options.registry);
2211
2262
  const nativeApps = hasNativeGoApp(workspaceRoot);
2263
+ const nativeRunners = readNativeBuildConfig(workspaceRoot).config.runners;
2212
2264
  if (options.ci === "azure" || options.ci === "both") {
2213
2265
  onProgress("azure-pipelines.yml \u2014 build, verify, pack and release");
2214
2266
  writePipeline(
2215
- (0, import_node_path3.join)(workspaceRoot, "azure-pipelines.yml"),
2267
+ (0, import_node_path4.join)(workspaceRoot, "azure-pipelines.yml"),
2216
2268
  onProgress,
2217
2269
  azurePipelinesYaml(
2218
2270
  options.agent,
@@ -2221,18 +2273,19 @@ function applyOverlay(workspaceRoot, options, onProgress = () => {
2221
2273
  options.registry.kind,
2222
2274
  nugetUrl,
2223
2275
  options.npmAuth,
2224
- nativeApps
2276
+ nativeApps,
2277
+ nativeRunners
2225
2278
  )
2226
2279
  );
2227
2280
  }
2228
2281
  if (options.ci === "github" || options.ci === "both") {
2229
2282
  onProgress(".github/workflows/ci.yml and dependabot.yml");
2230
2283
  writePipeline(
2231
- (0, import_node_path3.join)(workspaceRoot, ".github/workflows/ci.yml"),
2284
+ (0, import_node_path4.join)(workspaceRoot, ".github/workflows/ci.yml"),
2232
2285
  onProgress,
2233
- githubActionsYaml(options.agent, publishUrl, options.registry.kind, options.ci, nugetUrl, nativeApps)
2286
+ githubActionsYaml(options.agent, publishUrl, options.registry.kind, options.ci, nugetUrl, nativeApps, nativeRunners)
2234
2287
  );
2235
- writeFileEnsured((0, import_node_path3.join)(workspaceRoot, ".github/dependabot.yml"), dependabotConfig(workspaceRoot));
2288
+ writeFileEnsured((0, import_node_path4.join)(workspaceRoot, ".github/dependabot.yml"), dependabotConfig(workspaceRoot));
2236
2289
  }
2237
2290
  }
2238
2291
 
@@ -2256,30 +2309,47 @@ function runNative(workspaceRoot, dependencies = {}) {
2256
2309
  }
2257
2310
  return status;
2258
2311
  };
2312
+ if (isLinuxAgent(environment)) {
2313
+ const prerequisites = installLinuxPrerequisites(workspaceRoot, inGroup);
2314
+ if (prerequisites !== 0) {
2315
+ return prerequisites;
2316
+ }
2317
+ }
2259
2318
  const built = inGroup("Lint, test, build and package the native apps", "npx", ["nx", "run-many", "-t", NATIVE_TARGETS, `--projects=tag:${GO_CGO_TAG}`]);
2260
2319
  if (built !== 0) {
2261
2320
  return built;
2262
2321
  }
2263
- if (host !== "github" || !isMainPush(environment) || !(0, import_node_fs5.existsSync)((0, import_node_path4.join)(workspaceRoot, "tools", "go-app-release.cjs"))) {
2322
+ if (host !== "github" || !isMainPush(environment) || !(0, import_node_fs6.existsSync)((0, import_node_path5.join)(workspaceRoot, "tools", "go-app-release.cjs"))) {
2264
2323
  return 0;
2265
2324
  }
2266
2325
  return inGroup("Attach this OS's zip to the GitHub Release", "node", ["tools/go-app-release.cjs", "assets", "--native"]);
2267
2326
  }
2327
+ function isLinuxAgent(environment) {
2328
+ return environment.RUNNER_OS === "Linux" || environment.AGENT_OS === "Linux";
2329
+ }
2330
+ function installLinuxPrerequisites(workspaceRoot, inGroup) {
2331
+ const { linuxPackages } = readNativeBuildConfig(workspaceRoot).config;
2332
+ const updated = inGroup("Update the package index", "sudo", ["apt-get", "update"]);
2333
+ if (updated !== 0) {
2334
+ return updated;
2335
+ }
2336
+ return inGroup("Install the native prerequisites (Linux)", "sudo", ["apt-get", "install", "-y", "gcc", "pkg-config", ...linuxPackages]);
2337
+ }
2268
2338
 
2269
2339
  // src/ci-pipeline/pack.use-case.ts
2270
- var import_node_fs6 = require("fs");
2271
- var import_node_path5 = require("path");
2340
+ var import_node_fs7 = require("fs");
2341
+ var import_node_path6 = require("path");
2272
2342
  function hasAppToPack(workspaceRoot) {
2273
- const hasProjectJson = (0, import_node_fs6.globSync)("apps/*/project.json", { cwd: workspaceRoot }).length > 0;
2274
- const hasInlineNx = (0, import_node_fs6.globSync)("apps/*/package.json", { cwd: workspaceRoot }).some((manifest) => {
2343
+ const hasProjectJson = (0, import_node_fs7.globSync)("apps/*/project.json", { cwd: workspaceRoot }).length > 0;
2344
+ const hasInlineNx = (0, import_node_fs7.globSync)("apps/*/package.json", { cwd: workspaceRoot }).some((manifest) => {
2275
2345
  try {
2276
- const parsed = JSON.parse((0, import_node_fs6.readFileSync)((0, import_node_path5.join)(workspaceRoot, manifest), "utf8"));
2346
+ const parsed = JSON.parse((0, import_node_fs7.readFileSync)((0, import_node_path6.join)(workspaceRoot, manifest), "utf8"));
2277
2347
  return Boolean(parsed.nx);
2278
2348
  } catch {
2279
2349
  return false;
2280
2350
  }
2281
2351
  });
2282
- const hasCsproj = (0, import_node_fs6.globSync)("apps/*/*.csproj", { cwd: workspaceRoot }).length > 0;
2352
+ const hasCsproj = (0, import_node_fs7.globSync)("apps/*/*.csproj", { cwd: workspaceRoot }).length > 0;
2283
2353
  return hasProjectJson || hasInlineNx || hasCsproj;
2284
2354
  }
2285
2355
  function runPack(workspaceRoot, dependencies = {}) {
@@ -2292,7 +2362,7 @@ function runPack(workspaceRoot, dependencies = {}) {
2292
2362
  console.log(message);
2293
2363
  });
2294
2364
  const host = detectCiHost(environment);
2295
- (0, import_node_fs6.mkdirSync)((0, import_node_path5.join)(workspaceRoot, "dist", "drop"), { recursive: true });
2365
+ (0, import_node_fs7.mkdirSync)((0, import_node_path6.join)(workspaceRoot, "dist", "drop"), { recursive: true });
2296
2366
  if (!hasAppToPack(workspaceRoot)) {
2297
2367
  log("No apps to pack - skipping.");
2298
2368
  return 0;
@@ -2307,12 +2377,12 @@ function runPack(workspaceRoot, dependencies = {}) {
2307
2377
  }
2308
2378
 
2309
2379
  // src/ci-pipeline/release.use-case.ts
2310
- var import_node_fs7 = require("fs");
2311
- var import_node_path6 = require("path");
2380
+ var import_node_fs8 = require("fs");
2381
+ var import_node_path7 = require("path");
2312
2382
  var SPECIFIER = /^(?:major|minor|patch|\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)$/;
2313
2383
  function hasTag(workspaceRoot, relativePath, tag) {
2314
2384
  try {
2315
- const parsed = JSON.parse((0, import_node_fs7.readFileSync)((0, import_node_path6.join)(workspaceRoot, relativePath), "utf8"));
2385
+ const parsed = JSON.parse((0, import_node_fs8.readFileSync)((0, import_node_path7.join)(workspaceRoot, relativePath), "utf8"));
2316
2386
  const tags = relativePath.endsWith("project.json") ? parsed.tags : parsed.nx?.tags;
2317
2387
  return Array.isArray(tags) && tags.includes(tag);
2318
2388
  } catch {
@@ -2321,12 +2391,12 @@ function hasTag(workspaceRoot, relativePath, tag) {
2321
2391
  }
2322
2392
  function releasableCounts(workspaceRoot) {
2323
2393
  return {
2324
- npm: (0, import_node_fs7.globSync)("packages/*/package.json", { cwd: workspaceRoot }).length,
2325
- csharp: (0, import_node_fs7.globSync)("packages/*/*.csproj", { cwd: workspaceRoot }).length,
2326
- python: (0, import_node_fs7.globSync)("python-packages/*/pyproject.toml", { cwd: workspaceRoot }).length,
2327
- dart: (0, import_node_fs7.globSync)("packages/*/pubspec.yaml", { cwd: workspaceRoot }).length,
2328
- vscode: (0, import_node_fs7.globSync)("apps/*/package.json", { cwd: workspaceRoot }).filter((path) => hasTag(workspaceRoot, path, VSCODE_EXTENSION_TAG)).length,
2329
- go: (0, import_node_fs7.globSync)("apps/*/project.json", { cwd: workspaceRoot }).filter((path) => hasTag(workspaceRoot, path, GO_RELEASE_TAG)).length
2394
+ npm: (0, import_node_fs8.globSync)("packages/*/package.json", { cwd: workspaceRoot }).length,
2395
+ csharp: (0, import_node_fs8.globSync)("packages/*/*.csproj", { cwd: workspaceRoot }).length,
2396
+ python: (0, import_node_fs8.globSync)("python-packages/*/pyproject.toml", { cwd: workspaceRoot }).length,
2397
+ dart: (0, import_node_fs8.globSync)("packages/*/pubspec.yaml", { cwd: workspaceRoot }).length,
2398
+ vscode: (0, import_node_fs8.globSync)("apps/*/package.json", { cwd: workspaceRoot }).filter((path) => hasTag(workspaceRoot, path, VSCODE_EXTENSION_TAG)).length,
2399
+ go: (0, import_node_fs8.globSync)("apps/*/project.json", { cwd: workspaceRoot }).filter((path) => hasTag(workspaceRoot, path, GO_RELEASE_TAG)).length
2330
2400
  };
2331
2401
  }
2332
2402
  function shallowCloneGuard(processes, log) {
@@ -2342,7 +2412,7 @@ function shallowCloneGuard(processes, log) {
2342
2412
  return 0;
2343
2413
  }
2344
2414
  function npmPreflight(workspaceRoot, registryKind, environment, processes, log) {
2345
- if (registryKind !== "npm" || (0, import_node_fs7.globSync)("packages/*/package.json", { cwd: workspaceRoot }).length === 0) {
2415
+ if (registryKind !== "npm" || (0, import_node_fs8.globSync)("packages/*/package.json", { cwd: workspaceRoot }).length === 0) {
2346
2416
  return 0;
2347
2417
  }
2348
2418
  if (!environment.NODE_AUTH_TOKEN) {
@@ -2358,7 +2428,7 @@ function npmPreflight(workspaceRoot, registryKind, environment, processes, log)
2358
2428
  return 0;
2359
2429
  }
2360
2430
  async function pypiPreflight(workspaceRoot, registryKind, environment, log, fetchStatus) {
2361
- const files = (0, import_node_fs7.globSync)("python-packages/*/pyproject.toml", { cwd: workspaceRoot });
2431
+ const files = (0, import_node_fs8.globSync)("python-packages/*/pyproject.toml", { cwd: workspaceRoot });
2362
2432
  if (registryKind !== "npm" || files.length === 0) {
2363
2433
  return 0;
2364
2434
  }
@@ -2371,7 +2441,7 @@ async function pypiPreflight(workspaceRoot, registryKind, environment, log, fetc
2371
2441
  return 1;
2372
2442
  }
2373
2443
  const names = files.map((file) => {
2374
- const text = (0, import_node_fs7.readFileSync)((0, import_node_path6.join)(workspaceRoot, file), "utf8");
2444
+ const text = (0, import_node_fs8.readFileSync)((0, import_node_path7.join)(workspaceRoot, file), "utf8");
2375
2445
  const block = text.slice(text.indexOf("[project]"));
2376
2446
  const line = block.split("\n").find((entry) => entry.trimStart().startsWith("name"));
2377
2447
  return line ? line.split("=", 2)[1].replaceAll(/[^\w.-]/gi, "") : "";
@@ -2446,14 +2516,14 @@ function runReleaseCommand(workspaceRoot, registry, counts, environment, process
2446
2516
  }
2447
2517
  function nxPushesTags(workspaceRoot) {
2448
2518
  try {
2449
- const nx = JSON.parse((0, import_node_fs7.readFileSync)((0, import_node_path6.join)(workspaceRoot, "nx.json"), "utf8"));
2519
+ const nx = JSON.parse((0, import_node_fs8.readFileSync)((0, import_node_path7.join)(workspaceRoot, "nx.json"), "utf8"));
2450
2520
  return nx.release?.git?.push === true;
2451
2521
  } catch {
2452
2522
  return false;
2453
2523
  }
2454
2524
  }
2455
2525
  function afterRelease(workspaceRoot, processes, githubReleases) {
2456
- if (githubReleases && (0, import_node_fs7.existsSync)((0, import_node_path6.join)(workspaceRoot, "tools", "go-app-release.cjs"))) {
2526
+ if (githubReleases && (0, import_node_fs8.existsSync)((0, import_node_path7.join)(workspaceRoot, "tools", "go-app-release.cjs"))) {
2457
2527
  const assets = processes.run("node", ["tools/go-app-release.cjs", "assets"]);
2458
2528
  if (assets !== 0) {
2459
2529
  return assets;
@@ -2504,17 +2574,17 @@ async function runRelease(workspaceRoot, dependencies = {}) {
2504
2574
  }
2505
2575
 
2506
2576
  // src/ci-pipeline/setup.use-case.ts
2507
- var import_node_fs10 = require("fs");
2508
- var import_node_path9 = require("path");
2577
+ var import_node_fs11 = require("fs");
2578
+ var import_node_path10 = require("path");
2509
2579
 
2510
2580
  // src/ci-pipeline/flutter-sdk.use-case.ts
2511
- var import_node_fs8 = require("fs");
2512
- var import_node_path7 = require("path");
2581
+ var import_node_fs9 = require("fs");
2582
+ var import_node_path8 = require("path");
2513
2583
  function flutterSdkDirectory(machine) {
2514
- return (0, import_node_path7.join)(machine.home, `.mnci-flutter-${FLUTTER_SDK_VERSION}`);
2584
+ return (0, import_node_path8.join)(machine.home, `.mnci-flutter-${FLUTTER_SDK_VERSION}`);
2515
2585
  }
2516
2586
  function installFlutterSdk(workspaceRoot, processes, log, machine) {
2517
- if (!(0, import_node_fs8.existsSync)((0, import_node_path7.join)(workspaceRoot, "pubspec.yaml"))) {
2587
+ if (!(0, import_node_fs9.existsSync)((0, import_node_path8.join)(workspaceRoot, "pubspec.yaml"))) {
2518
2588
  log("No Flutter projects - skipping.");
2519
2589
  return 0;
2520
2590
  }
@@ -2523,26 +2593,26 @@ function installFlutterSdk(workspaceRoot, processes, log, machine) {
2523
2593
  return 0;
2524
2594
  }
2525
2595
  const sdk = flutterSdkDirectory(machine);
2526
- if ((0, import_node_fs8.existsSync)(sdk)) {
2596
+ if ((0, import_node_fs9.existsSync)(sdk)) {
2527
2597
  log(`Flutter SDK already installed at ${sdk} - skipping.`);
2528
2598
  return 0;
2529
2599
  }
2530
2600
  return processes.run("git", ["clone", "--depth", "1", "--branch", FLUTTER_SDK_VERSION, "https://github.com/flutter/flutter.git", sdk]);
2531
2601
  }
2532
2602
  function publishFlutterSdk(workspaceRoot, host, environment, log, machine) {
2533
- if (!(0, import_node_fs8.existsSync)((0, import_node_path7.join)(workspaceRoot, "pubspec.yaml"))) {
2603
+ if (!(0, import_node_fs9.existsSync)((0, import_node_path8.join)(workspaceRoot, "pubspec.yaml"))) {
2534
2604
  log("No Flutter projects - skipping.");
2535
2605
  return;
2536
2606
  }
2537
2607
  const sdk = flutterSdkDirectory(machine);
2538
- if (!(0, import_node_fs8.existsSync)(sdk)) {
2608
+ if (!(0, import_node_fs9.existsSync)(sdk)) {
2539
2609
  log("Flutter SDK was not installed by mnci (already on PATH) - skipping.");
2540
2610
  return;
2541
2611
  }
2542
- addToPath(host, environment, (0, import_node_path7.join)(sdk, "bin"), log);
2612
+ addToPath(host, environment, (0, import_node_path8.join)(sdk, "bin"), log);
2543
2613
  }
2544
2614
  function resolveDartDependencies(workspaceRoot, processes, log) {
2545
- if (!(0, import_node_fs8.existsSync)((0, import_node_path7.join)(workspaceRoot, "pubspec.yaml"))) {
2615
+ if (!(0, import_node_fs9.existsSync)((0, import_node_path8.join)(workspaceRoot, "pubspec.yaml"))) {
2546
2616
  log("No Flutter projects - skipping.");
2547
2617
  return 0;
2548
2618
  }
@@ -2551,15 +2621,15 @@ function resolveDartDependencies(workspaceRoot, processes, log) {
2551
2621
 
2552
2622
  // src/ci-pipeline/go-tools.use-case.ts
2553
2623
  var import_node_crypto = require("crypto");
2554
- var import_node_fs9 = require("fs");
2624
+ var import_node_fs10 = require("fs");
2555
2625
  var import_node_os = require("os");
2556
- var import_node_path8 = require("path");
2626
+ var import_node_path9 = require("path");
2557
2627
  function currentMachine() {
2558
2628
  return { platform: process.platform, architecture: process.arch, home: (0, import_node_os.homedir)() };
2559
2629
  }
2560
2630
  var GOLANGCI_LINT_MODULE = "github.com/golangci/golangci-lint/v2/cmd/golangci-lint";
2561
2631
  function downloadGoModules(workspaceRoot, processes, log) {
2562
- if (!(0, import_node_fs9.existsSync)((0, import_node_path8.join)(workspaceRoot, "go.mod"))) {
2632
+ if (!(0, import_node_fs10.existsSync)((0, import_node_path9.join)(workspaceRoot, "go.mod"))) {
2563
2633
  log("No Go projects - skipping.");
2564
2634
  return 0;
2565
2635
  }
@@ -2567,7 +2637,7 @@ function downloadGoModules(workspaceRoot, processes, log) {
2567
2637
  }
2568
2638
  async function installGolangciLint(workspaceRoot, dependencies, machine) {
2569
2639
  const { processes, log, fetchBytes } = dependencies;
2570
- if (!(0, import_node_fs9.existsSync)((0, import_node_path8.join)(workspaceRoot, "go.mod"))) {
2640
+ if (!(0, import_node_fs10.existsSync)((0, import_node_path9.join)(workspaceRoot, "go.mod"))) {
2571
2641
  log("No Go projects - skipping.");
2572
2642
  return 0;
2573
2643
  }
@@ -2604,30 +2674,30 @@ async function installGolangciLint(workspaceRoot, dependencies, machine) {
2604
2674
  if ((0, import_node_crypto.createHash)("sha256").update(archive).digest("hex") !== entry[0]) {
2605
2675
  throw new Error(`checksum mismatch for ${file}`);
2606
2676
  }
2607
- temporary = (0, import_node_fs9.mkdtempSync)((0, import_node_path8.join)((0, import_node_os.tmpdir)(), "golangci-lint-"));
2608
- const archivePath = (0, import_node_path8.join)(temporary, file);
2609
- (0, import_node_fs9.writeFileSync)(archivePath, archive);
2610
- const tar = platform === "windows" ? (0, import_node_path8.join)(process.env.SystemRoot ?? "", "System32", "tar.exe") : "tar";
2677
+ temporary = (0, import_node_fs10.mkdtempSync)((0, import_node_path9.join)((0, import_node_os.tmpdir)(), "golangci-lint-"));
2678
+ const archivePath = (0, import_node_path9.join)(temporary, file);
2679
+ (0, import_node_fs10.writeFileSync)(archivePath, archive);
2680
+ const tar = platform === "windows" ? (0, import_node_path9.join)(process.env.SystemRoot ?? "", "System32", "tar.exe") : "tar";
2611
2681
  if (processes.run(tar, ["-xf", archivePath, "-C", temporary]) !== 0) {
2612
2682
  throw new Error(`could not extract ${file}`);
2613
2683
  }
2614
2684
  const executable = `golangci-lint${platform === "windows" ? ".exe" : ""}`;
2615
- const bin = (0, import_node_path8.join)(gopath.stdout.trim(), "bin");
2616
- (0, import_node_fs9.mkdirSync)(bin, { recursive: true });
2617
- (0, import_node_fs9.copyFileSync)((0, import_node_path8.join)(temporary, name, executable), (0, import_node_path8.join)(bin, executable));
2618
- (0, import_node_fs9.chmodSync)((0, import_node_path8.join)(bin, executable), 493);
2685
+ const bin = (0, import_node_path9.join)(gopath.stdout.trim(), "bin");
2686
+ (0, import_node_fs10.mkdirSync)(bin, { recursive: true });
2687
+ (0, import_node_fs10.copyFileSync)((0, import_node_path9.join)(temporary, name, executable), (0, import_node_path9.join)(bin, executable));
2688
+ (0, import_node_fs10.chmodSync)((0, import_node_path9.join)(bin, executable), 493);
2619
2689
  log(`golangci-lint ${version} installed from its checksum-verified prebuilt release into ${bin}`);
2620
2690
  return 0;
2621
2691
  } catch (error) {
2622
2692
  return fallback(error instanceof Error ? error.message : String(error));
2623
2693
  } finally {
2624
2694
  if (temporary !== void 0) {
2625
- (0, import_node_fs9.rmSync)(temporary, { recursive: true, force: true });
2695
+ (0, import_node_fs10.rmSync)(temporary, { recursive: true, force: true });
2626
2696
  }
2627
2697
  }
2628
2698
  }
2629
2699
  function publishGoTools(workspaceRoot, host, environment, processes, log) {
2630
- if (!(0, import_node_fs9.existsSync)((0, import_node_path8.join)(workspaceRoot, "go.mod"))) {
2700
+ if (!(0, import_node_fs10.existsSync)((0, import_node_path9.join)(workspaceRoot, "go.mod"))) {
2631
2701
  log("No Go projects - skipping.");
2632
2702
  return;
2633
2703
  }
@@ -2636,7 +2706,7 @@ function publishGoTools(workspaceRoot, host, environment, processes, log) {
2636
2706
  log("Could not resolve GOPATH - skipping.");
2637
2707
  return;
2638
2708
  }
2639
- addToPath(host, environment, (0, import_node_path8.join)(gopath.stdout.trim(), "bin"), log);
2709
+ addToPath(host, environment, (0, import_node_path9.join)(gopath.stdout.trim(), "bin"), log);
2640
2710
  }
2641
2711
 
2642
2712
  // src/ci-pipeline/setup.use-case.ts
@@ -2644,15 +2714,15 @@ function pythonCommand(machine) {
2644
2714
  return machine.platform === "win32" ? "python" : "python3";
2645
2715
  }
2646
2716
  function installPythonToolchain(workspaceRoot, processes, log, machine) {
2647
- if (!(0, import_node_fs10.existsSync)((0, import_node_path9.join)(workspaceRoot, "requirements-dev.txt"))) {
2717
+ if (!(0, import_node_fs11.existsSync)((0, import_node_path10.join)(workspaceRoot, "requirements-dev.txt"))) {
2648
2718
  log("No Python projects - skipping.");
2649
2719
  return 0;
2650
2720
  }
2651
2721
  return processes.run(pythonCommand(machine), ["-m", "pip", "install", "-r", "requirements-dev.txt"]);
2652
2722
  }
2653
2723
  function installPythonProjects(workspaceRoot, processes, log, machine) {
2654
- const editable = ["apps/*/pyproject.toml", "python-packages/*/pyproject.toml", "libs/*/pyproject.toml"].flatMap((pattern) => (0, import_node_fs10.globSync)(pattern, { cwd: workspaceRoot })).map((path) => (0, import_node_path9.dirname)(path));
2655
- const requirements = (0, import_node_fs10.globSync)("apps/*/requirements.txt", { cwd: workspaceRoot });
2724
+ const editable = ["apps/*/pyproject.toml", "python-packages/*/pyproject.toml", "libs/*/pyproject.toml"].flatMap((pattern) => (0, import_node_fs11.globSync)(pattern, { cwd: workspaceRoot })).map((path) => (0, import_node_path10.dirname)(path));
2725
+ const requirements = (0, import_node_fs11.globSync)("apps/*/requirements.txt", { cwd: workspaceRoot });
2656
2726
  if (editable.length === 0 && requirements.length === 0) {
2657
2727
  log("No Python projects - skipping.");
2658
2728
  return 0;
@@ -2794,7 +2864,7 @@ function runCiPhase(phase, workspaceRoot, dependencies = {}) {
2794
2864
  }
2795
2865
 
2796
2866
  // src/project-scaffolding/add-project.use-case.ts
2797
- var import_node_path30 = require("path");
2867
+ var import_node_path31 = require("path");
2798
2868
  var import_prompts3 = require("@inquirer/prompts");
2799
2869
 
2800
2870
  // src/project-name/project-name.validator.ts
@@ -2807,8 +2877,8 @@ function assertValidProjectName(name, label) {
2807
2877
  }
2808
2878
 
2809
2879
  // src/project-scaffolding/csharp.use-case.ts
2810
- var import_node_fs12 = require("fs");
2811
- var import_node_path11 = require("path");
2880
+ var import_node_fs13 = require("fs");
2881
+ var import_node_path12 = require("path");
2812
2882
 
2813
2883
  // src/project-scaffolding/csharp-example.algorithm.ts
2814
2884
  function csharpExampleFiles(identity) {
@@ -2849,10 +2919,10 @@ public class GreetUseCaseTests
2849
2919
  }
2850
2920
 
2851
2921
  // src/project-scaffolding/post-generation.use-case.ts
2852
- var import_node_fs11 = require("fs");
2853
- var import_node_path10 = require("path");
2922
+ var import_node_fs12 = require("fs");
2923
+ var import_node_path11 = require("path");
2854
2924
  function hasPlugin(workspaceRoot, packageName) {
2855
- const manifest = readJson((0, import_node_path10.join)(workspaceRoot, "package.json"));
2925
+ const manifest = readJson((0, import_node_path11.join)(workspaceRoot, "package.json"));
2856
2926
  const installed = { ...manifest.dependencies, ...manifest.devDependencies };
2857
2927
  return Object.hasOwn(installed, packageName);
2858
2928
  }
@@ -2891,7 +2961,7 @@ function markPublic(manifestPath) {
2891
2961
  function writeProjectReadme(projectRoot, projectName, testRunner) {
2892
2962
  const runner = testRunner === "vitest" ? "[Vitest](https://vitest.dev)" : "[Jest](https://jestjs.io)";
2893
2963
  writeFileEnsured(
2894
- (0, import_node_path10.join)(projectRoot, "README.md"),
2964
+ (0, import_node_path11.join)(projectRoot, "README.md"),
2895
2965
  [
2896
2966
  `# ${projectName}`,
2897
2967
  "",
@@ -2910,13 +2980,13 @@ function writeProjectReadme(projectRoot, projectName, testRunner) {
2910
2980
  }
2911
2981
  function removeStaleGitkeeps(workspaceRoot) {
2912
2982
  for (const scaffold of ["apps", "libs", "packages"]) {
2913
- const directory = (0, import_node_path10.join)(workspaceRoot, scaffold);
2983
+ const directory = (0, import_node_path11.join)(workspaceRoot, scaffold);
2914
2984
  try {
2915
- const holdsAProject = (0, import_node_fs11.readdirSync)(directory, { withFileTypes: true }).some(
2985
+ const holdsAProject = (0, import_node_fs12.readdirSync)(directory, { withFileTypes: true }).some(
2916
2986
  (entry) => entry.isDirectory()
2917
2987
  );
2918
2988
  if (holdsAProject) {
2919
- (0, import_node_fs11.rmSync)((0, import_node_path10.join)(directory, ".gitkeep"), { force: true });
2989
+ (0, import_node_fs12.rmSync)((0, import_node_path11.join)(directory, ".gitkeep"), { force: true });
2920
2990
  }
2921
2991
  } catch {
2922
2992
  }
@@ -2936,7 +3006,7 @@ function ensureAdmZip(workspaceRoot) {
2936
3006
  }
2937
3007
  }
2938
3008
  function defaultScope(workspaceRoot) {
2939
- const { name } = readJson((0, import_node_path10.join)(workspaceRoot, "package.json"));
3009
+ const { name } = readJson((0, import_node_path11.join)(workspaceRoot, "package.json"));
2940
3010
  const base = (name.startsWith("@") ? name.slice(1) : name).split("/", 1)[0];
2941
3011
  return `@${base}`;
2942
3012
  }
@@ -2964,14 +3034,14 @@ var ESLINT_CONFIG_FILENAMES = [
2964
3034
  ];
2965
3035
  function removeGeneratedEslintConfig(workspaceRoot, projectRoot) {
2966
3036
  for (const filename of ESLINT_CONFIG_FILENAMES) {
2967
- (0, import_node_fs11.rmSync)((0, import_node_path10.join)(workspaceRoot, projectRoot, filename), { force: true });
3037
+ (0, import_node_fs12.rmSync)((0, import_node_path11.join)(workspaceRoot, projectRoot, filename), { force: true });
2968
3038
  }
2969
- (0, import_node_fs11.rmSync)((0, import_node_path10.join)(workspaceRoot, ".vscode"), { recursive: true, force: true });
3039
+ (0, import_node_fs12.rmSync)((0, import_node_path11.join)(workspaceRoot, ".vscode"), { recursive: true, force: true });
2970
3040
  }
2971
3041
  function findCodeWorkspaceFile(workspaceRoot) {
2972
3042
  try {
2973
- const entry = (0, import_node_fs11.readdirSync)(workspaceRoot).find((file) => file.endsWith(".code-workspace"));
2974
- return entry ? (0, import_node_path10.join)(workspaceRoot, entry) : void 0;
3043
+ const entry = (0, import_node_fs12.readdirSync)(workspaceRoot).find((file) => file.endsWith(".code-workspace"));
3044
+ return entry ? (0, import_node_path11.join)(workspaceRoot, entry) : void 0;
2975
3045
  } catch {
2976
3046
  return void 0;
2977
3047
  }
@@ -2988,8 +3058,8 @@ function reshapeReactScaffold(projectRoot, name, empty = false) {
2988
3058
  reshapeScaffoldSlice(projectRoot, name, "tsx", "component", empty);
2989
3059
  }
2990
3060
  function reshapeReactAppScaffold(projectRoot) {
2991
- const appDir = (0, import_node_path10.join)(projectRoot, "src", "app");
2992
- if (!(0, import_node_fs11.existsSync)((0, import_node_path10.join)(appDir, "app.tsx"))) {
3061
+ const appDir = (0, import_node_path11.join)(projectRoot, "src", "app");
3062
+ if (!(0, import_node_fs12.existsSync)((0, import_node_path11.join)(appDir, "app.tsx"))) {
2993
3063
  return;
2994
3064
  }
2995
3065
  for (const [from, to] of [
@@ -2997,60 +3067,60 @@ function reshapeReactAppScaffold(projectRoot) {
2997
3067
  ["app.spec.tsx", "app.component.spec.tsx"],
2998
3068
  ["nx-welcome.tsx", "nx-welcome.component.tsx"]
2999
3069
  ]) {
3000
- if ((0, import_node_fs11.existsSync)((0, import_node_path10.join)(appDir, from))) {
3001
- (0, import_node_fs11.renameSync)((0, import_node_path10.join)(appDir, from), (0, import_node_path10.join)(appDir, to));
3070
+ if ((0, import_node_fs12.existsSync)((0, import_node_path11.join)(appDir, from))) {
3071
+ (0, import_node_fs12.renameSync)((0, import_node_path11.join)(appDir, from), (0, import_node_path11.join)(appDir, to));
3002
3072
  }
3003
3073
  }
3004
3074
  const rewrite = (file, from, to) => {
3005
- if ((0, import_node_fs11.existsSync)(file)) {
3006
- writeFileEnsured(file, repointSpecifier((0, import_node_fs11.readFileSync)(file, "utf8"), from, to));
3075
+ if ((0, import_node_fs12.existsSync)(file)) {
3076
+ writeFileEnsured(file, repointSpecifier((0, import_node_fs12.readFileSync)(file, "utf8"), from, to));
3007
3077
  }
3008
3078
  };
3009
- rewrite((0, import_node_path10.join)(appDir, "app.component.tsx"), "./nx-welcome", "./nx-welcome.component");
3010
- rewrite((0, import_node_path10.join)(appDir, "app.component.spec.tsx"), "./app", "./app.component");
3011
- rewrite((0, import_node_path10.join)(projectRoot, "src", "main.tsx"), "./app/app", "./app");
3079
+ rewrite((0, import_node_path11.join)(appDir, "app.component.tsx"), "./nx-welcome", "./nx-welcome.component");
3080
+ rewrite((0, import_node_path11.join)(appDir, "app.component.spec.tsx"), "./app", "./app.component");
3081
+ rewrite((0, import_node_path11.join)(projectRoot, "src", "main.tsx"), "./app/app", "./app");
3012
3082
  writeFileEnsured(
3013
- (0, import_node_path10.join)(appDir, "index.ts"),
3083
+ (0, import_node_path11.join)(appDir, "index.ts"),
3014
3084
  "export * from './app.component'\nexport { default } from './app.component'\n"
3015
3085
  );
3016
3086
  }
3017
3087
  function emptySlice(projectRoot, sliceDir) {
3018
- for (const entry of (0, import_node_fs11.readdirSync)(sliceDir)) {
3019
- (0, import_node_fs11.rmSync)((0, import_node_path10.join)(sliceDir, entry), { recursive: true, force: true });
3088
+ for (const entry of (0, import_node_fs12.readdirSync)(sliceDir)) {
3089
+ (0, import_node_fs12.rmSync)((0, import_node_path11.join)(sliceDir, entry), { recursive: true, force: true });
3020
3090
  }
3021
- writeFileEnsured((0, import_node_path10.join)(sliceDir, "index.ts"), "export {}\n");
3022
- addNxTargets((0, import_node_path10.join)(projectRoot, "package.json"), { test: { options: { passWithNoTests: true } } });
3091
+ writeFileEnsured((0, import_node_path11.join)(sliceDir, "index.ts"), "export {}\n");
3092
+ addNxTargets((0, import_node_path11.join)(projectRoot, "package.json"), { test: { options: { passWithNoTests: true } } });
3023
3093
  }
3024
3094
  function reshapeScaffoldSlice(projectRoot, name, extension, role, empty) {
3025
- const sourceDir = (0, import_node_path10.join)(projectRoot, "src");
3026
- const libDir = (0, import_node_path10.join)(sourceDir, "lib");
3027
- if (!(0, import_node_fs11.existsSync)((0, import_node_path10.join)(libDir, `${name}.${extension}`))) {
3095
+ const sourceDir = (0, import_node_path11.join)(projectRoot, "src");
3096
+ const libDir = (0, import_node_path11.join)(sourceDir, "lib");
3097
+ if (!(0, import_node_fs12.existsSync)((0, import_node_path11.join)(libDir, `${name}.${extension}`))) {
3028
3098
  return;
3029
3099
  }
3030
- const sliceDir = (0, import_node_path10.join)(sourceDir, name);
3031
- (0, import_node_fs11.mkdirSync)(sliceDir, { recursive: true });
3032
- for (const entry of (0, import_node_fs11.readdirSync)(libDir)) {
3100
+ const sliceDir = (0, import_node_path11.join)(sourceDir, name);
3101
+ (0, import_node_fs12.mkdirSync)(sliceDir, { recursive: true });
3102
+ for (const entry of (0, import_node_fs12.readdirSync)(libDir)) {
3033
3103
  if (entry === `${name}.${extension}`) {
3034
- (0, import_node_fs11.renameSync)((0, import_node_path10.join)(libDir, entry), (0, import_node_path10.join)(sliceDir, `${name}.${role}.${extension}`));
3104
+ (0, import_node_fs12.renameSync)((0, import_node_path11.join)(libDir, entry), (0, import_node_path11.join)(sliceDir, `${name}.${role}.${extension}`));
3035
3105
  } else if (entry === `${name}.spec.${extension}`) {
3036
- const renamed = (0, import_node_path10.join)(sliceDir, `${name}.${role}.spec.${extension}`);
3037
- (0, import_node_fs11.renameSync)((0, import_node_path10.join)(libDir, entry), renamed);
3038
- writeFileEnsured(renamed, repointSpecifier((0, import_node_fs11.readFileSync)(renamed, "utf8"), `./${name}`, `./${name}.${role}`));
3106
+ const renamed = (0, import_node_path11.join)(sliceDir, `${name}.${role}.spec.${extension}`);
3107
+ (0, import_node_fs12.renameSync)((0, import_node_path11.join)(libDir, entry), renamed);
3108
+ writeFileEnsured(renamed, repointSpecifier((0, import_node_fs12.readFileSync)(renamed, "utf8"), `./${name}`, `./${name}.${role}`));
3039
3109
  } else {
3040
- (0, import_node_fs11.renameSync)((0, import_node_path10.join)(libDir, entry), (0, import_node_path10.join)(sliceDir, entry));
3110
+ (0, import_node_fs12.renameSync)((0, import_node_path11.join)(libDir, entry), (0, import_node_path11.join)(sliceDir, entry));
3041
3111
  }
3042
3112
  }
3043
- const barrel = (0, import_node_path10.join)(sourceDir, "index.ts");
3044
- const esm = (0, import_node_fs11.existsSync)(barrel) && (0, import_node_fs11.readFileSync)(barrel, "utf8").includes(`./lib/${name}.js'`);
3045
- writeFileEnsured((0, import_node_path10.join)(sliceDir, "index.ts"), `export * from './${name}.${role}${esm ? ".js" : ""}'
3113
+ const barrel = (0, import_node_path11.join)(sourceDir, "index.ts");
3114
+ const esm = (0, import_node_fs12.existsSync)(barrel) && (0, import_node_fs12.readFileSync)(barrel, "utf8").includes(`./lib/${name}.js'`);
3115
+ writeFileEnsured((0, import_node_path11.join)(sliceDir, "index.ts"), `export * from './${name}.${role}${esm ? ".js" : ""}'
3046
3116
  `);
3047
- if ((0, import_node_fs11.existsSync)(barrel)) {
3117
+ if ((0, import_node_fs12.existsSync)(barrel)) {
3048
3118
  writeFileEnsured(
3049
3119
  barrel,
3050
- (0, import_node_fs11.readFileSync)(barrel, "utf8").replaceAll(`./lib/${name}.js'`, () => `./${name}/index.js'`).replaceAll(`./lib/${name}'`, () => `./${name}'`)
3120
+ (0, import_node_fs12.readFileSync)(barrel, "utf8").replaceAll(`./lib/${name}.js'`, () => `./${name}/index.js'`).replaceAll(`./lib/${name}'`, () => `./${name}'`)
3051
3121
  );
3052
3122
  }
3053
- (0, import_node_fs11.rmSync)(libDir, { recursive: true, force: true });
3123
+ (0, import_node_fs12.rmSync)(libDir, { recursive: true, force: true });
3054
3124
  if (empty) {
3055
3125
  emptySlice(projectRoot, sliceDir);
3056
3126
  } else if (role === "use-case") {
@@ -3060,7 +3130,7 @@ function reshapeScaffoldSlice(projectRoot, name, extension, role, empty) {
3060
3130
  function writeWorkedExample(sliceDir, name, esm) {
3061
3131
  const suffix = esm ? ".js" : "";
3062
3132
  writeFileEnsured(
3063
- (0, import_node_path10.join)(sliceDir, `${name}.contract.ts`),
3133
+ (0, import_node_path11.join)(sliceDir, `${name}.contract.ts`),
3064
3134
  `/** What greeting someone returns. */
3065
3135
  export interface Greeting {
3066
3136
  readonly message: string
@@ -3068,7 +3138,7 @@ export interface Greeting {
3068
3138
  `
3069
3139
  );
3070
3140
  writeFileEnsured(
3071
- (0, import_node_path10.join)(sliceDir, `${name}.use-case.ts`),
3141
+ (0, import_node_path11.join)(sliceDir, `${name}.use-case.ts`),
3072
3142
  `import type { Greeting } from './${name}.contract${suffix}'
3073
3143
 
3074
3144
  /**
@@ -3087,7 +3157,7 @@ export function greet (name: string): Greeting {
3087
3157
  `
3088
3158
  );
3089
3159
  writeFileEnsured(
3090
- (0, import_node_path10.join)(sliceDir, `${name}.use-case.spec.ts`),
3160
+ (0, import_node_path11.join)(sliceDir, `${name}.use-case.spec.ts`),
3091
3161
  `import { greet } from './${name}.use-case${suffix}'
3092
3162
 
3093
3163
  describe('greet', () => {
@@ -3098,7 +3168,7 @@ describe('greet', () => {
3098
3168
  `
3099
3169
  );
3100
3170
  writeFileEnsured(
3101
- (0, import_node_path10.join)(sliceDir, "index.ts"),
3171
+ (0, import_node_path11.join)(sliceDir, "index.ts"),
3102
3172
  `export * from './${name}.contract${suffix}'
3103
3173
  export * from './${name}.use-case${suffix}'
3104
3174
  `
@@ -3112,8 +3182,8 @@ function repointSpecifier(source, from, to) {
3112
3182
  return result;
3113
3183
  }
3114
3184
  function ensureNxPeerOverrides(workspaceRoot) {
3115
- const manifestPath = (0, import_node_path10.join)(workspaceRoot, "package.json");
3116
- if (!(0, import_node_fs11.existsSync)(manifestPath)) {
3185
+ const manifestPath = (0, import_node_path11.join)(workspaceRoot, "package.json");
3186
+ if (!(0, import_node_fs12.existsSync)(manifestPath)) {
3117
3187
  return;
3118
3188
  }
3119
3189
  const manifest = readJson(manifestPath);
@@ -3136,11 +3206,11 @@ function registerProjectCommands(workspaceRoot, name, commands) {
3136
3206
  if (commands.start) {
3137
3207
  scripts[`${name}:start`] = commands.start;
3138
3208
  }
3139
- const dependabotPath = (0, import_node_path10.join)(workspaceRoot, ".github/dependabot.yml");
3140
- if ((0, import_node_fs11.existsSync)(dependabotPath)) {
3209
+ const dependabotPath = (0, import_node_path11.join)(workspaceRoot, ".github/dependabot.yml");
3210
+ if ((0, import_node_fs12.existsSync)(dependabotPath)) {
3141
3211
  writeFileEnsured(dependabotPath, dependabotConfig(workspaceRoot));
3142
3212
  }
3143
- const manifestPath = (0, import_node_path10.join)(workspaceRoot, "package.json");
3213
+ const manifestPath = (0, import_node_path11.join)(workspaceRoot, "package.json");
3144
3214
  const manifest = readJson(manifestPath);
3145
3215
  const existingScripts = manifest.scripts ?? {};
3146
3216
  writeFileEnsured(
@@ -3178,7 +3248,7 @@ function registerProjectCommands(workspaceRoot, name, commands) {
3178
3248
  var PROJECT_MANIFEST_ROOTS = ["apps", "packages", "libs"];
3179
3249
  function rootRuntimeDependencies(workspaceRoot) {
3180
3250
  try {
3181
- return readJson((0, import_node_path10.join)(workspaceRoot, "package.json")).dependencies ?? {};
3251
+ return readJson((0, import_node_path11.join)(workspaceRoot, "package.json")).dependencies ?? {};
3182
3252
  } catch {
3183
3253
  return {};
3184
3254
  }
@@ -3190,7 +3260,7 @@ function relocateRootRuntimeDependencies(workspaceRoot, projectName, before) {
3190
3260
  return;
3191
3261
  }
3192
3262
  const manifestPath = PROJECT_MANIFEST_ROOTS.map(
3193
- (root) => (0, import_node_path10.join)(workspaceRoot, root, projectName, "package.json")
3263
+ (root) => (0, import_node_path11.join)(workspaceRoot, root, projectName, "package.json")
3194
3264
  ).find((candidate) => fileExists(candidate));
3195
3265
  if (manifestPath === void 0) {
3196
3266
  return;
@@ -3202,10 +3272,10 @@ function relocateRootRuntimeDependencies(workspaceRoot, projectName, before) {
3202
3272
  const remaining = Object.fromEntries(
3203
3273
  Object.entries(after).filter(([name]) => !added.includes(name))
3204
3274
  );
3205
- const rootManifest = readJson((0, import_node_path10.join)(workspaceRoot, "package.json"));
3275
+ const rootManifest = readJson((0, import_node_path11.join)(workspaceRoot, "package.json"));
3206
3276
  const { dependencies: _dropped, ...rest } = rootManifest;
3207
3277
  writeFileEnsured(
3208
- (0, import_node_path10.join)(workspaceRoot, "package.json"),
3278
+ (0, import_node_path11.join)(workspaceRoot, "package.json"),
3209
3279
  toJson(Object.keys(remaining).length > 0 ? { ...rest, dependencies: remaining } : rest)
3210
3280
  );
3211
3281
  logger.step(`Moved ${added.join(", ")} into ${projectName}'s own manifest`);
@@ -3244,28 +3314,28 @@ function scaffoldDotnetProject(workspaceRoot, projectRoot, identity, template) {
3244
3314
  }
3245
3315
  function writeCsharpExample(absoluteRoot, identity, kind) {
3246
3316
  if (kind === "classlib") {
3247
- (0, import_node_fs12.rmSync)((0, import_node_path11.join)(absoluteRoot, "Class1.cs"), { force: true });
3317
+ (0, import_node_fs13.rmSync)((0, import_node_path12.join)(absoluteRoot, "Class1.cs"), { force: true });
3248
3318
  }
3249
3319
  const files = csharpExampleFiles(identity);
3250
3320
  for (const [file, contents] of Object.entries(files)) {
3251
- writeFileEnsured((0, import_node_path11.join)(absoluteRoot, file), contents);
3321
+ writeFileEnsured((0, import_node_path12.join)(absoluteRoot, file), contents);
3252
3322
  }
3253
3323
  if (kind === "console") {
3254
- writeFileEnsured((0, import_node_path11.join)(absoluteRoot, "Program.cs"), csharpConsoleProgram(identity));
3324
+ writeFileEnsured((0, import_node_path12.join)(absoluteRoot, "Program.cs"), csharpConsoleProgram(identity));
3255
3325
  }
3256
3326
  }
3257
3327
  function addCsharpTestProject(workspaceRoot, projectRoot, identity) {
3258
- const name = (0, import_node_path11.basename)(projectRoot);
3328
+ const name = (0, import_node_path12.basename)(projectRoot);
3259
3329
  const testRoot = `tests/${name}`;
3260
3330
  scaffoldDotnetProject(workspaceRoot, testRoot, `${identity}.Tests`, "xunit");
3261
- (0, import_node_fs12.rmSync)((0, import_node_path11.join)(workspaceRoot, testRoot, "UnitTest1.cs"), { force: true });
3262
- writeFileEnsured((0, import_node_path11.join)(workspaceRoot, testRoot, "GreetUseCaseTests.cs"), csharpExampleTest(identity));
3331
+ (0, import_node_fs13.rmSync)((0, import_node_path12.join)(workspaceRoot, testRoot, "UnitTest1.cs"), { force: true });
3332
+ writeFileEnsured((0, import_node_path12.join)(workspaceRoot, testRoot, "GreetUseCaseTests.cs"), csharpExampleTest(identity));
3263
3333
  writeFileEnsured(
3264
- (0, import_node_path11.join)(workspaceRoot, testRoot, "project.json"),
3334
+ (0, import_node_path12.join)(workspaceRoot, testRoot, "project.json"),
3265
3335
  toJson({ name: `${name}-tests`, tags: ["type:csharp-test"] })
3266
3336
  );
3267
- const reference = (0, import_node_path11.join)(workspaceRoot, projectRoot, `${identity}.csproj`);
3268
- if (runShell("dotnet", ["add", (0, import_node_path11.join)(workspaceRoot, testRoot), "reference", reference], workspaceRoot) !== 0) {
3337
+ const reference = (0, import_node_path12.join)(workspaceRoot, projectRoot, `${identity}.csproj`);
3338
+ if (runShell("dotnet", ["add", (0, import_node_path12.join)(workspaceRoot, testRoot), "reference", reference], workspaceRoot) !== 0) {
3269
3339
  throw new Error(`dotnet add reference failed for ${testRoot}`);
3270
3340
  }
3271
3341
  }
@@ -3292,9 +3362,9 @@ function addCsharpApp(workspaceRoot, name, template = "console") {
3292
3362
  ensureAdmZip(workspaceRoot);
3293
3363
  const projectRoot = `apps/${name}`;
3294
3364
  scaffoldDotnetProject(workspaceRoot, projectRoot, pascalCase(name), template);
3295
- writeCsharpExample((0, import_node_path11.join)(workspaceRoot, projectRoot), pascalCase(name), template);
3365
+ writeCsharpExample((0, import_node_path12.join)(workspaceRoot, projectRoot), pascalCase(name), template);
3296
3366
  addCsharpTestProject(workspaceRoot, projectRoot, pascalCase(name));
3297
- addProjectJsonTargets((0, import_node_path11.join)(workspaceRoot, projectRoot, "project.json"), {
3367
+ addProjectJsonTargets((0, import_node_path12.join)(workspaceRoot, projectRoot, "project.json"), {
3298
3368
  package: csharpAppPackageTarget("csharp-app", projectRoot, name),
3299
3369
  start: csharpAppStartTarget(projectRoot)
3300
3370
  });
@@ -3387,7 +3457,7 @@ class CsharpVersionActions extends VersionActions {
3387
3457
  module.exports = CsharpVersionActions
3388
3458
  `;
3389
3459
  function writeCsharpVersionActions(workspaceRoot) {
3390
- writeFileEnsured((0, import_node_path11.join)(workspaceRoot, CSHARP_VERSION_ACTIONS_PATH), CSHARP_VERSION_ACTIONS);
3460
+ writeFileEnsured((0, import_node_path12.join)(workspaceRoot, CSHARP_VERSION_ACTIONS_PATH), CSHARP_VERSION_ACTIONS);
3391
3461
  }
3392
3462
  function addProjectJsonReleaseVersionActions(projectJsonPath) {
3393
3463
  const project = fileExists(projectJsonPath) ? readJson(projectJsonPath) : {};
@@ -3402,7 +3472,7 @@ function addProjectJsonReleaseVersionActions(projectJsonPath) {
3402
3472
  );
3403
3473
  }
3404
3474
  function addInitialVersion(csprojPath) {
3405
- const contents = (0, import_node_fs12.readFileSync)(csprojPath, "utf8");
3475
+ const contents = (0, import_node_fs13.readFileSync)(csprojPath, "utf8");
3406
3476
  writeFileEnsured(csprojPath, contents.replace("<PropertyGroup>", "<PropertyGroup>\n <Version>0.1.0</Version>"));
3407
3477
  }
3408
3478
  function csharpLibPublishTarget(projectRoot) {
@@ -3417,16 +3487,16 @@ async function addCsharpLib(workspaceRoot, name, options, kindProvided) {
3417
3487
  const projectRoot = `packages/${name}`;
3418
3488
  const identity = `${pascalScope(scope)}.${pascalCase(name)}`;
3419
3489
  scaffoldDotnetProject(workspaceRoot, projectRoot, identity, "classlib");
3420
- writeCsharpExample((0, import_node_path11.join)(workspaceRoot, projectRoot), identity, "classlib");
3490
+ writeCsharpExample((0, import_node_path12.join)(workspaceRoot, projectRoot), identity, "classlib");
3421
3491
  addCsharpTestProject(workspaceRoot, projectRoot, identity);
3422
- addInitialVersion((0, import_node_path11.join)(workspaceRoot, projectRoot, `${identity}.csproj`));
3492
+ addInitialVersion((0, import_node_path12.join)(workspaceRoot, projectRoot, `${identity}.csproj`));
3423
3493
  writeCsharpVersionActions(workspaceRoot);
3424
- addProjectJsonReleaseVersionActions((0, import_node_path11.join)(workspaceRoot, projectRoot, "project.json"));
3425
- addProjectJsonTargets((0, import_node_path11.join)(workspaceRoot, projectRoot, "project.json"), {
3494
+ addProjectJsonReleaseVersionActions((0, import_node_path12.join)(workspaceRoot, projectRoot, "project.json"));
3495
+ addProjectJsonTargets((0, import_node_path12.join)(workspaceRoot, projectRoot, "project.json"), {
3426
3496
  "nx-release-publish": csharpLibPublishTarget(projectRoot)
3427
3497
  });
3428
3498
  const registry = readMnciConfig(workspaceRoot).registry ?? { kind: "npm" };
3429
- writeFileEnsured((0, import_node_path11.join)(workspaceRoot, "nuget.config"), nugetConfigContent(registry, scope));
3499
+ writeFileEnsured((0, import_node_path12.join)(workspaceRoot, "nuget.config"), nugetConfigContent(registry, scope));
3430
3500
  registerProjectCommands(workspaceRoot, name, { build: true });
3431
3501
  }
3432
3502
  function addCsharpInternalLib(workspaceRoot, name) {
@@ -3435,7 +3505,7 @@ function addCsharpInternalLib(workspaceRoot, name) {
3435
3505
  const projectRoot = `libs/${name}`;
3436
3506
  const identity = pascalCase(name);
3437
3507
  scaffoldDotnetProject(workspaceRoot, projectRoot, identity, "classlib");
3438
- writeCsharpExample((0, import_node_path11.join)(workspaceRoot, projectRoot), identity, "classlib");
3508
+ writeCsharpExample((0, import_node_path12.join)(workspaceRoot, projectRoot), identity, "classlib");
3439
3509
  addCsharpTestProject(workspaceRoot, projectRoot, identity);
3440
3510
  registerProjectCommands(workspaceRoot, name, { build: false });
3441
3511
  logger.step(
@@ -3504,20 +3574,20 @@ function addCsharpFunctionApp(workspaceRoot, name) {
3504
3574
  const projectRoot = `apps/${name}`;
3505
3575
  const identity = pascalCase(name);
3506
3576
  scaffoldDotnetProject(workspaceRoot, projectRoot, identity, "console");
3507
- const absoluteRoot = (0, import_node_path11.join)(workspaceRoot, projectRoot);
3508
- writeFileEnsured((0, import_node_path11.join)(absoluteRoot, `${identity}.csproj`), csharpFunctionAppCsproj());
3509
- writeFileEnsured((0, import_node_path11.join)(absoluteRoot, "Program.cs"), CSHARP_FUNCTION_APP_PROGRAM);
3510
- writeFileEnsured((0, import_node_path11.join)(absoluteRoot, "Hello.cs"), csharpFunctionAppHello(identity));
3577
+ const absoluteRoot = (0, import_node_path12.join)(workspaceRoot, projectRoot);
3578
+ writeFileEnsured((0, import_node_path12.join)(absoluteRoot, `${identity}.csproj`), csharpFunctionAppCsproj());
3579
+ writeFileEnsured((0, import_node_path12.join)(absoluteRoot, "Program.cs"), CSHARP_FUNCTION_APP_PROGRAM);
3580
+ writeFileEnsured((0, import_node_path12.join)(absoluteRoot, "Hello.cs"), csharpFunctionAppHello(identity));
3511
3581
  const example = csharpExampleFiles(identity);
3512
3582
  for (const [file, contents] of Object.entries(example)) {
3513
- writeFileEnsured((0, import_node_path11.join)(absoluteRoot, file), contents);
3583
+ writeFileEnsured((0, import_node_path12.join)(absoluteRoot, file), contents);
3514
3584
  }
3515
- writeFileEnsured((0, import_node_path11.join)(absoluteRoot, "host.json"), CSHARP_FUNCTION_APP_HOST_JSON);
3585
+ writeFileEnsured((0, import_node_path12.join)(absoluteRoot, "host.json"), CSHARP_FUNCTION_APP_HOST_JSON);
3516
3586
  if (runShell("dotnet", ["restore", projectRoot], workspaceRoot) !== 0) {
3517
3587
  throw new Error(`dotnet restore failed for ${projectRoot}`);
3518
3588
  }
3519
3589
  addCsharpTestProject(workspaceRoot, projectRoot, identity);
3520
- addProjectJsonTargets((0, import_node_path11.join)(absoluteRoot, "project.json"), {
3590
+ addProjectJsonTargets((0, import_node_path12.join)(absoluteRoot, "project.json"), {
3521
3591
  package: csharpAppPackageTarget("csharp-function-app", projectRoot, name),
3522
3592
  start: csharpFunctionAppStartTarget(projectRoot)
3523
3593
  });
@@ -3525,7 +3595,7 @@ function addCsharpFunctionApp(workspaceRoot, name) {
3525
3595
  }
3526
3596
 
3527
3597
  // src/project-scaffolding/flutter.use-case.ts
3528
- var import_node_path12 = require("path");
3598
+ var import_node_path13 = require("path");
3529
3599
  function flutterAppStartTarget(name) {
3530
3600
  return {
3531
3601
  executor: "nx:run-commands",
@@ -3561,7 +3631,7 @@ function addFlutterApp(workspaceRoot, name) {
3561
3631
  prepareFlutter(workspaceRoot);
3562
3632
  ensureAdmZip(workspaceRoot);
3563
3633
  runNx(["g", "@mnci/nx-flutter:application", name, "--no-interactive"], workspaceRoot);
3564
- addProjectJsonTargets((0, import_node_path12.join)(workspaceRoot, "apps", name, "project.json"), {
3634
+ addProjectJsonTargets((0, import_node_path13.join)(workspaceRoot, "apps", name, "project.json"), {
3565
3635
  start: flutterAppStartTarget(name)
3566
3636
  });
3567
3637
  registerProjectCommands(workspaceRoot, name, { build: true, start: `nx run ${name}:start` });
@@ -3578,8 +3648,8 @@ function addFlutterInternalLib(workspaceRoot, name) {
3578
3648
  }
3579
3649
 
3580
3650
  // src/project-scaffolding/go.use-case.ts
3581
- var import_node_fs16 = require("fs");
3582
- var import_node_path16 = require("path");
3651
+ var import_node_fs17 = require("fs");
3652
+ var import_node_path17 = require("path");
3583
3653
 
3584
3654
  // src/project-scaffolding/go-example.algorithm.ts
3585
3655
  function greetingContract(packageName) {
@@ -3648,14 +3718,14 @@ function goAppExampleFiles(modulePath) {
3648
3718
  }
3649
3719
 
3650
3720
  // src/go-workspace/go-plugin.use-case.ts
3651
- var import_node_fs13 = require("fs");
3652
- var import_node_path13 = require("path");
3721
+ var import_node_fs14 = require("fs");
3722
+ var import_node_path14 = require("path");
3653
3723
  var NX_GO_PLUGIN = "@nx-go/nx-go";
3654
3724
  function hasGoProject(workspaceRoot) {
3655
- const projectFiles = ["apps", "libs", "packages"].flatMap((directory) => (0, import_node_fs13.globSync)(`${directory}/*/project.json`, { cwd: workspaceRoot }));
3725
+ const projectFiles = ["apps", "libs", "packages"].flatMap((directory) => (0, import_node_fs14.globSync)(`${directory}/*/project.json`, { cwd: workspaceRoot }));
3656
3726
  return projectFiles.some((projectFile) => {
3657
3727
  try {
3658
- const { tags } = JSON.parse((0, import_node_fs13.readFileSync)((0, import_node_path13.join)(workspaceRoot, projectFile), "utf8"));
3728
+ const { tags } = JSON.parse((0, import_node_fs14.readFileSync)((0, import_node_path14.join)(workspaceRoot, projectFile), "utf8"));
3659
3729
  return (tags ?? []).some((tag) => tag.startsWith("type:go-"));
3660
3730
  } catch {
3661
3731
  return false;
@@ -3663,7 +3733,7 @@ function hasGoProject(workspaceRoot) {
3663
3733
  });
3664
3734
  }
3665
3735
  function isNxGoPluginRegistered(workspaceRoot) {
3666
- const nxJsonPath = (0, import_node_path13.join)(workspaceRoot, "nx.json");
3736
+ const nxJsonPath = (0, import_node_path14.join)(workspaceRoot, "nx.json");
3667
3737
  if (!fileExists(nxJsonPath)) {
3668
3738
  return false;
3669
3739
  }
@@ -3690,7 +3760,7 @@ function goModulePrefix(workspaceRoot) {
3690
3760
  return result.status === 0 ? modulePrefixFromRemoteUrl(result.stdout) : void 0;
3691
3761
  }
3692
3762
  function registerNxGoPlugin(workspaceRoot) {
3693
- const nxJsonPath = (0, import_node_path13.join)(workspaceRoot, "nx.json");
3763
+ const nxJsonPath = (0, import_node_path14.join)(workspaceRoot, "nx.json");
3694
3764
  if (!fileExists(nxJsonPath)) {
3695
3765
  return false;
3696
3766
  }
@@ -3714,8 +3784,8 @@ function registerNxGoPlugin(workspaceRoot) {
3714
3784
  }
3715
3785
 
3716
3786
  // src/project-scaffolding/go-release.use-case.ts
3717
- var import_node_fs14 = require("fs");
3718
- var import_node_path14 = require("path");
3787
+ var import_node_fs15 = require("fs");
3788
+ var import_node_path15 = require("path");
3719
3789
  var GO_RELEASE_SCRIPT_PATH = "tools/go-app-release.cjs";
3720
3790
  var GO_RELEASE_SCRIPT = String.raw`#!/usr/bin/env node
3721
3791
  // Written by mnci: 'mnci add go-app --release' creates it and 'mnci upgrade'
@@ -3841,7 +3911,7 @@ var GO_RELEASE_PUBLISH_TARGET = {
3841
3911
  }
3842
3912
  };
3843
3913
  function makeGoAppReleasable(workspaceRoot, name) {
3844
- const projectJsonPath = (0, import_node_path14.join)(workspaceRoot, "apps", name, "project.json");
3914
+ const projectJsonPath = (0, import_node_path15.join)(workspaceRoot, "apps", name, "project.json");
3845
3915
  if (!fileExists(projectJsonPath)) {
3846
3916
  throw new Error(`No Go app at apps/${name}: cannot make it releasable.`);
3847
3917
  }
@@ -3862,22 +3932,22 @@ function makeGoAppReleasable(workspaceRoot, name) {
3862
3932
  }
3863
3933
  })
3864
3934
  );
3865
- writeFileEnsured((0, import_node_path14.join)(workspaceRoot, GO_RELEASE_SCRIPT_PATH), GO_RELEASE_SCRIPT);
3935
+ writeFileEnsured((0, import_node_path15.join)(workspaceRoot, GO_RELEASE_SCRIPT_PATH), GO_RELEASE_SCRIPT);
3866
3936
  }
3867
3937
  function refreshGoReleaseScript(workspaceRoot) {
3868
- const apps = (0, import_node_path14.join)(workspaceRoot, "apps");
3938
+ const apps = (0, import_node_path15.join)(workspaceRoot, "apps");
3869
3939
  let entries;
3870
3940
  try {
3871
- entries = (0, import_node_fs14.readdirSync)(apps);
3941
+ entries = (0, import_node_fs15.readdirSync)(apps);
3872
3942
  } catch {
3873
3943
  return false;
3874
3944
  }
3875
3945
  const hasReleasableApp = entries.some((entry) => {
3876
- const projectJsonPath = (0, import_node_path14.join)(apps, entry, "project.json");
3946
+ const projectJsonPath = (0, import_node_path15.join)(apps, entry, "project.json");
3877
3947
  return fileExists(projectJsonPath) && (readJson(projectJsonPath).tags ?? []).includes(GO_RELEASE_TAG);
3878
3948
  });
3879
- const path = (0, import_node_path14.join)(workspaceRoot, GO_RELEASE_SCRIPT_PATH);
3880
- if (!hasReleasableApp || fileExists(path) && (0, import_node_fs14.readFileSync)(path, "utf8") === GO_RELEASE_SCRIPT) {
3949
+ const path = (0, import_node_path15.join)(workspaceRoot, GO_RELEASE_SCRIPT_PATH);
3950
+ if (!hasReleasableApp || fileExists(path) && (0, import_node_fs15.readFileSync)(path, "utf8") === GO_RELEASE_SCRIPT) {
3881
3951
  return false;
3882
3952
  }
3883
3953
  writeFileEnsured(path, GO_RELEASE_SCRIPT);
@@ -3885,8 +3955,8 @@ function refreshGoReleaseScript(workspaceRoot) {
3885
3955
  }
3886
3956
 
3887
3957
  // src/project-scaffolding/go-web.use-case.ts
3888
- var import_node_fs15 = require("fs");
3889
- var import_node_path15 = require("path");
3958
+ var import_node_fs16 = require("fs");
3959
+ var import_node_path16 = require("path");
3890
3960
  var TARGETS_NEEDING_THE_FRONTEND = ["build", "test", "lint", "start", "build-all", "build-native"];
3891
3961
  var DEFAULT_ADDRESS = "127.0.0.1:8080";
3892
3962
  var GO_WEB_SOURCE = `package main
@@ -3964,18 +4034,18 @@ func TestWebHandlerServesTheBuiltFrontend(t *testing.T) {
3964
4034
  }
3965
4035
  `;
3966
4036
  function assertWebApp(workspaceRoot, web) {
3967
- const directory = (0, import_node_path15.join)(workspaceRoot, "apps", web);
3968
- const isReactApp = fileExists((0, import_node_path15.join)(directory, "package.json")) && (0, import_node_fs15.readdirSync)(directory).some((entry) => entry.startsWith("vite.config."));
4037
+ const directory = (0, import_node_path16.join)(workspaceRoot, "apps", web);
4038
+ const isReactApp = fileExists((0, import_node_path16.join)(directory, "package.json")) && (0, import_node_fs16.readdirSync)(directory).some((entry) => entry.startsWith("vite.config."));
3969
4039
  if (!isReactApp) {
3970
4040
  throw new Error(`--web ${web}: no React app at apps/${web}. Add it first with \`mnci add react-app ${web}\`.`);
3971
4041
  }
3972
4042
  }
3973
4043
  function webProjectName(workspaceRoot, web) {
3974
- const manifest = readJson((0, import_node_path15.join)(workspaceRoot, "apps", web, "package.json"));
4044
+ const manifest = readJson((0, import_node_path16.join)(workspaceRoot, "apps", web, "package.json"));
3975
4045
  return manifest.nx?.name ?? manifest.name ?? web;
3976
4046
  }
3977
4047
  function addApiProxy(viteConfigPath) {
3978
- const source = (0, import_node_fs15.readFileSync)(viteConfigPath, "utf8");
4048
+ const source = (0, import_node_fs16.readFileSync)(viteConfigPath, "utf8");
3979
4049
  if (source.includes("'/api'") || source.includes('"/api"')) {
3980
4050
  return false;
3981
4051
  }
@@ -3988,7 +4058,7 @@ function addApiProxy(viteConfigPath) {
3988
4058
  return true;
3989
4059
  }
3990
4060
  function wireGoAppToWeb(workspaceRoot, name, web) {
3991
- const projectJsonPath = (0, import_node_path15.join)(workspaceRoot, "apps", name, "project.json");
4061
+ const projectJsonPath = (0, import_node_path16.join)(workspaceRoot, "apps", name, "project.json");
3992
4062
  const project = readJson(projectJsonPath);
3993
4063
  const webName = webProjectName(workspaceRoot, web);
3994
4064
  const targets = project.targets ?? {};
@@ -4014,13 +4084,13 @@ function wireGoAppToWeb(workspaceRoot, name, web) {
4014
4084
  projectJsonPath,
4015
4085
  toJson({ ...project, implicitDependencies: [.../* @__PURE__ */ new Set([...project.implicitDependencies ?? [], webName])], targets })
4016
4086
  );
4017
- const directory = (0, import_node_path15.join)(workspaceRoot, "apps", name);
4018
- writeFileEnsured((0, import_node_path15.join)(directory, ".gitignore"), "/web/\n");
4019
- writeFileEnsured((0, import_node_path15.join)(directory, "web.go"), GO_WEB_SOURCE);
4020
- writeFileEnsured((0, import_node_path15.join)(directory, "main.go"), GO_WEB_MAIN);
4021
- writeFileEnsured((0, import_node_path15.join)(directory, "main_test.go"), GO_WEB_MAIN_TEST);
4022
- const viteConfig = (0, import_node_fs15.readdirSync)((0, import_node_path15.join)(workspaceRoot, "apps", web)).find((entry) => entry.startsWith("vite.config."));
4023
- if (viteConfig === void 0 || !addApiProxy((0, import_node_path15.join)(workspaceRoot, "apps", web, viteConfig))) {
4087
+ const directory = (0, import_node_path16.join)(workspaceRoot, "apps", name);
4088
+ writeFileEnsured((0, import_node_path16.join)(directory, ".gitignore"), "/web/\n");
4089
+ writeFileEnsured((0, import_node_path16.join)(directory, "web.go"), GO_WEB_SOURCE);
4090
+ writeFileEnsured((0, import_node_path16.join)(directory, "main.go"), GO_WEB_MAIN);
4091
+ writeFileEnsured((0, import_node_path16.join)(directory, "main_test.go"), GO_WEB_MAIN_TEST);
4092
+ const viteConfig = (0, import_node_fs16.readdirSync)((0, import_node_path16.join)(workspaceRoot, "apps", web)).find((entry) => entry.startsWith("vite.config."));
4093
+ if (viteConfig === void 0 || !addApiProxy((0, import_node_path16.join)(workspaceRoot, "apps", web, viteConfig))) {
4024
4094
  logger.warn(
4025
4095
  `Could not add the /api proxy to apps/${web}'s Vite config: add \`server: { proxy: { '/api': 'http://${DEFAULT_ADDRESS}' } }\` yourself, so \`nx run ${name}:dev\` reaches the Go server.`
4026
4096
  );
@@ -4054,7 +4124,7 @@ function ensureNxGoPlugin(workspaceRoot) {
4054
4124
  }
4055
4125
  }
4056
4126
  function ensureGoModule(workspaceRoot) {
4057
- if (fileExists((0, import_node_path16.join)(workspaceRoot, "go.work")) || fileExists((0, import_node_path16.join)(workspaceRoot, "go.mod"))) {
4127
+ if (fileExists((0, import_node_path17.join)(workspaceRoot, "go.work")) || fileExists((0, import_node_path17.join)(workspaceRoot, "go.mod"))) {
4058
4128
  return;
4059
4129
  }
4060
4130
  logger.step("Bootstrapping the Go workspace (go.work, one module per project)");
@@ -4062,38 +4132,38 @@ function ensureGoModule(workspaceRoot) {
4062
4132
  }
4063
4133
  function readGoModModule(goModPath) {
4064
4134
  try {
4065
- return /^module\s+(\S+)/m.exec((0, import_node_fs16.readFileSync)(goModPath, "utf8"))?.[1];
4135
+ return /^module\s+(\S+)/m.exec((0, import_node_fs17.readFileSync)(goModPath, "utf8"))?.[1];
4066
4136
  } catch {
4067
4137
  return void 0;
4068
4138
  }
4069
4139
  }
4070
4140
  function goModulePathFor(workspaceRoot, projectDir) {
4071
- const projectModule = readGoModModule((0, import_node_path16.join)(workspaceRoot, projectDir, "go.mod"));
4141
+ const projectModule = readGoModModule((0, import_node_path17.join)(workspaceRoot, projectDir, "go.mod"));
4072
4142
  if (projectModule !== void 0) {
4073
4143
  return projectModule;
4074
4144
  }
4075
- const rootModule = readGoModModule((0, import_node_path16.join)(workspaceRoot, "go.mod"));
4145
+ const rootModule = readGoModModule((0, import_node_path17.join)(workspaceRoot, "go.mod"));
4076
4146
  return rootModule === void 0 ? void 0 : `${rootModule}/${projectDir}`;
4077
4147
  }
4078
4148
  function setGoModulePath(workspaceRoot, projectDir) {
4079
4149
  const prefix = goModulePrefix(workspaceRoot);
4080
- const goModPath = (0, import_node_path16.join)(workspaceRoot, projectDir, "go.mod");
4150
+ const goModPath = (0, import_node_path17.join)(workspaceRoot, projectDir, "go.mod");
4081
4151
  if (prefix === void 0 || !fileExists(goModPath)) {
4082
4152
  return;
4083
4153
  }
4084
- const rewritten = (0, import_node_fs16.readFileSync)(goModPath, "utf8").replace(/^module\s+\S+/m, () => `module ${prefix}/${projectDir}`);
4154
+ const rewritten = (0, import_node_fs17.readFileSync)(goModPath, "utf8").replace(/^module\s+\S+/m, () => `module ${prefix}/${projectDir}`);
4085
4155
  writeFileEnsured(goModPath, rewritten);
4086
4156
  }
4087
4157
  function writeGoAppExample(workspaceRoot, projectDir) {
4088
- const goModPath = (0, import_node_path16.join)(workspaceRoot, projectDir, "go.mod");
4089
- const modulePath = fileExists(goModPath) ? /^module\s+(\S+)/m.exec((0, import_node_fs16.readFileSync)(goModPath, "utf8"))?.[1] : void 0;
4158
+ const goModPath = (0, import_node_path17.join)(workspaceRoot, projectDir, "go.mod");
4159
+ const modulePath = fileExists(goModPath) ? /^module\s+(\S+)/m.exec((0, import_node_fs17.readFileSync)(goModPath, "utf8"))?.[1] : void 0;
4090
4160
  if (modulePath === void 0) {
4091
4161
  return;
4092
4162
  }
4093
- (0, import_node_fs16.rmSync)((0, import_node_path16.join)(workspaceRoot, projectDir, "main_test.go"), { force: true });
4163
+ (0, import_node_fs17.rmSync)((0, import_node_path17.join)(workspaceRoot, projectDir, "main_test.go"), { force: true });
4094
4164
  const example = goAppExampleFiles(modulePath);
4095
4165
  for (const [relative, contents] of Object.entries(example)) {
4096
- writeFileEnsured((0, import_node_path16.join)(workspaceRoot, projectDir, relative), contents);
4166
+ writeFileEnsured((0, import_node_path17.join)(workspaceRoot, projectDir, relative), contents);
4097
4167
  }
4098
4168
  }
4099
4169
  function goTestTarget() {
@@ -4171,16 +4241,16 @@ function goNativePackageTarget(name) {
4171
4241
  }
4172
4242
  function addGoPlatformTargets(workspaceRoot) {
4173
4243
  const changed = [];
4174
- const apps = (0, import_node_path16.join)(workspaceRoot, "apps");
4244
+ const apps = (0, import_node_path17.join)(workspaceRoot, "apps");
4175
4245
  if (!fileExists(apps)) {
4176
4246
  return changed;
4177
4247
  }
4178
- for (const name of (0, import_node_fs16.readdirSync)(apps)) {
4179
- const projectJsonPath = (0, import_node_path16.join)(apps, name, "project.json");
4248
+ for (const name of (0, import_node_fs17.readdirSync)(apps)) {
4249
+ const projectJsonPath = (0, import_node_path17.join)(apps, name, "project.json");
4180
4250
  if (!fileExists(projectJsonPath)) {
4181
4251
  continue;
4182
4252
  }
4183
- const project = JSON.parse((0, import_node_fs16.readFileSync)(projectJsonPath, "utf8"));
4253
+ const project = JSON.parse((0, import_node_fs17.readFileSync)(projectJsonPath, "utf8"));
4184
4254
  const tag = (project.tags ?? []).find((each) => each === "type:go-app" || each === "type:go-function-app")?.slice("type:".length);
4185
4255
  if (tag === void 0 || (project.tags ?? []).includes(GO_CGO_TAG)) {
4186
4256
  continue;
@@ -4216,8 +4286,8 @@ function goLibraryIdentifiers(projectName) {
4216
4286
  }
4217
4287
  function reshapeGoLibraryScaffold(projectRoot, projectName) {
4218
4288
  const { packageName, fileStem } = goLibraryIdentifiers(projectName);
4219
- (0, import_node_fs16.rmSync)((0, import_node_path16.join)(projectRoot, `${projectName}.go`), { force: true });
4220
- (0, import_node_fs16.rmSync)((0, import_node_path16.join)(projectRoot, `${projectName}_test.go`), { force: true });
4289
+ (0, import_node_fs17.rmSync)((0, import_node_path17.join)(projectRoot, `${projectName}.go`), { force: true });
4290
+ (0, import_node_fs17.rmSync)((0, import_node_path17.join)(projectRoot, `${projectName}_test.go`), { force: true });
4221
4291
  const files = [
4222
4292
  [
4223
4293
  "doc.go",
@@ -4227,7 +4297,7 @@ package ${packageName}
4227
4297
  `
4228
4298
  ],
4229
4299
  [
4230
- (0, import_node_path16.join)(packageName, "doc.go"),
4300
+ (0, import_node_path17.join)(packageName, "doc.go"),
4231
4301
  `// Package ${packageName} is the starter slice of ${projectName}: rename it after
4232
4302
  // the outcome it delivers, and add one package per further outcome.
4233
4303
  package ${packageName}
@@ -4235,11 +4305,11 @@ package ${packageName}
4235
4305
  ],
4236
4306
  // The starter slice: a contract, a use case and its test (see goLibraryExampleFiles).
4237
4307
  ...Object.entries(goLibraryExampleFiles(packageName, fileStem)).map(
4238
- ([name, content]) => [(0, import_node_path16.join)(packageName, name), content]
4308
+ ([name, content]) => [(0, import_node_path17.join)(packageName, name), content]
4239
4309
  )
4240
4310
  ];
4241
4311
  for (const [relativePath, content] of files) {
4242
- const path = (0, import_node_path16.join)(projectRoot, relativePath);
4312
+ const path = (0, import_node_path17.join)(projectRoot, relativePath);
4243
4313
  if (!fileExists(path)) {
4244
4314
  writeFileEnsured(path, content);
4245
4315
  }
@@ -4277,7 +4347,7 @@ function addGoApp(workspaceRoot, name, options = {}) {
4277
4347
  if (options.web === void 0) {
4278
4348
  writeGoAppExample(workspaceRoot, `apps/${name}`);
4279
4349
  }
4280
- addProjectJsonTargets((0, import_node_path16.join)(workspaceRoot, "apps", name, "project.json"), {
4350
+ addProjectJsonTargets((0, import_node_path17.join)(workspaceRoot, "apps", name, "project.json"), {
4281
4351
  build: goBuildTarget(name),
4282
4352
  test: goTestTarget(),
4283
4353
  lint: goLintTarget(),
@@ -4317,7 +4387,7 @@ function addGoFunctionApp(workspaceRoot, name) {
4317
4387
  );
4318
4388
  setGoModulePath(workspaceRoot, `apps/${name}`);
4319
4389
  writeGoAppExample(workspaceRoot, `apps/${name}`);
4320
- addProjectJsonTargets((0, import_node_path16.join)(workspaceRoot, "apps", name, "project.json"), {
4390
+ addProjectJsonTargets((0, import_node_path17.join)(workspaceRoot, "apps", name, "project.json"), {
4321
4391
  "build": goBuildTarget(name),
4322
4392
  "test": goTestTarget(),
4323
4393
  "lint": goLintTarget(),
@@ -4341,11 +4411,11 @@ function addGoLib(workspaceRoot, name) {
4341
4411
  workspaceRoot
4342
4412
  );
4343
4413
  setGoModulePath(workspaceRoot, `packages/${name}`);
4344
- addProjectJsonTargets((0, import_node_path16.join)(workspaceRoot, "packages", name, "project.json"), {
4414
+ addProjectJsonTargets((0, import_node_path17.join)(workspaceRoot, "packages", name, "project.json"), {
4345
4415
  test: goTestTarget(),
4346
4416
  lint: goLintTarget()
4347
4417
  });
4348
- const slice = reshapeGoLibraryScaffold((0, import_node_path16.join)(workspaceRoot, "packages", name), name);
4418
+ const slice = reshapeGoLibraryScaffold((0, import_node_path17.join)(workspaceRoot, "packages", name), name);
4349
4419
  registerProjectCommands(workspaceRoot, name, { build: false });
4350
4420
  const module2 = goModulePathFor(workspaceRoot, `packages/${name}`);
4351
4421
  if (module2) {
@@ -4366,11 +4436,11 @@ function addGoInternalLib(workspaceRoot, name) {
4366
4436
  workspaceRoot
4367
4437
  );
4368
4438
  setGoModulePath(workspaceRoot, `libs/${name}`);
4369
- addProjectJsonTargets((0, import_node_path16.join)(workspaceRoot, "libs", name, "project.json"), {
4439
+ addProjectJsonTargets((0, import_node_path17.join)(workspaceRoot, "libs", name, "project.json"), {
4370
4440
  test: goTestTarget(),
4371
4441
  lint: goLintTarget()
4372
4442
  });
4373
- const slice = reshapeGoLibraryScaffold((0, import_node_path16.join)(workspaceRoot, "libs", name), name);
4443
+ const slice = reshapeGoLibraryScaffold((0, import_node_path17.join)(workspaceRoot, "libs", name), name);
4374
4444
  registerProjectCommands(workspaceRoot, name, { build: false });
4375
4445
  const module2 = goModulePathFor(workspaceRoot, `libs/${name}`);
4376
4446
  if (module2) {
@@ -4379,7 +4449,7 @@ function addGoInternalLib(workspaceRoot, name) {
4379
4449
  }
4380
4450
 
4381
4451
  // src/project-scaffolding/node.use-case.ts
4382
- var import_node_path17 = require("path");
4452
+ var import_node_path18 = require("path");
4383
4453
 
4384
4454
  // src/project-scaffolding/node-app-example.algorithm.ts
4385
4455
  var GREET_USE_CASE = `import type { Greeting } from './greeting.contract'
@@ -4502,12 +4572,12 @@ function runNodeApp(workspaceRoot, name, stack, framework) {
4502
4572
  ],
4503
4573
  workspaceRoot
4504
4574
  );
4505
- const appRoot = (0, import_node_path17.join)(workspaceRoot, "apps", name);
4575
+ const appRoot = (0, import_node_path18.join)(workspaceRoot, "apps", name);
4506
4576
  separateDeclarationOutput(appRoot);
4507
4577
  repairAssetMapping(appRoot, name);
4508
4578
  }
4509
4579
  function separateDeclarationOutput(appRoot) {
4510
- const tsconfigPath = (0, import_node_path17.join)(appRoot, "tsconfig.app.json");
4580
+ const tsconfigPath = (0, import_node_path18.join)(appRoot, "tsconfig.app.json");
4511
4581
  if (!fileExists(tsconfigPath)) {
4512
4582
  return;
4513
4583
  }
@@ -4529,7 +4599,7 @@ function separateDeclarationOutput(appRoot) {
4529
4599
  );
4530
4600
  }
4531
4601
  function repairAssetMapping(appRoot, name) {
4532
- const manifestPath = (0, import_node_path17.join)(appRoot, "package.json");
4602
+ const manifestPath = (0, import_node_path18.join)(appRoot, "package.json");
4533
4603
  if (!fileExists(manifestPath)) {
4534
4604
  return;
4535
4605
  }
@@ -4558,11 +4628,11 @@ function addNodeApp(workspaceRoot, name, stack, framework = "none") {
4558
4628
  const example = nodeAppExampleFiles(framework);
4559
4629
  if (example !== null) {
4560
4630
  for (const [relative, contents] of Object.entries(example)) {
4561
- writeFileEnsured((0, import_node_path17.join)(workspaceRoot, "apps", name, "src", relative), contents);
4631
+ writeFileEnsured((0, import_node_path18.join)(workspaceRoot, "apps", name, "src", relative), contents);
4562
4632
  }
4563
4633
  }
4564
4634
  ensureAdmZip(workspaceRoot);
4565
- addNxTargets((0, import_node_path17.join)(workspaceRoot, "apps", name, "package.json"), {
4635
+ addNxTargets((0, import_node_path18.join)(workspaceRoot, "apps", name, "package.json"), {
4566
4636
  package: nodeAppPackageTarget(name)
4567
4637
  });
4568
4638
  removeGeneratedEslintConfig(workspaceRoot, `apps/${name}`);
@@ -4631,10 +4701,10 @@ describe('greet', () => {
4631
4701
  })
4632
4702
  `;
4633
4703
  function repairNodeFunctionAppManifest(nodeFunctionAppRoot, workspaceRoot) {
4634
- const manifestPath = (0, import_node_path17.join)(nodeFunctionAppRoot, "package.json");
4704
+ const manifestPath = (0, import_node_path18.join)(nodeFunctionAppRoot, "package.json");
4635
4705
  const manifest = readJson(manifestPath);
4636
4706
  const azureFunctionsVersion = readJson(
4637
- (0, import_node_path17.join)(workspaceRoot, "node_modules/@azure/functions/package.json")
4707
+ (0, import_node_path18.join)(workspaceRoot, "node_modules/@azure/functions/package.json")
4638
4708
  ).version;
4639
4709
  const dependencies = manifest.dependencies ?? {};
4640
4710
  writeFileEnsured(
@@ -4677,20 +4747,20 @@ function nodeFunctionAppStartTarget(name) {
4677
4747
  function addNodeFunctionApp(workspaceRoot, name, stack, empty = false) {
4678
4748
  runNodeApp(workspaceRoot, name, stack, "none");
4679
4749
  ensureAzureFunctionsPackage(workspaceRoot);
4680
- const nodeFunctionAppRoot = (0, import_node_path17.join)(workspaceRoot, "apps", name);
4681
- writeFileEnsured((0, import_node_path17.join)(nodeFunctionAppRoot, "src/main.ts"), empty ? NODE_FUNCTION_APP_MAIN_EMPTY : NODE_FUNCTION_APP_MAIN);
4750
+ const nodeFunctionAppRoot = (0, import_node_path18.join)(workspaceRoot, "apps", name);
4751
+ writeFileEnsured((0, import_node_path18.join)(nodeFunctionAppRoot, "src/main.ts"), empty ? NODE_FUNCTION_APP_MAIN_EMPTY : NODE_FUNCTION_APP_MAIN);
4682
4752
  if (!empty) {
4683
- const slice = (0, import_node_path17.join)(nodeFunctionAppRoot, "src/hello");
4684
- writeFileEnsured((0, import_node_path17.join)(slice, "hello.handler.ts"), NODE_FUNCTION_APP_HELLO);
4685
- writeFileEnsured((0, import_node_path17.join)(slice, "greet.use-case.ts"), NODE_FUNCTION_APP_GREET_USE_CASE);
4686
- writeFileEnsured((0, import_node_path17.join)(slice, "greet.use-case.spec.ts"), NODE_FUNCTION_APP_GREET_SPEC);
4687
- writeFileEnsured((0, import_node_path17.join)(slice, "greeting.contract.ts"), NODE_FUNCTION_APP_GREETING_CONTRACT);
4688
- writeFileEnsured((0, import_node_path17.join)(slice, "index.ts"), NODE_FUNCTION_APP_HELLO_BARREL);
4689
- }
4690
- writeFileEnsured((0, import_node_path17.join)(nodeFunctionAppRoot, "host.json"), NODE_FUNCTION_APP_HOST_JSON);
4753
+ const slice = (0, import_node_path18.join)(nodeFunctionAppRoot, "src/hello");
4754
+ writeFileEnsured((0, import_node_path18.join)(slice, "hello.handler.ts"), NODE_FUNCTION_APP_HELLO);
4755
+ writeFileEnsured((0, import_node_path18.join)(slice, "greet.use-case.ts"), NODE_FUNCTION_APP_GREET_USE_CASE);
4756
+ writeFileEnsured((0, import_node_path18.join)(slice, "greet.use-case.spec.ts"), NODE_FUNCTION_APP_GREET_SPEC);
4757
+ writeFileEnsured((0, import_node_path18.join)(slice, "greeting.contract.ts"), NODE_FUNCTION_APP_GREETING_CONTRACT);
4758
+ writeFileEnsured((0, import_node_path18.join)(slice, "index.ts"), NODE_FUNCTION_APP_HELLO_BARREL);
4759
+ }
4760
+ writeFileEnsured((0, import_node_path18.join)(nodeFunctionAppRoot, "host.json"), NODE_FUNCTION_APP_HOST_JSON);
4691
4761
  repairNodeFunctionAppManifest(nodeFunctionAppRoot, workspaceRoot);
4692
4762
  ensureAdmZip(workspaceRoot);
4693
- addNxTargets((0, import_node_path17.join)(nodeFunctionAppRoot, "package.json"), {
4763
+ addNxTargets((0, import_node_path18.join)(nodeFunctionAppRoot, "package.json"), {
4694
4764
  package: nodeFunctionAppPackageTarget(name),
4695
4765
  prune: nodeFunctionAppPruneTarget(name),
4696
4766
  start: nodeFunctionAppStartTarget(name),
@@ -4702,11 +4772,11 @@ function addNodeFunctionApp(workspaceRoot, name, stack, empty = false) {
4702
4772
  }
4703
4773
 
4704
4774
  // src/project-scaffolding/npm-lib.use-case.ts
4705
- var import_node_path21 = require("path");
4775
+ var import_node_path22 = require("path");
4706
4776
 
4707
4777
  // src/rollup-library/repair-publishable-manifest.use-case.ts
4708
- var import_node_fs17 = require("fs");
4709
- var import_node_path18 = require("path");
4778
+ var import_node_fs18 = require("fs");
4779
+ var import_node_path19 = require("path");
4710
4780
  var WRONG_TYPES_PATH = "./dist/index.esm.d.ts";
4711
4781
  var ACTUAL_TYPES_PATH = "./dist/src/index.d.ts";
4712
4782
  var DECLARATION_MAP_EXCLUSION = "!**/*.d.ts.map";
@@ -4729,14 +4799,14 @@ function repairPublishableManifest(manifestPath) {
4729
4799
  }
4730
4800
  function repairPublishableManifests(workspaceRoot) {
4731
4801
  const changed = [];
4732
- const manifests = (0, import_node_fs17.globSync)(["packages/*/package.json", "libs/*/package.json"], {
4802
+ const manifests = (0, import_node_fs18.globSync)(["packages/*/package.json", "libs/*/package.json"], {
4733
4803
  cwd: workspaceRoot
4734
4804
  });
4735
4805
  for (const relativePath of manifests) {
4736
- const manifestPath = (0, import_node_path18.join)(workspaceRoot, relativePath);
4737
- const before = (0, import_node_fs17.readFileSync)(manifestPath, "utf8");
4806
+ const manifestPath = (0, import_node_path19.join)(workspaceRoot, relativePath);
4807
+ const before = (0, import_node_fs18.readFileSync)(manifestPath, "utf8");
4738
4808
  repairPublishableManifest(manifestPath);
4739
- const after = (0, import_node_fs17.readFileSync)(manifestPath, "utf8");
4809
+ const after = (0, import_node_fs18.readFileSync)(manifestPath, "utf8");
4740
4810
  if (after !== before) {
4741
4811
  changed.push(relativePath.replaceAll("\\", "/"));
4742
4812
  }
@@ -4745,8 +4815,8 @@ function repairPublishableManifests(workspaceRoot) {
4745
4815
  }
4746
4816
 
4747
4817
  // src/rollup-library/repair-rollup-config.use-case.ts
4748
- var import_node_fs18 = require("fs");
4749
- var import_node_path19 = require("path");
4818
+ var import_node_fs19 = require("fs");
4819
+ var import_node_path20 = require("path");
4750
4820
 
4751
4821
  // src/rollup-library/rollup-config.algorithm.ts
4752
4822
  var ROLLUP_CONFIG_PLACEHOLDER = [
@@ -4948,12 +5018,12 @@ function withUpgradedDeclarationSpecifierPlugin(config) {
4948
5018
  // src/rollup-library/repair-rollup-config.use-case.ts
4949
5019
  function repairRollupSourceMaps(workspaceRoot) {
4950
5020
  const changed = [];
4951
- const configs = (0, import_node_fs18.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
5021
+ const configs = (0, import_node_fs19.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
4952
5022
  cwd: workspaceRoot
4953
5023
  });
4954
5024
  for (const relativePath of configs) {
4955
- const configPath = (0, import_node_path19.join)(workspaceRoot, relativePath);
4956
- const before = (0, import_node_fs18.readFileSync)(configPath, "utf8");
5025
+ const configPath = (0, import_node_path20.join)(workspaceRoot, relativePath);
5026
+ const before = (0, import_node_fs19.readFileSync)(configPath, "utf8");
4957
5027
  const after = withRollupSourceMaps(before);
4958
5028
  if (after !== before) {
4959
5029
  writeFileEnsured(configPath, after);
@@ -4964,12 +5034,12 @@ function repairRollupSourceMaps(workspaceRoot) {
4964
5034
  }
4965
5035
  function upgradeDeclarationSpecifierPlugins(workspaceRoot) {
4966
5036
  const changed = [];
4967
- const configs = (0, import_node_fs18.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
5037
+ const configs = (0, import_node_fs19.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
4968
5038
  cwd: workspaceRoot
4969
5039
  });
4970
5040
  for (const relativePath of configs) {
4971
- const configPath = (0, import_node_path19.join)(workspaceRoot, relativePath);
4972
- const before = (0, import_node_fs18.readFileSync)(configPath, "utf8");
5041
+ const configPath = (0, import_node_path20.join)(workspaceRoot, relativePath);
5042
+ const before = (0, import_node_fs19.readFileSync)(configPath, "utf8");
4973
5043
  const after = withUpgradedDeclarationSpecifierPlugin(before);
4974
5044
  if (after !== before) {
4975
5045
  writeFileEnsured(configPath, after);
@@ -4979,11 +5049,11 @@ function upgradeDeclarationSpecifierPlugins(workspaceRoot) {
4979
5049
  return changed;
4980
5050
  }
4981
5051
  function repairDeclarationSpecifiers(projectRoot) {
4982
- const configPath = (0, import_node_path19.join)(projectRoot, "rollup.config.cjs");
5052
+ const configPath = (0, import_node_path20.join)(projectRoot, "rollup.config.cjs");
4983
5053
  if (!fileExists(configPath)) {
4984
5054
  return;
4985
5055
  }
4986
- const config = (0, import_node_fs18.readFileSync)(configPath, "utf8");
5056
+ const config = (0, import_node_fs19.readFileSync)(configPath, "utf8");
4987
5057
  if (!config.includes(ROLLUP_CONFIG_PLACEHOLDER)) {
4988
5058
  return;
4989
5059
  }
@@ -4992,10 +5062,10 @@ function repairDeclarationSpecifiers(projectRoot) {
4992
5062
  }
4993
5063
 
4994
5064
  // src/rollup-library/rollup-config.repository.ts
4995
- var import_node_fs19 = require("fs");
4996
- var import_node_path20 = require("path");
5065
+ var import_node_fs20 = require("fs");
5066
+ var import_node_path21 = require("path");
4997
5067
  function resolveRequireTarget(fromDir, specifier) {
4998
- const base = (0, import_node_path20.join)(fromDir, specifier);
5068
+ const base = (0, import_node_path21.join)(fromDir, specifier);
4999
5069
  return [base, `${base}.cjs`, `${base}.js`].find((candidate) => fileExists(candidate));
5000
5070
  }
5001
5071
  function resolveRollupConfigText(configPath, visited = /* @__PURE__ */ new Set()) {
@@ -5005,7 +5075,7 @@ function resolveRollupConfigText(configPath, visited = /* @__PURE__ */ new Set()
5005
5075
  visited.add(configPath);
5006
5076
  let text;
5007
5077
  try {
5008
- text = (0, import_node_fs19.readFileSync)(configPath, "utf8");
5078
+ text = (0, import_node_fs20.readFileSync)(configPath, "utf8");
5009
5079
  } catch {
5010
5080
  return "";
5011
5081
  }
@@ -5013,15 +5083,15 @@ function resolveRollupConfigText(configPath, visited = /* @__PURE__ */ new Set()
5013
5083
  text.matchAll(/require\((['"])(\.[^'"]*)\1\)/g),
5014
5084
  (match) => match[2]
5015
5085
  );
5016
- const requiredText = specifiers.map((specifier) => resolveRequireTarget((0, import_node_path20.dirname)(configPath), specifier)).filter((target) => target !== void 0).map((target) => resolveRollupConfigText(target, visited));
5086
+ const requiredText = specifiers.map((specifier) => resolveRequireTarget((0, import_node_path21.dirname)(configPath), specifier)).filter((target) => target !== void 0).map((target) => resolveRollupConfigText(target, visited));
5017
5087
  return [text, ...requiredText].join("\n");
5018
5088
  }
5019
5089
 
5020
5090
  // src/project-scaffolding/npm-lib.use-case.ts
5021
5091
  async function addNpmLib(workspaceRoot, name, options, kindProvided, stack) {
5022
5092
  const scope = options.scope ?? (kindProvided ? defaultScope(workspaceRoot) : await promptText("npm scope for the published package", defaultScope(workspaceRoot)));
5023
- const projectRoot = (0, import_node_path21.join)(workspaceRoot, "packages", name);
5024
- const manifestPath = (0, import_node_path21.join)(projectRoot, "package.json");
5093
+ const projectRoot = (0, import_node_path22.join)(workspaceRoot, "packages", name);
5094
+ const manifestPath = (0, import_node_path22.join)(projectRoot, "package.json");
5025
5095
  runGeneratorAndRepair(
5026
5096
  workspaceRoot,
5027
5097
  [
@@ -5050,8 +5120,8 @@ async function addNpmLib(workspaceRoot, name, options, kindProvided, stack) {
5050
5120
  }
5051
5121
 
5052
5122
  // src/project-scaffolding/python.use-case.ts
5053
- var import_node_fs20 = require("fs");
5054
- var import_node_path22 = require("path");
5123
+ var import_node_fs21 = require("fs");
5124
+ var import_node_path23 = require("path");
5055
5125
  function ensurePython(workspaceRoot) {
5056
5126
  const hasPython = runShell("python3", ["--version"], workspaceRoot) === 0 || runShell("python", ["--version"], workspaceRoot) === 0;
5057
5127
  if (!hasPython) {
@@ -5074,7 +5144,7 @@ function ensurePythonPipPlugin(workspaceRoot) {
5074
5144
  registerPythonGraphPlugin(workspaceRoot);
5075
5145
  }
5076
5146
  function registerPythonGraphPlugin(workspaceRoot) {
5077
- const nxJsonPath = (0, import_node_path22.join)(workspaceRoot, "nx.json");
5147
+ const nxJsonPath = (0, import_node_path23.join)(workspaceRoot, "nx.json");
5078
5148
  if (!fileExists(nxJsonPath)) {
5079
5149
  return;
5080
5150
  }
@@ -5097,7 +5167,7 @@ pytest
5097
5167
  pip-audit
5098
5168
  `;
5099
5169
  function ensureRequirementsDev(workspaceRoot) {
5100
- const requirementsDevPath = (0, import_node_path22.join)(workspaceRoot, "requirements-dev.txt");
5170
+ const requirementsDevPath = (0, import_node_path23.join)(workspaceRoot, "requirements-dev.txt");
5101
5171
  if (!fileExists(requirementsDevPath)) {
5102
5172
  writeFileEnsured(requirementsDevPath, PYTHON_REQUIREMENTS_DEV);
5103
5173
  }
@@ -5157,8 +5227,8 @@ function addPythonApp(workspaceRoot, name) {
5157
5227
  ["g", "@mnci/nx-python-pip:application", name, `--directory=apps/${name}`, "--no-interactive"],
5158
5228
  workspaceRoot
5159
5229
  );
5160
- writeFileEnsured((0, import_node_path22.join)(workspaceRoot, "apps", name, "main.py"), pythonAppMain(name));
5161
- addProjectJsonTargets((0, import_node_path22.join)(workspaceRoot, "apps", name, "project.json"), {
5230
+ writeFileEnsured((0, import_node_path23.join)(workspaceRoot, "apps", name, "main.py"), pythonAppMain(name));
5231
+ addProjectJsonTargets((0, import_node_path23.join)(workspaceRoot, "apps", name, "project.json"), {
5162
5232
  package: pythonAppPackageTarget(name),
5163
5233
  start: pythonAppStartTarget(name)
5164
5234
  });
@@ -5180,7 +5250,7 @@ function addPythonFunctionApp(workspaceRoot, name) {
5180
5250
  workspaceRoot
5181
5251
  );
5182
5252
  const moduleDirectory = pythonModuleDirectory(name);
5183
- addProjectJsonTargets((0, import_node_path22.join)(workspaceRoot, "apps", name, "project.json"), {
5253
+ addProjectJsonTargets((0, import_node_path23.join)(workspaceRoot, "apps", name, "project.json"), {
5184
5254
  package: pythonFunctionAppPackageTarget(name, moduleDirectory),
5185
5255
  start: pythonFunctionAppStartTarget(name)
5186
5256
  });
@@ -5221,7 +5291,7 @@ function addPythonInternalLib(workspaceRoot, name) {
5221
5291
  var PYTHON_PROJECT_DIRS = ["apps", "python-packages", "libs"];
5222
5292
  function findPythonProjectDirectory(workspaceRoot, name) {
5223
5293
  return PYTHON_PROJECT_DIRS.find(
5224
- (directory) => fileExists((0, import_node_path22.join)(workspaceRoot, directory, name, "pyproject.toml"))
5294
+ (directory) => fileExists((0, import_node_path23.join)(workspaceRoot, directory, name, "pyproject.toml"))
5225
5295
  );
5226
5296
  }
5227
5297
  function parseVendorEntries(pyprojectToml) {
@@ -5260,7 +5330,7 @@ async function addPythonVendor(workspaceRoot, consumer, options, kindProvided) {
5260
5330
  `No Python project named '${consumer}' with a pyproject.toml found (checked apps/, python-packages/, libs/). A Python function app has no pyproject.toml \u2014 there is nothing to vendor into.`
5261
5331
  );
5262
5332
  }
5263
- if (!fileExists((0, import_node_path22.join)(workspaceRoot, "libs", lib, "pyproject.toml"))) {
5333
+ if (!fileExists((0, import_node_path23.join)(workspaceRoot, "libs", lib, "pyproject.toml"))) {
5264
5334
  throw new Error(
5265
5335
  `No internal Python library named '${lib}' found at libs/${lib}/pyproject.toml. Only an internal library (added via 'mnci add python-internal-lib') can be vendored.`
5266
5336
  );
@@ -5268,8 +5338,8 @@ async function addPythonVendor(workspaceRoot, consumer, options, kindProvided) {
5268
5338
  if (consumerDirectory === "libs" && consumer === lib) {
5269
5339
  throw new Error(`'${consumer}' cannot vendor itself.`);
5270
5340
  }
5271
- const pyprojectPath = (0, import_node_path22.join)(workspaceRoot, consumerDirectory, consumer, "pyproject.toml");
5272
- const pyprojectToml = (0, import_node_fs20.readFileSync)(pyprojectPath, "utf8");
5341
+ const pyprojectPath = (0, import_node_path23.join)(workspaceRoot, consumerDirectory, consumer, "pyproject.toml");
5342
+ const pyprojectToml = (0, import_node_fs21.readFileSync)(pyprojectPath, "utf8");
5273
5343
  if (parseVendorEntries(pyprojectToml).includes(lib)) {
5274
5344
  logger.info(`'${consumer}' already vendors '${lib}' \u2014 nothing to do.`);
5275
5345
  return;
@@ -5281,8 +5351,8 @@ async function addPythonVendor(workspaceRoot, consumer, options, kindProvided) {
5281
5351
  }
5282
5352
 
5283
5353
  // src/project-scaffolding/react-app.use-case.ts
5284
- var import_node_fs21 = require("fs");
5285
- var import_node_path23 = require("path");
5354
+ var import_node_fs22 = require("fs");
5355
+ var import_node_path24 = require("path");
5286
5356
 
5287
5357
  // src/project-scaffolding/react-app-example.algorithm.ts
5288
5358
  function reactAppExampleFiles(name) {
@@ -5399,12 +5469,12 @@ function reactAppTargets(name) {
5399
5469
  return targets;
5400
5470
  }
5401
5471
  function allowEnvFiles(workspaceRoot) {
5402
- const gitignorePath = (0, import_node_path23.join)(workspaceRoot, ".gitignore");
5472
+ const gitignorePath = (0, import_node_path24.join)(workspaceRoot, ".gitignore");
5403
5473
  if (!fileExists(gitignorePath)) {
5404
5474
  return;
5405
5475
  }
5406
5476
  const marker = "# MoNecromanCI: keep the committed per-environment Vite config (public VITE_ values)";
5407
- const current = (0, import_node_fs21.readFileSync)(gitignorePath, "utf8");
5477
+ const current = (0, import_node_fs22.readFileSync)(gitignorePath, "utf8");
5408
5478
  if (current.includes(marker)) {
5409
5479
  return;
5410
5480
  }
@@ -5431,30 +5501,30 @@ function addReactApp(workspaceRoot, name, stack) {
5431
5501
  workspaceRoot
5432
5502
  );
5433
5503
  ensureAdmZip(workspaceRoot);
5434
- const reactAppRoot = (0, import_node_path23.join)(workspaceRoot, "apps", name);
5504
+ const reactAppRoot = (0, import_node_path24.join)(workspaceRoot, "apps", name);
5435
5505
  for (const environment of REACT_ENVIRONMENTS) {
5436
- writeFileEnsured((0, import_node_path23.join)(reactAppRoot, `.env.${environment}`), reactEnvironmentFile(environment));
5506
+ writeFileEnsured((0, import_node_path24.join)(reactAppRoot, `.env.${environment}`), reactEnvironmentFile(environment));
5437
5507
  }
5438
5508
  allowEnvFiles(workspaceRoot);
5439
- addNxTargets((0, import_node_path23.join)(reactAppRoot, "package.json"), reactAppTargets(name));
5509
+ addNxTargets((0, import_node_path24.join)(reactAppRoot, "package.json"), reactAppTargets(name));
5440
5510
  reshapeReactAppScaffold(reactAppRoot);
5441
- (0, import_node_fs21.rmSync)((0, import_node_path23.join)(reactAppRoot, "src/app/nx-welcome.component.tsx"), { force: true });
5511
+ (0, import_node_fs22.rmSync)((0, import_node_path24.join)(reactAppRoot, "src/app/nx-welcome.component.tsx"), { force: true });
5442
5512
  const example = reactAppExampleFiles(name);
5443
5513
  for (const [relative, contents] of Object.entries(example)) {
5444
- writeFileEnsured((0, import_node_path23.join)(reactAppRoot, "src", relative), contents);
5514
+ writeFileEnsured((0, import_node_path24.join)(reactAppRoot, "src", relative), contents);
5445
5515
  }
5446
5516
  removeGeneratedEslintConfig(workspaceRoot, `apps/${name}`);
5447
5517
  registerProjectCommands(workspaceRoot, name, { build: true, start: `nx run ${name}:serve` });
5448
5518
  }
5449
5519
 
5450
5520
  // src/project-scaffolding/react-lib.use-case.ts
5451
- var import_node_path24 = require("path");
5521
+ var import_node_path25 = require("path");
5452
5522
  var REACT_LIB_BUNDLER = "rollup";
5453
5523
  async function addReactLib(workspaceRoot, name, options, kindProvided, stack) {
5454
5524
  ensurePlugin(workspaceRoot, "@nx/react");
5455
5525
  const scope = options.scope ?? (kindProvided ? defaultScope(workspaceRoot) : await promptText("npm scope for the published package", defaultScope(workspaceRoot)));
5456
- const projectRoot = (0, import_node_path24.join)(workspaceRoot, "packages", name);
5457
- const publishableManifest = (0, import_node_path24.join)(projectRoot, "package.json");
5526
+ const projectRoot = (0, import_node_path25.join)(workspaceRoot, "packages", name);
5527
+ const publishableManifest = (0, import_node_path25.join)(projectRoot, "package.json");
5458
5528
  runGeneratorAndRepair(
5459
5529
  workspaceRoot,
5460
5530
  [
@@ -5484,8 +5554,8 @@ async function addReactLib(workspaceRoot, name, options, kindProvided, stack) {
5484
5554
  }
5485
5555
  function addReactInternalLib(workspaceRoot, name, stack, empty = false) {
5486
5556
  ensurePlugin(workspaceRoot, "@nx/react");
5487
- const projectRoot = (0, import_node_path24.join)(workspaceRoot, "libs", name);
5488
- const privateManifest = (0, import_node_path24.join)(projectRoot, "package.json");
5557
+ const projectRoot = (0, import_node_path25.join)(workspaceRoot, "libs", name);
5558
+ const privateManifest = (0, import_node_path25.join)(projectRoot, "package.json");
5489
5559
  runGeneratorAndRepair(
5490
5560
  workspaceRoot,
5491
5561
  [
@@ -5512,8 +5582,8 @@ function addReactInternalLib(workspaceRoot, name, stack, empty = false) {
5512
5582
  }
5513
5583
 
5514
5584
  // src/project-scaffolding/vscode-extension.use-case.ts
5515
- var import_node_fs22 = require("fs");
5516
- var import_node_path25 = require("path");
5585
+ var import_node_fs23 = require("fs");
5586
+ var import_node_path26 = require("path");
5517
5587
  var VSCODE_EXTENSION_SCRIPT_PATH = "tools/vscode-extension.cjs";
5518
5588
  var VSCODE_ENGINE_FLOOR = "1.96.0";
5519
5589
  var VSCODE_SIDECAR_TARGETS = {
@@ -5698,8 +5768,8 @@ export const window = {
5698
5768
  var VSCODE_STUB_PATH = "test/vscode.stub.ts";
5699
5769
  function mapVscodeToStub(projectRoot, testRunner) {
5700
5770
  const [file, anchor, mapping] = testRunner === "jest" ? ["jest.config.cts", "testEnvironment: 'node',", `moduleNameMapper: { '^vscode$': '<rootDir>/${VSCODE_STUB_PATH}' },`] : ["vitest.config.mts", "environment: 'node',", `alias: { vscode: \`\${import.meta.dirname}/${VSCODE_STUB_PATH}\` },`];
5701
- const path = (0, import_node_path25.join)(projectRoot, file);
5702
- const content = fileExists(path) ? (0, import_node_fs22.readFileSync)(path, "utf8") : "";
5771
+ const path = (0, import_node_path26.join)(projectRoot, file);
5772
+ const content = fileExists(path) ? (0, import_node_fs23.readFileSync)(path, "utf8") : "";
5703
5773
  const line = content.split("\n").find((candidate) => candidate.trim() === anchor);
5704
5774
  if (line === void 0) {
5705
5775
  throw new Error(`${file} has no "${anchor}" line to map the vscode module after; map 'vscode' to ${VSCODE_STUB_PATH} by hand.`);
@@ -5719,11 +5789,11 @@ function ensureVscodeToolchain(workspaceRoot) {
5719
5789
  }
5720
5790
  }
5721
5791
  function defaultPublisher(workspaceRoot) {
5722
- const { name } = readJson((0, import_node_path25.join)(workspaceRoot, "package.json"));
5792
+ const { name } = readJson((0, import_node_path26.join)(workspaceRoot, "package.json"));
5723
5793
  return (name ?? "publisher").replace(/^@/, "").split("/", 1)[0];
5724
5794
  }
5725
5795
  function reshapeManifest(projectRoot, name, publisher) {
5726
- const manifestPath = (0, import_node_path25.join)(projectRoot, "package.json");
5796
+ const manifestPath = (0, import_node_path26.join)(projectRoot, "package.json");
5727
5797
  const manifest = readJson(manifestPath);
5728
5798
  const { nx = {}, ...rest } = manifest;
5729
5799
  const targets = { ...nx.targets };
@@ -5787,11 +5857,11 @@ function vscodeExtensionPublishTarget(name, sidecar) {
5787
5857
  };
5788
5858
  }
5789
5859
  function addDebugLaunch(workspaceRoot, name) {
5790
- const file = (0, import_node_fs22.readdirSync)(workspaceRoot).find((entry) => entry.endsWith(".code-workspace"));
5860
+ const file = (0, import_node_fs23.readdirSync)(workspaceRoot).find((entry) => entry.endsWith(".code-workspace"));
5791
5861
  if (file === void 0) {
5792
5862
  return;
5793
5863
  }
5794
- const path = (0, import_node_path25.join)(workspaceRoot, file);
5864
+ const path = (0, import_node_path26.join)(workspaceRoot, file);
5795
5865
  const workspace = readCodeWorkspace(path) ?? {};
5796
5866
  const folder = `\${workspaceFolder:${workspace.folders?.[0]?.name ?? file.replace(/\.code-workspace$/, "")}}`;
5797
5867
  const taskLabel = `${name}: build (development)`;
@@ -5824,39 +5894,39 @@ function addDebugLaunch(workspaceRoot, name) {
5824
5894
  );
5825
5895
  }
5826
5896
  function refreshVscodeExtensionScript(workspaceRoot) {
5827
- const apps = (0, import_node_path25.join)(workspaceRoot, "apps");
5897
+ const apps = (0, import_node_path26.join)(workspaceRoot, "apps");
5828
5898
  let entries;
5829
5899
  try {
5830
- entries = (0, import_node_fs22.readdirSync)(apps);
5900
+ entries = (0, import_node_fs23.readdirSync)(apps);
5831
5901
  } catch {
5832
5902
  return false;
5833
5903
  }
5834
5904
  const hasExtension = entries.some((entry) => {
5835
- const manifestPath = (0, import_node_path25.join)(apps, entry, "package.json");
5905
+ const manifestPath = (0, import_node_path26.join)(apps, entry, "package.json");
5836
5906
  if (!fileExists(manifestPath)) {
5837
5907
  return false;
5838
5908
  }
5839
5909
  const tags = readJson(manifestPath).nx?.tags ?? [];
5840
5910
  return tags.includes(VSCODE_EXTENSION_TAG);
5841
5911
  });
5842
- const path = (0, import_node_path25.join)(workspaceRoot, VSCODE_EXTENSION_SCRIPT_PATH);
5843
- if (!hasExtension || fileExists(path) && (0, import_node_fs22.readFileSync)(path, "utf8") === VSCODE_EXTENSION_SCRIPT) {
5912
+ const path = (0, import_node_path26.join)(workspaceRoot, VSCODE_EXTENSION_SCRIPT_PATH);
5913
+ if (!hasExtension || fileExists(path) && (0, import_node_fs23.readFileSync)(path, "utf8") === VSCODE_EXTENSION_SCRIPT) {
5844
5914
  return false;
5845
5915
  }
5846
5916
  writeFileEnsured(path, VSCODE_EXTENSION_SCRIPT);
5847
5917
  return true;
5848
5918
  }
5849
5919
  function pinVscodeExtensionProjectNames(workspaceRoot) {
5850
- const apps = (0, import_node_path25.join)(workspaceRoot, "apps");
5920
+ const apps = (0, import_node_path26.join)(workspaceRoot, "apps");
5851
5921
  let entries;
5852
5922
  try {
5853
- entries = (0, import_node_fs22.readdirSync)(apps);
5923
+ entries = (0, import_node_fs23.readdirSync)(apps);
5854
5924
  } catch {
5855
5925
  return [];
5856
5926
  }
5857
5927
  const updated = [];
5858
5928
  for (const entry of entries) {
5859
- const manifestPath = (0, import_node_path25.join)(apps, entry, "package.json");
5929
+ const manifestPath = (0, import_node_path26.join)(apps, entry, "package.json");
5860
5930
  if (!fileExists(manifestPath)) {
5861
5931
  continue;
5862
5932
  }
@@ -5876,22 +5946,22 @@ function refreshLockFile(workspaceRoot, name) {
5876
5946
  }
5877
5947
  function addVscodeExtension(workspaceRoot, name, stack, options = {}) {
5878
5948
  const { sidecar } = options;
5879
- if (sidecar !== void 0 && !fileExists((0, import_node_path25.join)(workspaceRoot, "apps", sidecar, "project.json"))) {
5949
+ if (sidecar !== void 0 && !fileExists((0, import_node_path26.join)(workspaceRoot, "apps", sidecar, "project.json"))) {
5880
5950
  throw new Error(`--sidecar ${sidecar}: no Go app at apps/${sidecar}. Add it first with \`mnci add go-app ${sidecar}\`.`);
5881
5951
  }
5882
5952
  runNodeApp(workspaceRoot, name, stack, "none");
5883
5953
  ensureVscodeToolchain(workspaceRoot);
5884
- const projectRoot = (0, import_node_path25.join)(workspaceRoot, "apps", name);
5954
+ const projectRoot = (0, import_node_path26.join)(workspaceRoot, "apps", name);
5885
5955
  reshapeManifest(projectRoot, name, options.publisher ?? defaultPublisher(workspaceRoot));
5886
- addVscodeTypes((0, import_node_path25.join)(projectRoot, "tsconfig.app.json"));
5887
- addVscodeTypes((0, import_node_path25.join)(projectRoot, "tsconfig.spec.json"));
5888
- writeFileEnsured((0, import_node_path25.join)(projectRoot, "src/main.ts"), vscodeExtensionMain(name));
5889
- writeFileEnsured((0, import_node_path25.join)(projectRoot, "src/main.spec.ts"), vscodeExtensionMainSpec(name));
5890
- writeFileEnsured((0, import_node_path25.join)(projectRoot, VSCODE_STUB_PATH), VSCODE_STUB);
5956
+ addVscodeTypes((0, import_node_path26.join)(projectRoot, "tsconfig.app.json"));
5957
+ addVscodeTypes((0, import_node_path26.join)(projectRoot, "tsconfig.spec.json"));
5958
+ writeFileEnsured((0, import_node_path26.join)(projectRoot, "src/main.ts"), vscodeExtensionMain(name));
5959
+ writeFileEnsured((0, import_node_path26.join)(projectRoot, "src/main.spec.ts"), vscodeExtensionMainSpec(name));
5960
+ writeFileEnsured((0, import_node_path26.join)(projectRoot, VSCODE_STUB_PATH), VSCODE_STUB);
5891
5961
  mapVscodeToStub(projectRoot, stack.testRunner);
5892
- writeFileEnsured((0, import_node_path25.join)(projectRoot, ".vscodeignore"), VSCODE_IGNORE);
5893
- writeFileEnsured((0, import_node_path25.join)(workspaceRoot, VSCODE_EXTENSION_SCRIPT_PATH), VSCODE_EXTENSION_SCRIPT);
5894
- addNxTargets((0, import_node_path25.join)(projectRoot, "package.json"), {
5962
+ writeFileEnsured((0, import_node_path26.join)(projectRoot, ".vscodeignore"), VSCODE_IGNORE);
5963
+ writeFileEnsured((0, import_node_path26.join)(workspaceRoot, VSCODE_EXTENSION_SCRIPT_PATH), VSCODE_EXTENSION_SCRIPT);
5964
+ addNxTargets((0, import_node_path26.join)(projectRoot, "package.json"), {
5895
5965
  "package": vscodeExtensionPackageTarget(name, sidecar),
5896
5966
  "nx-release-publish": vscodeExtensionPublishTarget(name, sidecar)
5897
5967
  });
@@ -5902,12 +5972,12 @@ function addVscodeExtension(workspaceRoot, name, stack, options = {}) {
5902
5972
  }
5903
5973
 
5904
5974
  // src/dependency-management/install-dependencies.use-case.ts
5905
- var import_node_fs24 = require("fs");
5906
- var import_node_path27 = require("path");
5975
+ var import_node_fs25 = require("fs");
5976
+ var import_node_path28 = require("path");
5907
5977
 
5908
5978
  // src/dependency-management/manifest.repository.ts
5909
- var import_node_fs23 = require("fs");
5910
- var import_node_path26 = require("path");
5979
+ var import_node_fs24 = require("fs");
5980
+ var import_node_path27 = require("path");
5911
5981
  var ECOSYSTEMS = ["npm", "pip", "pub", "nuget", "go"];
5912
5982
  var ROOT_LABEL = "(root)";
5913
5983
  var MANIFEST_GLOBS = {
@@ -5940,23 +6010,23 @@ function projectOf(manifestRelativePath) {
5940
6010
  }
5941
6011
  function hasEcosystem(workspaceRoot, ecosystem) {
5942
6012
  if (ecosystem === "go") {
5943
- return fileExists((0, import_node_path26.join)(workspaceRoot, "go.mod"));
6013
+ return fileExists((0, import_node_path27.join)(workspaceRoot, "go.mod"));
5944
6014
  }
5945
6015
  if (ecosystem === "nuget") {
5946
- return (0, import_node_fs23.globSync)(MANIFEST_GLOBS.nuget, { cwd: workspaceRoot }).length > 0;
6016
+ return (0, import_node_fs24.globSync)(MANIFEST_GLOBS.nuget, { cwd: workspaceRoot }).length > 0;
5947
6017
  }
5948
6018
  const rootMarker = {
5949
6019
  npm: "package.json",
5950
6020
  pip: "requirements-dev.txt",
5951
6021
  pub: "pubspec.yaml"
5952
6022
  };
5953
- return fileExists((0, import_node_path26.join)(workspaceRoot, rootMarker[ecosystem])) || (0, import_node_fs23.globSync)(MANIFEST_GLOBS[ecosystem], { cwd: workspaceRoot }).length > 0;
6023
+ return fileExists((0, import_node_path27.join)(workspaceRoot, rootMarker[ecosystem])) || (0, import_node_fs24.globSync)(MANIFEST_GLOBS[ecosystem], { cwd: workspaceRoot }).length > 0;
5954
6024
  }
5955
6025
  function collectNpm(workspaceRoot) {
5956
6026
  const sites = [];
5957
- const relativePaths = ["package.json", ...(0, import_node_fs23.globSync)(MANIFEST_GLOBS.npm, { cwd: workspaceRoot })];
6027
+ const relativePaths = ["package.json", ...(0, import_node_fs24.globSync)(MANIFEST_GLOBS.npm, { cwd: workspaceRoot })];
5958
6028
  for (const relativePath of relativePaths) {
5959
- const manifestPath = (0, import_node_path26.join)(workspaceRoot, relativePath);
6029
+ const manifestPath = (0, import_node_path27.join)(workspaceRoot, relativePath);
5960
6030
  try {
5961
6031
  const manifest = readJson(manifestPath);
5962
6032
  sites.push(...npmManifestSites(manifest, relativePath, manifestPath));
@@ -6017,17 +6087,17 @@ function collectPip(workspaceRoot) {
6017
6087
  name: parsed.name,
6018
6088
  ecosystem: "pip",
6019
6089
  project: projectOf(relativePath),
6020
- manifestPath: (0, import_node_path26.join)(workspaceRoot, relativePath),
6090
+ manifestPath: (0, import_node_path27.join)(workspaceRoot, relativePath),
6021
6091
  section,
6022
6092
  spec: parsed.spec,
6023
6093
  rewritable: parsed.rewritable && parsed.spec !== ""
6024
6094
  });
6025
6095
  };
6026
- const pyprojectPaths = (0, import_node_fs23.globSync)(MANIFEST_GLOBS.pip, { cwd: workspaceRoot });
6096
+ const pyprojectPaths = (0, import_node_fs24.globSync)(MANIFEST_GLOBS.pip, { cwd: workspaceRoot });
6027
6097
  for (const relativePath of pyprojectPaths) {
6028
6098
  let content;
6029
6099
  try {
6030
- content = (0, import_node_fs23.readFileSync)((0, import_node_path26.join)(workspaceRoot, relativePath), "utf8");
6100
+ content = (0, import_node_fs24.readFileSync)((0, import_node_path27.join)(workspaceRoot, relativePath), "utf8");
6031
6101
  } catch {
6032
6102
  continue;
6033
6103
  }
@@ -6038,14 +6108,14 @@ function collectPip(workspaceRoot) {
6038
6108
  }
6039
6109
  const requirementsPaths = [
6040
6110
  "requirements-dev.txt",
6041
- ...(0, import_node_fs23.globSync)("apps/*/requirements.txt", { cwd: workspaceRoot })
6111
+ ...(0, import_node_fs24.globSync)("apps/*/requirements.txt", { cwd: workspaceRoot })
6042
6112
  ];
6043
6113
  for (const relativePath of requirementsPaths) {
6044
- if (!fileExists((0, import_node_path26.join)(workspaceRoot, relativePath))) {
6114
+ if (!fileExists((0, import_node_path27.join)(workspaceRoot, relativePath))) {
6045
6115
  continue;
6046
6116
  }
6047
6117
  const section = relativePath === "requirements-dev.txt" ? "devDep" : "dep";
6048
- const lines = (0, import_node_fs23.readFileSync)((0, import_node_path26.join)(workspaceRoot, relativePath), "utf8").split(/\r?\n/);
6118
+ const lines = (0, import_node_fs24.readFileSync)((0, import_node_path27.join)(workspaceRoot, relativePath), "utf8").split(/\r?\n/);
6049
6119
  for (const line of lines) {
6050
6120
  push(relativePath, section, line);
6051
6121
  }
@@ -6083,11 +6153,11 @@ function pyprojectDependencies(content) {
6083
6153
  }
6084
6154
  function collectPub(workspaceRoot) {
6085
6155
  const sites = [];
6086
- const pubspecPaths = (0, import_node_fs23.globSync)(MANIFEST_GLOBS.pub, { cwd: workspaceRoot });
6156
+ const pubspecPaths = (0, import_node_fs24.globSync)(MANIFEST_GLOBS.pub, { cwd: workspaceRoot });
6087
6157
  for (const relativePath of pubspecPaths) {
6088
6158
  let content;
6089
6159
  try {
6090
- content = (0, import_node_fs23.readFileSync)((0, import_node_path26.join)(workspaceRoot, relativePath), "utf8");
6160
+ content = (0, import_node_fs24.readFileSync)((0, import_node_path27.join)(workspaceRoot, relativePath), "utf8");
6091
6161
  } catch {
6092
6162
  continue;
6093
6163
  }
@@ -6097,7 +6167,7 @@ function collectPub(workspaceRoot) {
6097
6167
  name: entry.name,
6098
6168
  ecosystem: "pub",
6099
6169
  project: projectOf(relativePath),
6100
- manifestPath: (0, import_node_path26.join)(workspaceRoot, relativePath),
6170
+ manifestPath: (0, import_node_path27.join)(workspaceRoot, relativePath),
6101
6171
  section: block === "dependencies" ? "dep" : "devDep",
6102
6172
  spec: entry.spec,
6103
6173
  rewritable: entry.spec !== ""
@@ -6147,11 +6217,11 @@ function stripQuotes(value) {
6147
6217
  }
6148
6218
  function collectNuget(workspaceRoot) {
6149
6219
  const sites = [];
6150
- const csprojPaths = (0, import_node_fs23.globSync)(MANIFEST_GLOBS.nuget, { cwd: workspaceRoot });
6220
+ const csprojPaths = (0, import_node_fs24.globSync)(MANIFEST_GLOBS.nuget, { cwd: workspaceRoot });
6151
6221
  for (const relativePath of csprojPaths) {
6152
6222
  let content;
6153
6223
  try {
6154
- content = (0, import_node_fs23.readFileSync)((0, import_node_path26.join)(workspaceRoot, relativePath), "utf8");
6224
+ content = (0, import_node_fs24.readFileSync)((0, import_node_path27.join)(workspaceRoot, relativePath), "utf8");
6155
6225
  } catch {
6156
6226
  continue;
6157
6227
  }
@@ -6160,7 +6230,7 @@ function collectNuget(workspaceRoot) {
6160
6230
  name: entry.name,
6161
6231
  ecosystem: "nuget",
6162
6232
  project: projectOf(relativePath),
6163
- manifestPath: (0, import_node_path26.join)(workspaceRoot, relativePath),
6233
+ manifestPath: (0, import_node_path27.join)(workspaceRoot, relativePath),
6164
6234
  section: "dep",
6165
6235
  spec: entry.spec,
6166
6236
  // A plain SemVer string is rewritable; an MSBuild property reference
@@ -6185,13 +6255,13 @@ function csprojPackageReferences(content) {
6185
6255
  return entries;
6186
6256
  }
6187
6257
  function collectGo(workspaceRoot) {
6188
- const manifestPath = (0, import_node_path26.join)(workspaceRoot, "go.mod");
6258
+ const manifestPath = (0, import_node_path27.join)(workspaceRoot, "go.mod");
6189
6259
  if (!fileExists(manifestPath)) {
6190
6260
  return [];
6191
6261
  }
6192
6262
  let content;
6193
6263
  try {
6194
- content = (0, import_node_fs23.readFileSync)(manifestPath, "utf8");
6264
+ content = (0, import_node_fs24.readFileSync)(manifestPath, "utf8");
6195
6265
  } catch {
6196
6266
  return [];
6197
6267
  }
@@ -6240,7 +6310,7 @@ var PROJECT_GLOBS = {
6240
6310
  function locateProjects(workspaceRoot) {
6241
6311
  const locations = [];
6242
6312
  for (const ecosystem of ECOSYSTEMS) {
6243
- const relativePaths = (0, import_node_fs23.globSync)(PROJECT_GLOBS[ecosystem], { cwd: workspaceRoot });
6313
+ const relativePaths = (0, import_node_fs24.globSync)(PROJECT_GLOBS[ecosystem], { cwd: workspaceRoot });
6244
6314
  for (const relativePath of relativePaths) {
6245
6315
  const posix = toPosix(relativePath);
6246
6316
  const dir = posix.slice(0, posix.lastIndexOf("/"));
@@ -6248,7 +6318,7 @@ function locateProjects(workspaceRoot) {
6248
6318
  ecosystem,
6249
6319
  dir,
6250
6320
  name: dir.slice(dir.lastIndexOf("/") + 1),
6251
- manifestPath: (0, import_node_path26.join)(workspaceRoot, relativePath)
6321
+ manifestPath: (0, import_node_path27.join)(workspaceRoot, relativePath)
6252
6322
  });
6253
6323
  }
6254
6324
  }
@@ -6269,7 +6339,7 @@ function rewriteSpec(site, spec) {
6269
6339
  writeFileEnsured(site.manifestPath, toJson(manifest));
6270
6340
  return true;
6271
6341
  }
6272
- const before = (0, import_node_fs23.readFileSync)(site.manifestPath, "utf8");
6342
+ const before = (0, import_node_fs24.readFileSync)(site.manifestPath, "utf8");
6273
6343
  const after = (() => {
6274
6344
  switch (site.ecosystem) {
6275
6345
  case "pip": {
@@ -6360,13 +6430,13 @@ function escapeForRegex(value) {
6360
6430
  function isWorkspaceProject(workspaceRoot, name) {
6361
6431
  const short = name.includes("/") ? name.split("/").at(-1) : name;
6362
6432
  return ["apps", "libs", "packages"].some(
6363
- (directory) => fileExists((0, import_node_path26.join)(workspaceRoot, directory, short ?? name, "package.json"))
6433
+ (directory) => fileExists((0, import_node_path27.join)(workspaceRoot, directory, short ?? name, "package.json"))
6364
6434
  );
6365
6435
  }
6366
6436
  function isAliasedInstall(workspaceRoot, name) {
6367
6437
  try {
6368
6438
  const installed = readJson(
6369
- (0, import_node_path26.join)(workspaceRoot, "node_modules", name, "package.json")
6439
+ (0, import_node_path27.join)(workspaceRoot, "node_modules", name, "package.json")
6370
6440
  );
6371
6441
  return installed.name !== void 0 && installed.name !== name;
6372
6442
  } catch {
@@ -6377,14 +6447,14 @@ function resolvedVersion(workspaceRoot, ecosystem, name) {
6377
6447
  if (ecosystem === "npm") {
6378
6448
  try {
6379
6449
  return readJson(
6380
- (0, import_node_path26.join)(workspaceRoot, "node_modules", name, "package.json")
6450
+ (0, import_node_path27.join)(workspaceRoot, "node_modules", name, "package.json")
6381
6451
  ).version;
6382
6452
  } catch {
6383
6453
  return void 0;
6384
6454
  }
6385
6455
  }
6386
6456
  if (ecosystem === "pub") {
6387
- const lockPath = (0, import_node_path26.join)(workspaceRoot, "pubspec.lock");
6457
+ const lockPath = (0, import_node_path27.join)(workspaceRoot, "pubspec.lock");
6388
6458
  if (!fileExists(lockPath)) {
6389
6459
  return void 0;
6390
6460
  }
@@ -6392,7 +6462,7 @@ function resolvedVersion(workspaceRoot, ecosystem, name) {
6392
6462
  const match = new RegExp(
6393
6463
  String.raw`^\s{2}${escapeForRegex(name)}:[^]*?^\s+version:\s*["']?([^"'\s]+)`,
6394
6464
  "m"
6395
- ).exec((0, import_node_fs23.readFileSync)(lockPath, "utf8"));
6465
+ ).exec((0, import_node_fs24.readFileSync)(lockPath, "utf8"));
6396
6466
  return match?.[1];
6397
6467
  } catch {
6398
6468
  return void 0;
@@ -6458,7 +6528,7 @@ function resolveTarget(locations, target) {
6458
6528
  return byName[0];
6459
6529
  }
6460
6530
  function installInto(workspaceRoot, location, packages, saveDev) {
6461
- const projectDir = (0, import_node_path27.join)(workspaceRoot, location.dir);
6531
+ const projectDir = (0, import_node_path28.join)(workspaceRoot, location.dir);
6462
6532
  switch (location.ecosystem) {
6463
6533
  case "npm": {
6464
6534
  const flags = saveDev ? ["--save-dev"] : [];
@@ -6511,7 +6581,7 @@ function installInto(workspaceRoot, location, packages, saveDev) {
6511
6581
  function addPythonDependency(manifestPath, specifier) {
6512
6582
  let content;
6513
6583
  try {
6514
- content = (0, import_node_fs24.readFileSync)(manifestPath, "utf8");
6584
+ content = (0, import_node_fs25.readFileSync)(manifestPath, "utf8");
6515
6585
  } catch {
6516
6586
  logger.warn(`Could not read ${manifestPath} \u2014 skipped ${specifier}`);
6517
6587
  return;
@@ -6540,7 +6610,7 @@ function installEverything(workspaceRoot, only) {
6540
6610
  }
6541
6611
  function ecosystemPresent(workspaceRoot, ecosystem) {
6542
6612
  if (ecosystem === "go") {
6543
- return fileExists((0, import_node_path27.join)(workspaceRoot, "go.work")) || fileExists((0, import_node_path27.join)(workspaceRoot, "go.mod"));
6613
+ return fileExists((0, import_node_path28.join)(workspaceRoot, "go.work")) || fileExists((0, import_node_path28.join)(workspaceRoot, "go.mod"));
6544
6614
  }
6545
6615
  return hasEcosystem(workspaceRoot, ecosystem);
6546
6616
  }
@@ -6559,7 +6629,7 @@ function splitAtLast(value, separator) {
6559
6629
  }
6560
6630
 
6561
6631
  // src/dependency-management/sync-dependencies.use-case.ts
6562
- var import_node_path28 = require("path");
6632
+ var import_node_path29 = require("path");
6563
6633
 
6564
6634
  // src/dependency-management/semver.algorithm.ts
6565
6635
  var UPDATE_KINDS = ["patch", "minor", "major", "non-semver"];
@@ -6736,7 +6806,7 @@ function describe(finding) {
6736
6806
  return `${finding.name} \u2192 ${finding.target} (${finding.reason}); disagreeing: ${sites}`;
6737
6807
  }
6738
6808
  function runSync(workspaceRoot, options) {
6739
- if (!fileExists((0, import_node_path28.join)(workspaceRoot, "nx.json"))) {
6809
+ if (!fileExists((0, import_node_path29.join)(workspaceRoot, "nx.json"))) {
6740
6810
  throw new Error(
6741
6811
  `No nx.json found in ${workspaceRoot} \u2014 run 'mnci sync' from the workspace root.`
6742
6812
  );
@@ -6786,7 +6856,7 @@ function runSync(workspaceRoot, options) {
6786
6856
  }
6787
6857
 
6788
6858
  // src/dependency-management/update-dependencies.use-case.ts
6789
- var import_node_path29 = require("path");
6859
+ var import_node_path30 = require("path");
6790
6860
  var import_prompts2 = require("@inquirer/prompts");
6791
6861
 
6792
6862
  // src/dependency-management/registry.client.ts
@@ -7069,7 +7139,7 @@ function reinstall(workspaceRoot, ecosystems) {
7069
7139
  function hasPythonInstallScript(workspaceRoot) {
7070
7140
  try {
7071
7141
  const manifest = readJson(
7072
- (0, import_node_path29.join)(workspaceRoot, "package.json")
7142
+ (0, import_node_path30.join)(workspaceRoot, "package.json")
7073
7143
  );
7074
7144
  return manifest.scripts?.["python:install"] !== void 0;
7075
7145
  } catch {
@@ -7085,7 +7155,7 @@ function applyGoUpdates(workspaceRoot, entries) {
7085
7155
  }
7086
7156
  }
7087
7157
  async function runUp(workspaceRoot, options) {
7088
- if (!fileExists((0, import_node_path29.join)(workspaceRoot, "nx.json"))) {
7158
+ if (!fileExists((0, import_node_path30.join)(workspaceRoot, "nx.json"))) {
7089
7159
  throw new Error(`No nx.json found in ${workspaceRoot} \u2014 run 'mnci up' from the workspace root.`);
7090
7160
  }
7091
7161
  const ecosystems = resolveEcosystems(options.ecosystem);
@@ -7162,7 +7232,7 @@ var PROJECT_KINDS = [
7162
7232
  var EMPTY_KINDS = /* @__PURE__ */ new Set(["npm-lib", "internal-lib", "react-lib", "react-internal-lib", "node-function-app"]);
7163
7233
  async function runAdd(kind, name, options) {
7164
7234
  const workspaceRoot = process.cwd();
7165
- if (!fileExists((0, import_node_path30.join)(workspaceRoot, "nx.json"))) {
7235
+ if (!fileExists((0, import_node_path31.join)(workspaceRoot, "nx.json"))) {
7166
7236
  throw new Error("No nx.json found here. Run `add` from the workspace root.");
7167
7237
  }
7168
7238
  const stack = readWorkspaceStack(workspaceRoot);
@@ -7225,8 +7295,8 @@ async function runAdd(kind, name, options) {
7225
7295
  ],
7226
7296
  workspaceRoot
7227
7297
  );
7228
- markPrivate((0, import_node_path30.join)(workspaceRoot, "libs", resolvedName, "package.json"));
7229
- renameScaffoldPlaceholder((0, import_node_path30.join)(workspaceRoot, "libs", resolvedName), resolvedName, options.empty === true);
7298
+ markPrivate((0, import_node_path31.join)(workspaceRoot, "libs", resolvedName, "package.json"));
7299
+ renameScaffoldPlaceholder((0, import_node_path31.join)(workspaceRoot, "libs", resolvedName), resolvedName, options.empty === true);
7230
7300
  removeGeneratedEslintConfig(workspaceRoot, `libs/${resolvedName}`);
7231
7301
  registerProjectCommands(workspaceRoot, resolvedName, { build: true });
7232
7302
  break;
@@ -7318,7 +7388,7 @@ async function runAdd(kind, name, options) {
7318
7388
  }
7319
7389
  function readWorkspaceStack(workspaceRoot) {
7320
7390
  const nxJson = readJson(
7321
- (0, import_node_path30.join)(workspaceRoot, "nx.json")
7391
+ (0, import_node_path31.join)(workspaceRoot, "nx.json")
7322
7392
  );
7323
7393
  const stack = nxJson.mnci?.stack;
7324
7394
  return {
@@ -7367,15 +7437,15 @@ function runKinds(options) {
7367
7437
 
7368
7438
  // src/workspace-diagnostics/check-invariants.use-case.ts
7369
7439
  var import_node_child_process = require("child_process");
7370
- var import_node_fs25 = require("fs");
7371
- var import_node_path31 = require("path");
7440
+ var import_node_fs26 = require("fs");
7441
+ var import_node_path32 = require("path");
7372
7442
  var SUPPORTED_ESLINT_MAJOR = ESLINT_VERSION.replace(/^\D*/, "").split(".", 1)[0];
7373
7443
  function toPosix2(path) {
7374
7444
  return path.replaceAll("\\", "/");
7375
7445
  }
7376
7446
  function checkEslintConfigs(workspaceRoot) {
7377
- const rootConfigs = (0, import_node_fs25.globSync)("eslint.config.{js,mjs,cjs,ts,mts,cts}", { cwd: workspaceRoot });
7378
- const projectConfigs = (0, import_node_fs25.globSync)("{apps,libs,packages}/*/eslint.config.{js,mjs,cjs,ts,mts,cts}", {
7447
+ const rootConfigs = (0, import_node_fs26.globSync)("eslint.config.{js,mjs,cjs,ts,mts,cts}", { cwd: workspaceRoot });
7448
+ const projectConfigs = (0, import_node_fs26.globSync)("{apps,libs,packages}/*/eslint.config.{js,mjs,cjs,ts,mts,cts}", {
7379
7449
  cwd: workspaceRoot
7380
7450
  }).map((config) => toPosix2(config));
7381
7451
  return [
@@ -7395,10 +7465,10 @@ function checkEslintConfigs(workspaceRoot) {
7395
7465
  ];
7396
7466
  }
7397
7467
  function checkEslintEntryPointReachesTheRules(workspaceRoot) {
7398
- const rules = (0, import_node_path31.join)(workspaceRoot, ESLINT_MNCI_FILENAME);
7399
- if (!(0, import_node_fs25.existsSync)(rules)) return [];
7400
- const entryPoint = (0, import_node_path31.join)(workspaceRoot, ESLINT_USER_FILENAME);
7401
- const source = (0, import_node_fs25.existsSync)(entryPoint) ? (0, import_node_fs25.readFileSync)(entryPoint, "utf8") : "";
7468
+ const rules = (0, import_node_path32.join)(workspaceRoot, ESLINT_MNCI_FILENAME);
7469
+ if (!(0, import_node_fs26.existsSync)(rules)) return [];
7470
+ const entryPoint = (0, import_node_path32.join)(workspaceRoot, ESLINT_USER_FILENAME);
7471
+ const source = (0, import_node_fs26.existsSync)(entryPoint) ? (0, import_node_fs26.readFileSync)(entryPoint, "utf8") : "";
7402
7472
  return [
7403
7473
  {
7404
7474
  check: `${ESLINT_USER_FILENAME} imports the mnci rules`,
@@ -7411,7 +7481,7 @@ function checkEslintEntryPointReachesTheRules(workspaceRoot) {
7411
7481
  function declaredDevDependencies(workspaceRoot) {
7412
7482
  try {
7413
7483
  const manifest = readJson(
7414
- (0, import_node_path31.join)(workspaceRoot, "package.json")
7484
+ (0, import_node_path32.join)(workspaceRoot, "package.json")
7415
7485
  );
7416
7486
  return manifest.devDependencies ?? {};
7417
7487
  } catch {
@@ -7419,7 +7489,7 @@ function declaredDevDependencies(workspaceRoot) {
7419
7489
  }
7420
7490
  }
7421
7491
  function checkNoRetiredFormatter(workspaceRoot) {
7422
- const files = RETIRED_FORMATTER_FILES.filter((file) => fileExists((0, import_node_path31.join)(workspaceRoot, file)));
7492
+ const files = RETIRED_FORMATTER_FILES.filter((file) => fileExists((0, import_node_path32.join)(workspaceRoot, file)));
7423
7493
  const declared = ["prettier", "eslint-config-prettier", "oxlint", "oxfmt", "@mnci/oxlint-config"].filter((name) => declaredDevDependencies(workspaceRoot)[name] !== void 0);
7424
7494
  const stale = [...files, ...declared];
7425
7495
  if (stale.length === 0) {
@@ -7445,7 +7515,7 @@ function checkEslintPlugin(nxJson) {
7445
7515
  };
7446
7516
  }
7447
7517
  function checkResolvedEslint(workspaceRoot) {
7448
- const manifestPath = (0, import_node_path31.join)(workspaceRoot, "node_modules/eslint/package.json");
7518
+ const manifestPath = (0, import_node_path32.join)(workspaceRoot, "node_modules/eslint/package.json");
7449
7519
  if (!fileExists(manifestPath)) {
7450
7520
  return void 0;
7451
7521
  }
@@ -7463,11 +7533,11 @@ function checkResolvedEslint(workspaceRoot) {
7463
7533
  }
7464
7534
  }
7465
7535
  function checkNpmrc(workspaceRoot, registry, scope) {
7466
- const npmrcPath = (0, import_node_path31.join)(workspaceRoot, ".npmrc");
7536
+ const npmrcPath = (0, import_node_path32.join)(workspaceRoot, ".npmrc");
7467
7537
  if (!registry || !fileExists(npmrcPath)) {
7468
7538
  return void 0;
7469
7539
  }
7470
- const npmrc = (0, import_node_fs25.readFileSync)(npmrcPath, "utf8");
7540
+ const npmrc = (0, import_node_fs26.readFileSync)(npmrcPath, "utf8");
7471
7541
  if (registry.kind === "npm") {
7472
7542
  return {
7473
7543
  check: ".npmrc authenticates the public registry",
@@ -7484,11 +7554,11 @@ function checkNpmrc(workspaceRoot, registry, scope) {
7484
7554
  };
7485
7555
  }
7486
7556
  function checkNpmrcCredentialResolves(workspaceRoot, environment = process.env) {
7487
- const npmrcPath = (0, import_node_path31.join)(workspaceRoot, ".npmrc");
7557
+ const npmrcPath = (0, import_node_path32.join)(workspaceRoot, ".npmrc");
7488
7558
  if (!fileExists(npmrcPath)) {
7489
7559
  return void 0;
7490
7560
  }
7491
- const npmrc = (0, import_node_fs25.readFileSync)(npmrcPath, "utf8");
7561
+ const npmrc = (0, import_node_fs26.readFileSync)(npmrcPath, "utf8");
7492
7562
  const credentials = npmrc.split("\n").filter((line) => !line.trimStart().startsWith(";") && !line.trimStart().startsWith("#")).filter((line) => /(?:_authToken|_password|_auth)\s*=/u.test(line));
7493
7563
  const referenced = [
7494
7564
  ...new Set(
@@ -7512,13 +7582,13 @@ function checkNpmrcCredentialResolves(workspaceRoot, environment = process.env)
7512
7582
  };
7513
7583
  }
7514
7584
  function checkNpmAuthMatchesPipeline(workspaceRoot, registry) {
7515
- const npmrcPath = (0, import_node_path31.join)(workspaceRoot, ".npmrc");
7516
- const pipelinePath = (0, import_node_path31.join)(workspaceRoot, "azure-pipelines.yml");
7585
+ const npmrcPath = (0, import_node_path32.join)(workspaceRoot, ".npmrc");
7586
+ const pipelinePath = (0, import_node_path32.join)(workspaceRoot, "azure-pipelines.yml");
7517
7587
  if (registry?.kind !== "azure-artifacts" || !fileExists(npmrcPath) || !fileExists(pipelinePath)) {
7518
7588
  return void 0;
7519
7589
  }
7520
- const holdsCredentials = (0, import_node_fs25.readFileSync)(npmrcPath, "utf8").split("\n").filter((line) => !line.trimStart().startsWith(";") && !line.trimStart().startsWith("#")).some((line) => /(?:_authToken|_password|_auth)\s*=/u.test(line));
7521
- const runsTask = (0, import_node_fs25.readFileSync)(pipelinePath, "utf8").includes("npmAuthenticate@0");
7590
+ const holdsCredentials = (0, import_node_fs26.readFileSync)(npmrcPath, "utf8").split("\n").filter((line) => !line.trimStart().startsWith(";") && !line.trimStart().startsWith("#")).some((line) => /(?:_authToken|_password|_auth)\s*=/u.test(line));
7591
+ const runsTask = (0, import_node_fs26.readFileSync)(pipelinePath, "utf8").includes("npmAuthenticate@0");
7522
7592
  if (!holdsCredentials && !runsTask) {
7523
7593
  return {
7524
7594
  check: "npm auth: .npmrc and azure-pipelines.yml agree",
@@ -7563,13 +7633,13 @@ function npmjsCredentialShape(credentials, environment) {
7563
7633
  }
7564
7634
  function checkVersionActions(workspaceRoot) {
7565
7635
  const candidates = [
7566
- ...(0, import_node_fs25.globSync)("packages/*/pubspec.yaml", { cwd: workspaceRoot }),
7567
- ...(0, import_node_fs25.globSync)("packages/*/*.csproj", { cwd: workspaceRoot }),
7568
- ...(0, import_node_fs25.globSync)("python-packages/*/pyproject.toml", { cwd: workspaceRoot })
7636
+ ...(0, import_node_fs26.globSync)("packages/*/pubspec.yaml", { cwd: workspaceRoot }),
7637
+ ...(0, import_node_fs26.globSync)("packages/*/*.csproj", { cwd: workspaceRoot }),
7638
+ ...(0, import_node_fs26.globSync)("python-packages/*/pyproject.toml", { cwd: workspaceRoot })
7569
7639
  ].map((manifest) => toPosix2(manifest));
7570
7640
  return candidates.flatMap((manifest) => {
7571
7641
  const projectRoot = manifest.slice(0, manifest.lastIndexOf("/"));
7572
- const projectJsonPath = (0, import_node_path31.join)(workspaceRoot, projectRoot, "project.json");
7642
+ const projectJsonPath = (0, import_node_path32.join)(workspaceRoot, projectRoot, "project.json");
7573
7643
  let hasOverride = false;
7574
7644
  try {
7575
7645
  const projectJson = readJson(projectJsonPath);
@@ -7598,7 +7668,7 @@ function declaredTargets(workspaceRoot, projectRoot) {
7598
7668
  ]) {
7599
7669
  try {
7600
7670
  const targets = extract(
7601
- readJson((0, import_node_path31.join)(workspaceRoot, projectRoot, file))
7671
+ readJson((0, import_node_path32.join)(workspaceRoot, projectRoot, file))
7602
7672
  );
7603
7673
  if (targets && typeof targets === "object") {
7604
7674
  sources.push({
@@ -7614,8 +7684,8 @@ function declaredTargets(workspaceRoot, projectRoot) {
7614
7684
  function checkTargetFilesExist(workspaceRoot) {
7615
7685
  const projectRoots = new Set(
7616
7686
  [
7617
- ...(0, import_node_fs25.globSync)("{apps,libs,packages}/*/project.json", { cwd: workspaceRoot }),
7618
- ...(0, import_node_fs25.globSync)("{apps,libs,packages}/*/package.json", { cwd: workspaceRoot })
7687
+ ...(0, import_node_fs26.globSync)("{apps,libs,packages}/*/project.json", { cwd: workspaceRoot }),
7688
+ ...(0, import_node_fs26.globSync)("{apps,libs,packages}/*/package.json", { cwd: workspaceRoot })
7619
7689
  ].map((manifest) => toPosix2(manifest).split("/").slice(0, 2).join("/"))
7620
7690
  );
7621
7691
  return [...projectRoots].flatMap(
@@ -7630,7 +7700,7 @@ function checkOneTargetsFiles(workspaceRoot, source, targetName, target) {
7630
7700
  return TARGET_FILE_OPTIONS.flatMap((option) => {
7631
7701
  const value = target?.options?.[option];
7632
7702
  const checkable = typeof value === "string" && !value.includes("{");
7633
- if (!checkable || fileExists((0, import_node_path31.join)(workspaceRoot, value))) {
7703
+ if (!checkable || fileExists((0, import_node_path32.join)(workspaceRoot, value))) {
7634
7704
  return [];
7635
7705
  }
7636
7706
  return [
@@ -7669,15 +7739,15 @@ function checkGoPluginRegistered(workspaceRoot) {
7669
7739
  };
7670
7740
  }
7671
7741
  function checkGoWorkInSync(workspaceRoot) {
7672
- const goWorkPath = (0, import_node_path31.join)(workspaceRoot, "go.work");
7742
+ const goWorkPath = (0, import_node_path32.join)(workspaceRoot, "go.work");
7673
7743
  if (!fileExists(goWorkPath)) {
7674
7744
  return void 0;
7675
7745
  }
7676
- const contents = (0, import_node_fs25.existsSync)(goWorkPath) ? (0, import_node_fs25.readFileSync)(goWorkPath, "utf8") : "";
7746
+ const contents = (0, import_node_fs26.existsSync)(goWorkPath) ? (0, import_node_fs26.readFileSync)(goWorkPath, "utf8") : "";
7677
7747
  const blockEntries = Array.from(contents.matchAll(/(?:^|\n)\s*use\s+\(([^)]*)\)/g), (match) => match[1].split("\n")).flat();
7678
7748
  const singleEntries = Array.from(contents.matchAll(/(?:^|\n)\s*use\s+(\.\S+)/g), (match) => match[1]);
7679
7749
  const uses = [...blockEntries, ...singleEntries].map((entry) => entry.trim()).filter(Boolean);
7680
- const stale = uses.filter((entry) => !(0, import_node_fs25.existsSync)((0, import_node_path31.join)(workspaceRoot, entry, "go.mod")));
7750
+ const stale = uses.filter((entry) => !(0, import_node_fs26.existsSync)((0, import_node_path32.join)(workspaceRoot, entry, "go.mod")));
7681
7751
  return {
7682
7752
  check: "every go.work `use` entry points to a module that still exists",
7683
7753
  ok: stale.length === 0,
@@ -7693,9 +7763,9 @@ function checkNativeApps(workspaceRoot) {
7693
7763
  { file: ".github/workflows/ci.yml", marker: "native (${{ matrix.os }})" },
7694
7764
  { file: "azure-pipelines.yml", marker: "- job: native" }
7695
7765
  ];
7696
- const findings = pipelines.filter(({ file }) => fileExists((0, import_node_path31.join)(workspaceRoot, file))).map(({ file, marker }) => ({
7766
+ const findings = pipelines.filter(({ file }) => fileExists((0, import_node_path32.join)(workspaceRoot, file))).map(({ file, marker }) => ({
7697
7767
  check: `${file} builds the native apps on every OS`,
7698
- ok: (0, import_node_fs25.readFileSync)((0, import_node_path31.join)(workspaceRoot, file), "utf8").includes(marker),
7768
+ ok: (0, import_node_fs26.readFileSync)((0, import_node_path32.join)(workspaceRoot, file), "utf8").includes(marker),
7699
7769
  detail: `${file} has no native job: CI would verify a cgo app on the one agent that cannot build it`,
7700
7770
  remedy: "run `mnci upgrade`"
7701
7771
  }));
@@ -7708,7 +7778,7 @@ function checkNativeApps(workspaceRoot) {
7708
7778
  return findings;
7709
7779
  }
7710
7780
  function checkNoRootRuntimeDependencies(workspaceRoot) {
7711
- const manifestPath = (0, import_node_path31.join)(workspaceRoot, "package.json");
7781
+ const manifestPath = (0, import_node_path32.join)(workspaceRoot, "package.json");
7712
7782
  if (!fileExists(manifestPath)) {
7713
7783
  return void 0;
7714
7784
  }
@@ -7728,14 +7798,14 @@ function checkNoRootRuntimeDependencies(workspaceRoot) {
7728
7798
  };
7729
7799
  }
7730
7800
  function checkRollupSourceMaps(workspaceRoot) {
7731
- const configs = (0, import_node_fs25.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
7801
+ const configs = (0, import_node_fs26.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
7732
7802
  cwd: workspaceRoot
7733
7803
  }).map((config) => toPosix2(config));
7734
7804
  return configs.flatMap((relativePath) => {
7735
- const configPath = (0, import_node_path31.join)(workspaceRoot, relativePath);
7805
+ const configPath = (0, import_node_path32.join)(workspaceRoot, relativePath);
7736
7806
  let config;
7737
7807
  try {
7738
- config = (0, import_node_fs25.readFileSync)(configPath, "utf8");
7808
+ config = (0, import_node_fs26.readFileSync)(configPath, "utf8");
7739
7809
  } catch {
7740
7810
  return [];
7741
7811
  }
@@ -7750,11 +7820,11 @@ function checkRollupSourceMaps(workspaceRoot) {
7750
7820
  });
7751
7821
  }
7752
7822
  function checkDeclarationSpecifiers(workspaceRoot) {
7753
- const configs = (0, import_node_fs25.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
7823
+ const configs = (0, import_node_fs26.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
7754
7824
  cwd: workspaceRoot
7755
7825
  }).map((config) => toPosix2(config));
7756
7826
  return configs.flatMap((relativePath) => {
7757
- const configPath = (0, import_node_path31.join)(workspaceRoot, relativePath);
7827
+ const configPath = (0, import_node_path32.join)(workspaceRoot, relativePath);
7758
7828
  if (!fileExists(configPath)) {
7759
7829
  return [];
7760
7830
  }
@@ -7789,8 +7859,8 @@ function checkDeclarationSpecifiers(workspaceRoot) {
7789
7859
  }
7790
7860
  function checkPipelinePhases(workspaceRoot) {
7791
7861
  const files = ["azure-pipelines.yml", ".github/workflows/ci.yml"];
7792
- return files.filter((file) => fileExists((0, import_node_path31.join)(workspaceRoot, file))).flatMap((file) => {
7793
- const { verifyActive, switchedOff } = inspectPipeline((0, import_node_fs25.readFileSync)((0, import_node_path31.join)(workspaceRoot, file), "utf8"));
7862
+ return files.filter((file) => fileExists((0, import_node_path32.join)(workspaceRoot, file))).flatMap((file) => {
7863
+ const { verifyActive, switchedOff } = inspectPipeline((0, import_node_fs26.readFileSync)((0, import_node_path32.join)(workspaceRoot, file), "utf8"));
7794
7864
  const verify = {
7795
7865
  check: `${file} runs the enforced verify phase`,
7796
7866
  ok: verifyActive,
@@ -7807,8 +7877,20 @@ function checkPipelinePhases(workspaceRoot) {
7807
7877
  return [verify, ...warnings];
7808
7878
  });
7809
7879
  }
7880
+ function checkNativeBuildConfig(workspaceRoot) {
7881
+ const { problems } = readNativeBuildConfig(workspaceRoot);
7882
+ if (problems.length === 0) {
7883
+ return [];
7884
+ }
7885
+ return [{
7886
+ check: "mnci.native in nx.json is valid",
7887
+ ok: false,
7888
+ detail: problems.join("; "),
7889
+ remedy: "fix the entry in the mnci block of nx.json, then run `mnci upgrade`"
7890
+ }];
7891
+ }
7810
7892
  function collectFindings(workspaceRoot) {
7811
- const nxJsonPath = (0, import_node_path31.join)(workspaceRoot, "nx.json");
7893
+ const nxJsonPath = (0, import_node_path32.join)(workspaceRoot, "nx.json");
7812
7894
  if (!fileExists(nxJsonPath)) {
7813
7895
  throw new Error(
7814
7896
  `No nx.json found in ${workspaceRoot} \u2014 run 'mnci doctor' from the workspace root.`
@@ -7832,7 +7914,8 @@ function collectFindings(workspaceRoot) {
7832
7914
  checkGoPluginRegistered(workspaceRoot),
7833
7915
  checkGoWorkInSync(workspaceRoot),
7834
7916
  ...checkNativeApps(workspaceRoot),
7835
- ...checkPipelinePhases(workspaceRoot)
7917
+ ...checkPipelinePhases(workspaceRoot),
7918
+ ...checkNativeBuildConfig(workspaceRoot)
7836
7919
  ].filter((finding) => finding !== void 0);
7837
7920
  }
7838
7921
  function runDoctor(workspaceRoot, options = {}) {
@@ -7938,11 +8021,11 @@ function runCommands(program, options) {
7938
8021
  }
7939
8022
 
7940
8023
  // src/workspace-info/list-projects.use-case.ts
7941
- var import_node_path32 = require("path");
8024
+ var import_node_path33 = require("path");
7942
8025
  var TYPE_TAG_PREFIX = "type:";
7943
8026
  function listProjects(workspaceRoot) {
7944
8027
  return locateProjects(workspaceRoot).map((location) => {
7945
- const projectJsonPath = (0, import_node_path32.join)(workspaceRoot, location.dir, "project.json");
8028
+ const projectJsonPath = (0, import_node_path33.join)(workspaceRoot, location.dir, "project.json");
7946
8029
  const project = fileExists(projectJsonPath) ? readJson(projectJsonPath) : {};
7947
8030
  const typeTag = (project.tags ?? []).find((tag) => tag.startsWith(TYPE_TAG_PREFIX));
7948
8031
  return {
@@ -7955,7 +8038,7 @@ function listProjects(workspaceRoot) {
7955
8038
  }).toSorted((a, b) => a.dir.localeCompare(b.dir));
7956
8039
  }
7957
8040
  function runProjects(workspaceRoot, options) {
7958
- if (!fileExists((0, import_node_path32.join)(workspaceRoot, "nx.json"))) {
8041
+ if (!fileExists((0, import_node_path33.join)(workspaceRoot, "nx.json"))) {
7959
8042
  throw new Error("No nx.json found here. Run `projects` from the workspace root.");
7960
8043
  }
7961
8044
  const projects = listProjects(workspaceRoot);
@@ -7969,13 +8052,13 @@ function runProjects(workspaceRoot, options) {
7969
8052
  }
7970
8053
 
7971
8054
  // src/workspace-info/read-workspace-info.use-case.ts
7972
- var import_node_path34 = require("path");
8055
+ var import_node_path35 = require("path");
7973
8056
 
7974
8057
  // src/cli-version/check-for-update.use-case.ts
7975
- var import_node_fs26 = require("fs");
7976
- var import_node_path33 = require("path");
8058
+ var import_node_fs27 = require("fs");
8059
+ var import_node_path34 = require("path");
7977
8060
  var import_cross_spawn3 = __toESM(require("cross-spawn"));
7978
- var PACKAGE_NAME = "@mnci/cli";
8061
+ var PACKAGE_NAME2 = "@mnci/cli";
7979
8062
  var REGISTRY_TIMEOUT_MS = 2e3;
7980
8063
  function checkForUpdate(currentVersion2) {
7981
8064
  try {
@@ -7992,7 +8075,7 @@ function checkForUpdate(currentVersion2) {
7992
8075
  }
7993
8076
  }
7994
8077
  function fetchLatestVersion() {
7995
- const result = import_cross_spawn3.default.sync("npm", ["view", PACKAGE_NAME, "version"], {
8078
+ const result = import_cross_spawn3.default.sync("npm", ["view", PACKAGE_NAME2, "version"], {
7996
8079
  encoding: "utf8",
7997
8080
  timeout: REGISTRY_TIMEOUT_MS,
7998
8081
  stdio: ["ignore", "pipe", "ignore"]
@@ -8008,9 +8091,9 @@ function reportIfOutdated(currentVersion2) {
8008
8091
  return;
8009
8092
  }
8010
8093
  logger.info("");
8011
- logger.info(`A new version of ${PACKAGE_NAME} is available: ${latestVersion}`);
8094
+ logger.info(`A new version of ${PACKAGE_NAME2} is available: ${latestVersion}`);
8012
8095
  logger.info(` Current version: ${currentVersion2}`);
8013
- logger.info(` Update with: npm install -g ${PACKAGE_NAME}@latest`);
8096
+ logger.info(` Update with: npm install -g ${PACKAGE_NAME2}@latest`);
8014
8097
  logger.info("");
8015
8098
  }
8016
8099
  function isNewerVersion(candidate, current) {
@@ -8032,8 +8115,8 @@ function releaseTriple(version) {
8032
8115
  }
8033
8116
  function readCliVersion(packageDirectory) {
8034
8117
  try {
8035
- const manifestPath = (0, import_node_path33.join)(packageDirectory, "..", "package.json");
8036
- const manifest = JSON.parse((0, import_node_fs26.readFileSync)(manifestPath, "utf8"));
8118
+ const manifestPath = (0, import_node_path34.join)(packageDirectory, "..", "package.json");
8119
+ const manifest = JSON.parse((0, import_node_fs27.readFileSync)(manifestPath, "utf8"));
8037
8120
  return manifest.version ?? "0.0.0";
8038
8121
  } catch {
8039
8122
  return "0.0.0";
@@ -8043,7 +8126,7 @@ function readCliVersion(packageDirectory) {
8043
8126
  // src/workspace-info/read-workspace-info.use-case.ts
8044
8127
  function readWorkspaceInfo(workspaceRoot, cliVersion) {
8045
8128
  const latest = fetchLatestVersion() ?? null;
8046
- const isWorkspace = fileExists((0, import_node_path34.join)(workspaceRoot, "nx.json"));
8129
+ const isWorkspace = fileExists((0, import_node_path35.join)(workspaceRoot, "nx.json"));
8047
8130
  return {
8048
8131
  cli: {
8049
8132
  version: cliVersion,
@@ -8064,8 +8147,8 @@ function runInfo(workspaceRoot, cliVersion, options) {
8064
8147
  }
8065
8148
 
8066
8149
  // src/workspace-creation/adopt-directory.use-case.ts
8067
- var import_node_fs27 = require("fs");
8068
- var import_node_path35 = require("path");
8150
+ var import_node_fs28 = require("fs");
8151
+ var import_node_path36 = require("path");
8069
8152
  var NEVER_COPIED = /* @__PURE__ */ new Set([".git", "node_modules"]);
8070
8153
  var AGENT_AND_CI_ENTRIES = [
8071
8154
  "AGENTS.md",
@@ -8096,13 +8179,13 @@ var PREFLIGHT_BLOCKERS = [
8096
8179
  "packages"
8097
8180
  ];
8098
8181
  function assertAdoptableDirectory(target) {
8099
- if (!(0, import_node_fs27.existsSync)(target)) {
8182
+ if (!(0, import_node_fs28.existsSync)(target)) {
8100
8183
  throw new Error(`--into '${target}' does not exist. Create or clone it first.`);
8101
8184
  }
8102
- if (!(0, import_node_fs27.statSync)(target).isDirectory()) {
8185
+ if (!(0, import_node_fs28.statSync)(target).isDirectory()) {
8103
8186
  throw new Error(`--into '${target}' is not a directory.`);
8104
8187
  }
8105
- const blockers = PREFLIGHT_BLOCKERS.filter((entry) => (0, import_node_fs27.existsSync)((0, import_node_path35.join)(target, entry)));
8188
+ const blockers = PREFLIGHT_BLOCKERS.filter((entry) => (0, import_node_fs28.existsSync)((0, import_node_path36.join)(target, entry)));
8106
8189
  if (blockers.length > 0) {
8107
8190
  throw new Error(
8108
8191
  `--into '${target}' already holds ${blockers.join(", ")}, so it is a project already. Use \`mnci upgrade\` to re-apply the overlay to an existing workspace, or point --into at an empty checkout.`
@@ -8110,15 +8193,15 @@ function assertAdoptableDirectory(target) {
8110
8193
  }
8111
8194
  }
8112
8195
  function mergeGitignore(generatedFile, targetFile) {
8113
- const existing = (0, import_node_fs27.readFileSync)(targetFile, "utf8");
8196
+ const existing = (0, import_node_fs28.readFileSync)(targetFile, "utf8");
8114
8197
  const present = new Set(existing.split("\n").map((line) => line.trim()));
8115
- const additions = (0, import_node_fs27.readFileSync)(generatedFile, "utf8").split("\n").map((line) => line.trimEnd()).filter((line) => {
8198
+ const additions = (0, import_node_fs28.readFileSync)(generatedFile, "utf8").split("\n").map((line) => line.trimEnd()).filter((line) => {
8116
8199
  const trimmed = line.trim();
8117
8200
  return trimmed !== "" && !trimmed.startsWith("#") && !present.has(trimmed);
8118
8201
  });
8119
8202
  if (additions.length === 0) return false;
8120
8203
  const separator = existing.endsWith("\n") ? "" : "\n";
8121
- (0, import_node_fs27.writeFileSync)(
8204
+ (0, import_node_fs28.writeFileSync)(
8122
8205
  targetFile,
8123
8206
  `${existing}${separator}
8124
8207
  # Added by mnci (Nx workspace)
@@ -8128,9 +8211,9 @@ ${additions.join("\n")}
8128
8211
  return true;
8129
8212
  }
8130
8213
  function adoptGeneratedWorkspace(generatedRoot, target) {
8131
- const entries = (0, import_node_fs27.readdirSync)(generatedRoot).filter((entry) => !NEVER_COPIED.has(entry));
8214
+ const entries = (0, import_node_fs28.readdirSync)(generatedRoot).filter((entry) => !NEVER_COPIED.has(entry));
8132
8215
  const collisions = entries.filter(
8133
- (entry) => (0, import_node_fs27.existsSync)((0, import_node_path35.join)(target, entry)) && !EXISTING_WINS.has(entry) && entry !== ".gitignore"
8216
+ (entry) => (0, import_node_fs28.existsSync)((0, import_node_path36.join)(target, entry)) && !EXISTING_WINS.has(entry) && entry !== ".gitignore"
8134
8217
  );
8135
8218
  if (collisions.length > 0) {
8136
8219
  throw new Error(
@@ -8139,28 +8222,28 @@ function adoptGeneratedWorkspace(generatedRoot, target) {
8139
8222
  }
8140
8223
  const result = { copied: [], kept: [], mergedGitignore: false };
8141
8224
  for (const entry of entries) {
8142
- const from = (0, import_node_path35.join)(generatedRoot, entry);
8143
- const to = (0, import_node_path35.join)(target, entry);
8144
- if (entry === ".gitignore" && (0, import_node_fs27.existsSync)(to)) {
8225
+ const from = (0, import_node_path36.join)(generatedRoot, entry);
8226
+ const to = (0, import_node_path36.join)(target, entry);
8227
+ if (entry === ".gitignore" && (0, import_node_fs28.existsSync)(to)) {
8145
8228
  result.mergedGitignore = mergeGitignore(from, to);
8146
8229
  result.kept.push(entry);
8147
8230
  continue;
8148
8231
  }
8149
- if ((0, import_node_fs27.existsSync)(to)) {
8232
+ if ((0, import_node_fs28.existsSync)(to)) {
8150
8233
  result.kept.push(entry);
8151
8234
  continue;
8152
8235
  }
8153
- (0, import_node_fs27.cpSync)(from, to, { recursive: true });
8236
+ (0, import_node_fs28.cpSync)(from, to, { recursive: true });
8154
8237
  result.copied.push(entry);
8155
8238
  }
8156
- (0, import_node_fs27.rmSync)(generatedRoot, { recursive: true, force: true });
8239
+ (0, import_node_fs28.rmSync)(generatedRoot, { recursive: true, force: true });
8157
8240
  return result;
8158
8241
  }
8159
8242
 
8160
8243
  // src/workspace-creation/create-workspace.use-case.ts
8161
- var import_node_fs28 = require("fs");
8244
+ var import_node_fs29 = require("fs");
8162
8245
  var import_node_os2 = require("os");
8163
- var import_node_path36 = require("path");
8246
+ var import_node_path37 = require("path");
8164
8247
  function nxCloudProviderValue(ci) {
8165
8248
  return ci === "azure" ? "azure" : "github";
8166
8249
  }
@@ -8203,9 +8286,9 @@ async function resolveRegistry(options) {
8203
8286
  return await promptRegistry();
8204
8287
  }
8205
8288
  async function runNew(name, options) {
8206
- const adoptTarget = options.into === void 0 ? void 0 : (0, import_node_path36.resolve)(process.cwd(), options.into);
8289
+ const adoptTarget = options.into === void 0 ? void 0 : (0, import_node_path37.resolve)(process.cwd(), options.into);
8207
8290
  if (adoptTarget !== void 0) assertAdoptableDirectory(adoptTarget);
8208
- const workspaceName = name ?? (adoptTarget === void 0 ? await promptText("Workspace name") : (0, import_node_path36.basename)(adoptTarget));
8291
+ const workspaceName = name ?? (adoptTarget === void 0 ? await promptText("Workspace name") : (0, import_node_path37.basename)(adoptTarget));
8209
8292
  assertValidProjectName(workspaceName, "Workspace name");
8210
8293
  const scope = options.scope ?? (options.yes ? `@${workspaceName}` : await promptText("npm scope for publishable packages", `@${workspaceName}`));
8211
8294
  const registry = await resolveRegistry(options);
@@ -8218,8 +8301,8 @@ async function runNew(name, options) {
8218
8301
  const npmAuth = resolveNpmAuth(options.npmAuth, registry, ci);
8219
8302
  const stack = await resolveStack(options);
8220
8303
  const nxCloud = options.nxCloud ?? (options.yes ? false : await promptNxCloud());
8221
- const stagingParent = adoptTarget === void 0 ? process.cwd() : (0, import_node_fs28.mkdtempSync)((0, import_node_path36.join)((0, import_node_os2.tmpdir)(), "mnci-new-"));
8222
- let workspaceRoot = (0, import_node_path36.join)(stagingParent, workspaceName);
8304
+ const stagingParent = adoptTarget === void 0 ? process.cwd() : (0, import_node_fs29.mkdtempSync)((0, import_node_path37.join)((0, import_node_os2.tmpdir)(), "mnci-new-"));
8305
+ let workspaceRoot = (0, import_node_path37.join)(stagingParent, workspaceName);
8223
8306
  try {
8224
8307
  logger.step(`Creating Nx workspace '${workspaceName}' (preset: ts)`);
8225
8308
  runNpx(
@@ -8242,7 +8325,7 @@ async function runNew(name, options) {
8242
8325
  workspaceRoot = adoptTarget;
8243
8326
  }
8244
8327
  } finally {
8245
- if (adoptTarget !== void 0) (0, import_node_fs28.rmSync)(stagingParent, { recursive: true, force: true });
8328
+ if (adoptTarget !== void 0) (0, import_node_fs29.rmSync)(stagingParent, { recursive: true, force: true });
8246
8329
  }
8247
8330
  logger.step(
8248
8331
  "Applying MoNecromanCI overlay (VS Code workspace, release config, .npmrc, commitlint, pipeline, stack)"
@@ -8252,8 +8335,8 @@ async function runNew(name, options) {
8252
8335
  { workspaceName, scope, registry, agent, variableGroup, ci, stack, ...npmAuth && { npmAuth } },
8253
8336
  logger.detail
8254
8337
  );
8255
- (0, import_node_fs28.rmSync)((0, import_node_path36.join)(workspaceRoot, "node_modules"), { recursive: true, force: true });
8256
- (0, import_node_fs28.rmSync)((0, import_node_path36.join)(workspaceRoot, "package-lock.json"), { force: true });
8338
+ (0, import_node_fs29.rmSync)((0, import_node_path37.join)(workspaceRoot, "node_modules"), { recursive: true, force: true });
8339
+ (0, import_node_fs29.rmSync)((0, import_node_path37.join)(workspaceRoot, "package-lock.json"), { force: true });
8257
8340
  logger.step("Installing the toolchain (commitlint + husky + linting/formatting)");
8258
8341
  const installStatus = runShell(
8259
8342
  "npm",
@@ -8291,12 +8374,12 @@ function projectKindHintLines(kinds = PROJECT_KINDS) {
8291
8374
  }
8292
8375
 
8293
8376
  // src/workspace-creation/interactive-wizard.use-case.ts
8294
- var import_node_path38 = require("path");
8377
+ var import_node_path39 = require("path");
8295
8378
  var import_prompts4 = require("@inquirer/prompts");
8296
8379
 
8297
8380
  // src/workspace-upgrade/upgrade-workspace.use-case.ts
8298
- var import_node_fs29 = require("fs");
8299
- var import_node_path37 = require("path");
8381
+ var import_node_fs30 = require("fs");
8382
+ var import_node_path38 = require("path");
8300
8383
  function resolveRegistry2(options, persisted) {
8301
8384
  if (options.registry === "azure-artifacts" || options.organization && options.artifactsFeed) {
8302
8385
  const persistedAzure = persisted?.kind === "azure-artifacts" ? persisted : void 0;
@@ -8325,7 +8408,7 @@ function resolveWorkspaceName(workspaceRoot, persisted) {
8325
8408
  return persisted.workspaceName;
8326
8409
  }
8327
8410
  try {
8328
- const existing = (0, import_node_fs29.readdirSync)(workspaceRoot).find(
8411
+ const existing = (0, import_node_fs30.readdirSync)(workspaceRoot).find(
8329
8412
  (file) => file.endsWith(".code-workspace") && file !== "undefined.code-workspace"
8330
8413
  );
8331
8414
  if (existing) {
@@ -8333,11 +8416,11 @@ function resolveWorkspaceName(workspaceRoot, persisted) {
8333
8416
  }
8334
8417
  } catch {
8335
8418
  }
8336
- return (0, import_node_path37.basename)(workspaceRoot);
8419
+ return (0, import_node_path38.basename)(workspaceRoot);
8337
8420
  }
8338
8421
  function detectNpmAuth(workspaceRoot) {
8339
8422
  try {
8340
- return (0, import_node_fs29.readFileSync)((0, import_node_path37.join)(workspaceRoot, "azure-pipelines.yml"), "utf8").includes("npmAuthenticate@0") ? "build-identity" : void 0;
8423
+ return (0, import_node_fs30.readFileSync)((0, import_node_path38.join)(workspaceRoot, "azure-pipelines.yml"), "utf8").includes("npmAuthenticate@0") ? "build-identity" : void 0;
8341
8424
  } catch {
8342
8425
  return void 0;
8343
8426
  }
@@ -8384,7 +8467,7 @@ function resolveOverlayOptions(workspaceRoot, options, persisted) {
8384
8467
  };
8385
8468
  }
8386
8469
  function runUpgrade(workspaceRoot, options) {
8387
- if (!fileExists((0, import_node_path37.join)(workspaceRoot, "nx.json"))) {
8470
+ if (!fileExists((0, import_node_path38.join)(workspaceRoot, "nx.json"))) {
8388
8471
  throw new Error(
8389
8472
  `No nx.json found in ${workspaceRoot} \u2014 this does not look like an Nx workspace. Run 'mnci upgrade' from the workspace root.`
8390
8473
  );
@@ -8450,7 +8533,7 @@ function runUpgrade(workspaceRoot, options) {
8450
8533
 
8451
8534
  // src/workspace-creation/interactive-wizard.use-case.ts
8452
8535
  async function runInteractive() {
8453
- const inWorkspace = fileExists((0, import_node_path38.join)(process.cwd(), "nx.json"));
8536
+ const inWorkspace = fileExists((0, import_node_path39.join)(process.cwd(), "nx.json"));
8454
8537
  const choiceNew = { name: "Create a new monorepo", value: "new" };
8455
8538
  const choiceAdd = { name: "Add a project to this workspace", value: "add" };
8456
8539
  const choiceUpgrade = {