refactor(projects): 代码优化

This commit is contained in:
Soybean
2022-07-16 00:13:19 +08:00
parent 872bb84502
commit 6143605297
24 changed files with 107 additions and 104 deletions

View File

@ -5,7 +5,7 @@ import type { ProxyOptions } from 'vite';
* @param isOpenProxy - 是否开启代理
* @param envConfig - env环境配置
*/
export function createViteProxy(isOpenProxy: boolean, envConfig: EnvConfig) {
export function createViteProxy(isOpenProxy: boolean, envConfig: ServiceEnvConfig) {
if (!isOpenProxy) return undefined;
const proxy: Record<string, string | ProxyOptions> = {

View File

@ -14,10 +14,10 @@ import compress from './compress';
export function setupVitePlugins(viteEnv: ImportMetaEnv): (PluginOption | PluginOption[])[] {
const plugins = [...vue, html(viteEnv), ...unplugin, unocss, mock];
if (viteEnv.VITE_VISUALIZER === '1') {
if (viteEnv.VITE_VISUALIZER === 'Y') {
plugins.push(visualizer);
}
if (viteEnv.VITE_COMPRESS === '1') {
if (viteEnv.VITE_COMPRESS === 'Y') {
plugins.push(compress(viteEnv));
}

View File

@ -2,7 +2,7 @@ import path from 'path';
/**
* 获取项目根路径
* @descrition 尾不带斜杠
* @descrition 尾不带斜杠
*/
export function getRootPath() {
return path.resolve(process.cwd());
@ -11,7 +11,7 @@ export function getRootPath() {
/**
* 获取项目src路径
* @param srcName - src目录名称(默认: "src")
* @descrition 尾不带斜杠
* @descrition 尾不带斜杠
*/
export function getSrcPath(srcName = 'src') {
const rootPath = getRootPath();