workspace-tools
Version:
A collection of tools that are useful in a git-controlled monorepo that is managed by one of these software:
32 lines (31 loc) • 1.13 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const find_up_1 = __importDefault(require("find-up"));
function getWorkspaceImplementation(cwd) {
// This needs to come before Yarn and NPM because
// lerna can be used with either package manager
const lernaJsonPath = find_up_1.default.sync("lerna.json", { cwd });
if (lernaJsonPath) {
return "lerna";
}
const yarnLockPath = find_up_1.default.sync("yarn.lock", { cwd });
if (yarnLockPath) {
return "yarn";
}
const pnpmLockPath = find_up_1.default.sync("pnpm-workspace.yaml", { cwd });
if (pnpmLockPath) {
return "pnpm";
}
const rushJsonPath = find_up_1.default.sync("rush.json", { cwd });
if (rushJsonPath) {
return "rush";
}
const npmLockPath = find_up_1.default.sync("package-lock.json", { cwd });
if (npmLockPath) {
return "npm";
}
}
exports.getWorkspaceImplementation = getWorkspaceImplementation;