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

Function updateRange

packages/bumpy/src/core/apply-release-plan.ts:89–109  ·  view source on GitHub ↗

Update a version range to include a new version, preserving the range prefix

(range: string, newVersion: string)

Source from the content-addressed store, hash-verified

87
88/** Update a version range to include a new version, preserving the range prefix */
89function updateRange(range: string, newVersion: string): string {
90 // Preserve workspace:/catalog: protocols
91 let protocol = '';
92 let cleanRange = range;
93 const protoMatch = range.match(/^(workspace:|catalog:)/);
94 if (protoMatch) {
95 protocol = protoMatch[1]!;
96 cleanRange = range.slice(protocol.length);
97 }
98
99 // Preserve the range prefix (^, ~, >=, etc.)
100 const prefixMatch = cleanRange.match(/^(\^|~|>=|>|<=|<|=)?/);
101 const prefix = prefixMatch?.[1] ?? '^';
102
103 // Handle wildcard ranges and workspace shorthand (workspace:^, workspace:~, workspace:*)
104 if (cleanRange === '*' || cleanRange === '' || cleanRange === '^' || cleanRange === '~') {
105 return range; // don't touch wildcards or workspace shorthands
106 }
107
108 return `${protocol}${prefix}${newVersion}`;
109}

Callers 1

applyReleasePlanFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…