Skip to content

Commit 213aa47

Browse files
authored
fix: consider packages key existence in pnpm-workspace.yaml (#78)
1 parent 6887d41 commit 213aa47

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/normalize-options.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ export async function normalizeOptions(raw: VersionBumpOptions): Promise<Normali
126126
// read pnpm-workspace.yaml
127127
const pnpmWorkspace = await fs.readFile('pnpm-workspace.yaml', 'utf8')
128128
// parse yaml
129-
const workspaces = yaml.parse(pnpmWorkspace) as { packages: string[] }
129+
const workspaces = yaml.parse(pnpmWorkspace) as { packages?: string[] }
130130
// append package.json to each workspace string
131-
const workspacesWithPackageJson = workspaces.packages.map(workspace => `${workspace}/package.json`)
131+
const workspacesWithPackageJson = (workspaces.packages ?? []).map(workspace => `${workspace}/package.json`)
132132
// start with ! or already in files should be excluded
133133
const withoutExcludedWorkspaces = workspacesWithPackageJson.filter(workspace => !workspace.startsWith('!') && !raw.files?.includes(workspace))
134134
// add to files

0 commit comments

Comments
 (0)