初始化

缺陷:主题配色需要优化整体的同风格
This commit is contained in:
2026-08-14 23:19:06 +08:00
parent 318aeab092
commit 27135f4ae6
187 changed files with 13631 additions and 187 deletions

View File

@@ -4,22 +4,30 @@ import type { ArchiverPluginOptions } from '../typing';
import fs from 'node:fs';
import fsp from 'node:fs/promises';
import { join } from 'node:path';
import { basename, isAbsolute, join } from 'node:path';
import { ZipArchive } from 'archiver';
export const viteArchiverPlugin = (
options: ArchiverPluginOptions = {},
): PluginOption => {
// 归档必须跟随实际构建目录,否则 --outDir dist-brm 这类多产物构建会去压缩上一次的 dist
let resolvedOutDir = 'dist';
return {
apply: 'build',
configResolved(config) {
resolvedOutDir = config.build.outDir || 'dist';
},
closeBundle: {
handler() {
const { name = 'dist', outputDir = '.' } = options;
const { outputDir = '.' } = options;
const folderToZip = isAbsolute(resolvedOutDir)
? resolvedOutDir
: join(process.cwd(), resolvedOutDir);
const name = options.name ?? basename(folderToZip);
setTimeout(async () => {
const folderToZip = 'dist';
const zipOutputDir = join(process.cwd(), outputDir);
const zipOutputPath = join(zipOutputDir, `${name}.zip`);
try {

View File

@@ -85,7 +85,7 @@ interface NitroMockPluginOptions {
interface ArchiverPluginOptions {
/**
* 输出文件名
* @default 'dist'
* @default 构建目录名(build.outDir)
*/
name?: string;
/**