mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-10-15 17:32:58 +08:00
feat: 样板打包脚本
This commit is contained in:
parent
c339825f5e
commit
17f771c644
1
.gitignore
vendored
1
.gitignore
vendored
@ -53,3 +53,4 @@ docs/.vitepress/cache
|
|||||||
docs/.vitepress/dist
|
docs/.vitepress/dist
|
||||||
docs/.vitepress/apiSidebar.ts
|
docs/.vitepress/apiSidebar.ts
|
||||||
_docs
|
_docs
|
||||||
|
template
|
||||||
|
@ -14,7 +14,8 @@
|
|||||||
"build:lib": "vue-tsc --noEmit && tsx script/build-lib.ts",
|
"build:lib": "vue-tsc --noEmit && tsx script/build-lib.ts",
|
||||||
"docs:dev": "concurrently -k -n SIDEBAR,VITEPRESS -c blue,green \"tsx docs/.vitepress/api.ts\" \"vitepress dev docs\"",
|
"docs:dev": "concurrently -k -n SIDEBAR,VITEPRESS -c blue,green \"tsx docs/.vitepress/api.ts\" \"vitepress dev docs\"",
|
||||||
"docs:build": "vitepress build docs",
|
"docs:build": "vitepress build docs",
|
||||||
"docs:preview": "vitepress preview docs"
|
"docs:preview": "vitepress preview docs",
|
||||||
|
"pack:template": "tsx script/pack-template.ts"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ant-design/icons-vue": "^6.1.0",
|
"@ant-design/icons-vue": "^6.1.0",
|
||||||
|
49
script/pack-template.ts
Normal file
49
script/pack-template.ts
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/* eslint-disable no-console */
|
||||||
|
import { copy, emptyDir, ensureDir } from 'fs-extra';
|
||||||
|
import { resolve } from 'path';
|
||||||
|
|
||||||
|
const base = resolve(process.cwd());
|
||||||
|
const template = resolve(base, 'template');
|
||||||
|
|
||||||
|
async function packTemplate() {
|
||||||
|
await ensureDir(template);
|
||||||
|
await emptyDir(template);
|
||||||
|
|
||||||
|
// 复制必要文件
|
||||||
|
const toCopy = [
|
||||||
|
'.vscode',
|
||||||
|
'packages',
|
||||||
|
'packages-user',
|
||||||
|
'public',
|
||||||
|
'script',
|
||||||
|
'src',
|
||||||
|
'.gitignore',
|
||||||
|
'.madgerc',
|
||||||
|
'.prettierignore',
|
||||||
|
'.prettierrc',
|
||||||
|
'eslint.config.js',
|
||||||
|
'index.html',
|
||||||
|
'LICENSE',
|
||||||
|
'package.json',
|
||||||
|
'pnpm-lock.yaml',
|
||||||
|
'pnpm-workspace.yaml',
|
||||||
|
'README.md',
|
||||||
|
'tsconfig.json',
|
||||||
|
'tsconfig.node.json',
|
||||||
|
'vite.config.ts'
|
||||||
|
];
|
||||||
|
|
||||||
|
await Promise.all(
|
||||||
|
toCopy.map(v =>
|
||||||
|
copy(resolve(base, v), resolve(template, v), {
|
||||||
|
filter: src => !src.includes('node_modules')
|
||||||
|
})
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(`样板打包完成`);
|
||||||
|
}
|
||||||
|
|
||||||
|
(() => {
|
||||||
|
packTemplate();
|
||||||
|
})();
|
Loading…
Reference in New Issue
Block a user