MCPcopy Create free account
hub / github.com/ZToolsCenter/ZTools / getBaseVersion

Function getBaseVersion

scripts/version-utils.mjs:25–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23
24// 从package.json读取基础版本号
25export function getBaseVersion() {
26 try {
27 const pkg = readFileSync('package.json', 'utf-8')
28 const { version } = JSON.parse(pkg)
29 // 移除dev版本格式后缀
30 return version.replace(/-d\d{2,4}\.[a-f0-9]{7}$/, '')
31 } catch (error) {
32 console.error('Failed to read package.json:', error.message)
33 return '1.0.0'
34 }
35}
36
37// 生成dev版本号
38export function getDevVersion() {

Callers 2

getDevVersionFunction · 0.85
getProcessedVersionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected