@mnci/cli 4.38.0 → 4.39.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
@@ -2376,13 +2376,80 @@ function runPack(workspaceRoot, dependencies = {}) {
2376
2376
  return status;
2377
2377
  }
2378
2378
 
2379
- // src/ci-pipeline/release.use-case.ts
2379
+ // src/ci-pipeline/report-phase.use-case.ts
2380
2380
  var import_node_fs8 = require("fs");
2381
+
2382
+ // src/ci-pipeline/phase-timing.algorithm.ts
2383
+ function formatDuration(milliseconds) {
2384
+ const seconds = Math.max(0, milliseconds) / 1e3;
2385
+ if (seconds < 60) {
2386
+ return `${seconds.toFixed(1)}s`;
2387
+ }
2388
+ const whole = Math.round(seconds);
2389
+ return `${Math.floor(whole / 60)}m ${String(whole % 60).padStart(2, "0")}s`;
2390
+ }
2391
+ function escapeCommandData(text) {
2392
+ return text.replaceAll("%", "%25").replaceAll("\r", "%0D").replaceAll("\n", "%0A");
2393
+ }
2394
+ function describePhaseOutcome(host, phase, status, milliseconds) {
2395
+ const took = formatDuration(milliseconds);
2396
+ if (status === 0) {
2397
+ return {
2398
+ log: `mnci ci ${phase}: passed in ${took}`,
2399
+ summary: `- \u2705 **${phase}** passed in ${took}`
2400
+ };
2401
+ }
2402
+ const message = `The ${phase} phase failed with exit status ${status} after ${took}`;
2403
+ let annotation;
2404
+ if (host === "github") {
2405
+ annotation = `::error title=mnci ci ${phase}::${escapeCommandData(message)}`;
2406
+ } else if (host === "azure") {
2407
+ annotation = `##vso[task.logissue type=error;]${message}`;
2408
+ }
2409
+ return {
2410
+ log: `mnci ci ${phase}: failed (exit ${status}) in ${took}`,
2411
+ annotation,
2412
+ summary: `- \u274C **${phase}** failed (exit ${status}) after ${took}`
2413
+ };
2414
+ }
2415
+
2416
+ // src/ci-pipeline/report-phase.use-case.ts
2417
+ async function reportPhase(phase, run, dependencies = {}) {
2418
+ const environment = dependencies.environment ?? process.env;
2419
+ const log = dependencies.log ?? ((message) => {
2420
+ console.log(message);
2421
+ });
2422
+ const clock = dependencies.clock ?? (() => Date.now());
2423
+ const host = detectCiHost(environment);
2424
+ const started = clock();
2425
+ const finish = (status) => {
2426
+ const outcome = describePhaseOutcome(host, phase, status, clock() - started);
2427
+ log(outcome.log);
2428
+ if (outcome.annotation !== void 0) {
2429
+ log(outcome.annotation);
2430
+ }
2431
+ if (host === "github" && environment.GITHUB_STEP_SUMMARY) {
2432
+ (0, import_node_fs8.appendFileSync)(environment.GITHUB_STEP_SUMMARY, `${outcome.summary}
2433
+ `);
2434
+ }
2435
+ };
2436
+ try {
2437
+ const status = await run();
2438
+ finish(status);
2439
+ return status;
2440
+ } catch (error) {
2441
+ finish(1);
2442
+ throw error;
2443
+ }
2444
+ }
2445
+
2446
+ // src/ci-pipeline/release.use-case.ts
2447
+ var import_node_fs9 = require("fs");
2381
2448
  var import_node_path7 = require("path");
2382
2449
  var SPECIFIER = /^(?:major|minor|patch|\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)$/;
