11import fs from 'fs-extra'
22import { join , parse } from 'path'
33import childProcess from 'child_process'
4- import globby from 'globby'
54
65async 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