File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -132,8 +132,16 @@ export async function normalizeOptions(raw: VersionBumpOptions): Promise<Normali
132132 }
133133 // check npm/bun workspace config
134134 if ( fsSync . existsSync ( 'package.json' ) ) {
135- const packageJson = await fs . readFile ( 'package.json' , 'utf8' ) . then ( JSON . parse ) as { workspaces ?: string [ ] }
136- workspaces . push ( ...( packageJson . workspaces ?? [ ] ) )
135+ type PKGWorkspaces = string [ ] | { packages ?: string [ ] }
136+ const packageJson = await fs . readFile ( 'package.json' , 'utf8' ) . then ( JSON . parse ) as { workspaces ?: PKGWorkspaces }
137+ const _workspaces
138+ = Array . isArray ( packageJson . workspaces )
139+ ? packageJson . workspaces
140+ : packageJson . workspaces && Array . isArray ( packageJson . workspaces . packages )
141+ ? packageJson . workspaces . packages
142+ : [ ]
143+
144+ workspaces . push ( ..._workspaces )
137145 }
138146 // append package.json to each workspace string
139147 const workspacesWithPackageJson = workspaces . map ( workspace => `${ workspace } /package.json` )
You can’t perform that action at this time.
0 commit comments