@jskit-ai/release 0.1.4 → 0.1.5

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/release.mjs +22 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jskit-ai/release",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Selective npm release preparation, publication and dependency pinning for package repositories.",
5
5
  "type": "module",
6
6
  "files": [
package/src/release.mjs CHANGED
@@ -713,6 +713,27 @@ async function publishCommand(options) {
713
713
  await publishRelease(records, options);
714
714
  }
715
715
 
716
+ // npm cannot move exactly pinned packages that require each other in
717
+ // lockstep (assistant-core and assistant-runtime, say): the locked old
718
+ // versions still demand the old peers, and install stops with ERESOLVE.
719
+ // Forgetting only the pinned packages' lock entries lets npm resolve them
720
+ // afresh while every other locked dependency stays as it was.
721
+ async function forgetPinnedLockEntries(repoRoot, names) {
722
+ const lockPath = path.join(repoRoot, "package-lock.json");
723
+ let lock;
724
+ try {
725
+ lock = JSON.parse(await readFile(lockPath, "utf8"));
726
+ } catch (error) {
727
+ if (error.code === "ENOENT") return;
728
+ throw error;
729
+ }
730
+ for (const key of Object.keys(lock.packages || {})) {
731
+ const name = key.split("node_modules/").at(-1);
732
+ if (key.includes("node_modules/") && names.has(name)) delete lock.packages[key];
733
+ }
734
+ await writeFile(lockPath, serializeJson(lock), "utf8");
735
+ }
736
+
716
737
  // npm can take minutes to serve a just-published version everywhere.
717
738
  // Moved from Vibe64 Online's deploy orchestrator.
718
739
  async function installReleasedPins(repoRoot, { attempts = 20, delayMs = Number(process.env.JSKIT_RELEASE_RETRY_DELAY_MS || 30_000) } = {}) {
@@ -760,6 +781,7 @@ async function pinCommand({ cwd: repoRoot, from, dryRun, noCommit }) {
760
781
  process.stdout.write("Pin dry-run complete.\n");
761
782
  return;
762
783
  }
784
+ await forgetPinnedLockEntries(repoRoot, new Set(versions.keys()));
763
785
  await installReleasedPins(repoRoot);
764
786
  if (noCommit) {
765
787
  process.stdout.write(`${path.basename(repoRoot)}: pins installed; not committed\n`);