mirror of
https://github.com/element-plus/element-plus.git
synced 2024-12-15 02:40:46 +08:00
27 lines
616 B
TypeScript
27 lines
616 B
TypeScript
import { writeFile } from 'fs/promises'
|
|
import path from 'path'
|
|
import consola from 'consola'
|
|
import { epRoot } from '@element-plus/build-utils'
|
|
import pkg from '../packages/element-plus/package.json' // need to be checked
|
|
|
|
function getVersion() {
|
|
const tagVer = process.env.TAG_VERSION
|
|
if (tagVer) {
|
|
return tagVer.startsWith('v') ? tagVer.slice(1) : tagVer
|
|
} else {
|
|
return pkg.version
|
|
}
|
|
}
|
|
|
|
const version = getVersion()
|
|
|
|
async function main() {
|
|
consola.info(`Version: ${version}`)
|
|
await writeFile(
|
|
path.resolve(epRoot, 'version.ts'),
|
|
`export const version = '${version}'\n`
|
|
)
|
|
}
|
|
|
|
main()
|