()
| 23 | |
| 24 | // 从package.json读取基础版本号 |
| 25 | export 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版本号 |
| 38 | export function getDevVersion() { |
no outgoing calls
no test coverage detected