workspace-tools
Version:
A collection of utilities that are useful in a git-controlled monorepo managed by one of these tools:
15 lines • 642 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.findWorkspacePath = void 0;
/**
* Find the path for a particular package name from an array of info about packages ("workspaces"
* in npm/yarn/pnpm terms) within a monorepo.
* @param workspaces Array of info about packages within a monorepo
* @param packageName Package name to find
* @returns Package path if found, or undefined
*/
function findWorkspacePath(workspaces, packageName) {
return workspaces.find(({ name }) => name === packageName)?.path;
}
exports.findWorkspacePath = findWorkspacePath;
//# sourceMappingURL=findWorkspacePath.js.map