|
@@ -1,7 +1,6 @@
|
|
|
import fs from 'fs';
|
|
|
import path from 'path';
|
|
|
import dotenv from 'dotenv';
|
|
|
-import chalk from 'chalk';
|
|
|
|
|
|
export const isFunction = (arg: unknown): arg is (...args: any[]) => any =>
|
|
|
typeof arg === 'function';
|
|
@@ -44,6 +43,7 @@ export interface ViteEnv {
|
|
|
VITE_BUILD_GZIP: boolean;
|
|
|
VITE_DYNAMIC_IMPORT: boolean;
|
|
|
VITE_LEGACY: boolean;
|
|
|
+ VITE_USE_IMAGEMIN: boolean;
|
|
|
}
|
|
|
|
|
|
// Read all environment variable configuration files to process.env
|
|
@@ -90,38 +90,6 @@ export function getEnvConfig(match = 'VITE_GLOB_', confFiles = ['.env', '.env.pr
|
|
|
return envConfig;
|
|
|
}
|
|
|
|
|
|
-function consoleFn(color: string, message: any) {
|
|
|
- console.log(
|
|
|
- chalk.blue.bold('**************** ') +
|
|
|
- (chalk as any)[color].bold(message) +
|
|
|
- chalk.blue.bold(' ****************')
|
|
|
- );
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * warnConsole
|
|
|
- * @param message
|
|
|
- */
|
|
|
-export function successConsole(message: any) {
|
|
|
- consoleFn('green', '✨ ' + message);
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * warnConsole
|
|
|
- * @param message
|
|
|
- */
|
|
|
-export function errorConsole(message: any) {
|
|
|
- consoleFn('red', '✨ ' + message);
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * warnConsole
|
|
|
- * @param message message
|
|
|
- */
|
|
|
-export function warnConsole(message: any) {
|
|
|
- consoleFn('yellow', '✨ ' + message);
|
|
|
-}
|
|
|
-
|
|
|
/**
|
|
|
* Get user root directory
|
|
|
* @param dir file path
|