Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion scripts/bump-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,22 @@ function getWorkspacePackageJsonFiles(workspaceFile: string): string[] {
const workspaceYaml = fs.readFileSync(workspaceFile, 'utf8');
const workspace = yaml.parse(workspaceYaml) as { packages?: string[] };
if (!workspace.packages) throw new Error('No "packages" key found in pnpm-workspace.yaml');
const rootDir = path.dirname(workspaceFile);

const files = new Set<string>();

// include all package.json files in the workspace
const rootDir = path.dirname(workspaceFile);
for (const pattern of workspace.packages) {
const matches = glob.sync(path.join(pattern, 'package.json'), {
cwd: rootDir,
absolute: true,
});
matches.filter((f) => !f.includes('node_modules')).forEach((f) => files.add(f));
}

// include root package.json
files.add(path.resolve(__dirname, '../package.json'));

return Array.from(files);
}

Expand Down