chore: utils
This commit is contained in:
@@ -40,6 +40,7 @@ export default antfu(
|
|||||||
{
|
{
|
||||||
rules: {
|
rules: {
|
||||||
'antfu/if-newline': 'off',
|
'antfu/if-newline': 'off',
|
||||||
|
'antfu/no-top-level-await': 'off',
|
||||||
'eslint-comments/no-unlimited-disable': ['off'],
|
'eslint-comments/no-unlimited-disable': ['off'],
|
||||||
'no-console': ['off'],
|
'no-console': ['off'],
|
||||||
'perfectionist/sort-imports': ['error', {
|
'perfectionist/sort-imports': ['error', {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
"packageManager": "pnpm@10.13.1+sha512.37ebf1a5c7a30d5fabe0c5df44ee8da4c965ca0c5af3dbab28c3a1681b70a256218d05c81c9c0dcf767ef6b8551eb5b960042b9ed4300c59242336377e01cfad",
|
"packageManager": "pnpm@10.13.1+sha512.37ebf1a5c7a30d5fabe0c5df44ee8da4c965ca0c5af3dbab28c3a1681b70a256218d05c81c9c0dcf767ef6b8551eb5b960042b9ed4300c59242336377e01cfad",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "tsc -b && vite build",
|
"build": "tsc -b && vite build && tsx src/utils/post-build.ts",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"lint:fix": "eslint . --fix",
|
"lint:fix": "eslint . --fix",
|
||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
|
|||||||
15
src/utils/post-build.ts
Normal file
15
src/utils/post-build.ts
Normal 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);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user