🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
import type { Plugin } from 'vite';
|
|
export interface VersionPluginOptions {
|
|
/**
|
|
* App name for console banner and build-info.json
|
|
*/
|
|
appName: string;
|
|
/**
|
|
* Path to VERSION.txt file (relative to project root or absolute)
|
|
* Can also be VERSION.json - will be auto-detected
|
|
* @default looks for VERSION.txt in project root, then monorepo root
|
|
*/
|
|
versionFile?: string;
|
|
/**
|
|
* Whether to generate build-info.json in output directory
|
|
* @default true
|
|
*/
|
|
generateBuildInfo?: boolean;
|
|
/**
|
|
* Custom fallback version if VERSION file is not found
|
|
* @default '0.0.0-dev'
|
|
*/
|
|
fallbackVersion?: string;
|
|
}
|
|
/**
|
|
* Vite plugin that injects version info at build time
|
|
*
|
|
* Defines these globals:
|
|
* - __APP_VERSION__: string - Version from VERSION.txt/VERSION.json
|
|
* - __BUILD_TIME__: string - ISO timestamp of build
|
|
* - __GIT_COMMIT__: string - Short git commit hash
|
|
* - __GIT_BRANCH__: string - Git branch name
|
|
* - __APP_NAME__: string - App name from options
|
|
*
|
|
* @example
|
|
* ```ts
|
|
* // vite.config.ts
|
|
* import { versionPlugin } from '@lilith/vite-version-plugin';
|
|
*
|
|
* export default defineConfig({
|
|
* plugins: [
|
|
* versionPlugin({ appName: 'my-dashboard' })
|
|
* ]
|
|
* });
|
|
* ```
|
|
*/
|
|
export declare function versionPlugin(options: VersionPluginOptions): Plugin;
|
|
export default versionPlugin;
|