MCPcopy Create free account
hub / github.com/dmno-dev/bumpy / extractPrereleaseCounters

Function extractPrereleaseCounters

packages/bumpy/src/core/prerelease.ts:29–41  ·  view source on GitHub ↗
(versions: string[], target: string, preid: string)

Source from the content-addressed store, hash-verified

27 * Only exact `<target>-<preid>.<N>` versions count — other preids and targets are ignored.
28 */
29export function extractPrereleaseCounters(versions: string[], target: string, preid: string): number[] {
30 const counters: number[] = [];
31 for (const v of versions) {
32 const parsed = semver.parse(v);
33 if (!parsed) continue;
34 if (`${parsed.major}.${parsed.minor}.${parsed.patch}` !== target) continue;
35 if (parsed.prerelease.length !== 2) continue;
36 if (parsed.prerelease[0] !== preid) continue;
37 const n = parsed.prerelease[1];
38 if (typeof n === 'number') counters.push(n);
39 }
40 return counters;
41}
42
43/** Compute the next prerelease version: `<target>-<preid>.<max existing counter + 1>` */
44export function nextPrereleaseVersion(target: string, preid: string, existingCounters: number[]): string {

Callers 2

prerelease.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…