workspace-tools 0.32.0 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +48 -1
- package/CHANGELOG.md +20 -2
- package/README.md +4 -0
- package/lib/getPackagePaths.d.ts +10 -2
- package/lib/getPackagePaths.js +32 -33
- package/lib/getPackagePaths.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.js +10 -3
- package/lib/index.js.map +1 -1
- package/lib/lockfile/index.js +1 -1
- package/lib/lockfile/index.js.map +1 -1
- package/lib/logging.d.ts +5 -0
- package/lib/logging.js +15 -0
- package/lib/logging.js.map +1 -0
- package/lib/paths.js +7 -1
- package/lib/paths.js.map +1 -1
- package/lib/types/WorkspaceInfo.d.ts +7 -0
- package/lib/workspaces/findWorkspacePath.d.ts +7 -0
- package/lib/workspaces/findWorkspacePath.js +9 -4
- package/lib/workspaces/findWorkspacePath.js.map +1 -1
- package/lib/workspaces/getWorkspacePackageInfo.d.ts +22 -2
- package/lib/workspaces/getWorkspacePackageInfo.js +43 -22
- package/lib/workspaces/getWorkspacePackageInfo.js.map +1 -1
- package/lib/workspaces/getWorkspaceRoot.d.ts +8 -1
- package/lib/workspaces/getWorkspaceRoot.js +9 -18
- package/lib/workspaces/getWorkspaceRoot.js.map +1 -1
- package/lib/workspaces/getWorkspaces.d.ts +16 -0
- package/lib/workspaces/getWorkspaces.js +25 -28
- package/lib/workspaces/getWorkspaces.js.map +1 -1
- package/lib/workspaces/implementations/getWorkspaceManagerAndRoot.d.ts +22 -0
- package/lib/workspaces/implementations/getWorkspaceManagerAndRoot.js +63 -0
- package/lib/workspaces/implementations/getWorkspaceManagerAndRoot.js.map +1 -0
- package/lib/workspaces/implementations/getWorkspaceUtilities.d.ts +18 -0
- package/lib/workspaces/implementations/getWorkspaceUtilities.js +26 -0
- package/lib/workspaces/implementations/getWorkspaceUtilities.js.map +1 -0
- package/lib/workspaces/implementations/index.d.ts +2 -14
- package/lib/workspaces/implementations/index.js +5 -55
- package/lib/workspaces/implementations/index.js.map +1 -1
- package/lib/workspaces/implementations/lerna.d.ts +6 -2
- package/lib/workspaces/implementations/lerna.js +17 -10
- package/lib/workspaces/implementations/lerna.js.map +1 -1
- package/lib/workspaces/implementations/npm.d.ts +10 -1
- package/lib/workspaces/implementations/npm.js +19 -8
- package/lib/workspaces/implementations/npm.js.map +1 -1
- package/lib/workspaces/implementations/packageJsonWorkspaces.d.ts +8 -1
- package/lib/workspaces/implementations/packageJsonWorkspaces.js +26 -24
- package/lib/workspaces/implementations/packageJsonWorkspaces.js.map +1 -1
- package/lib/workspaces/implementations/pnpm.d.ts +6 -0
- package/lib/workspaces/implementations/pnpm.js +16 -7
- package/lib/workspaces/implementations/pnpm.js.map +1 -1
- package/lib/workspaces/implementations/rush.d.ts +6 -0
- package/lib/workspaces/implementations/rush.js +16 -7
- package/lib/workspaces/implementations/rush.js.map +1 -1
- package/lib/workspaces/implementations/yarn.d.ts +11 -0
- package/lib/workspaces/implementations/yarn.js +20 -7
- package/lib/workspaces/implementations/yarn.js.map +1 -1
- package/lib/workspaces/workspaces.d.ts +11 -3
- package/lib/workspaces/workspaces.js +13 -5
- package/lib/workspaces/workspaces.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,41 +2,38 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getWorkspacesAsync = exports.getWorkspaces = void 0;
|
|
4
4
|
const implementations_1 = require("./implementations");
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Get an array with names, paths, and package.json contents for each package in a workspace.
|
|
7
|
+
* The list of included packages is based on the workspace manager's config file.
|
|
8
|
+
*
|
|
9
|
+
* The method name is somewhat misleading due to the double meaning of "workspace", but it's retained
|
|
10
|
+
* for compatibility. "Workspace" here refers to an individual package, in the sense of the `workspaces`
|
|
11
|
+
* package.json config used by npm/yarn (instead of referring to the entire monorepo).
|
|
12
|
+
*/
|
|
6
13
|
function getWorkspaces(cwd) {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
return [];
|
|
10
|
-
}
|
|
11
|
-
switch (workspaceImplementation) {
|
|
12
|
-
case "yarn":
|
|
13
|
-
return require(`./implementations/yarn`).getYarnWorkspaces(cwd);
|
|
14
|
-
case "pnpm":
|
|
15
|
-
return require(`./implementations/pnpm`).getPnpmWorkspaces(cwd);
|
|
16
|
-
case "rush":
|
|
17
|
-
return require(`./implementations/rush`).getRushWorkspaces(cwd);
|
|
18
|
-
case "npm":
|
|
19
|
-
return require(`./implementations/npm`).getNpmWorkspaces(cwd);
|
|
20
|
-
case "lerna":
|
|
21
|
-
return require(`./implementations/lerna`).getLernaWorkspaces(cwd);
|
|
22
|
-
}
|
|
14
|
+
const utils = (0, implementations_1.getWorkspaceUtilities)(cwd);
|
|
15
|
+
return (utils === null || utils === void 0 ? void 0 : utils.getWorkspaces(cwd)) || [];
|
|
23
16
|
}
|
|
24
17
|
exports.getWorkspaces = getWorkspaces;
|
|
18
|
+
/**
|
|
19
|
+
* Get an array with names, paths, and package.json contents for each package in a workspace.
|
|
20
|
+
* The list of included packages is based on the workspace manager's config file.
|
|
21
|
+
*
|
|
22
|
+
* The method name is somewhat misleading due to the double meaning of "workspace", but it's retained
|
|
23
|
+
* for compatibility. "Workspace" here refers to an individual package, in the sense of the `workspaces`
|
|
24
|
+
* package.json config used by npm/yarn (instead of referring to the entire monorepo).
|
|
25
|
+
*/
|
|
25
26
|
async function getWorkspacesAsync(cwd) {
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
var _a;
|
|
28
|
+
const utils = (0, implementations_1.getWorkspaceUtilities)(cwd);
|
|
29
|
+
if (!utils) {
|
|
28
30
|
return [];
|
|
29
31
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
case "npm":
|
|
34
|
-
return require(`./implementations/npm`).getNpmWorkspacesAsync(cwd);
|
|
35
|
-
case "pnpm":
|
|
36
|
-
case "rush":
|
|
37
|
-
case "lerna":
|
|
38
|
-
throw new Error(`${cwd} is using ${workspaceImplementation} which has not been converted to async yet`);
|
|
32
|
+
if (!utils.getWorkspacesAsync) {
|
|
33
|
+
const managerName = (_a = (0, implementations_1.getWorkspaceManagerAndRoot)(cwd)) === null || _a === void 0 ? void 0 : _a.manager;
|
|
34
|
+
throw new Error(`${cwd} is using ${managerName} which has not been converted to async yet`);
|
|
39
35
|
}
|
|
36
|
+
return utils.getWorkspacesAsync(cwd);
|
|
40
37
|
}
|
|
41
38
|
exports.getWorkspacesAsync = getWorkspacesAsync;
|
|
42
39
|
//# sourceMappingURL=getWorkspaces.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getWorkspaces.js","sourceRoot":"","sources":["../../src/workspaces/getWorkspaces.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"getWorkspaces.js","sourceRoot":"","sources":["../../src/workspaces/getWorkspaces.ts"],"names":[],"mappings":";;;AAAA,uDAAsF;AAGtF;;;;;;;GAOG;AACH,SAAgB,aAAa,CAAC,GAAW;IACvC,MAAM,KAAK,GAAG,IAAA,uCAAqB,EAAC,GAAG,CAAC,CAAC;IACzC,OAAO,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,aAAa,CAAC,GAAG,CAAC,KAAI,EAAE,CAAC;AACzC,CAAC;AAHD,sCAGC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,kBAAkB,CAAC,GAAW;;IAClD,MAAM,KAAK,GAAG,IAAA,uCAAqB,EAAC,GAAG,CAAC,CAAC;IAEzC,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,EAAE,CAAC;KACX;IAED,IAAI,CAAC,KAAK,CAAC,kBAAkB,EAAE;QAC7B,MAAM,WAAW,GAAG,MAAA,IAAA,4CAA0B,EAAC,GAAG,CAAC,0CAAE,OAAO,CAAC;QAC7D,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,aAAa,WAAW,4CAA4C,CAAC,CAAC;KAC7F;IAED,OAAO,KAAK,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;AACvC,CAAC;AAbD,gDAaC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { WorkspaceManager } from "../WorkspaceManager";
|
|
2
|
+
export interface WorkspaceManagerAndRoot {
|
|
3
|
+
/** Workspace manager name */
|
|
4
|
+
manager: WorkspaceManager;
|
|
5
|
+
/** Workspace root, where the manager configuration file is located */
|
|
6
|
+
root: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Get the preferred workspace manager based on `process.env.PREFERRED_WORKSPACE_MANAGER`
|
|
10
|
+
* (if valid).
|
|
11
|
+
*/
|
|
12
|
+
export declare function getPreferredWorkspaceManager(): WorkspaceManager | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Get the workspace manager name and workspace root directory for `cwd`, with caching.
|
|
15
|
+
* Also respects the `process.env.PREFERRED_WORKSPACE_MANAGER` override, provided the relevant
|
|
16
|
+
* manager file exists.
|
|
17
|
+
* @param cwd Directory to search up from
|
|
18
|
+
* @param cache Optional override cache for testing
|
|
19
|
+
* @param preferredManager Optional override manager (if provided, only searches for this manager's file)
|
|
20
|
+
* @returns Workspace manager and root, or undefined if it can't be determined
|
|
21
|
+
*/
|
|
22
|
+
export declare function getWorkspaceManagerAndRoot(cwd: string, cache?: Map<string, WorkspaceManagerAndRoot | undefined>, preferredManager?: WorkspaceManager): WorkspaceManagerAndRoot | undefined;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getWorkspaceManagerAndRoot = exports.getPreferredWorkspaceManager = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const paths_1 = require("../../paths");
|
|
9
|
+
const workspaceCache = new Map();
|
|
10
|
+
/**
|
|
11
|
+
* Files indicating the workspace root for each manager.
|
|
12
|
+
*
|
|
13
|
+
* DO NOT REORDER! The order of keys determines the precedence of the files, which is
|
|
14
|
+
* important for cases like lerna where lerna.json and e.g. yarn.lock may both exist.
|
|
15
|
+
*/
|
|
16
|
+
const managerFiles = {
|
|
17
|
+
// DO NOT REORDER! (see above)
|
|
18
|
+
lerna: "lerna.json",
|
|
19
|
+
rush: "rush.json",
|
|
20
|
+
yarn: "yarn.lock",
|
|
21
|
+
pnpm: "pnpm-workspace.yaml",
|
|
22
|
+
npm: "package-lock.json",
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Get the preferred workspace manager based on `process.env.PREFERRED_WORKSPACE_MANAGER`
|
|
26
|
+
* (if valid).
|
|
27
|
+
*/
|
|
28
|
+
function getPreferredWorkspaceManager() {
|
|
29
|
+
const preferred = process.env.PREFERRED_WORKSPACE_MANAGER;
|
|
30
|
+
return preferred && managerFiles[preferred] ? preferred : undefined;
|
|
31
|
+
}
|
|
32
|
+
exports.getPreferredWorkspaceManager = getPreferredWorkspaceManager;
|
|
33
|
+
/**
|
|
34
|
+
* Get the workspace manager name and workspace root directory for `cwd`, with caching.
|
|
35
|
+
* Also respects the `process.env.PREFERRED_WORKSPACE_MANAGER` override, provided the relevant
|
|
36
|
+
* manager file exists.
|
|
37
|
+
* @param cwd Directory to search up from
|
|
38
|
+
* @param cache Optional override cache for testing
|
|
39
|
+
* @param preferredManager Optional override manager (if provided, only searches for this manager's file)
|
|
40
|
+
* @returns Workspace manager and root, or undefined if it can't be determined
|
|
41
|
+
*/
|
|
42
|
+
function getWorkspaceManagerAndRoot(cwd, cache, preferredManager) {
|
|
43
|
+
cache = cache || workspaceCache;
|
|
44
|
+
if (cache.has(cwd)) {
|
|
45
|
+
return cache.get(cwd);
|
|
46
|
+
}
|
|
47
|
+
preferredManager = preferredManager || getPreferredWorkspaceManager();
|
|
48
|
+
const managerFile = (0, paths_1.searchUp)((preferredManager && managerFiles[preferredManager]) || Object.values(managerFiles), cwd);
|
|
49
|
+
if (managerFile) {
|
|
50
|
+
const managerFileName = path_1.default.basename(managerFile);
|
|
51
|
+
cache.set(cwd, {
|
|
52
|
+
manager: Object.keys(managerFiles).find((name) => managerFiles[name] === managerFileName),
|
|
53
|
+
root: path_1.default.dirname(managerFile),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
// Avoid searching again if no file was found
|
|
58
|
+
cache.set(cwd, undefined);
|
|
59
|
+
}
|
|
60
|
+
return cache.get(cwd);
|
|
61
|
+
}
|
|
62
|
+
exports.getWorkspaceManagerAndRoot = getWorkspaceManagerAndRoot;
|
|
63
|
+
//# sourceMappingURL=getWorkspaceManagerAndRoot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getWorkspaceManagerAndRoot.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/getWorkspaceManagerAndRoot.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,uCAAuC;AASvC,MAAM,cAAc,GAAG,IAAI,GAAG,EAA+C,CAAC;AAE9E;;;;;GAKG;AACH,MAAM,YAAY,GAAG;IACnB,8BAA8B;IAC9B,KAAK,EAAE,YAAY;IACnB,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,qBAAqB;IAC3B,GAAG,EAAE,mBAAmB;CACzB,CAAC;AAEF;;;GAGG;AACH,SAAgB,4BAA4B;IAC1C,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,2BAA2D,CAAC;IAC1F,OAAO,SAAS,IAAI,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;AACtE,CAAC;AAHD,oEAGC;AAED;;;;;;;;GAQG;AACH,SAAgB,0BAA0B,CACxC,GAAW,EACX,KAAwD,EACxD,gBAAmC;IAEnC,KAAK,GAAG,KAAK,IAAI,cAAc,CAAC;IAChC,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;QAClB,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;KACvB;IAED,gBAAgB,GAAG,gBAAgB,IAAI,4BAA4B,EAAE,CAAC;IACtE,MAAM,WAAW,GAAG,IAAA,gBAAQ,EAC1B,CAAC,gBAAgB,IAAI,YAAY,CAAC,gBAAgB,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,EACnF,GAAG,CACJ,CAAC;IAEF,IAAI,WAAW,EAAE;QACf,MAAM,eAAe,GAAG,cAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACnD,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE;YACb,OAAO,EAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAwB,CAAC,IAAI,CAC7D,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,eAAe,CAChD;YACF,IAAI,EAAE,cAAI,CAAC,OAAO,CAAC,WAAW,CAAC;SAChC,CAAC,CAAC;KACJ;SAAM;QACL,6CAA6C;QAC7C,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;KAC3B;IAED,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACxB,CAAC;AA9BD,gEA8BC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { WorkspaceInfo } from "../../types/WorkspaceInfo";
|
|
2
|
+
export interface WorkspaceUtilities {
|
|
3
|
+
/**
|
|
4
|
+
* Get an array with names, paths, and package.json contents for each package in a workspace.
|
|
5
|
+
* (See `../getWorkspaces` for why it's named this way.)
|
|
6
|
+
*/
|
|
7
|
+
getWorkspaces: (cwd: string) => WorkspaceInfo;
|
|
8
|
+
/**
|
|
9
|
+
* Get an array with names, paths, and package.json contents for each package in a workspace.
|
|
10
|
+
* (See `../getWorkspaces` for why it's named this way.)
|
|
11
|
+
*/
|
|
12
|
+
getWorkspacesAsync?: (cwd: string) => Promise<WorkspaceInfo>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get utility implementations for the workspace manager of `cwd`.
|
|
16
|
+
* Returns undefined if the manager can't be determined.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getWorkspaceUtilities(cwd: string): WorkspaceUtilities | undefined;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getWorkspaceUtilities = void 0;
|
|
4
|
+
const getWorkspaceManagerAndRoot_1 = require("./getWorkspaceManagerAndRoot");
|
|
5
|
+
/**
|
|
6
|
+
* Get utility implementations for the workspace manager of `cwd`.
|
|
7
|
+
* Returns undefined if the manager can't be determined.
|
|
8
|
+
*/
|
|
9
|
+
function getWorkspaceUtilities(cwd) {
|
|
10
|
+
var _a;
|
|
11
|
+
const manager = (_a = (0, getWorkspaceManagerAndRoot_1.getWorkspaceManagerAndRoot)(cwd)) === null || _a === void 0 ? void 0 : _a.manager;
|
|
12
|
+
switch (manager) {
|
|
13
|
+
case "yarn":
|
|
14
|
+
return require("./yarn");
|
|
15
|
+
case "pnpm":
|
|
16
|
+
return require("./pnpm");
|
|
17
|
+
case "rush":
|
|
18
|
+
return require("./rush");
|
|
19
|
+
case "npm":
|
|
20
|
+
return require("./npm");
|
|
21
|
+
case "lerna":
|
|
22
|
+
return require("./lerna");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.getWorkspaceUtilities = getWorkspaceUtilities;
|
|
26
|
+
//# sourceMappingURL=getWorkspaceUtilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getWorkspaceUtilities.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/getWorkspaceUtilities.ts"],"names":[],"mappings":";;;AACA,6EAA0E;AAqB1E;;;GAGG;AACH,SAAgB,qBAAqB,CAAC,GAAW;;IAC/C,MAAM,OAAO,GAAG,MAAA,IAAA,uDAA0B,EAAC,GAAG,CAAC,0CAAE,OAAO,CAAC;IAEzD,QAAQ,OAAO,EAAE;QACf,KAAK,MAAM;YACT,OAAO,OAAO,CAAC,QAAQ,CAAyB,CAAC;QAEnD,KAAK,MAAM;YACT,OAAO,OAAO,CAAC,QAAQ,CAAyB,CAAC;QAEnD,KAAK,MAAM;YACT,OAAO,OAAO,CAAC,QAAQ,CAAyB,CAAC;QAEnD,KAAK,KAAK;YACR,OAAO,OAAO,CAAC,OAAO,CAAwB,CAAC;QAEjD,KAAK,OAAO;YACV,OAAO,OAAO,CAAC,SAAS,CAA0B,CAAC;KACtD;AACH,CAAC;AAnBD,sDAmBC"}
|
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
implementation: WorkspaceImplementations | undefined;
|
|
4
|
-
lockFile: string;
|
|
5
|
-
}
|
|
6
|
-
export declare function getWorkspaceImplementationAndLockFile(cwd: string, cache?: {
|
|
7
|
-
[cwd: string]: ImplementationAndLockFile;
|
|
8
|
-
}): {
|
|
9
|
-
implementation: WorkspaceImplementations | undefined;
|
|
10
|
-
lockFile: string;
|
|
11
|
-
} | undefined;
|
|
12
|
-
export declare function getWorkspaceImplementation(cwd: string, cache?: {
|
|
13
|
-
[cwd: string]: ImplementationAndLockFile;
|
|
14
|
-
}): WorkspaceImplementations | undefined;
|
|
1
|
+
export { getWorkspaceManagerAndRoot, WorkspaceManagerAndRoot } from "./getWorkspaceManagerAndRoot";
|
|
2
|
+
export { getWorkspaceUtilities, WorkspaceUtilities } from "./getWorkspaceUtilities";
|
|
@@ -1,58 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (cache[cwd]) {
|
|
12
|
-
return cache[cwd];
|
|
13
|
-
}
|
|
14
|
-
const lockFile = (0, paths_1.searchUp)(["lerna.json", "rush.json", "yarn.lock", "pnpm-workspace.yaml", "package-lock.json"], cwd);
|
|
15
|
-
if (!lockFile) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
switch (path_1.default.basename(lockFile)) {
|
|
19
|
-
case "lerna.json":
|
|
20
|
-
cache[cwd] = {
|
|
21
|
-
implementation: "lerna",
|
|
22
|
-
lockFile,
|
|
23
|
-
};
|
|
24
|
-
break;
|
|
25
|
-
case "yarn.lock":
|
|
26
|
-
cache[cwd] = {
|
|
27
|
-
implementation: "yarn",
|
|
28
|
-
lockFile,
|
|
29
|
-
};
|
|
30
|
-
break;
|
|
31
|
-
case "pnpm-workspace.yaml":
|
|
32
|
-
cache[cwd] = {
|
|
33
|
-
implementation: "pnpm",
|
|
34
|
-
lockFile,
|
|
35
|
-
};
|
|
36
|
-
break;
|
|
37
|
-
case "rush.json":
|
|
38
|
-
cache[cwd] = {
|
|
39
|
-
implementation: "rush",
|
|
40
|
-
lockFile,
|
|
41
|
-
};
|
|
42
|
-
break;
|
|
43
|
-
case "package-lock.json":
|
|
44
|
-
cache[cwd] = {
|
|
45
|
-
implementation: "npm",
|
|
46
|
-
lockFile,
|
|
47
|
-
};
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
return cache[cwd];
|
|
51
|
-
}
|
|
52
|
-
exports.getWorkspaceImplementationAndLockFile = getWorkspaceImplementationAndLockFile;
|
|
53
|
-
function getWorkspaceImplementation(cwd, cache = workspaceCache) {
|
|
54
|
-
var _a;
|
|
55
|
-
return (_a = getWorkspaceImplementationAndLockFile(cwd, cache)) === null || _a === void 0 ? void 0 : _a.implementation;
|
|
56
|
-
}
|
|
57
|
-
exports.getWorkspaceImplementation = getWorkspaceImplementation;
|
|
3
|
+
exports.getWorkspaceUtilities = exports.getWorkspaceManagerAndRoot = void 0;
|
|
4
|
+
var getWorkspaceManagerAndRoot_1 = require("./getWorkspaceManagerAndRoot");
|
|
5
|
+
Object.defineProperty(exports, "getWorkspaceManagerAndRoot", { enumerable: true, get: function () { return getWorkspaceManagerAndRoot_1.getWorkspaceManagerAndRoot; } });
|
|
6
|
+
var getWorkspaceUtilities_1 = require("./getWorkspaceUtilities");
|
|
7
|
+
Object.defineProperty(exports, "getWorkspaceUtilities", { enumerable: true, get: function () { return getWorkspaceUtilities_1.getWorkspaceUtilities; } });
|
|
58
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/index.ts"],"names":[],"mappings":";;;AAAA,2EAAmG;AAA1F,wIAAA,0BAA0B,OAAA;AACnC,iEAAoF;AAA3E,8HAAA,qBAAqB,OAAA"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { WorkspaceInfo } from "../../types/WorkspaceInfo";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Get an array with names, paths, and package.json contents for each package in a lerna workspace.
|
|
4
|
+
* (See `../getWorkspaces` for why it's named this way.)
|
|
5
|
+
*/
|
|
6
|
+
export declare function getLernaWorkspaces(cwd: string): WorkspaceInfo;
|
|
7
|
+
export { getLernaWorkspaces as getWorkspaces };
|
|
@@ -3,33 +3,40 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.getWorkspaces = exports.getLernaWorkspaces = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const jju_1 = __importDefault(require("jju"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
const getPackagePaths_1 = require("../../getPackagePaths");
|
|
11
|
-
const paths_1 = require("../../paths");
|
|
12
11
|
const getWorkspacePackageInfo_1 = require("../getWorkspacePackageInfo");
|
|
12
|
+
const logging_1 = require("../../logging");
|
|
13
|
+
const getWorkspaceManagerAndRoot_1 = require("./getWorkspaceManagerAndRoot");
|
|
13
14
|
function getLernaWorkspaceRoot(cwd) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
var _a;
|
|
16
|
+
const root = (_a = (0, getWorkspaceManagerAndRoot_1.getWorkspaceManagerAndRoot)(cwd, undefined, "lerna")) === null || _a === void 0 ? void 0 : _a.root;
|
|
17
|
+
if (!root) {
|
|
18
|
+
throw new Error("Could not find lerna workspace root from " + cwd);
|
|
17
19
|
}
|
|
18
|
-
return
|
|
20
|
+
return root;
|
|
19
21
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Get an array with names, paths, and package.json contents for each package in a lerna workspace.
|
|
24
|
+
* (See `../getWorkspaces` for why it's named this way.)
|
|
25
|
+
*/
|
|
26
|
+
function getLernaWorkspaces(cwd) {
|
|
22
27
|
try {
|
|
23
28
|
const lernaWorkspaceRoot = getLernaWorkspaceRoot(cwd);
|
|
24
29
|
const lernaJsonPath = path_1.default.join(lernaWorkspaceRoot, "lerna.json");
|
|
25
30
|
const lernaConfig = jju_1.default.parse(fs_1.default.readFileSync(lernaJsonPath, "utf-8"));
|
|
26
|
-
const packagePaths = (0, getPackagePaths_1.getPackagePaths)(lernaWorkspaceRoot, lernaConfig.packages
|
|
31
|
+
const packagePaths = (0, getPackagePaths_1.getPackagePaths)(lernaWorkspaceRoot, lernaConfig.packages);
|
|
27
32
|
const workspaceInfo = (0, getWorkspacePackageInfo_1.getWorkspacePackageInfo)(packagePaths);
|
|
28
33
|
return workspaceInfo;
|
|
29
34
|
}
|
|
30
|
-
catch {
|
|
35
|
+
catch (err) {
|
|
36
|
+
(0, logging_1.logVerboseWarning)(`Error getting lerna workspaces for ${cwd}`, err);
|
|
31
37
|
return [];
|
|
32
38
|
}
|
|
33
39
|
}
|
|
34
40
|
exports.getLernaWorkspaces = getLernaWorkspaces;
|
|
41
|
+
exports.getWorkspaces = getLernaWorkspaces;
|
|
35
42
|
//# sourceMappingURL=lerna.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lerna.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/lerna.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,8CAAsB;AACtB,gDAAwB;AACxB,2DAAwD;
|
|
1
|
+
{"version":3,"file":"lerna.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/lerna.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,8CAAsB;AACtB,gDAAwB;AACxB,2DAAwD;AAExD,wEAAqE;AACrE,2CAAkD;AAClD,6EAA0E;AAE1E,SAAS,qBAAqB,CAAC,GAAW;;IACxC,MAAM,IAAI,GAAG,MAAA,IAAA,uDAA0B,EAAC,GAAG,EAAE,SAAS,EAAE,OAAO,CAAC,0CAAE,IAAI,CAAC;IACvE,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,2CAA2C,GAAG,GAAG,CAAC,CAAC;KACpE;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,GAAW;IAC5C,IAAI;QACF,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC;QACtD,MAAM,aAAa,GAAG,cAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAC;QAElE,MAAM,WAAW,GAAG,aAAG,CAAC,KAAK,CAAC,YAAE,CAAC,YAAY,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;QAEvE,MAAM,YAAY,GAAG,IAAA,iCAAe,EAAC,kBAAkB,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC/E,MAAM,aAAa,GAAG,IAAA,iDAAuB,EAAC,YAAY,CAAC,CAAC;QAC5D,OAAO,aAAa,CAAC;KACtB;IAAC,OAAO,GAAG,EAAE;QACZ,IAAA,2BAAiB,EAAC,sCAAsC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC;QACpE,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AAdD,gDAcC;AAE8B,2CAAa"}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { WorkspaceInfo } from "../../types/WorkspaceInfo";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Get an array with names, paths, and package.json contents for each package in an npm workspace.
|
|
4
|
+
* (See `../getWorkspaces` for why it's named this way.)
|
|
5
|
+
*/
|
|
3
6
|
export declare function getNpmWorkspaces(cwd: string): WorkspaceInfo;
|
|
7
|
+
/**
|
|
8
|
+
* Get an array with names, paths, and package.json contents for each package in an npm workspace.
|
|
9
|
+
* (See `../getWorkspaces` for why it's named this way.)
|
|
10
|
+
*/
|
|
4
11
|
export declare function getNpmWorkspacesAsync(cwd: string): Promise<WorkspaceInfo>;
|
|
12
|
+
export { getNpmWorkspaces as getWorkspaces };
|
|
13
|
+
export { getNpmWorkspacesAsync as getWorkspacesAsync };
|
|
@@ -1,23 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getWorkspacesAsync = exports.getWorkspaces = exports.getNpmWorkspacesAsync = exports.getNpmWorkspaces = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
4
5
|
const packageJsonWorkspaces_1 = require("./packageJsonWorkspaces");
|
|
5
6
|
function getNpmWorkspaceRoot(cwd) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
var _a;
|
|
8
|
+
const root = (_a = (0, _1.getWorkspaceManagerAndRoot)(cwd, undefined, "npm")) === null || _a === void 0 ? void 0 : _a.root;
|
|
9
|
+
if (!root) {
|
|
10
|
+
throw new Error("Could not find npm workspace root from " + cwd);
|
|
9
11
|
}
|
|
10
|
-
return
|
|
12
|
+
return root;
|
|
11
13
|
}
|
|
12
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Get an array with names, paths, and package.json contents for each package in an npm workspace.
|
|
16
|
+
* (See `../getWorkspaces` for why it's named this way.)
|
|
17
|
+
*/
|
|
13
18
|
function getNpmWorkspaces(cwd) {
|
|
14
19
|
const npmWorkspacesRoot = getNpmWorkspaceRoot(cwd);
|
|
15
20
|
return (0, packageJsonWorkspaces_1.getWorkspaceInfoFromWorkspaceRoot)(npmWorkspacesRoot);
|
|
16
21
|
}
|
|
17
22
|
exports.getNpmWorkspaces = getNpmWorkspaces;
|
|
18
|
-
|
|
23
|
+
exports.getWorkspaces = getNpmWorkspaces;
|
|
24
|
+
/**
|
|
25
|
+
* Get an array with names, paths, and package.json contents for each package in an npm workspace.
|
|
26
|
+
* (See `../getWorkspaces` for why it's named this way.)
|
|
27
|
+
*/
|
|
28
|
+
function getNpmWorkspacesAsync(cwd) {
|
|
19
29
|
const npmWorkspacesRoot = getNpmWorkspaceRoot(cwd);
|
|
20
|
-
return
|
|
30
|
+
return (0, packageJsonWorkspaces_1.getWorkspaceInfoFromWorkspaceRootAsync)(npmWorkspacesRoot);
|
|
21
31
|
}
|
|
22
32
|
exports.getNpmWorkspacesAsync = getNpmWorkspacesAsync;
|
|
33
|
+
exports.getWorkspacesAsync = getNpmWorkspacesAsync;
|
|
23
34
|
//# sourceMappingURL=npm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"npm.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/npm.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"npm.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/npm.ts"],"names":[],"mappings":";;;AAAA,wBAA+C;AAE/C,mEAAoH;AAEpH,SAAS,mBAAmB,CAAC,GAAW;;IACtC,MAAM,IAAI,GAAG,MAAA,IAAA,6BAA0B,EAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,0CAAE,IAAI,CAAC;IACrE,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,yCAAyC,GAAG,GAAG,CAAC,CAAC;KAClE;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,GAAW;IAC1C,MAAM,iBAAiB,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACnD,OAAO,IAAA,yDAAiC,EAAC,iBAAiB,CAAC,CAAC;AAC9D,CAAC;AAHD,4CAGC;AAW4B,yCAAa;AAT1C;;;GAGG;AACH,SAAgB,qBAAqB,CAAC,GAAW;IAC/C,MAAM,iBAAiB,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACnD,OAAO,IAAA,8DAAsC,EAAC,iBAAiB,CAAC,CAAC;AACnE,CAAC;AAHD,sDAGC;AAGiC,mDAAkB"}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Get an array with names, paths, and package.json contents for each package in an npm/yarn workspace.
|
|
3
|
+
* (See `../getWorkspaces` for why it's named this way.)
|
|
4
|
+
*/
|
|
2
5
|
export declare function getWorkspaceInfoFromWorkspaceRoot(packageJsonWorkspacesRoot: string): import("../..").WorkspaceInfo;
|
|
6
|
+
/**
|
|
7
|
+
* Get an array with names, paths, and package.json contents for each package in an npm/yarn workspace.
|
|
8
|
+
* (See `../getWorkspaces` for why it's named this way.)
|
|
9
|
+
*/
|
|
3
10
|
export declare function getWorkspaceInfoFromWorkspaceRootAsync(packageJsonWorkspacesRoot: string): Promise<import("../..").WorkspaceInfo>;
|
|
@@ -3,59 +3,61 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getWorkspaceInfoFromWorkspaceRootAsync = exports.getWorkspaceInfoFromWorkspaceRoot =
|
|
6
|
+
exports.getWorkspaceInfoFromWorkspaceRootAsync = exports.getWorkspaceInfoFromWorkspaceRoot = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const _1 = require(".");
|
|
10
9
|
const getPackagePaths_1 = require("../../getPackagePaths");
|
|
11
10
|
const getWorkspacePackageInfo_1 = require("../getWorkspacePackageInfo");
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
exports.getPackageJsonWorkspaceRoot = getPackageJsonWorkspaceRoot;
|
|
19
|
-
function getRootPackageJson(packageJsonWorkspacesRoot) {
|
|
11
|
+
const logging_1 = require("../../logging");
|
|
12
|
+
/**
|
|
13
|
+
* Read the workspace root package.json and get the list of package globs from its `workspaces` property.
|
|
14
|
+
*/
|
|
15
|
+
function getPackages(packageJsonWorkspacesRoot) {
|
|
20
16
|
const packageJsonFile = path_1.default.join(packageJsonWorkspacesRoot, "package.json");
|
|
17
|
+
let packageJson;
|
|
21
18
|
try {
|
|
22
|
-
|
|
23
|
-
return packageJson;
|
|
19
|
+
packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonFile, "utf-8"));
|
|
24
20
|
}
|
|
25
21
|
catch (e) {
|
|
26
22
|
throw new Error("Could not load package.json from workspaces root");
|
|
27
23
|
}
|
|
28
|
-
}
|
|
29
|
-
function getPackages(packageJson) {
|
|
30
24
|
const { workspaces } = packageJson;
|
|
31
|
-
if (
|
|
25
|
+
if (Array.isArray(workspaces)) {
|
|
32
26
|
return workspaces;
|
|
33
27
|
}
|
|
34
|
-
if (!workspaces ||
|
|
28
|
+
if (!(workspaces === null || workspaces === void 0 ? void 0 : workspaces.packages)) {
|
|
35
29
|
throw new Error("Could not find a workspaces object in package.json");
|
|
36
30
|
}
|
|
37
31
|
return workspaces.packages;
|
|
38
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Get an array with names, paths, and package.json contents for each package in an npm/yarn workspace.
|
|
35
|
+
* (See `../getWorkspaces` for why it's named this way.)
|
|
36
|
+
*/
|
|
39
37
|
function getWorkspaceInfoFromWorkspaceRoot(packageJsonWorkspacesRoot) {
|
|
40
38
|
try {
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const packagePaths = (0, getPackagePaths_1.getPackagePaths)(packageJsonWorkspacesRoot, packages);
|
|
39
|
+
const packageGlobs = getPackages(packageJsonWorkspacesRoot);
|
|
40
|
+
const packagePaths = (0, getPackagePaths_1.getPackagePaths)(packageJsonWorkspacesRoot, packageGlobs);
|
|
44
41
|
return (0, getWorkspacePackageInfo_1.getWorkspacePackageInfo)(packagePaths);
|
|
45
42
|
}
|
|
46
|
-
catch {
|
|
43
|
+
catch (err) {
|
|
44
|
+
(0, logging_1.logVerboseWarning)(`Error getting workspace info for ${packageJsonWorkspacesRoot}`, err);
|
|
47
45
|
return [];
|
|
48
46
|
}
|
|
49
47
|
}
|
|
50
48
|
exports.getWorkspaceInfoFromWorkspaceRoot = getWorkspaceInfoFromWorkspaceRoot;
|
|
49
|
+
/**
|
|
50
|
+
* Get an array with names, paths, and package.json contents for each package in an npm/yarn workspace.
|
|
51
|
+
* (See `../getWorkspaces` for why it's named this way.)
|
|
52
|
+
*/
|
|
51
53
|
async function getWorkspaceInfoFromWorkspaceRootAsync(packageJsonWorkspacesRoot) {
|
|
52
54
|
try {
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
const packagePaths = await (0, getPackagePaths_1.getPackagePathsAsync)(packageJsonWorkspacesRoot, packages);
|
|
55
|
+
const packageGlobs = getPackages(packageJsonWorkspacesRoot);
|
|
56
|
+
const packagePaths = await (0, getPackagePaths_1.getPackagePathsAsync)(packageJsonWorkspacesRoot, packageGlobs);
|
|
56
57
|
return (0, getWorkspacePackageInfo_1.getWorkspacePackageInfoAsync)(packagePaths);
|
|
57
58
|
}
|
|
58
|
-
catch {
|
|
59
|
+
catch (err) {
|
|
60
|
+
(0, logging_1.logVerboseWarning)(`Error getting workspace info for ${packageJsonWorkspacesRoot}`, err);
|
|
59
61
|
return [];
|
|
60
62
|
}
|
|
61
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageJsonWorkspaces.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/packageJsonWorkspaces.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"packageJsonWorkspaces.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/packageJsonWorkspaces.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,2DAA8E;AAC9E,wEAAmG;AACnG,2CAAkD;AAWlD;;GAEG;AACH,SAAS,WAAW,CAAC,yBAAiC;IACpD,MAAM,eAAe,GAAG,cAAI,CAAC,IAAI,CAAC,yBAAyB,EAAE,cAAc,CAAC,CAAC;IAE7E,IAAI,WAAsC,CAAC;IAC3C,IAAI;QACF,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAE,CAAC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAA8B,CAAC;KAClG;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;KACrE;IAED,MAAM,EAAE,UAAU,EAAE,GAAG,WAAW,CAAC;IAEnC,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;QAC7B,OAAO,UAAU,CAAC;KACnB;IAED,IAAI,CAAC,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,QAAQ,CAAA,EAAE;QACzB,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;KACvE;IAED,OAAO,UAAU,CAAC,QAAQ,CAAC;AAC7B,CAAC;AAED;;;GAGG;AACH,SAAgB,iCAAiC,CAAC,yBAAiC;IACjF,IAAI;QACF,MAAM,YAAY,GAAG,WAAW,CAAC,yBAAyB,CAAC,CAAC;QAC5D,MAAM,YAAY,GAAG,IAAA,iCAAe,EAAC,yBAAyB,EAAE,YAAY,CAAC,CAAC;QAC9E,OAAO,IAAA,iDAAuB,EAAC,YAAY,CAAC,CAAC;KAC9C;IAAC,OAAO,GAAG,EAAE;QACZ,IAAA,2BAAiB,EAAC,oCAAoC,yBAAyB,EAAE,EAAE,GAAG,CAAC,CAAC;QACxF,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AATD,8EASC;AAED;;;GAGG;AACI,KAAK,UAAU,sCAAsC,CAAC,yBAAiC;IAC5F,IAAI;QACF,MAAM,YAAY,GAAG,WAAW,CAAC,yBAAyB,CAAC,CAAC;QAC5D,MAAM,YAAY,GAAG,MAAM,IAAA,sCAAoB,EAAC,yBAAyB,EAAE,YAAY,CAAC,CAAC;QACzF,OAAO,IAAA,sDAA4B,EAAC,YAAY,CAAC,CAAC;KACnD;IAAC,OAAO,GAAG,EAAE;QACZ,IAAA,2BAAiB,EAAC,oCAAoC,yBAAyB,EAAE,EAAE,GAAG,CAAC,CAAC;QACxF,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AATD,wFASC"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { WorkspaceInfo } from "../../types/WorkspaceInfo";
|
|
2
|
+
/** @deprecated Use `getWorkspaceRoot` */
|
|
2
3
|
export declare function getPnpmWorkspaceRoot(cwd: string): string;
|
|
4
|
+
/**
|
|
5
|
+
* Get an array with names, paths, and package.json contents for each package in a pnpm workspace.
|
|
6
|
+
* (See `../getWorkspaces` for why it's named this way.)
|
|
7
|
+
*/
|
|
3
8
|
export declare function getPnpmWorkspaces(cwd: string): WorkspaceInfo;
|
|
9
|
+
export { getPnpmWorkspaces as getWorkspaces };
|
|
@@ -3,20 +3,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getPnpmWorkspaces = exports.getPnpmWorkspaceRoot = void 0;
|
|
6
|
+
exports.getWorkspaces = exports.getPnpmWorkspaces = exports.getPnpmWorkspaceRoot = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const getPackagePaths_1 = require("../../getPackagePaths");
|
|
9
9
|
const getWorkspacePackageInfo_1 = require("../getWorkspacePackageInfo");
|
|
10
10
|
const readYaml_1 = require("../../lockfile/readYaml");
|
|
11
|
-
const
|
|
11
|
+
const logging_1 = require("../../logging");
|
|
12
|
+
const getWorkspaceManagerAndRoot_1 = require("./getWorkspaceManagerAndRoot");
|
|
13
|
+
/** @deprecated Use `getWorkspaceRoot` */
|
|
12
14
|
function getPnpmWorkspaceRoot(cwd) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
var _a;
|
|
16
|
+
const root = (_a = (0, getWorkspaceManagerAndRoot_1.getWorkspaceManagerAndRoot)(cwd, undefined, "pnpm")) === null || _a === void 0 ? void 0 : _a.root;
|
|
17
|
+
if (!root) {
|
|
18
|
+
throw new Error("Could not find pnpm workspace root from " + cwd);
|
|
16
19
|
}
|
|
17
|
-
return
|
|
20
|
+
return root;
|
|
18
21
|
}
|
|
19
22
|
exports.getPnpmWorkspaceRoot = getPnpmWorkspaceRoot;
|
|
23
|
+
/**
|
|
24
|
+
* Get an array with names, paths, and package.json contents for each package in a pnpm workspace.
|
|
25
|
+
* (See `../getWorkspaces` for why it's named this way.)
|
|
26
|
+
*/
|
|
20
27
|
function getPnpmWorkspaces(cwd) {
|
|
21
28
|
try {
|
|
22
29
|
const pnpmWorkspacesRoot = getPnpmWorkspaceRoot(cwd);
|
|
@@ -26,9 +33,11 @@ function getPnpmWorkspaces(cwd) {
|
|
|
26
33
|
const workspaceInfo = (0, getWorkspacePackageInfo_1.getWorkspacePackageInfo)(packagePaths);
|
|
27
34
|
return workspaceInfo;
|
|
28
35
|
}
|
|
29
|
-
catch {
|
|
36
|
+
catch (err) {
|
|
37
|
+
(0, logging_1.logVerboseWarning)(`Error getting pnpm workspaces for ${cwd}`, err);
|
|
30
38
|
return [];
|
|
31
39
|
}
|
|
32
40
|
}
|
|
33
41
|
exports.getPnpmWorkspaces = getPnpmWorkspaces;
|
|
42
|
+
exports.getWorkspaces = getPnpmWorkspaces;
|
|
34
43
|
//# sourceMappingURL=pnpm.js.map
|