mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-21 04:46:26 +00:00
1. 统一所有API文件的request导入路径,从@utils/http改为@utils 2. 合并工具类导出,将分散的工具模块整合到@utils统一出口 3. 重构状态管理导入路径,统一从@utils导入相关工具与store 4. 整理组件导入与样式引用,优化项目内组件与样式的引用路径 5. 新增部分基础组件与工具方法,完善项目基础能力 6. 修复部分样式类名的书写规范,统一类名格式
48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
import type { PluginOption, ResolvedConfig } from "vite";
|
|
import pc from "picocolors";
|
|
import { BANNER } from "./banner";
|
|
|
|
const { green, blue, bold, dim, cyan, yellow, magenta } = pc;
|
|
|
|
const W = 96;
|
|
const ANSI_RE = new RegExp(String.fromCharCode(27) + "\\[\\d+(;\\d+)*m", "g");
|
|
const strip = (s: string) => s.replace(ANSI_RE, "");
|
|
const BANNER_LINES = BANNER.split("\n");
|
|
const row = (content: string) => {
|
|
const pad = Math.max(0, W - strip(content).length - 1);
|
|
return ` ${dim("│")} ${content}${" ".repeat(pad)}${dim("│")}`;
|
|
};
|
|
|
|
function printBanner(env: Record<string, string>, mode: string) {
|
|
const line = dim("─".repeat(W));
|
|
console.log(
|
|
[
|
|
"",
|
|
` ${dim("┌")}${line}${dim("┐")}`,
|
|
row(""),
|
|
row(`${bold(cyan("fastapiadmin"))} ${bold(magenta(`v${env.VITE_VERSION || "3.0.0"}`))}`),
|
|
row(""),
|
|
...BANNER_LINES.map((l) => row(green(l))),
|
|
row(""),
|
|
row(`${dim("mode")} ${yellow(env.VITE_APP_ENV || mode)}`),
|
|
row(`${dim("api")} ${blue(env.VITE_API_BASE_URL || "")}`),
|
|
row(`${dim("port")} ${cyan(env.VITE_PORT || "")}`),
|
|
row(""),
|
|
` ${dim("└")}${line}${dim("┘")}`,
|
|
"",
|
|
].join("\n")
|
|
);
|
|
}
|
|
|
|
export default function vitePluginStart(): PluginOption {
|
|
return {
|
|
name: "vite:start-banner",
|
|
enforce: "pre",
|
|
|
|
configResolved(resolvedConfig: ResolvedConfig) {
|
|
const env = resolvedConfig.env as Record<string, string>;
|
|
printBanner(env, resolvedConfig.mode);
|
|
},
|
|
};
|
|
}
|