bob-the-bundler
Version:
Bob The Bundler!
14 lines (13 loc) • 668 B
JavaScript
import path from 'path';
import { globby } from 'globby';
import { buildArtifactDirectories } from '../constants.js';
export async function getWorkspacePackagePaths(workspaces, cwd = process.cwd()) {
const packageJSONPaths = await globby(workspaces
/** We are only interested in workspaces that are packages (for now.) */
.filter(workspacePattern => workspacePattern.startsWith('packages/'))
.map(workspacePattern => path.join(workspacePattern, 'package.json')), {
cwd,
ignore: ['**/node_modules/**', ...buildArtifactDirectories],
});
return packageJSONPaths.map(packageJSONPath => path.dirname(packageJSONPath));
}