UNPKG

workspace-tools

Version:

A collection of tools that are useful in a git-controlled monorepo that is managed by one of these software:

23 lines (22 loc) 708 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const getWorkspaces_1 = require("./getWorkspaces"); const cache = new Map(); /** * Get paths to every package.json in the workspace, given a cwd * @param cwd */ function getAllPackageJsonFiles(cwd) { if (cache.has(cwd)) { return cache.get(cwd); } const workspaces = getWorkspaces_1.getWorkspaces(cwd); const packageJsonFiles = workspaces.map((workspace) => workspace.packageJson.packageJsonPath); cache.set(cwd, packageJsonFiles); return packageJsonFiles; } exports.getAllPackageJsonFiles = getAllPackageJsonFiles; function _resetCache() { cache.clear(); } exports._resetCache = _resetCache;