UNPKG

workspace-tools

Version:

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

30 lines 1.45 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getWorkspacePackagePathsAsync = exports.getWorkspacePackagePaths = void 0; const implementations_1 = require("./implementations"); /** * Get a list of package folder paths in the workspace. The list of included packages is based on * the manager's config file and matching package folders (which must contain package.json) on disk. */ function getWorkspacePackagePaths(cwd) { const utils = (0, implementations_1.getWorkspaceUtilities)(cwd); return utils?.getWorkspacePackagePaths(cwd) || []; } exports.getWorkspacePackagePaths = getWorkspacePackagePaths; /** * Get a list of package folder paths in the workspace. The list of included packages is based on * the manager's config file and matching package folders (which must contain package.json) on disk. */ async function getWorkspacePackagePathsAsync(cwd) { const utils = (0, implementations_1.getWorkspaceUtilities)(cwd); if (!utils) { return []; } if (!utils.getWorkspacePackagePathsAsync) { const managerName = (0, implementations_1.getWorkspaceManagerAndRoot)(cwd)?.manager; throw new Error(`${cwd} is using ${managerName} which has not been converted to async yet`); } return utils.getWorkspacePackagePathsAsync(cwd); } exports.getWorkspacePackagePathsAsync = getWorkspacePackagePathsAsync; //# sourceMappingURL=getWorkspacePackagePaths.js.map