MCPcopy Create free account
hub / github.com/formkit/formkit / suggestVersionIncrement

Function suggestVersionIncrement

scripts/publish.mjs:472–497  ·  view source on GitHub ↗

* Given a version string and a version bump type - suggest the next version

(version, updateType)

Source from the content-addressed store, hash-verified

470 * Given a version string and a version bump type - suggest the next version
471 */
472function suggestVersionIncrement(version, updateType) {
473 // Strip any existing pre-release suffix for base version calculation
474 const baseVersion = version.split('-')[0]
475 let versionParts = baseVersion.split('.')
476 let targetIndex = versionParts.length - 1
477 switch (updateType) {
478 case 'major':
479 targetIndex = 0
480 break
481 case 'minor':
482 targetIndex = 1
483 break
484 default:
485 targetIndex = versionParts.length - 1
486 break
487 }
488
489 versionParts[targetIndex]++
490 versionParts = versionParts.map((part, index) => {
491 if (index > targetIndex) {
492 return 0
493 }
494 return part
495 })
496 return versionParts.join('.')
497}
498
499/**
500 * Confirm with user that all packages are going to be built

Callers 2

promptForTaggedVersionFunction · 0.70
promptForMasterVersionFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected