https://github.com/mic1on/vite-plugin-version-output
Automatically insert the version in your project
https://github.com/mic1on/vite-plugin-version-output
Last synced: 10 months ago
JSON representation
Automatically insert the version in your project
- Host: GitHub
- URL: https://github.com/mic1on/vite-plugin-version-output
- Owner: mic1on
- Created: 2023-05-31T07:43:51.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-06-01T03:16:09.000Z (over 2 years ago)
- Last Synced: 2025-02-19T02:49:40.117Z (11 months ago)
- Language: TypeScript
- Size: 992 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# vite-plugin-version-output
> Automatically insert the version in your project
## Install
```sh
pnpm install -D vite-plugin-version-output
# OR yarn add -D vite-plugin-version-output
# OR npm install -D vite-plugin-version-output
```
## Usage
```ts
// vite.config.ts
import { defineConfig } from 'vite'
import { vitePluginVersionOutput } from 'vite-plugin-version-output'
export default defineConfig({
plugins: [
vitePluginVersionOutput({
// name: 'test-app',
// version: '0.0.1',
json: {
enable: true,
fileName: 'version.json'
},
html: {
enable: true,
toMeta: true,
toConsole: true,
toGlobal: true
},
})
],
})
```
## Config
`vite-plugin-version-output` can be print application version in the `Console` or add `` in HTML element.
- `name` - application name (`name in package.json` by default)
- `version` - application version (`version in package.json` by default)
- `html` - HTML output config
- `enable` - enable HTML output (`true` by default)
- `ifMeta` - add \ in the \ (`true` by default)
- `ifConsole` - print info in the Console (`true` by default)
- `ifGlobal` - set a variable named *\`\_\_${APPNAME}\_VERSION\_\_\`* in the window. (`true` by default)
- `json` - JSON output config
- `enable` - enable JSON output (`true` by default)
- `fileName` - output file name (`version.json` by default)
Then you can use `vite-plugin-version-output` ! 🎉
## Thanks
- [vite-plugin-version-mark](https://github.com/ZhongxuYang/vite-plugin-version-mark)