@@ -6,15 +6,16 @@ import set from 'set-value'
66import { resolveCommandConfig } from '../core/config'
77import { getWorkspaceData } from '../core/workspace'
88
9- function mergeCleanConfig ( base : CleanCommandConfig , overrides ?: Partial < CleanCommandConfig > ) {
9+ function mergeCleanConfig ( base ?: CleanCommandConfig , overrides ?: Partial < CleanCommandConfig > ) : CleanCommandConfig {
10+ const normalizedBase = base ?? { }
1011 if ( ! overrides ) {
11- return base
12+ return normalizedBase
1213 }
1314 const definedOverrides = Object . fromEntries (
1415 Object . entries ( overrides ) . filter ( ( [ , value ] ) => value !== undefined ) ,
1516 ) as Partial < CleanCommandConfig >
1617 return {
17- ...base ,
18+ ...normalizedBase ,
1819 ...definedOverrides ,
1920 }
2021}
@@ -24,7 +25,8 @@ function mergeCleanConfig(base: CleanCommandConfig, overrides?: Partial<CleanCom
2425 */
2526export async function cleanProjects ( cwd : string , overrides ?: Partial < CleanCommandConfig > ) {
2627 const cleanConfig = mergeCleanConfig ( await resolveCommandConfig ( 'clean' , cwd ) , overrides )
27- const workspaceOptions = cleanConfig ?. includePrivate ? { ignorePrivatePackage : false } : undefined
28+ const includePrivate = cleanConfig ?. includePrivate ?? true
29+ const workspaceOptions = includePrivate ? { ignorePrivatePackage : false } : undefined
2830 const { packages, workspaceDir } = await getWorkspaceData ( cwd , workspaceOptions )
2931
3032 // 根据配置过滤需要跳过的包,默认全部参与清理。
@@ -59,7 +61,11 @@ export async function cleanProjects(cwd: string, overrides?: Partial<CleanComman
5961 } )
6062 }
6163
62- const candidates = Array . from ( new Set ( cleanDirs . filter ( Boolean ) ) )
64+ const readmeZh = path . resolve ( workspaceDir , 'README.zh-CN.md' )
65+ const candidates = Array . from ( new Set ( [
66+ ...cleanDirs . filter ( Boolean ) ,
67+ readmeZh ,
68+ ] ) )
6369 await Promise . all ( candidates . map ( async ( dir ) => {
6470 if ( await fs . pathExists ( dir ) ) {
6571 await fs . remove ( dir )
0 commit comments