element-plus/scripts/gen-version.ts

18 lines
418 B
TypeScript
Raw Normal View History

import fs from 'fs'
import path from 'path'
import pkg from '../packages/element-plus/package.json' // need to be checked
2020-12-23 16:57:31 +08:00
const tagVer = process.env.TAG_VERSION
let version = ''
2020-12-23 16:57:31 +08:00
if (tagVer) {
version = tagVer.startsWith('v') ? tagVer.slice(1) : tagVer
} else {
version = pkg.version
2020-12-23 16:57:31 +08:00
}
2020-12-23 16:57:31 +08:00
fs.writeFileSync(
path.resolve(__dirname, '../packages/element-plus/version.ts'),
`export const version = '${version}'
`
2020-12-23 16:57:31 +08:00
)