2383
2450
  function hasTag(workspaceRoot, relativePath, tag) {
2384
2451
  try {
2385
- const parsed = JSON.parse((0, import_node_fs8.readFileSync)((0, import_node_path7.join)(workspaceRoot, relativePath), "utf8"));
2452
+ const parsed = JSON.parse((0, import_node_fs9.readFileSync)((0, import_node_path7.join)(workspaceRoot, relativePath), "utf8"));
2386
2453
  const tags = relativePath.endsWith("project.json") ? parsed.tags : parsed.nx?.tags;
2387
2454
  return Array.isArray(tags) && tags.includes(tag);
2388
2455
  } catch {
@@ -2391,12 +2458,12 @@ function hasTag(workspaceRoot, relativePath, tag) {
2391
2458
  }
2392
2459
  function releasableCounts(workspaceRoot) {
2393
2460
  return {
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
2461
+ npm: (0, import_node_fs9.globSync)("packages/*/package.json", { cwd: workspaceRoot }).length,
2462
+ csharp: (0, import_node_fs9.globSync)("packages/*/*.csproj", { cwd: workspaceRoot }).length,
2463
+ python: (0, import_node_fs9.globSync)("python-packages/*/pyproject.toml", { cwd: workspaceRoot }).length,
2464
+ dart: (0, import_node_fs9.globSync)("packages/*/pubspec.yaml", { cwd: workspaceRoot }).length,
2465
+ vscode: (0, import_node_fs9.globSync)("apps/*/package.json", { cwd: workspaceRoot }).filter((path) => hasTag(workspaceRoot, path, VSCODE_EXTENSION_TAG)).length,
2466
+ go: (0, import_node_fs9.globSync)("apps/*/project.json", { cwd: workspaceRoot }).filter((path) => hasTag(workspaceRoot, path, GO_RELEASE_TAG)).length
2400
2467
  };
2401
2468
  }
2402
2469
  function shallowCloneGuard(processes, log) {
@@ -2412,7 +2479,7 @@ function shallowCloneGuard(processes, log) {
2412
2479
  return 0;
2413
2480
  }
2414
2481
  function npmPreflight(workspaceRoot, registryKind, environment, processes, log) {
2415
- if (registryKind !== "npm" || (0, import_node_fs8.globSync)("packages/*/package.json", { cwd: workspaceRoot }).length === 0) {
2482
+ if (registryKind !== "npm" || (0, import_node_fs9.globSync)("packages/*/package.json", { cwd: workspaceRoot }).length === 0) {
2416
2483
  return 0;
2417
2484
  }
2418
2485
  if (!environment.NODE_AUTH_TOKEN) {
@@ -2428,7 +2495,7 @@ function npmPreflight(workspaceRoot, registryKind, environment, processes, log)
2428
2495
  return 0;
2429
2496
  }
2430
2497
  async function pypiPreflight(workspaceRoot, registryKind, environment, log, fetchStatus) {
2431
- const files = (0, import_node_fs8.globSync)("python-packages/*/pyproject.toml", { cwd: workspaceRoot });
2498
+ const files = (0, import_node_fs9.globSync)("python-packages/*/pyproject.toml", { cwd: workspaceRoot });
2432
2499
  if (registryKind !== "npm" || files.length === 0) {
2433
2500
  return 0;
2434
2501
  }
@@ -2441,7 +2508,7 @@ async function pypiPreflight(workspaceRoot, registryKind, environment, log, fetc
2441
2508
  return 1;
2442
2509
  }
2443
2510
  const names = files.map((file) => {
2444
- const text = (0, import_node_fs8.readFileSync)((0, import_node_path7.join)(workspaceRoot, file), "utf8");
2511
+ const text = (0, import_node_fs9.readFileSync)((0, import_node_path7.join)(workspaceRoot, file), "utf8");
2445
2512
  const block = text.slice(text.indexOf("[project]"));
2446
2513
  const line = block.split("\n").find((entry) => entry.trimStart().startsWith("name"));
2447
2514
  return line ? line.split("=", 2)[1].replaceAll(/[^\w.-]/gi, "") : "";
@@ -2516,14 +2583,14 @@ function runReleaseCommand(workspaceRoot, registry, counts, environment, process
2516
2583
  }
2517
2584
  function nxPushesTags(workspaceRoot) {
2518
2585
  try {
2519
- const nx = JSON.parse((0, import_node_fs8.readFileSync)((0, import_node_path7.join)(workspaceRoot, "nx.json"), "utf8"));
2586
+ const nx = JSON.parse((0, import_node_fs9.readFileSync)((0, import_node_path7.join)(workspaceRoot, "nx.json"), "utf8"));
2520
2587
  return nx.release?.git?.push === true;
2521
2588
  } catch {
2522
2589
  return false;
2523
2590
  }
2524
2591
  }
2525
2592
  function afterRelease(workspaceRoot, processes, githubReleases) {
2526
- if (githubReleases && (0, import_node_fs8.existsSync)((0, import_node_path7.join)(workspaceRoot, "tools", "go-app-release.cjs"))) {
2593
+ if (githubReleases && (0, import_node_fs9.existsSync)((0, import_node_path7.join)(workspaceRoot, "tools", "go-app-release.cjs"))) {
2527
2594
  const assets = processes.run("node", ["tools/go-app-release.cjs", "assets"]);
2528
2595
  if (assets !== 0) {
2529
2596
  return assets;
@@ -2574,17 +2641,17 @@ async function runRelease(workspaceRoot, dependencies = {}) {
2574
2641
  }
2575
2642
 
2576
2643
  // src/ci-pipeline/setup.use-case.ts
2577
- var import_node_fs11 = require("fs");
2644
+ var import_node_fs12 = require("fs");
2578
2645
  var import_node_path10 = require("path");
2579
2646
 
2580
2647
  // src/ci-pipeline/flutter-sdk.use-case.ts
2581
- var import_node_fs9 = require("fs");
2648
+ var import_node_fs10 = require("fs");
2582
2649
  var import_node_path8 = require("path");
2583
2650
  function flutterSdkDirectory(machine) {
2584
2651
  return (0, import_node_path8.join)(machine.home, `.mnci-flutter-${FLUTTER_SDK_VERSION}`);
2585
2652
  }
2586
2653
  function installFlutterSdk(workspaceRoot, processes, log, machine) {
2587
- if (!(0, import_node_fs9.existsSync)((0, import_node_path8.join)(workspaceRoot, "pubspec.yaml"))) {
2654
+ if (!(0, import_node_fs10.existsSync)((0, import_node_path8.join)(workspaceRoot, "pubspec.yaml"))) {
2588
2655
  log("No Flutter projects - skipping.");
2589
2656
  return 0;
2590
2657
  }
@@ -2593,26 +2660,26 @@ function installFlutterSdk(workspaceRoot, processes, log, machine) {
2593
2660
  return 0;
2594
2661
  }
2595
2662
  const sdk = flutterSdkDirectory(machine);
2596
- if ((0, import_node_fs9.existsSync)(sdk)) {
2663
+ if ((0, import_node_fs10.existsSync)(sdk)) {
2597
2664
  log(`Flutter SDK already installed at ${sdk} - skipping.`);
2598
2665
  return 0;
2599
2666
  }
2600
2667
  return processes.run("git", ["clone", "--depth", "1", "--branch", FLUTTER_SDK_VERSION, "https://github.com/flutter/flutter.git", sdk]);
2601
2668
  }
2602
2669
  function publishFlutterSdk(workspaceRoot, host, environment, log, machine) {
2603
- if (!(0, import_node_fs9.existsSync)((0, import_node_path8.join)(workspaceRoot, "pubspec.yaml"))) {
2670
+ if (!(0, import_node_fs10.existsSync)((0, import_node_path8.join)(workspaceRoot, "pubspec.yaml"))) {
2604
2671
  log("No Flutter projects - skipping.");
2605
2672
  return;
2606
2673
  }
2607
2674
  const sdk = flutterSdkDirectory(machine);
2608
- if (!(0, import_node_fs9.existsSync)(sdk)) {
2675
+ if (!(0, import_node_fs10.existsSync)(sdk)) {
2609
2676
  log("Flutter SDK was not installed by mnci (already on PATH) - skipping.");
2610
2677
  return;
2611
2678
  }
2612
2679
  addToPath(host, environment, (0, import_node_path8.join)(sdk, "bin"), log);
2613
2680
  }
2614
2681
  function resolveDartDependencies(workspaceRoot, processes, log) {
2615
- if (!(0, import_node_fs9.existsSync)((0, import_node_path8.join)(workspaceRoot, "pubspec.yaml"))) {
2682
+ if (!(0, import_node_fs10.existsSync)((0, import_node_path8.join)(workspaceRoot, "pubspec.yaml"))) {
2616
2683
  log("No Flutter projects - skipping.");
2617
2684
  return 0;
2618
2685
  }
@@ -2621,7 +2688,7 @@ function resolveDartDependencies(workspaceRoot, processes, log) {
2621
2688
 
2622
2689
  // src/ci-pipeline/go-tools.use-case.ts
2623
2690
  var import_node_crypto = require("crypto");
2624
- var import_node_fs10 = require("fs");
2691
+ var import_node_fs11 = require("fs");
2625
2692
  var import_node_os = require("os");
2626
2693
  var import_node_path9 = require("path");
2627
2694
  function currentMachine() {
@@ -2629,7 +2696,7 @@ function currentMachine() {
2629
2696
  }
2630
2697
  var GOLANGCI_LINT_MODULE = "github.com/golangci/golangci-lint/v2/cmd/golangci-lint";
2631
2698
  function downloadGoModules(workspaceRoot, processes, log) {
2632
- if (!(0, import_node_fs10.existsSync)((0, import_node_path9.join)(workspaceRoot, "go.mod"))) {
2699
+ if (!(0, import_node_fs11.existsSync)((0, import_node_path9.join)(workspaceRoot, "go.mod"))) {
2633
2700
  log("No Go projects - skipping.");
2634
2701
  return 0;
2635
2702
  }
@@ -2637,7 +2704,7 @@ function downloadGoModules(workspaceRoot, processes, log) {
2637
2704
  }
2638
2705
  async function installGolangciLint(workspaceRoot, dependencies, machine) {
2639
2706
  const { processes, log, fetchBytes } = dependencies;
2640
- if (!(0, import_node_fs10.existsSync)((0, import_node_path9.join)(workspaceRoot, "go.mod"))) {
2707
+ if (!(0, import_node_fs11.existsSync)((0, import_node_path9.join)(workspaceRoot, "go.mod"))) {
2641
2708
  log("No Go projects - skipping.");
2642
2709
  return 0;
2643
2710
  }
@@ -2674,30 +2741,30 @@ async function installGolangciLint(workspaceRoot, dependencies, machine) {
2674
2741
  if ((0, import_node_crypto.createHash)("sha256").update(archive).digest("hex") !== entry[0]) {
2675
2742
  throw new Error(`checksum mismatch for ${file}`);
2676
2743
  }
2677
- temporary = (0, import_node_fs10.mkdtempSync)((0, import_node_path9.join)((0, import_node_os.tmpdir)(), "golangci-lint-"));
2744
+ temporary = (0, import_node_fs11.mkdtempSync)((0, import_node_path9.join)((0, import_node_os.tmpdir)(), "golangci-lint-"));
2678
2745
  const archivePath = (0, import_node_path9.join)(temporary, file);
2679
- (0, import_node_fs10.writeFileSync)(archivePath, archive);
2746
+ (0, import_node_fs11.writeFileSync)(archivePath, archive);
2680
2747
  const tar = platform === "windows" ? (0, import_node_path9.join)(process.env.SystemRoot ?? "", "System32", "tar.exe") : "tar";
2681
2748
  if (processes.run(tar, ["-xf", archivePath, "-C", temporary]) !== 0) {
2682
2749
  throw new Error(`could not extract ${file}`);
2683
2750
  }
2684
2751
  const executable = `golangci-lint${platform === "windows" ? ".exe" : ""}`;
2685
2752
  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);
2753
+ (0, import_node_fs11.mkdirSync)(bin, { recursive: true });
2754
+ (0, import_node_fs11.copyFileSync)((0, import_node_path9.join)(temporary, name, executable), (0, import_node_path9.join)(bin, executable));
2755
+ (0, import_node_fs11.chmodSync)((0, import_node_path9.join)(bin, executable), 493);
2689
2756
  log(`golangci-lint ${version} installed from its checksum-verified prebuilt release into ${bin}`);
2690
2757
  return 0;
2691
2758
  } catch (error) {
2692
2759
  return fallback(error instanceof Error ? error.message : String(error));
2693
2760
  } finally {
2694
2761
  if (temporary !== void 0) {
2695
- (0, import_node_fs10.rmSync)(temporary, { recursive: true, force: true });
2762
+ (0, import_node_fs11.rmSync)(temporary, { recursive: true, force: true });
2696
2763
  }
2697
2764
  }
2698
2765
  }
2699
2766
  function publishGoTools(workspaceRoot, host, environment, processes, log) {
2700
- if (!(0, import_node_fs10.existsSync)((0, import_node_path9.join)(workspaceRoot, "go.mod"))) {
2767
+ if (!(0, import_node_fs11.existsSync)((0, import_node_path9.join)(workspaceRoot, "go.mod"))) {
2701
2768
  log("No Go projects - skipping.");
2702
2769
  return;
2703
2770
  }
@@ -2714,15 +2781,15 @@ function pythonCommand(machine) {
2714
2781
  return machine.platform === "win32" ? "python" : "python3";
2715
2782
  }
2716
2783
  function installPythonToolchain(workspaceRoot, processes, log, machine) {
2717
- if (!(0, import_node_fs11.existsSync)((0, import_node_path10.join)(workspaceRoot, "requirements-dev.txt"))) {
2784
+ if (!(0, import_node_fs12.existsSync)((0, import_node_path10.join)(workspaceRoot, "requirements-dev.txt"))) {
2718
2785
  log("No Python projects - skipping.");
2719
2786
  return 0;
2720
2787
  }
2721
2788
  return processes.run(pythonCommand(machine), ["-m", "pip", "install", "-r", "requirements-dev.txt"]);
2722
2789
  }
2723
2790
  function installPythonProjects(workspaceRoot, processes, log, machine) {
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 });
2791
+ const editable = ["apps/*/pyproject.toml", "python-packages/*/pyproject.toml", "libs/*/pyproject.toml"].flatMap((pattern) => (0, import_node_fs12.globSync)(pattern, { cwd: workspaceRoot })).map((path) => (0, import_node_path10.dirname)(path));
2792
+ const requirements = (0, import_node_fs12.globSync)("apps/*/requirements.txt", { cwd: workspaceRoot });
2726
2793
  if (editable.length === 0 && requirements.length === 0) {
2727
2794
  log("No Python projects - skipping.");
2728
2795
  return 0;
@@ -2841,6 +2908,9 @@ function runVerify(workspaceRoot, dependencies = {}) {
2841
2908
  // src/ci-pipeline/index.ts
2842
2909
  var CI_PHASES = ["setup", "audit", "verify", "pack", "release", "native"];
2843
2910
  function runCiPhase(phase, workspaceRoot, dependencies = {}) {
2911
+ return reportPhase(phase, () => runPhase(phase, workspaceRoot, dependencies), dependencies);
2912
+ }
2913
+ function runPhase(phase, workspaceRoot, dependencies) {
2844
2914
  switch (phase) {
2845
2915
  case "verify": {
2846
2916
  return runVerify(workspaceRoot, dependencies);
@@ -2877,7 +2947,7 @@ function assertValidProjectName(name, label) {
2877
2947
  }
2878
2948
 
2879
2949
  // src/project-scaffolding/csharp.use-case.ts
2880
- var import_node_fs13 = require("fs");
2950
+ var import_node_fs14 = require("fs");
2881
2951
  var import_node_path12 = require("path");
2882
2952
 
2883
2953
  // src/project-scaffolding/csharp-example.algorithm.ts
@@ -2919,7 +2989,7 @@ public class GreetUseCaseTests
2919
2989
  }
2920
2990
 
2921
2991
  // src/project-scaffolding/post-generation.use-case.ts
2922
- var import_node_fs12 = require("fs");
2992
+ var import_node_fs13 = require("fs");
2923
2993
  var import_node_path11 = require("path");
2924
2994
  function hasPlugin(workspaceRoot, packageName) {
2925
2995
  const manifest = readJson((0, import_node_path11.join)(workspaceRoot, "package.json"));
@@ -2982,11 +3052,11 @@ function removeStaleGitkeeps(workspaceRoot) {
2982
3052
  for (const scaffold of ["apps", "libs", "packages"]) {
2983
3053
  const directory = (0, import_node_path11.join)(workspaceRoot, scaffold);
2984
3054
  try {
2985
- const holdsAProject = (0, import_node_fs12.readdirSync)(directory, { withFileTypes: true }).some(
3055
+ const holdsAProject = (0, import_node_fs13.readdirSync)(directory, { withFileTypes: true }).some(
2986
3056
  (entry) => entry.isDirectory()
2987
3057
  );
2988
3058
  if (holdsAProject) {
2989
- (0, import_node_fs12.rmSync)((0, import_node_path11.join)(directory, ".gitkeep"), { force: true });
3059
+ (0, import_node_fs13.rmSync)((0, import_node_path11.join)(directory, ".gitkeep"), { force: true });
2990
3060
  }
2991
3061
  } catch {
2992
3062
  }
@@ -3034,13 +3104,13 @@ var ESLINT_CONFIG_FILENAMES = [
3034
3104
  ];
3035
3105
  function removeGeneratedEslintConfig(workspaceRoot, projectRoot) {
3036
3106
  for (const filename of ESLINT_CONFIG_FILENAMES) {
3037
- (0, import_node_fs12.rmSync)((0, import_node_path11.join)(workspaceRoot, projectRoot, filename), { force: true });
3107
+ (0, import_node_fs13.rmSync)((0, import_node_path11.join)(workspaceRoot, projectRoot, filename), { force: true });
3038
3108
  }
3039
- (0, import_node_fs12.rmSync)((0, import_node_path11.join)(workspaceRoot, ".vscode"), { recursive: true, force: true });
3109
+ (0, import_node_fs13.rmSync)((0, import_node_path11.join)(workspaceRoot, ".vscode"), { recursive: true, force: true });
3040
3110
  }
3041
3111
  function findCodeWorkspaceFile(workspaceRoot) {
3042
3112
  try {
3043
- const entry = (0, import_node_fs12.readdirSync)(workspaceRoot).find((file) => file.endsWith(".code-workspace"));
3113
+ const entry = (0, import_node_fs13.readdirSync)(workspaceRoot).find((file) => file.endsWith(".code-workspace"));
3044
3114
  return entry ? (0, import_node_path11.join)(workspaceRoot, entry) : void 0;
3045
3115
  } catch {
3046
3116
  return void 0;
@@ -3059,7 +3129,7 @@ function reshapeReactScaffold(projectRoot, name, empty = false) {
3059
3129
  }
3060
3130
  function reshapeReactAppScaffold(projectRoot) {
3061
3131
  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"))) {
3132
+ if (!(0, import_node_fs13.existsSync)((0, import_node_path11.join)(appDir, "app.tsx"))) {
3063
3133
  return;
3064
3134
  }
3065
3135
  for (const [from, to] of [
@@ -3067,13 +3137,13 @@ function reshapeReactAppScaffold(projectRoot) {
3067
3137
  ["app.spec.tsx", "app.component.spec.tsx"],
3068
3138
  ["nx-welcome.tsx", "nx-welcome.component.tsx"]
3069
3139
  ]) {
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));
3140
+ if ((0, import_node_fs13.existsSync)((0, import_node_path11.join)(appDir, from))) {
3141
+ (0, import_node_fs13.renameSync)((0, import_node_path11.join)(appDir, from), (0, import_node_path11.join)(appDir, to));
3072
3142
  }
3073
3143
  }
3074
3144
  const rewrite = (file, from, to) => {
3075
- if ((0, import_node_fs12.existsSync)(file)) {
3076
- writeFileEnsured(file, repointSpecifier((0, import_node_fs12.readFileSync)(file, "utf8"), from, to));
3145
+ if ((0, import_node_fs13.existsSync)(file)) {
3146
+ writeFileEnsured(file, repointSpecifier((0, import_node_fs13.readFileSync)(file, "utf8"), from, to));
3077
3147
  }
3078
3148
  };
3079
3149
  rewrite((0, import_node_path11.join)(appDir, "app.component.tsx"), "./nx-welcome", "./nx-welcome.component");
@@ -3085,8 +3155,8 @@ function reshapeReactAppScaffold(projectRoot) {
3085
3155
  );
3086
3156
  }
3087
3157
  function emptySlice(projectRoot, sliceDir) {
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 });
3158
+ for (const entry of (0, import_node_fs13.readdirSync)(sliceDir)) {
3159
+ (0, import_node_fs13.rmSync)((0, import_node_path11.join)(sliceDir, entry), { recursive: true, force: true });
3090
3160
  }
3091
3161
  writeFileEnsured((0, import_node_path11.join)(sliceDir, "index.ts"), "export {}\n");
3092
3162
  addNxTargets((0, import_node_path11.join)(projectRoot, "package.json"), { test: { options: { passWithNoTests: true } } });
@@ -3094,33 +3164,33 @@ function emptySlice(projectRoot, sliceDir) {
3094
3164
  function reshapeScaffoldSlice(projectRoot, name, extension, role, empty) {
3095
3165
  const sourceDir = (0, import_node_path11.join)(projectRoot, "src");
3096
3166
  const libDir = (0, import_node_path11.join)(sourceDir, "lib");
3097
- if (!(0, import_node_fs12.existsSync)((0, import_node_path11.join)(libDir, `${name}.${extension}`))) {
3167
+ if (!(0, import_node_fs13.existsSync)((0, import_node_path11.join)(libDir, `${name}.${extension}`))) {
3098
3168
  return;
3099
3169
  }
3100
3170
  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)) {
3171
+ (0, import_node_fs13.mkdirSync)(sliceDir, { recursive: true });
3172
+ for (const entry of (0, import_node_fs13.readdirSync)(libDir)) {
3103
3173
  if (entry === `${name}.${extension}`) {
3104
- (0, import_node_fs12.renameSync)((0, import_node_path11.join)(libDir, entry), (0, import_node_path11.join)(sliceDir, `${name}.${role}.${extension}`));
3174
+ (0, import_node_fs13.renameSync)((0, import_node_path11.join)(libDir, entry), (0, import_node_path11.join)(sliceDir, `${name}.${role}.${extension}`));
3105
3175
  } else if (entry === `${name}.spec.${extension}`) {
3106
3176
  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}`));
3177
+ (0, import_node_fs13.renameSync)((0, import_node_path11.join)(libDir, entry), renamed);
3178
+ writeFileEnsured(renamed, repointSpecifier((0, import_node_fs13.readFileSync)(renamed, "utf8"), `./${name}`, `./${name}.${role}`));
3109
3179
  } else {
3110
- (0, import_node_fs12.renameSync)((0, import_node_path11.join)(libDir, entry), (0, import_node_path11.join)(sliceDir, entry));
3180
+ (0, import_node_fs13.renameSync)((0, import_node_path11.join)(libDir, entry), (0, import_node_path11.join)(sliceDir, entry));
3111
3181
  }
3112
3182
  }
3113
3183
  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'`);
3184
+ const esm = (0, import_node_fs13.existsSync)(barrel) && (0, import_node_fs13.readFileSync)(barrel, "utf8").includes(`./lib/${name}.js'`);
3115
3185
  writeFileEnsured((0, import_node_path11.join)(sliceDir, "index.ts"), `export * from './${name}.${role}${esm ? ".js" : ""}'
3116
3186
  `);
3117
- if ((0, import_node_fs12.existsSync)(barrel)) {
3187
+ if ((0, import_node_fs13.existsSync)(barrel)) {
3118
3188
  writeFileEnsured(
3119
3189
  barrel,
3120
- (0, import_node_fs12.readFileSync)(barrel, "utf8").replaceAll(`./lib/${name}.js'`, () => `./${name}/index.js'`).replaceAll(`./lib/${name}'`, () => `./${name}'`)
3190
+ (0, import_node_fs13.readFileSync)(barrel, "utf8").replaceAll(`./lib/${name}.js'`, () => `./${name}/index.js'`).replaceAll(`./lib/${name}'`, () => `./${name}'`)
3121
3191
  );
3122
3192
  }
3123
- (0, import_node_fs12.rmSync)(libDir, { recursive: true, force: true });
3193
+ (0, import_node_fs13.rmSync)(libDir, { recursive: true, force: true });
3124
3194
  if (empty) {
3125
3195
  emptySlice(projectRoot, sliceDir);
3126
3196
  } else if (role === "use-case") {
@@ -3183,7 +3253,7 @@ function repointSpecifier(source, from, to) {
3183
3253
  }
3184
3254
  function ensureNxPeerOverrides(workspaceRoot) {
3185
3255
  const manifestPath = (0, import_node_path11.join)(workspaceRoot, "package.json");
3186
- if (!(0, import_node_fs12.existsSync)(manifestPath)) {
3256
+ if (!(0, import_node_fs13.existsSync)(manifestPath)) {
3187
3257
  return;
3188
3258
  }
3189
3259
  const manifest = readJson(manifestPath);
@@ -3207,7 +3277,7 @@ function registerProjectCommands(workspaceRoot, name, commands) {
3207
3277
  scripts[`${name}:start`] = commands.start;
3208
3278
  }
3209
3279
  const dependabotPath = (0, import_node_path11.join)(workspaceRoot, ".github/dependabot.yml");
3210
- if ((0, import_node_fs12.existsSync)(dependabotPath)) {
3280
+ if ((0, import_node_fs13.existsSync)(dependabotPath)) {
3211
3281
  writeFileEnsured(dependabotPath, dependabotConfig(workspaceRoot));
3212
3282
  }
3213
3283
  const manifestPath = (0, import_node_path11.join)(workspaceRoot, "package.json");
@@ -3314,7 +3384,7 @@ function scaffoldDotnetProject(workspaceRoot, projectRoot, identity, template) {
3314
3384
  }
3315
3385
  function writeCsharpExample(absoluteRoot, identity, kind) {
3316
3386
  if (kind === "classlib") {
3317
- (0, import_node_fs13.rmSync)((0, import_node_path12.join)(absoluteRoot, "Class1.cs"), { force: true });
3387
+ (0, import_node_fs14.rmSync)((0, import_node_path12.join)(absoluteRoot, "Class1.cs"), { force: true });
3318
3388
  }
3319
3389
  const files = csharpExampleFiles(identity);
3320
3390
  for (const [file, contents] of Object.entries(files)) {
@@ -3328,7 +3398,7 @@ function addCsharpTestProject(workspaceRoot, projectRoot, identity) {
3328
3398
  const name = (0, import_node_path12.basename)(projectRoot);
3329
3399
  const testRoot = `tests/${name}`;
3330
3400
  scaffoldDotnetProject(workspaceRoot, testRoot, `${identity}.Tests`, "xunit");
3331
- (0, import_node_fs13.rmSync)((0, import_node_path12.join)(workspaceRoot, testRoot, "UnitTest1.cs"), { force: true });
3401
+ (0, import_node_fs14.rmSync)((0, import_node_path12.join)(workspaceRoot, testRoot, "UnitTest1.cs"), { force: true });
3332
3402
  writeFileEnsured((0, import_node_path12.join)(workspaceRoot, testRoot, "GreetUseCaseTests.cs"), csharpExampleTest(identity));
3333
3403
  writeFileEnsured(
3334
3404
  (0, import_node_path12.join)(workspaceRoot, testRoot, "project.json"),
@@ -3472,7 +3542,7 @@ function addProjectJsonReleaseVersionActions(projectJsonPath) {
3472
3542
  );
3473
3543
  }
3474
3544
  function addInitialVersion(csprojPath) {
3475
- const contents = (0, import_node_fs13.readFileSync)(csprojPath, "utf8");
3545
+ const contents = (0, import_node_fs14.readFileSync)(csprojPath, "utf8");
3476
3546
  writeFileEnsured(csprojPath, contents.replace("<PropertyGroup>", "<PropertyGroup>\n <Version>0.1.0</Version>"));
3477
3547
  }
3478
3548
  function csharpLibPublishTarget(projectRoot) {
@@ -3648,7 +3718,7 @@ function addFlutterInternalLib(workspaceRoot, name) {
3648
3718
  }
3649
3719
 
3650
3720
  // src/project-scaffolding/go.use-case.ts
3651
- var import_node_fs17 = require("fs");
3721
+ var import_node_fs18 = require("fs");
3652
3722
  var import_node_path17 = require("path");
3653
3723
 
3654
3724
  // src/project-scaffolding/go-example.algorithm.ts
@@ -3718,14 +3788,14 @@ function goAppExampleFiles(modulePath) {
3718
3788
  }
3719
3789
 
3720
3790
  // src/go-workspace/go-plugin.use-case.ts
3721
- var import_node_fs14 = require("fs");
3791
+ var import_node_fs15 = require("fs");
3722
3792
  var import_node_path14 = require("path");
3723
3793
  var NX_GO_PLUGIN = "@nx-go/nx-go";
3724
3794
  function hasGoProject(workspaceRoot) {
3725
- const projectFiles = ["apps", "libs", "packages"].flatMap((directory) => (0, import_node_fs14.globSync)(`${directory}/*/project.json`, { cwd: workspaceRoot }));
3795
+ const projectFiles = ["apps", "libs", "packages"].flatMap((directory) => (0, import_node_fs15.globSync)(`${directory}/*/project.json`, { cwd: workspaceRoot }));
3726
3796
  return projectFiles.some((projectFile) => {
3727
3797
  try {
3728
- const { tags } = JSON.parse((0, import_node_fs14.readFileSync)((0, import_node_path14.join)(workspaceRoot, projectFile), "utf8"));
3798
+ const { tags } = JSON.parse((0, import_node_fs15.readFileSync)((0, import_node_path14.join)(workspaceRoot, projectFile), "utf8"));
3729
3799
  return (tags ?? []).some((tag) => tag.startsWith("type:go-"));
3730
3800
  } catch {
3731
3801
  return false;
@@ -3784,7 +3854,7 @@ function registerNxGoPlugin(workspaceRoot) {
3784
3854
  }
3785
3855
 
3786
3856
  // src/project-scaffolding/go-release.use-case.ts
3787
- var import_node_fs15 = require("fs");
3857
+ var import_node_fs16 = require("fs");
3788
3858
  var import_node_path15 = require("path");
3789
3859
  var GO_RELEASE_SCRIPT_PATH = "tools/go-app-release.cjs";
3790
3860
  var GO_RELEASE_SCRIPT = String.raw`#!/usr/bin/env node
@@ -3938,7 +4008,7 @@ function refreshGoReleaseScript(workspaceRoot) {
3938
4008
  const apps = (0, import_node_path15.join)(workspaceRoot, "apps");
3939
4009
  let entries;
3940
4010
  try {
3941
- entries = (0, import_node_fs15.readdirSync)(apps);
4011
+ entries = (0, import_node_fs16.readdirSync)(apps);
3942
4012
  } catch {
3943
4013
  return false;
3944
4014
  }
@@ -3947,7 +4017,7 @@ function refreshGoReleaseScript(workspaceRoot) {
3947
4017
  return fileExists(projectJsonPath) && (readJson(projectJsonPath).tags ?? []).includes(GO_RELEASE_TAG);
3948
4018
  });
3949
4019
  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) {
4020
+ if (!hasReleasableApp || fileExists(path) && (0, import_node_fs16.readFileSync)(path, "utf8") === GO_RELEASE_SCRIPT) {
3951
4021
  return false;
3952
4022
  }
3953
4023
  writeFileEnsured(path, GO_RELEASE_SCRIPT);
@@ -3955,7 +4025,7 @@ function refreshGoReleaseScript(workspaceRoot) {
3955
4025
  }
3956
4026
 
3957
4027
  // src/project-scaffolding/go-web.use-case.ts
3958
- var import_node_fs16 = require("fs");
4028
+ var import_node_fs17 = require("fs");
3959
4029
  var import_node_path16 = require("path");
3960
4030
  var TARGETS_NEEDING_THE_FRONTEND = ["build", "test", "lint", "start", "build-all", "build-native"];
3961
4031
  var DEFAULT_ADDRESS = "127.0.0.1:8080";
@@ -4035,7 +4105,7 @@ func TestWebHandlerServesTheBuiltFrontend(t *testing.T) {
4035
4105
  `;
4036
4106
  function assertWebApp(workspaceRoot, web) {
4037
4107
  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."));
4108
+ const isReactApp = fileExists((0, import_node_path16.join)(directory, "package.json")) && (0, import_node_fs17.readdirSync)(directory).some((entry) => entry.startsWith("vite.config."));
4039
4109
  if (!isReactApp) {
4040
4110
  throw new Error(`--web ${web}: no React app at apps/${web}. Add it first with \`mnci add react-app ${web}\`.`);
4041
4111
  }
@@ -4045,7 +4115,7 @@ function webProjectName(workspaceRoot, web) {
4045
4115
  return manifest.nx?.name ?? manifest.name ?? web;
4046
4116
  }
4047
4117
  function addApiProxy(viteConfigPath) {
4048
- const source = (0, import_node_fs16.readFileSync)(viteConfigPath, "utf8");
4118
+ const source = (0, import_node_fs17.readFileSync)(viteConfigPath, "utf8");
4049
4119
  if (source.includes("'/api'") || source.includes('"/api"')) {
4050
4120
  return false;
4051
4121
  }
@@ -4089,7 +4159,7 @@ function wireGoAppToWeb(workspaceRoot, name, web) {
4089
4159
  writeFileEnsured((0, import_node_path16.join)(directory, "web.go"), GO_WEB_SOURCE);
4090
4160
  writeFileEnsured((0, import_node_path16.join)(directory, "main.go"), GO_WEB_MAIN);
4091
4161
  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."));
4162
+ const viteConfig = (0, import_node_fs17.readdirSync)((0, import_node_path16.join)(workspaceRoot, "apps", web)).find((entry) => entry.startsWith("vite.config."));
4093
4163
  if (viteConfig === void 0 || !addApiProxy((0, import_node_path16.join)(workspaceRoot, "apps", web, viteConfig))) {
4094
4164
  logger.warn(
4095
4165
  `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.`
@@ -4132,7 +4202,7 @@ function ensureGoModule(workspaceRoot) {
4132
4202
  }
4133
4203
  function readGoModModule(goModPath) {
4134
4204
  try {
4135
- return /^module\s+(\S+)/m.exec((0, import_node_fs17.readFileSync)(goModPath, "utf8"))?.[1];
4205
+ return /^module\s+(\S+)/m.exec((0, import_node_fs18.readFileSync)(goModPath, "utf8"))?.[1];
4136
4206
  } catch {
4137
4207
  return void 0;
4138
4208
  }
@@ -4151,16 +4221,16 @@ function setGoModulePath(workspaceRoot, projectDir) {
4151
4221
  if (prefix === void 0 || !fileExists(goModPath)) {
4152
4222
  return;
4153
4223
  }
4154
- const rewritten = (0, import_node_fs17.readFileSync)(goModPath, "utf8").replace(/^module\s+\S+/m, () => `module ${prefix}/${projectDir}`);
4224
+ const rewritten = (0, import_node_fs18.readFileSync)(goModPath, "utf8").replace(/^module\s+\S+/m, () => `module ${prefix}/${projectDir}`);
4155
4225
  writeFileEnsured(goModPath, rewritten);
4156
4226
  }
4157
4227
  function writeGoAppExample(workspaceRoot, projectDir) {
4158
4228
  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;
4229
+ const modulePath = fileExists(goModPath) ? /^module\s+(\S+)/m.exec((0, import_node_fs18.readFileSync)(goModPath, "utf8"))?.[1] : void 0;
4160
4230
  if (modulePath === void 0) {
4161
4231
  return;
4162
4232
  }
4163
- (0, import_node_fs17.rmSync)((0, import_node_path17.join)(workspaceRoot, projectDir, "main_test.go"), { force: true });
4233
+ (0, import_node_fs18.rmSync)((0, import_node_path17.join)(workspaceRoot, projectDir, "main_test.go"), { force: true });
4164
4234
  const example = goAppExampleFiles(modulePath);
4165
4235
  for (const [relative, contents] of Object.entries(example)) {
4166
4236
  writeFileEnsured((0, import_node_path17.join)(workspaceRoot, projectDir, relative), contents);
@@ -4245,12 +4315,12 @@ function addGoPlatformTargets(workspaceRoot) {
4245
4315
  if (!fileExists(apps)) {
4246
4316
  return changed;
4247
4317
  }
4248
- for (const name of (0, import_node_fs17.readdirSync)(apps)) {
4318
+ for (const name of (0, import_node_fs18.readdirSync)(apps)) {
4249
4319
  const projectJsonPath = (0, import_node_path17.join)(apps, name, "project.json");
4250
4320
  if (!fileExists(projectJsonPath)) {
4251
4321
  continue;
4252
4322
  }
4253
- const project = JSON.parse((0, import_node_fs17.readFileSync)(projectJsonPath, "utf8"));
4323
+ const project = JSON.parse((0, import_node_fs18.readFileSync)(projectJsonPath, "utf8"));
4254
4324
  const tag = (project.tags ?? []).find((each) => each === "type:go-app" || each === "type:go-function-app")?.slice("type:".length);
4255
4325
  if (tag === void 0 || (project.tags ?? []).includes(GO_CGO_TAG)) {
4256
4326
  continue;
@@ -4286,8 +4356,8 @@ function goLibraryIdentifiers(projectName) {
4286
4356
  }
4287
4357
  function reshapeGoLibraryScaffold(projectRoot, projectName) {
4288
4358
  const { packageName, fileStem } = goLibraryIdentifiers(projectName);
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 });
4359
+ (0, import_node_fs18.rmSync)((0, import_node_path17.join)(projectRoot, `${projectName}.go`), { force: true });
4360
+ (0, import_node_fs18.rmSync)((0, import_node_path17.join)(projectRoot, `${projectName}_test.go`), { force: true });
4291
4361
  const files = [
4292
4362
  [
4293
4363
  "doc.go",
@@ -4775,7 +4845,7 @@ function addNodeFunctionApp(workspaceRoot, name, stack, empty = false) {
4775
4845
  var import_node_path22 = require("path");
4776
4846
 
4777
4847
  // src/rollup-library/repair-publishable-manifest.use-case.ts
4778
- var import_node_fs18 = require("fs");
4848
+ var import_node_fs19 = require("fs");
4779
4849
  var import_node_path19 = require("path");
4780
4850
  var WRONG_TYPES_PATH = "./dist/index.esm.d.ts";
4781
4851
  var ACTUAL_TYPES_PATH = "./dist/src/index.d.ts";
@@ -4799,14 +4869,14 @@ function repairPublishableManifest(manifestPath) {
4799
4869
  }
4800
4870
  function repairPublishableManifests(workspaceRoot) {
4801
4871
  const changed = [];
4802
- const manifests = (0, import_node_fs18.globSync)(["packages/*/package.json", "libs/*/package.json"], {
4872
+ const manifests = (0, import_node_fs19.globSync)(["packages/*/package.json", "libs/*/package.json"], {
4803
4873
  cwd: workspaceRoot
4804
4874
  });
4805
4875
  for (const relativePath of manifests) {
4806
4876
  const manifestPath = (0, import_node_path19.join)(workspaceRoot, relativePath);
4807
- const before = (0, import_node_fs18.readFileSync)(manifestPath, "utf8");
4877
+ const before = (0, import_node_fs19.readFileSync)(manifestPath, "utf8");
4808
4878
  repairPublishableManifest(manifestPath);
4809
- const after = (0, import_node_fs18.readFileSync)(manifestPath, "utf8");
4879
+ const after = (0, import_node_fs19.readFileSync)(manifestPath, "utf8");
4810
4880
  if (after !== before) {
4811
4881
  changed.push(relativePath.replaceAll("\\", "/"));
4812
4882
  }
@@ -4815,7 +4885,7 @@ function repairPublishableManifests(workspaceRoot) {
4815
4885
  }
4816
4886
 
4817
4887
  // src/rollup-library/repair-rollup-config.use-case.ts
4818
- var import_node_fs19 = require("fs");
4888
+ var import_node_fs20 = require("fs");
4819
4889
  var import_node_path20 = require("path");
4820
4890
 
4821
4891
  // src/rollup-library/rollup-config.algorithm.ts
@@ -5018,12 +5088,12 @@ function withUpgradedDeclarationSpecifierPlugin(config) {
5018
5088
  // src/rollup-library/repair-rollup-config.use-case.ts
5019
5089
  function repairRollupSourceMaps(workspaceRoot) {
5020
5090
  const changed = [];
5021
- const configs = (0, import_node_fs19.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
5091
+ const configs = (0, import_node_fs20.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
5022
5092
  cwd: workspaceRoot
5023
5093
  });
5024
5094
  for (const relativePath of configs) {
5025
5095
  const configPath = (0, import_node_path20.join)(workspaceRoot, relativePath);
5026
- const before = (0, import_node_fs19.readFileSync)(configPath, "utf8");
5096
+ const before = (0, import_node_fs20.readFileSync)(configPath, "utf8");
5027
5097
  const after = withRollupSourceMaps(before);
5028
5098
  if (after !== before) {
5029
5099
  writeFileEnsured(configPath, after);
@@ -5034,12 +5104,12 @@ function repairRollupSourceMaps(workspaceRoot) {
5034
5104
  }
5035
5105
  function upgradeDeclarationSpecifierPlugins(workspaceRoot) {
5036
5106
  const changed = [];
5037
- const configs = (0, import_node_fs19.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
5107
+ const configs = (0, import_node_fs20.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
5038
5108
  cwd: workspaceRoot
5039
5109
  });
5040
5110
  for (const relativePath of configs) {
5041
5111
  const configPath = (0, import_node_path20.join)(workspaceRoot, relativePath);
5042
- const before = (0, import_node_fs19.readFileSync)(configPath, "utf8");
5112
+ const before = (0, import_node_fs20.readFileSync)(configPath, "utf8");
5043
5113
  const after = withUpgradedDeclarationSpecifierPlugin(before);
5044
5114
  if (after !== before) {
5045
5115
  writeFileEnsured(configPath, after);
@@ -5053,7 +5123,7 @@ function repairDeclarationSpecifiers(projectRoot) {
5053
5123
  if (!fileExists(configPath)) {
5054
5124
  return;
5055
5125
  }
5056
- const config = (0, import_node_fs19.readFileSync)(configPath, "utf8");
5126
+ const config = (0, import_node_fs20.readFileSync)(configPath, "utf8");
5057
5127
  if (!config.includes(ROLLUP_CONFIG_PLACEHOLDER)) {
5058
5128
  return;
5059
5129
  }
@@ -5062,7 +5132,7 @@ function repairDeclarationSpecifiers(projectRoot) {
5062
5132
  }
5063
5133
 
5064
5134
  // src/rollup-library/rollup-config.repository.ts
5065
- var import_node_fs20 = require("fs");
5135
+ var import_node_fs21 = require("fs");
5066
5136
  var import_node_path21 = require("path");
5067
5137
  function resolveRequireTarget(fromDir, specifier) {
5068
5138
  const base = (0, import_node_path21.join)(fromDir, specifier);
@@ -5075,7 +5145,7 @@ function resolveRollupConfigText(configPath, visited = /* @__PURE__ */ new Set()
5075
5145
  visited.add(configPath);
5076
5146
  let text;
5077
5147
  try {
5078
- text = (0, import_node_fs20.readFileSync)(configPath, "utf8");
5148
+ text = (0, import_node_fs21.readFileSync)(configPath, "utf8");
5079
5149
  } catch {
5080
5150
  return "";
5081
5151
  }
@@ -5120,7 +5190,7 @@ async function addNpmLib(workspaceRoot, name, options, kindProvided, stack) {
5120
5190
  }
5121
5191
 
5122
5192
  // src/project-scaffolding/python.use-case.ts
5123
- var import_node_fs21 = require("fs");
5193
+ var import_node_fs22 = require("fs");
5124
5194
  var import_node_path23 = require("path");
5125
5195
  function ensurePython(workspaceRoot) {
5126
5196
  const hasPython = runShell("python3", ["--version"], workspaceRoot) === 0 || runShell("python", ["--version"], workspaceRoot) === 0;
@@ -5339,7 +5409,7 @@ async function addPythonVendor(workspaceRoot, consumer, options, kindProvided) {
5339
5409
  throw new Error(`'${consumer}' cannot vendor itself.`);
5340
5410
  }
5341
5411
  const pyprojectPath = (0, import_node_path23.join)(workspaceRoot, consumerDirectory, consumer, "pyproject.toml");
5342
- const pyprojectToml = (0, import_node_fs21.readFileSync)(pyprojectPath, "utf8");
5412
+ const pyprojectToml = (0, import_node_fs22.readFileSync)(pyprojectPath, "utf8");
5343
5413
  if (parseVendorEntries(pyprojectToml).includes(lib)) {
5344
5414
  logger.info(`'${consumer}' already vendors '${lib}' \u2014 nothing to do.`);
5345
5415
  return;
@@ -5351,7 +5421,7 @@ async function addPythonVendor(workspaceRoot, consumer, options, kindProvided) {
5351
5421
  }
5352
5422
 
5353
5423
  // src/project-scaffolding/react-app.use-case.ts
5354
- var import_node_fs22 = require("fs");
5424
+ var import_node_fs23 = require("fs");
5355
5425
  var import_node_path24 = require("path");
5356
5426
 
5357
5427
  // src/project-scaffolding/react-app-example.algorithm.ts
@@ -5474,7 +5544,7 @@ function allowEnvFiles(workspaceRoot) {
5474
5544
  return;
5475
5545
  }
5476
5546
  const marker = "# MoNecromanCI: keep the committed per-environment Vite config (public VITE_ values)";
5477
- const current = (0, import_node_fs22.readFileSync)(gitignorePath, "utf8");
5547
+ const current = (0, import_node_fs23.readFileSync)(gitignorePath, "utf8");
5478
5548
  if (current.includes(marker)) {
5479
5549
  return;
5480
5550
  }
@@ -5508,7 +5578,7 @@ function addReactApp(workspaceRoot, name, stack) {
5508
5578
  allowEnvFiles(workspaceRoot);
5509
5579
  addNxTargets((0, import_node_path24.join)(reactAppRoot, "package.json"), reactAppTargets(name));
5510
5580
  reshapeReactAppScaffold(reactAppRoot);
5511
- (0, import_node_fs22.rmSync)((0, import_node_path24.join)(reactAppRoot, "src/app/nx-welcome.component.tsx"), { force: true });
5581
+ (0, import_node_fs23.rmSync)((0, import_node_path24.join)(reactAppRoot, "src/app/nx-welcome.component.tsx"), { force: true });
5512
5582
  const example = reactAppExampleFiles(name);
5513
5583
  for (const [relative, contents] of Object.entries(example)) {
5514
5584
  writeFileEnsured((0, import_node_path24.join)(reactAppRoot, "src", relative), contents);
@@ -5582,7 +5652,7 @@ function addReactInternalLib(workspaceRoot, name, stack, empty = false) {
5582
5652
  }
5583
5653
 
5584
5654
  // src/project-scaffolding/vscode-extension.use-case.ts
5585
- var import_node_fs23 = require("fs");
5655
+ var import_node_fs24 = require("fs");
5586
5656
  var import_node_path26 = require("path");
5587
5657
  var VSCODE_EXTENSION_SCRIPT_PATH = "tools/vscode-extension.cjs";
5588
5658
  var VSCODE_ENGINE_FLOOR = "1.96.0";
@@ -5769,7 +5839,7 @@ var VSCODE_STUB_PATH = "test/vscode.stub.ts";
5769
5839
  function mapVscodeToStub(projectRoot, testRunner) {
5770
5840
  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}\` },`];
5771
5841
  const path = (0, import_node_path26.join)(projectRoot, file);
5772
- const content = fileExists(path) ? (0, import_node_fs23.readFileSync)(path, "utf8") : "";
5842
+ const content = fileExists(path) ? (0, import_node_fs24.readFileSync)(path, "utf8") : "";
5773
5843
  const line = content.split("\n").find((candidate) => candidate.trim() === anchor);
5774
5844
  if (line === void 0) {
5775
5845
  throw new Error(`${file} has no "${anchor}" line to map the vscode module after; map 'vscode' to ${VSCODE_STUB_PATH} by hand.`);
@@ -5857,7 +5927,7 @@ function vscodeExtensionPublishTarget(name, sidecar) {
5857
5927
  };
5858
5928
  }
5859
5929
  function addDebugLaunch(workspaceRoot, name) {
5860
- const file = (0, import_node_fs23.readdirSync)(workspaceRoot).find((entry) => entry.endsWith(".code-workspace"));
5930
+ const file = (0, import_node_fs24.readdirSync)(workspaceRoot).find((entry) => entry.endsWith(".code-workspace"));
5861
5931
  if (file === void 0) {
5862
5932
  return;
5863
5933
  }
@@ -5897,7 +5967,7 @@ function refreshVscodeExtensionScript(workspaceRoot) {
5897
5967
  const apps = (0, import_node_path26.join)(workspaceRoot, "apps");
5898
5968
  let entries;
5899
5969
  try {
5900
- entries = (0, import_node_fs23.readdirSync)(apps);
5970
+ entries = (0, import_node_fs24.readdirSync)(apps);
5901
5971
  } catch {
5902
5972
  return false;
5903
5973
  }
@@ -5910,7 +5980,7 @@ function refreshVscodeExtensionScript(workspaceRoot) {
5910
5980
  return tags.includes(VSCODE_EXTENSION_TAG);
5911
5981
  });
5912
5982
  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) {
5983
+ if (!hasExtension || fileExists(path) && (0, import_node_fs24.readFileSync)(path, "utf8") === VSCODE_EXTENSION_SCRIPT) {
5914
5984
  return false;
5915
5985
  }
5916
5986
  writeFileEnsured(path, VSCODE_EXTENSION_SCRIPT);
@@ -5920,7 +5990,7 @@ function pinVscodeExtensionProjectNames(workspaceRoot) {
5920
5990
  const apps = (0, import_node_path26.join)(workspaceRoot, "apps");
5921
5991
  let entries;
5922
5992
  try {
5923
- entries = (0, import_node_fs23.readdirSync)(apps);
5993
+ entries = (0, import_node_fs24.readdirSync)(apps);
5924
5994
  } catch {
5925
5995
  return [];
5926
5996
  }
@@ -5972,11 +6042,11 @@ function addVscodeExtension(workspaceRoot, name, stack, options = {}) {
5972
6042
  }
5973
6043
 
5974
6044
  // src/dependency-management/install-dependencies.use-case.ts
5975
- var import_node_fs25 = require("fs");
6045
+ var import_node_fs26 = require("fs");
5976
6046
  var import_node_path28 = require("path");
5977
6047
 
5978
6048
  // src/dependency-management/manifest.repository.ts
5979
- var import_node_fs24 = require("fs");
6049
+ var import_node_fs25 = require("fs");
5980
6050
  var import_node_path27 = require("path");
5981
6051
  var ECOSYSTEMS = ["npm", "pip", "pub", "nuget", "go"];
5982
6052
  var ROOT_LABEL = "(root)";
@@ -6013,18 +6083,18 @@ function hasEcosystem(workspaceRoot, ecosystem) {
6013
6083
  return fileExists((0, import_node_path27.join)(workspaceRoot, "go.mod"));
6014
6084
  }
6015
6085
  if (ecosystem === "nuget") {
6016
- return (0, import_node_fs24.globSync)(MANIFEST_GLOBS.nuget, { cwd: workspaceRoot }).length > 0;
6086
+ return (0, import_node_fs25.globSync)(MANIFEST_GLOBS.nuget, { cwd: workspaceRoot }).length > 0;
6017
6087
  }
6018
6088
  const rootMarker = {
6019
6089
  npm: "package.json",
6020
6090
  pip: "requirements-dev.txt",
6021
6091
  pub: "pubspec.yaml"
6022
6092
  };
6023
- return fileExists((0, import_node_path27.join)(workspaceRoot, rootMarker[ecosystem])) || (0, import_node_fs24.globSync)(MANIFEST_GLOBS[ecosystem], { cwd: workspaceRoot }).length > 0;
6093
+ return fileExists((0, import_node_path27.join)(workspaceRoot, rootMarker[ecosystem])) || (0, import_node_fs25.globSync)(MANIFEST_GLOBS[ecosystem], { cwd: workspaceRoot }).length > 0;
6024
6094
  }
6025
6095
  function collectNpm(workspaceRoot) {
6026
6096
  const sites = [];
6027
- const relativePaths = ["package.json", ...(0, import_node_fs24.globSync)(MANIFEST_GLOBS.npm, { cwd: workspaceRoot })];
6097
+ const relativePaths = ["package.json", ...(0, import_node_fs25.globSync)(MANIFEST_GLOBS.npm, { cwd: workspaceRoot })];
6028
6098
  for (const relativePath of relativePaths) {
6029
6099
  const manifestPath = (0, import_node_path27.join)(workspaceRoot, relativePath);
6030
6100
  try {
@@ -6093,11 +6163,11 @@ function collectPip(workspaceRoot) {
6093
6163
  rewritable: parsed.rewritable && parsed.spec !== ""
6094
6164
  });
6095
6165
  };
6096
- const pyprojectPaths = (0, import_node_fs24.globSync)(MANIFEST_GLOBS.pip, { cwd: workspaceRoot });
6166
+ const pyprojectPaths = (0, import_node_fs25.globSync)(MANIFEST_GLOBS.pip, { cwd: workspaceRoot });
6097
6167
  for (const relativePath of pyprojectPaths) {
6098
6168
  let content;
6099
6169
  try {
6100
- content = (0, import_node_fs24.readFileSync)((0, import_node_path27.join)(workspaceRoot, relativePath), "utf8");
6170
+ content = (0, import_node_fs25.readFileSync)((0, import_node_path27.join)(workspaceRoot, relativePath), "utf8");
6101
6171
  } catch {
6102
6172
  continue;
6103
6173
  }
@@ -6108,14 +6178,14 @@ function collectPip(workspaceRoot) {
6108
6178
  }
6109
6179
  const requirementsPaths = [
6110
6180
  "requirements-dev.txt",
6111
- ...(0, import_node_fs24.globSync)("apps/*/requirements.txt", { cwd: workspaceRoot })
6181
+ ...(0, import_node_fs25.globSync)("apps/*/requirements.txt", { cwd: workspaceRoot })
6112
6182
  ];
6113
6183
  for (const relativePath of requirementsPaths) {
6114
6184
  if (!fileExists((0, import_node_path27.join)(workspaceRoot, relativePath))) {
6115
6185
  continue;
6116
6186
  }
6117
6187
  const section = relativePath === "requirements-dev.txt" ? "devDep" : "dep";
6118
- const lines = (0, import_node_fs24.readFileSync)((0, import_node_path27.join)(workspaceRoot, relativePath), "utf8").split(/\r?\n/);
6188
+ const lines = (0, import_node_fs25.readFileSync)((0, import_node_path27.join)(workspaceRoot, relativePath), "utf8").split(/\r?\n/);
6119
6189
  for (const line of lines) {
6120
6190
  push(relativePath, section, line);
6121
6191
  }
@@ -6153,11 +6223,11 @@ function pyprojectDependencies(content) {
6153
6223
  }
6154
6224
  function collectPub(workspaceRoot) {
6155
6225
  const sites = [];
6156
- const pubspecPaths = (0, import_node_fs24.globSync)(MANIFEST_GLOBS.pub, { cwd: workspaceRoot });
6226
+ const pubspecPaths = (0, import_node_fs25.globSync)(MANIFEST_GLOBS.pub, { cwd: workspaceRoot });
6157
6227
  for (const relativePath of pubspecPaths) {
6158
6228
  let content;
6159
6229
  try {
6160
- content = (0, import_node_fs24.readFileSync)((0, import_node_path27.join)(workspaceRoot, relativePath), "utf8");
6230
+ content = (0, import_node_fs25.readFileSync)((0, import_node_path27.join)(workspaceRoot, relativePath), "utf8");
6161
6231
  } catch {
6162
6232
  continue;
6163
6233
  }
@@ -6217,11 +6287,11 @@ function stripQuotes(value) {
6217
6287
  }
6218
6288
  function collectNuget(workspaceRoot) {
6219
6289
  const sites = [];
6220
- const csprojPaths = (0, import_node_fs24.globSync)(MANIFEST_GLOBS.nuget, { cwd: workspaceRoot });
6290
+ const csprojPaths = (0, import_node_fs25.globSync)(MANIFEST_GLOBS.nuget, { cwd: workspaceRoot });
6221
6291
  for (const relativePath of csprojPaths) {
6222
6292
  let content;
6223
6293
  try {
6224
- content = (0, import_node_fs24.readFileSync)((0, import_node_path27.join)(workspaceRoot, relativePath), "utf8");
6294
+ content = (0, import_node_fs25.readFileSync)((0, import_node_path27.join)(workspaceRoot, relativePath), "utf8");
6225
6295
  } catch {
6226
6296
  continue;
6227
6297
  }
@@ -6261,7 +6331,7 @@ function collectGo(workspaceRoot) {
6261
6331
  }
6262
6332
  let content;
6263
6333
  try {
6264
- content = (0, import_node_fs24.readFileSync)(manifestPath, "utf8");
6334
+ content = (0, import_node_fs25.readFileSync)(manifestPath, "utf8");
6265
6335
  } catch {
6266
6336
  return [];
6267
6337
  }
@@ -6310,7 +6380,7 @@ var PROJECT_GLOBS = {
6310
6380
  function locateProjects(workspaceRoot) {
6311
6381
  const locations = [];
6312
6382
  for (const ecosystem of ECOSYSTEMS) {
6313
- const relativePaths = (0, import_node_fs24.globSync)(PROJECT_GLOBS[ecosystem], { cwd: workspaceRoot });
6383
+ const relativePaths = (0, import_node_fs25.globSync)(PROJECT_GLOBS[ecosystem], { cwd: workspaceRoot });
6314
6384
  for (const relativePath of relativePaths) {
6315
6385
  const posix = toPosix(relativePath);
6316
6386
  const dir = posix.slice(0, posix.lastIndexOf("/"));
@@ -6339,7 +6409,7 @@ function rewriteSpec(site, spec) {
6339
6409
  writeFileEnsured(site.manifestPath, toJson(manifest));
6340
6410
  return true;
6341
6411
  }
6342
- const before = (0, import_node_fs24.readFileSync)(site.manifestPath, "utf8");
6412
+ const before = (0, import_node_fs25.readFileSync)(site.manifestPath, "utf8");
6343
6413
  const after = (() => {
6344
6414
  switch (site.ecosystem) {
6345
6415
  case "pip": {
@@ -6462,7 +6532,7 @@ function resolvedVersion(workspaceRoot, ecosystem, name) {
6462
6532
  const match = new RegExp(
6463
6533
  String.raw`^\s{2}${escapeForRegex(name)}:[^]*?^\s+version:\s*["']?([^"'\s]+)`,
6464
6534
  "m"
6465
- ).exec((0, import_node_fs24.readFileSync)(lockPath, "utf8"));
6535
+ ).exec((0, import_node_fs25.readFileSync)(lockPath, "utf8"));
6466
6536
  return match?.[1];
6467
6537
  } catch {
6468
6538
  return void 0;
@@ -6581,7 +6651,7 @@ function installInto(workspaceRoot, location, packages, saveDev) {
6581
6651
  function addPythonDependency(manifestPath, specifier) {
6582
6652
  let content;
6583
6653
  try {
6584
- content = (0, import_node_fs25.readFileSync)(manifestPath, "utf8");
6654
+ content = (0, import_node_fs26.readFileSync)(manifestPath, "utf8");
6585
6655
  } catch {
6586
6656
  logger.warn(`Could not read ${manifestPath} \u2014 skipped ${specifier}`);
6587
6657
  return;
@@ -7437,15 +7507,15 @@ function runKinds(options) {
7437
7507
 
7438
7508
  // src/workspace-diagnostics/check-invariants.use-case.ts
7439
7509
  var import_node_child_process = require("child_process");
7440
- var import_node_fs26 = require("fs");
7510
+ var import_node_fs27 = require("fs");
7441
7511
  var import_node_path32 = require("path");
7442
7512
  var SUPPORTED_ESLINT_MAJOR = ESLINT_VERSION.replace(/^\D*/, "").split(".", 1)[0];
7443
7513
  function toPosix2(path) {
7444
7514
  return path.replaceAll("\\", "/");
7445
7515
  }
7446
7516
  function checkEslintConfigs(workspaceRoot) {
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}", {
7517
+ const rootConfigs = (0, import_node_fs27.globSync)("eslint.config.{js,mjs,cjs,ts,mts,cts}", { cwd: workspaceRoot });
7518
+ const projectConfigs = (0, import_node_fs27.globSync)("{apps,libs,packages}/*/eslint.config.{js,mjs,cjs,ts,mts,cts}", {
7449
7519
  cwd: workspaceRoot
7450
7520
  }).map((config) => toPosix2(config));
7451
7521
  return [
@@ -7466,9 +7536,9 @@ function checkEslintConfigs(workspaceRoot) {
7466
7536
  }
7467
7537
  function checkEslintEntryPointReachesTheRules(workspaceRoot) {
7468
7538
  const rules = (0, import_node_path32.join)(workspaceRoot, ESLINT_MNCI_FILENAME);
7469
- if (!(0, import_node_fs26.existsSync)(rules)) return [];
7539
+ if (!(0, import_node_fs27.existsSync)(rules)) return [];
7470
7540
  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") : "";
7541
+ const source = (0, import_node_fs27.existsSync)(entryPoint) ? (0, import_node_fs27.readFileSync)(entryPoint, "utf8") : "";
7472
7542
  return [
7473
7543
  {
7474
7544
  check: `${ESLINT_USER_FILENAME} imports the mnci rules`,
@@ -7537,7 +7607,7 @@ function checkNpmrc(workspaceRoot, registry, scope) {
7537
7607
  if (!registry || !fileExists(npmrcPath)) {
7538
7608
  return void 0;
7539
7609
  }
7540
- const npmrc = (0, import_node_fs26.readFileSync)(npmrcPath, "utf8");
7610
+ const npmrc = (0, import_node_fs27.readFileSync)(npmrcPath, "utf8");
7541
7611
  if (registry.kind === "npm") {
7542
7612
  return {
7543
7613
  check: ".npmrc authenticates the public registry",
@@ -7558,7 +7628,7 @@ function checkNpmrcCredentialResolves(workspaceRoot, environment = process.env)
7558
7628
  if (!fileExists(npmrcPath)) {
7559
7629
  return void 0;
7560
7630
  }
7561
- const npmrc = (0, import_node_fs26.readFileSync)(npmrcPath, "utf8");
7631
+ const npmrc = (0, import_node_fs27.readFileSync)(npmrcPath, "utf8");
7562
7632
  const credentials = npmrc.split("\n").filter((line) => !line.trimStart().startsWith(";") && !line.trimStart().startsWith("#")).filter((line) => /(?:_authToken|_password|_auth)\s*=/u.test(line));
7563
7633
  const referenced = [
7564
7634
  ...new Set(
@@ -7587,8 +7657,8 @@ function checkNpmAuthMatchesPipeline(workspaceRoot, registry) {
7587
7657
  if (registry?.kind !== "azure-artifacts" || !fileExists(npmrcPath) || !fileExists(pipelinePath)) {
7588
7658
  return void 0;
7589
7659
  }
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");
7660
+ const holdsCredentials = (0, import_node_fs27.readFileSync)(npmrcPath, "utf8").split("\n").filter((line) => !line.trimStart().startsWith(";") && !line.trimStart().startsWith("#")).some((line) => /(?:_authToken|_password|_auth)\s*=/u.test(line));
7661
+ const runsTask = (0, import_node_fs27.readFileSync)(pipelinePath, "utf8").includes("npmAuthenticate@0");
7592
7662
  if (!holdsCredentials && !runsTask) {
7593
7663
  return {
7594
7664
  check: "npm auth: .npmrc and azure-pipelines.yml agree",
@@ -7633,9 +7703,9 @@ function npmjsCredentialShape(credentials, environment) {
7633
7703
  }
7634
7704
  function checkVersionActions(workspaceRoot) {
7635
7705
  const candidates = [
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 })
7706
+ ...(0, import_node_fs27.globSync)("packages/*/pubspec.yaml", { cwd: workspaceRoot }),
7707
+ ...(0, import_node_fs27.globSync)("packages/*/*.csproj", { cwd: workspaceRoot }),
7708
+ ...(0, import_node_fs27.globSync)("python-packages/*/pyproject.toml", { cwd: workspaceRoot })
7639
7709
  ].map((manifest) => toPosix2(manifest));
7640
7710
  return candidates.flatMap((manifest) => {
7641
7711
  const projectRoot = manifest.slice(0, manifest.lastIndexOf("/"));
@@ -7684,8 +7754,8 @@ function declaredTargets(workspaceRoot, projectRoot) {
7684
7754
  function checkTargetFilesExist(workspaceRoot) {
7685
7755
  const projectRoots = new Set(
7686
7756
  [
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 })
7757
+ ...(0, import_node_fs27.globSync)("{apps,libs,packages}/*/project.json", { cwd: workspaceRoot }),
7758
+ ...(0, import_node_fs27.globSync)("{apps,libs,packages}/*/package.json", { cwd: workspaceRoot })
7689
7759
  ].map((manifest) => toPosix2(manifest).split("/").slice(0, 2).join("/"))
7690
7760
  );
7691
7761
  return [...projectRoots].flatMap(
@@ -7743,11 +7813,11 @@ function checkGoWorkInSync(workspaceRoot) {
7743
7813
  if (!fileExists(goWorkPath)) {
7744
7814
  return void 0;
7745
7815
  }
7746
- const contents = (0, import_node_fs26.existsSync)(goWorkPath) ? (0, import_node_fs26.readFileSync)(goWorkPath, "utf8") : "";
7816
+ const contents = (0, import_node_fs27.existsSync)(goWorkPath) ? (0, import_node_fs27.readFileSync)(goWorkPath, "utf8") : "";
7747
7817
  const blockEntries = Array.from(contents.matchAll(/(?:^|\n)\s*use\s+\(([^)]*)\)/g), (match) => match[1].split("\n")).flat();
7748
7818
  const singleEntries = Array.from(contents.matchAll(/(?:^|\n)\s*use\s+(\.\S+)/g), (match) => match[1]);
7749
7819
  const uses = [...blockEntries, ...singleEntries].map((entry) => entry.trim()).filter(Boolean);
7750
- const stale = uses.filter((entry) => !(0, import_node_fs26.existsSync)((0, import_node_path32.join)(workspaceRoot, entry, "go.mod")));
7820
+ const stale = uses.filter((entry) => !(0, import_node_fs27.existsSync)((0, import_node_path32.join)(workspaceRoot, entry, "go.mod")));
7751
7821
  return {
7752
7822
  check: "every go.work `use` entry points to a module that still exists",
7753
7823
  ok: stale.length === 0,
@@ -7765,7 +7835,7 @@ function checkNativeApps(workspaceRoot) {
7765
7835
  ];
7766
7836
  const findings = pipelines.filter(({ file }) => fileExists((0, import_node_path32.join)(workspaceRoot, file))).map(({ file, marker }) => ({
7767
7837
  check: `${file} builds the native apps on every OS`,
7768
- ok: (0, import_node_fs26.readFileSync)((0, import_node_path32.join)(workspaceRoot, file), "utf8").includes(marker),
7838
+ ok: (0, import_node_fs27.readFileSync)((0, import_node_path32.join)(workspaceRoot, file), "utf8").includes(marker),
7769
7839
  detail: `${file} has no native job: CI would verify a cgo app on the one agent that cannot build it`,
7770
7840
  remedy: "run `mnci upgrade`"
7771
7841
  }));
@@ -7798,14 +7868,14 @@ function checkNoRootRuntimeDependencies(workspaceRoot) {
7798
7868
  };
7799
7869
  }
7800
7870
  function checkRollupSourceMaps(workspaceRoot) {
7801
- const configs = (0, import_node_fs26.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
7871
+ const configs = (0, import_node_fs27.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
7802
7872
  cwd: workspaceRoot
7803
7873
  }).map((config) => toPosix2(config));
7804
7874
  return configs.flatMap((relativePath) => {
7805
7875
  const configPath = (0, import_node_path32.join)(workspaceRoot, relativePath);
7806
7876
  let config;
7807
7877
  try {
7808
- config = (0, import_node_fs26.readFileSync)(configPath, "utf8");
7878
+ config = (0, import_node_fs27.readFileSync)(configPath, "utf8");
7809
7879
  } catch {
7810
7880
  return [];
7811
7881
  }
@@ -7820,7 +7890,7 @@ function checkRollupSourceMaps(workspaceRoot) {
7820
7890
  });
7821
7891
  }
7822
7892
  function checkDeclarationSpecifiers(workspaceRoot) {
7823
- const configs = (0, import_node_fs26.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
7893
+ const configs = (0, import_node_fs27.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
7824
7894
  cwd: workspaceRoot
7825
7895
  }).map((config) => toPosix2(config));
7826
7896
  return configs.flatMap((relativePath) => {
@@ -7860,7 +7930,7 @@ function checkDeclarationSpecifiers(workspaceRoot) {
7860
7930
  function checkPipelinePhases(workspaceRoot) {
7861
7931
  const files = ["azure-pipelines.yml", ".github/workflows/ci.yml"];
7862
7932
  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"));
7933
+ const { verifyActive, switchedOff } = inspectPipeline((0, import_node_fs27.readFileSync)((0, import_node_path32.join)(workspaceRoot, file), "utf8"));
7864
7934
  const verify = {
7865
7935
  check: `${file} runs the enforced verify phase`,
7866
7936
  ok: verifyActive,
@@ -8055,7 +8125,7 @@ function runProjects(workspaceRoot, options) {
8055
8125
  var import_node_path35 = require("path");
8056
8126
 
8057
8127
  // src/cli-version/check-for-update.use-case.ts
8058
- var import_node_fs27 = require("fs");
8128
+ var import_node_fs28 = require("fs");
8059
8129
  var import_node_path34 = require("path");
8060
8130
  var import_cross_spawn3 = __toESM(require("cross-spawn"));
8061
8131
  var PACKAGE_NAME2 = "@mnci/cli";
@@ -8116,7 +8186,7 @@ function releaseTriple(version) {
8116
8186
  function readCliVersion(packageDirectory) {
8117
8187
  try {
8118
8188
  const manifestPath = (0, import_node_path34.join)(packageDirectory, "..", "package.json");
8119
- const manifest = JSON.parse((0, import_node_fs27.readFileSync)(manifestPath, "utf8"));
8189
+ const manifest = JSON.parse((0, import_node_fs28.readFileSync)(manifestPath, "utf8"));
8120
8190
  return manifest.version ?? "0.0.0";
8121
8191
  } catch {
8122
8192
  return "0.0.0";
@@ -8147,7 +8217,7 @@ function runInfo(workspaceRoot, cliVersion, options) {
8147
8217
  }
8148
8218
 
8149
8219
  // src/workspace-creation/adopt-directory.use-case.ts
8150
- var import_node_fs28 = require("fs");
8220
+ var import_node_fs29 = require("fs");
8151
8221
  var import_node_path36 = require("path");
8152
8222
  var NEVER_COPIED = /* @__PURE__ */ new Set([".git", "node_modules"]);
8153
8223
  var AGENT_AND_CI_ENTRIES = [
@@ -8179,13 +8249,13 @@ var PREFLIGHT_BLOCKERS = [
8179
8249
  "packages"
8180
8250
  ];
8181
8251
  function assertAdoptableDirectory(target) {
8182
- if (!(0, import_node_fs28.existsSync)(target)) {
8252
+ if (!(0, import_node_fs29.existsSync)(target)) {
8183
8253
  throw new Error(`--into '${target}' does not exist. Create or clone it first.`);
8184
8254
  }
8185
- if (!(0, import_node_fs28.statSync)(target).isDirectory()) {
8255
+ if (!(0, import_node_fs29.statSync)(target).isDirectory()) {
8186
8256
  throw new Error(`--into '${target}' is not a directory.`);
8187
8257
  }
8188
- const blockers = PREFLIGHT_BLOCKERS.filter((entry) => (0, import_node_fs28.existsSync)((0, import_node_path36.join)(target, entry)));
8258
+ const blockers = PREFLIGHT_BLOCKERS.filter((entry) => (0, import_node_fs29.existsSync)((0, import_node_path36.join)(target, entry)));
8189
8259
  if (blockers.length > 0) {
8190
8260
  throw new Error(
8191
8261
  `--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.`
@@ -8193,15 +8263,15 @@ function assertAdoptableDirectory(target) {
8193
8263
  }
8194
8264
  }
8195
8265
  function mergeGitignore(generatedFile, targetFile) {
8196
- const existing = (0, import_node_fs28.readFileSync)(targetFile, "utf8");
8266
+ const existing = (0, import_node_fs29.readFileSync)(targetFile, "utf8");
8197
8267
  const present = new Set(existing.split("\n").map((line) => line.trim()));
8198
- const additions = (0, import_node_fs28.readFileSync)(generatedFile, "utf8").split("\n").map((line) => line.trimEnd()).filter((line) => {
8268
+ const additions = (0, import_node_fs29.readFileSync)(generatedFile, "utf8").split("\n").map((line) => line.trimEnd()).filter((line) => {
8199
8269
  const trimmed = line.trim();
8200
8270
  return trimmed !== "" && !trimmed.startsWith("#") && !present.has(trimmed);
8201
8271
  });
8202
8272
  if (additions.length === 0) return false;
8203
8273
  const separator = existing.endsWith("\n") ? "" : "\n";
8204
- (0, import_node_fs28.writeFileSync)(
8274
+ (0, import_node_fs29.writeFileSync)(
8205
8275
  targetFile,
8206
8276
  `${existing}${separator}
8207
8277
  # Added by mnci (Nx workspace)
@@ -8211,9 +8281,9 @@ ${additions.join("\n")}
8211
8281
  return true;
8212
8282
  }
8213
8283
  function adoptGeneratedWorkspace(generatedRoot, target) {
8214
- const entries = (0, import_node_fs28.readdirSync)(generatedRoot).filter((entry) => !NEVER_COPIED.has(entry));
8284
+ const entries = (0, import_node_fs29.readdirSync)(generatedRoot).filter((entry) => !NEVER_COPIED.has(entry));
8215
8285
  const collisions = entries.filter(
8216
- (entry) => (0, import_node_fs28.existsSync)((0, import_node_path36.join)(target, entry)) && !EXISTING_WINS.has(entry) && entry !== ".gitignore"
8286
+ (entry) => (0, import_node_fs29.existsSync)((0, import_node_path36.join)(target, entry)) && !EXISTING_WINS.has(entry) && entry !== ".gitignore"
8217
8287
  );
8218
8288
  if (collisions.length > 0) {
8219
8289
  throw new Error(
@@ -8224,24 +8294,24 @@ function adoptGeneratedWorkspace(generatedRoot, target) {
8224
8294
  for (const entry of entries) {
8225
8295
  const from = (0, import_node_path36.join)(generatedRoot, entry);
8226
8296
  const to = (0, import_node_path36.join)(target, entry);
8227
- if (entry === ".gitignore" && (0, import_node_fs28.existsSync)(to)) {
8297
+ if (entry === ".gitignore" && (0, import_node_fs29.existsSync)(to)) {
8228
8298
  result.mergedGitignore = mergeGitignore(from, to);
8229
8299
  result.kept.push(entry);
8230
8300
  continue;
8231
8301
  }
8232
- if ((0, import_node_fs28.existsSync)(to)) {
8302
+ if ((0, import_node_fs29.existsSync)(to)) {
8233
8303
  result.kept.push(entry);
8234
8304
  continue;
8235
8305
  }
8236
- (0, import_node_fs28.cpSync)(from, to, { recursive: true });
8306
+ (0, import_node_fs29.cpSync)(from, to, { recursive: true });
8237
8307
  result.copied.push(entry);
8238
8308
  }
8239
- (0, import_node_fs28.rmSync)(generatedRoot, { recursive: true, force: true });
8309
+ (0, import_node_fs29.rmSync)(generatedRoot, { recursive: true, force: true });
8240
8310
  return result;
8241
8311
  }
8242
8312
 
8243
8313
  // src/workspace-creation/create-workspace.use-case.ts
8244
- var import_node_fs29 = require("fs");
8314
+ var import_node_fs30 = require("fs");
8245
8315
  var import_node_os2 = require("os");
8246
8316
  var import_node_path37 = require("path");
8247
8317
  function nxCloudProviderValue(ci) {
@@ -8301,7 +8371,7 @@ async function runNew(name, options) {
8301
8371
  const npmAuth = resolveNpmAuth(options.npmAuth, registry, ci);
8302
8372
  const stack = await resolveStack(options);
8303
8373
  const nxCloud = options.nxCloud ?? (options.yes ? false : await promptNxCloud());
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-"));
8374
+ const stagingParent = adoptTarget === void 0 ? process.cwd() : (0, import_node_fs30.mkdtempSync)((0, import_node_path37.join)((0, import_node_os2.tmpdir)(), "mnci-new-"));
8305
8375
  let workspaceRoot = (0, import_node_path37.join)(stagingParent, workspaceName);
8306
8376
  try {
8307
8377
  logger.step(`Creating Nx workspace '${workspaceName}' (preset: ts)`);
@@ -8325,7 +8395,7 @@ async function runNew(name, options) {
8325
8395
  workspaceRoot = adoptTarget;
8326
8396
  }
8327
8397
  } finally {
8328
- if (adoptTarget !== void 0) (0, import_node_fs29.rmSync)(stagingParent, { recursive: true, force: true });
8398
+ if (adoptTarget !== void 0) (0, import_node_fs30.rmSync)(stagingParent, { recursive: true, force: true });
8329
8399
  }
8330
8400
  logger.step(
8331
8401
  "Applying MoNecromanCI overlay (VS Code workspace, release config, .npmrc, commitlint, pipeline, stack)"
@@ -8335,8 +8405,8 @@ async function runNew(name, options) {
8335
8405
  { workspaceName, scope, registry, agent, variableGroup, ci, stack, ...npmAuth && { npmAuth } },
8336
8406
  logger.detail
8337
8407
  );
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 });
8408
+ (0, import_node_fs30.rmSync)((0, import_node_path37.join)(workspaceRoot, "node_modules"), { recursive: true, force: true });
8409
+ (0, import_node_fs30.rmSync)((0, import_node_path37.join)(workspaceRoot, "package-lock.json"), { force: true });
8340
8410
  logger.step("Installing the toolchain (commitlint + husky + linting/formatting)");
8341
8411
  const installStatus = runShell(
8342
8412
  "npm",
@@ -8378,7 +8448,7 @@ var import_node_path39 = require("path");
8378
8448
  var import_prompts4 = require("@inquirer/prompts");
8379
8449
 
8380
8450
  // src/workspace-upgrade/upgrade-workspace.use-case.ts
8381
- var import_node_fs30 = require("fs");
8451
+ var import_node_fs31 = require("fs");
8382
8452
  var import_node_path38 = require("path");
8383
8453
  function resolveRegistry2(options, persisted) {
8384
8454
  if (options.registry === "azure-artifacts" || options.organization && options.artifactsFeed) {
@@ -8408,7 +8478,7 @@ function resolveWorkspaceName(workspaceRoot, persisted) {
8408
8478
  return persisted.workspaceName;
8409
8479
  }
8410
8480
  try {
8411
- const existing = (0, import_node_fs30.readdirSync)(workspaceRoot).find(
8481
+ const existing = (0, import_node_fs31.readdirSync)(workspaceRoot).find(
8412
8482
  (file) => file.endsWith(".code-workspace") && file !== "undefined.code-workspace"
8413
8483
  );
8414
8484
  if (existing) {
@@ -8420,7 +8490,7 @@ function resolveWorkspaceName(workspaceRoot, persisted) {
8420
8490
  }
8421
8491
  function detectNpmAuth(workspaceRoot) {
8422
8492
  try {
8423
- return (0, import_node_fs30.readFileSync)((0, import_node_path38.join)(workspaceRoot, "azure-pipelines.yml"), "utf8").includes("npmAuthenticate@0") ? "build-identity" : void 0;
8493
+ return (0, import_node_fs31.readFileSync)((0, import_node_path38.join)(workspaceRoot, "azure-pipelines.yml"), "utf8").includes("npmAuthenticate@0") ? "build-identity" : void 0;
8424
8494
  } catch {
8425
8495
  return void 0;
8426
8496
  }