MCPcopy Index your code
hub / github.com/dmno-dev/bumpy / writeTransientVersionsInPlace

Function writeTransientVersionsInPlace

packages/bumpy/src/core/prerelease.ts:201–232  ·  view source on GitHub ↗
(
  plan: ReleasePlan,
  packages: Map<string, WorkspacePackage>,
)

Source from the content-addressed store, hash-verified

199 * coherent set it was published with.
200 */
201export async function writeTransientVersionsInPlace(
202 plan: ReleasePlan,
203 packages: Map<string, WorkspacePackage>,
204): Promise<() => Promise<void>> {
205 const releaseMap = new Map(plan.releases.map((r) => [r.name, r]));
206 const originals = new Map<string, string>();
207
208 for (const release of plan.releases) {
209 const pkg = packages.get(release.name);
210 if (!pkg) continue;
211 const pkgJsonPath = resolve(pkg.dir, 'package.json');
212 originals.set(pkgJsonPath, await readText(pkgJsonPath));
213
214 await updateJsonFields(pkgJsonPath, { version: release.newVersion });
215
216 // Exact-pin in-cycle deps (dev deps excluded — not installed by consumers)
217 for (const depField of ['dependencies', 'peerDependencies', 'optionalDependencies'] as const) {
218 const deps = pkg[depField];
219 for (const depName of Object.keys(deps)) {
220 const depRelease = releaseMap.get(depName);
221 if (!depRelease) continue;
222 await updateJsonNestedField(pkgJsonPath, depField, depName, depRelease.newVersion);
223 }
224 }
225 }
226
227 return async () => {
228 for (const [path, content] of originals) {
229 await writeText(path, content);
230 }
231 };
232}
233
234/**
235 * Derive display versions for a channel cycle without touching the registry:

Callers 3

prerelease.test.tsFile · 0.90
publishChannelFunction · 0.90
publishSnapshotFunction · 0.90

Calls 4

readTextFunction · 0.90
updateJsonFieldsFunction · 0.90
updateJsonNestedFieldFunction · 0.90
writeTextFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…