@mnci/cli 4.10.4 → 4.10.6

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
@@ -449,7 +449,30 @@ function releaseConfig(ci) {
449
449
  // Set here at `new` time it wins: the generator only fills this in when
450
450
  // absent (it spreads the existing release.version over its default). Both
451
451
  // globs are listed; `nx run-many` no-ops cleanly when one matches nothing.
452
- preVersionCommand: "npx nx run-many -t build --projects=packages/*,python-packages/*"
452
+ preVersionCommand: "npx nx run-many -t build --projects=packages/*,python-packages/*",
453
+ // The lock file resync is OFF, and the reason is that it cannot succeed
454
+ // on the one release where it would matter.
455
+ //
456
+ // It is not `preVersionCommand` that does this, despite the name it gets
457
+ // reported under: `@nx/js`'s `afterAllProjectsVersioned` hook shells
458
+ // `npm install --package-lock-only` once every project has been versioned.
459
+ // That command resolves the whole tree against the registry, so the first
460
+ // release of two NEW interdependent packages 404s — package A declares a
461
+ // dependency on package B at the version this very run is about to
462
+ // publish, and B does not exist on the registry yet. Measured on a real
463
+ // workspace releasing `@scope/cli` and `@scope/studio` together.
464
+ //
465
+ // Turning it off costs nothing here, because mnci releases are tag-only:
466
+ // `git.commit` is `false`, so the refreshed lock file is written into an
467
+ // ephemeral CI checkout and then thrown away without ever being committed.
468
+ // It was never protecting anything. That it goes stale is not a new
469
+ // condition either — every manifest on disk is already stale by design for
470
+ // exactly the same reason, which is why `fallbackCurrentVersionResolver`
471
+ // is `'disk'` and why a tagless clone makes a dry run silently wrong.
472
+ //
473
+ // A workspace that DOES want the lock file refreshed should commit the
474
+ // bump too (`git.commit: true`), at which point this can be dropped.
475
+ versionActionsOptions: { skipLockFileUpdate: true }
453
476
  },
454
477
  changelog: githubReleases ? {
455
478
  workspaceChangelog: false,
@@ -2087,6 +2110,29 @@ function projectTask(name, kind) {
2087
2110
  const base = { label: `${name}: ${kind}`, type: "npm", script, problemMatcher: [] };
2088
2111
  return kind === "start" ? { ...base, isBackground: true } : { ...base, group: kind };
2089
2112
  }
2113
+ function renameScaffoldPlaceholder(projectRoot, name) {
2114
+ const placeholder = (0, import_node_path3.join)(projectRoot, "src", "lib", `${name}.ts`);
2115
+ if (!(0, import_node_fs3.existsSync)(placeholder)) {
2116
+ return;
2117
+ }
2118
+ (0, import_node_fs3.renameSync)(placeholder, (0, import_node_path3.join)(projectRoot, "src", "lib", `${name}.use-case.ts`));
2119
+ const spec = (0, import_node_path3.join)(projectRoot, "src", "lib", `${name}.spec.ts`);
2120
+ if ((0, import_node_fs3.existsSync)(spec)) {
2121
+ const renamed = (0, import_node_path3.join)(projectRoot, "src", "lib", `${name}.use-case.spec.ts`);
2122
+ (0, import_node_fs3.renameSync)(spec, renamed);
2123
+ writeFileEnsured(
2124
+ renamed,
2125
+ (0, import_node_fs3.readFileSync)(renamed, "utf8").replaceAll(`./${name}'`, () => `./${name}.use-case'`)
2126
+ );
2127
+ }
2128
+ const barrel = (0, import_node_path3.join)(projectRoot, "src", "index.ts");
2129
+ if ((0, import_node_fs3.existsSync)(barrel)) {
2130
+ writeFileEnsured(
2131
+ barrel,
2132
+ (0, import_node_fs3.readFileSync)(barrel, "utf8").replaceAll(`./lib/${name}'`, () => `./lib/${name}.use-case'`)
2133
+ );
2134
+ }
2135
+ }
2090
2136
  function ensureNxPeerOverrides(workspaceRoot) {
2091
2137
  const manifestPath = (0, import_node_path3.join)(workspaceRoot, "package.json");
2092
2138
  if (!(0, import_node_fs3.existsSync)(manifestPath)) {
@@ -3234,6 +3280,7 @@ async function addNpmLib(workspaceRoot, name, options, kindProvided, stack) {
3234
3280
  repairPublishableManifest(manifestPath);
3235
3281
  repairDeclarationSpecifiers(projectRoot);
3236
3282
  writeProjectReadme(projectRoot, `${scope}/${name}`, stack.testRunner);
3283
+ renameScaffoldPlaceholder(projectRoot, name);
3237
3284
  removeGeneratedEslintConfig(workspaceRoot, `packages/${name}`);
3238
3285
  removeLocalRegistryScaffolding(workspaceRoot);
3239
3286
  registerProjectCommands(workspaceRoot, name, { build: true });
@@ -4717,6 +4764,7 @@ async function runAdd(kind, name, options) {
4717
4764
  workspaceRoot
4718
4765
  );
4719
4766
  markPrivate((0, import_node_path18.join)(workspaceRoot, "libs", resolvedName, "package.json"));
4767
+ renameScaffoldPlaceholder((0, import_node_path18.join)(workspaceRoot, "libs", resolvedName), resolvedName);
4720
4768
  removeGeneratedEslintConfig(workspaceRoot, `libs/${resolvedName}`);
4721
4769
  registerProjectCommands(workspaceRoot, resolvedName, { build: true });
4722
4770
  break;