generate public release version from git info. designed in accordance with semantic versioning
in vite.config.ts
import { getVersion } from 'release-version-by-git'
import { defineConfig, UserConfig } from 'vite'
export default defineConfig(async (env): Promise<UserConfig> => {
const version = await getVersion()
return {}
})
- if has git info, then generate version by git info and
package.json
- style:
${major}.${minor}.${patch}-${branch}.${hash}
,major
、minor
、patch
frompkg.version
- style:
- if don't has git info, then copy from
package.json
version. - Support
gitlab CI
, if ingitlab ci build
, prioritize the use of environmental variables