import pkg from '../../package.json'; // Generate cache key according to version export function getPkgVersion() { return `${`__${pkg.version}`}__`.toUpperCase(); } /** * @description: Development mode */ export const devMode = 'development'; /** * @description: Production mode */ export const prodMode = 'production'; /** * @description: Get environment mode * @returns: * @example: */ export function getEnvMode(): string { return isDevMode() ? devMode : prodMode; } /** * @description: Get environment variables * @returns: * @example: */ export function getEnvValue(key: string): T { // @ts-ignore return import.meta.env[key]; } /** * @description: Is it a development mode * @returns: * @example: */ export function isDevMode(): boolean { return getEnvValue('VITE_DEV'); } /** * @description: Is it a production mode * @returns: * @example: */ export function isProdMode(): boolean { return getEnvValue('VITE_PROD'); }