Skip to content

Commit b6acf50

Browse files
committed
fix: 清理优化
1 parent 66efee3 commit b6acf50

1 file changed

Lines changed: 2 additions & 16 deletions

File tree

clean.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,16 @@
11
import fs from 'fs-extra'
22
import { join, parse } from 'path'
33
import childProcess from 'child_process'
4-
import globby from 'globby'
54

65
async function clean(rootDir: string) {
76
const projectFilePath = join.bind(null, rootDir)
87
const pkgFilePath = join.bind(null, projectFilePath('node_modules'))
98

109
// 需要保留的文件列表
1110
const reservedFiles = [
12-
pkgFilePath('react/cjs/react.production.min.js'),
13-
pkgFilePath('react-dom/cjs/react-dom.production.min.js'),
14-
pkgFilePath('react-is/cjs/react-is.production.min.js'),
15-
pkgFilePath('scheduler/cjs/scheduler.production.min.js'),
16-
pkgFilePath('history/cjs/history.min.js'),
17-
pkgFilePath('resolve-pathname/cjs/resolve-pathname.min.js'),
18-
pkgFilePath('value-equal/cjs/value-equal.min.js'),
19-
pkgFilePath('jsondiffpatch/dist/jsondiffpatch.umd.js'),
2011
pkgFilePath('ajv-i18n/localize/es'),
2112
pkgFilePath('svgo/.svgo.yml'),
2213
pkgFilePath('.bin'),
23-
...(await globby('**/*.min.*', {
24-
absolute: true,
25-
cwd: rootDir,
26-
ignore: ['**/node_modules/**'],
27-
})),
2814
].map((filePath) => {
2915
const { dir, base } = parse(filePath)
3016
return {
@@ -44,11 +30,11 @@ async function clean(rootDir: string) {
4430
cd ${rootDir}
4531
shopt -s globstar
4632
rm -rf \\
47-
**/*.{map,lock,log,md,yml,yaml,ts,txt} \\
33+
**/*.{map,lock,log,md,yml,yaml,ts,tsx,vue,txt} \\
4834
**/.[!.]* \\
4935
**/__*__ \\
5036
**/{tsconfig.json,package-lock.json,Makefile,CHANGELOG} \\
51-
**/*.{test,spec,min,umd,es,esm}.* \\
37+
**/*.{test,spec,es,esm}.* \\
5238
**/{test,tests,example,examples,doc,docs,coverage,demo,umd,es,esm}/
5339
`,
5440
{ shell: '/bin/bash' },

0 commit comments

Comments
 (0)