chore: utils

This commit is contained in:
2025-08-04 14:47:12 +08:00
parent db57eb68cd
commit ed962166b1
3 changed files with 17 additions and 1 deletions

View File

@@ -40,6 +40,7 @@ export default antfu(
{
rules: {
'antfu/if-newline': 'off',
'antfu/no-top-level-await': 'off',
'eslint-comments/no-unlimited-disable': ['off'],
'no-console': ['off'],
'perfectionist/sort-imports': ['error', {

View File

@@ -6,7 +6,7 @@
"packageManager": "pnpm@10.13.1+sha512.37ebf1a5c7a30d5fabe0c5df44ee8da4c965ca0c5af3dbab28c3a1681b70a256218d05c81c9c0dcf767ef6b8551eb5b960042b9ed4300c59242336377e01cfad",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"build": "tsc -b && vite build && tsx src/utils/post-build.ts",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"preview": "vite preview"

15
src/utils/post-build.ts Normal file
View File

@@ -0,0 +1,15 @@
import { tgz } from 'compressing';
import dayjs from 'dayjs';
import packageJson from '../../package.json';
const now = dayjs();
const fileName = `${packageJson.name}-${now.format('YYMMDD-HHmm')}`;
try {
await tgz.compressDir('./dist', `${fileName}.tar`);
await tgz.compressDir('./dist', `${fileName}.tar.gz`);
} catch (error) {
console.error('压缩失败:', error);
}