workspace-tools 0.38.4 → 0.38.5
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/lib/getPackageInfos.d.ts +14 -0
- package/lib/getPackageInfos.js +17 -20
- package/lib/getPackageInfos.js.map +1 -1
- package/lib/getPackagePaths.d.ts +2 -2
- package/lib/getPackagePaths.js +2 -2
- package/lib/git/gitUtilities.d.ts +132 -3
- package/lib/git/gitUtilities.js +141 -4
- package/lib/git/gitUtilities.js.map +1 -1
- package/lib/graph/createDependencyMap.d.ts +1 -1
- package/lib/graph/createDependencyMap.js.map +1 -1
- package/lib/graph/getPackageDependencies.d.ts +10 -1
- package/lib/graph/getPackageDependencies.js +17 -5
- package/lib/graph/getPackageDependencies.js.map +1 -1
- package/lib/index.d.ts +17 -14
- package/lib/index.js +40 -15
- package/lib/index.js.map +1 -1
- package/lib/lockfile/parseBerryLock.d.ts +3 -0
- package/lib/lockfile/parseBerryLock.js +3 -0
- package/lib/lockfile/parseBerryLock.js.map +1 -1
- package/lib/lockfile/types.d.ts +3 -0
- package/lib/paths.d.ts +3 -0
- package/lib/paths.js +4 -1
- package/lib/paths.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/lib/types/Catalogs.d.ts +30 -0
- package/lib/types/Catalogs.js +3 -0
- package/lib/types/Catalogs.js.map +1 -0
- package/lib/types/PackageInfo.d.ts +19 -1
- package/lib/types/WorkspaceInfo.d.ts +15 -6
- package/lib/workspaces/catalogs.d.ts +28 -0
- package/lib/workspaces/catalogs.js +57 -0
- package/lib/workspaces/catalogs.js.map +1 -0
- package/lib/workspaces/findWorkspacePath.d.ts +5 -5
- package/lib/workspaces/findWorkspacePath.js +3 -3
- package/lib/workspaces/findWorkspacePath.js.map +1 -1
- package/lib/workspaces/getWorkspacePackageInfo.d.ts +12 -9
- package/lib/workspaces/getWorkspacePackageInfo.js +14 -16
- package/lib/workspaces/getWorkspacePackageInfo.js.map +1 -1
- package/lib/workspaces/getWorkspaceRoot.d.ts +18 -2
- package/lib/workspaces/getWorkspaceRoot.js +23 -4
- package/lib/workspaces/getWorkspaceRoot.js.map +1 -1
- package/lib/workspaces/getWorkspaces.d.ts +11 -14
- package/lib/workspaces/getWorkspaces.js +8 -11
- package/lib/workspaces/getWorkspaces.js.map +1 -1
- package/lib/workspaces/implementations/getWorkspaceUtilities.d.ts +16 -9
- package/lib/workspaces/implementations/getWorkspaceUtilities.js.map +1 -1
- package/lib/workspaces/implementations/index.d.ts +2 -2
- package/lib/workspaces/implementations/index.js.map +1 -1
- package/lib/workspaces/implementations/lerna.d.ts +8 -8
- package/lib/workspaces/implementations/lerna.js +5 -5
- package/lib/workspaces/implementations/lerna.js.map +1 -1
- package/lib/workspaces/implementations/npm.d.ts +9 -9
- package/lib/workspaces/implementations/npm.js +6 -6
- package/lib/workspaces/implementations/npm.js.map +1 -1
- package/lib/workspaces/implementations/packageJsonWorkspaces.d.ts +21 -10
- package/lib/workspaces/implementations/packageJsonWorkspaces.js +34 -23
- package/lib/workspaces/implementations/packageJsonWorkspaces.js.map +1 -1
- package/lib/workspaces/implementations/pnpm.d.ts +17 -9
- package/lib/workspaces/implementations/pnpm.js +37 -11
- package/lib/workspaces/implementations/pnpm.js.map +1 -1
- package/lib/workspaces/implementations/rush.d.ts +8 -8
- package/lib/workspaces/implementations/rush.js +5 -5
- package/lib/workspaces/implementations/rush.js.map +1 -1
- package/lib/workspaces/implementations/yarn.d.ts +18 -10
- package/lib/workspaces/implementations/yarn.js +51 -10
- package/lib/workspaces/implementations/yarn.js.map +1 -1
- package/lib/workspaces/listOfWorkspacePackageNames.d.ts +5 -2
- package/lib/workspaces/listOfWorkspacePackageNames.js +3 -0
- package/lib/workspaces/listOfWorkspacePackageNames.js.map +1 -1
- package/lib/workspaces/readPackageInfo.d.ts +13 -0
- package/lib/workspaces/readPackageInfo.js +52 -0
- package/lib/workspaces/readPackageInfo.js.map +1 -0
- package/package.json +2 -3
|
@@ -5,17 +5,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getWorkspacePackageInfoAsync = exports.getWorkspacePackageInfo = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const fs_1 = __importDefault(require("fs"));
|
|
9
8
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
10
9
|
const logging_1 = require("../logging");
|
|
11
10
|
const infoFromPackageJson_1 = require("../infoFromPackageJson");
|
|
11
|
+
const readPackageInfo_1 = require("./readPackageInfo");
|
|
12
12
|
/**
|
|
13
13
|
* Get an array with names, paths, and package.json contents for each of the given package paths
|
|
14
|
-
* within a
|
|
14
|
+
* ("workspace" paths in npm/yarn/pnpm terms) within a monorepo.
|
|
15
15
|
*
|
|
16
16
|
* This is an internal helper used by `getWorkspaces` implementations for different managers.
|
|
17
|
-
*
|
|
18
|
-
* @param packagePaths Paths to packages within a
|
|
17
|
+
*
|
|
18
|
+
* @param packagePaths Paths to packages within a monorepo
|
|
19
19
|
* @returns Array of workspace package infos
|
|
20
20
|
* @internal
|
|
21
21
|
*/
|
|
@@ -25,19 +25,14 @@ function getWorkspacePackageInfo(packagePaths) {
|
|
|
25
25
|
}
|
|
26
26
|
return packagePaths
|
|
27
27
|
.map((workspacePath) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonPath, "utf-8"));
|
|
32
|
-
}
|
|
33
|
-
catch (err) {
|
|
34
|
-
(0, logging_1.logVerboseWarning)(`Error reading or parsing ${packageJsonPath} while getting workspace package info`, err);
|
|
35
|
-
return null;
|
|
28
|
+
const packageJson = (0, readPackageInfo_1.readPackageInfo)(workspacePath);
|
|
29
|
+
if (!packageJson) {
|
|
30
|
+
return null; // readPackageInfo already logged a warning
|
|
36
31
|
}
|
|
37
32
|
return {
|
|
38
33
|
name: packageJson.name,
|
|
39
34
|
path: workspacePath,
|
|
40
|
-
packageJson
|
|
35
|
+
packageJson,
|
|
41
36
|
};
|
|
42
37
|
})
|
|
43
38
|
.filter(Boolean);
|
|
@@ -45,11 +40,14 @@ function getWorkspacePackageInfo(packagePaths) {
|
|
|
45
40
|
exports.getWorkspacePackageInfo = getWorkspacePackageInfo;
|
|
46
41
|
/**
|
|
47
42
|
* Get an array with names, paths, and package.json contents for each of the given package paths
|
|
48
|
-
* within a
|
|
43
|
+
* ("workspace" paths in npm/yarn/pnpm terms) within a monorepo.
|
|
44
|
+
*
|
|
45
|
+
* NOTE: As of writing, this will start promises to read all package.json files in parallel,
|
|
46
|
+
* without direct concurrency control.
|
|
49
47
|
*
|
|
50
48
|
* This is an internal helper used by `getWorkspaces` implementations for different managers.
|
|
51
|
-
*
|
|
52
|
-
* @param packagePaths Paths to packages within a
|
|
49
|
+
*
|
|
50
|
+
* @param packagePaths Paths to packages within a monorepo
|
|
53
51
|
* @returns Array of workspace package infos
|
|
54
52
|
* @internal
|
|
55
53
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getWorkspacePackageInfo.js","sourceRoot":"","sources":["../../src/workspaces/getWorkspacePackageInfo.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"getWorkspacePackageInfo.js","sourceRoot":"","sources":["../../src/workspaces/getWorkspacePackageInfo.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,2DAAqC;AAGrC,wCAA+C;AAC/C,gEAA6D;AAC7D,uDAAoD;AAEpD;;;;;;;;;GASG;AACH,SAAgB,uBAAuB,CAAC,YAAsB;IAC5D,IAAI,CAAC,YAAY,EAAE;QACjB,OAAO,EAAE,CAAC;KACX;IAED,OAAO,YAAY;SAChB,GAAG,CAA8B,CAAC,aAAa,EAAE,EAAE;QAClD,MAAM,WAAW,GAAG,IAAA,iCAAe,EAAC,aAAa,CAAC,CAAC;QACnD,IAAI,CAAC,WAAW,EAAE;YAChB,OAAO,IAAI,CAAC,CAAC,2CAA2C;SACzD;QAED,OAAO;YACL,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,IAAI,EAAE,aAAa;YACnB,WAAW;SACZ,CAAC;IACJ,CAAC,CAAC;SACD,MAAM,CAAC,OAAO,CAAmB,CAAC;AACvC,CAAC;AAnBD,0DAmBC;AAED;;;;;;;;;;;;GAYG;AACI,KAAK,UAAU,4BAA4B,CAAC,YAAsB;IACvE,IAAI,CAAC,YAAY,EAAE;QACjB,OAAO,EAAE,CAAC;KACX;IAED,MAAM,oBAAoB,GAAG,YAAY,CAAC,GAAG,CAAuC,KAAK,EAAE,aAAa,EAAE,EAAE;QAC1G,MAAM,eAAe,GAAG,cAAI,CAAC,IAAI,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;QAEjE,IAAI;YACF,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,kBAAU,CAAC,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC,CAAgB,CAAC;YACnG,OAAO;gBACL,IAAI,EAAE,WAAW,CAAC,IAAI;gBACtB,IAAI,EAAE,aAAa;gBACnB,WAAW,EAAE,IAAA,yCAAmB,EAAC,WAAW,EAAE,eAAe,CAAC;aAC/D,CAAC;SACH;QAAC,OAAO,GAAG,EAAE;YACZ,IAAA,2BAAiB,EAAC,4BAA4B,eAAe,uCAAuC,EAAE,GAAG,CAAC,CAAC;YAC3G,OAAO,IAAI,CAAC;SACb;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAmB,CAAC;AACrF,CAAC;AAtBD,oEAsBC"}
|
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
import { WorkspaceManager } from "./WorkspaceManager";
|
|
2
2
|
/**
|
|
3
|
-
* Get the root directory of a
|
|
4
|
-
*
|
|
3
|
+
* Get the root directory of a monorepo, defined as the directory where the workspace manager
|
|
4
|
+
* config file is located.
|
|
5
|
+
*
|
|
6
|
+
* NOTE: "Workspace" here refers to the entire project, not an individual package the way it does
|
|
7
|
+
* in e.g. npm/yarn/pnpm "workspaces."
|
|
8
|
+
*
|
|
5
9
|
* @param cwd Start searching from here
|
|
6
10
|
* @param preferredManager Search for only this manager's config file
|
|
11
|
+
*
|
|
12
|
+
* @deprecated Renamed to `getWorkspaceManagerRoot` to align "workspace" terminology with npm/yarn/pnpm.
|
|
13
|
+
* In most cases, you should use `findProjectRoot` instead since it falls back to the git root if no
|
|
14
|
+
* workspace manager is found (single-package projects).
|
|
7
15
|
*/
|
|
8
16
|
export declare function getWorkspaceRoot(cwd: string, preferredManager?: WorkspaceManager): string | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Get the root directory of a monorepo, defined as the directory where the workspace manager
|
|
19
|
+
* config file is located.
|
|
20
|
+
*
|
|
21
|
+
* @param cwd Start searching from here
|
|
22
|
+
* @param preferredManager Search for only this manager's config file
|
|
23
|
+
*/
|
|
24
|
+
export declare function getWorkspaceManagerRoot(cwd: string, preferredManager?: WorkspaceManager): string | undefined;
|
|
@@ -1,15 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getWorkspaceRoot = void 0;
|
|
3
|
+
exports.getWorkspaceManagerRoot = exports.getWorkspaceRoot = void 0;
|
|
4
4
|
const implementations_1 = require("./implementations");
|
|
5
5
|
/**
|
|
6
|
-
* Get the root directory of a
|
|
7
|
-
*
|
|
6
|
+
* Get the root directory of a monorepo, defined as the directory where the workspace manager
|
|
7
|
+
* config file is located.
|
|
8
|
+
*
|
|
9
|
+
* NOTE: "Workspace" here refers to the entire project, not an individual package the way it does
|
|
10
|
+
* in e.g. npm/yarn/pnpm "workspaces."
|
|
11
|
+
*
|
|
8
12
|
* @param cwd Start searching from here
|
|
9
13
|
* @param preferredManager Search for only this manager's config file
|
|
14
|
+
*
|
|
15
|
+
* @deprecated Renamed to `getWorkspaceManagerRoot` to align "workspace" terminology with npm/yarn/pnpm.
|
|
16
|
+
* In most cases, you should use `findProjectRoot` instead since it falls back to the git root if no
|
|
17
|
+
* workspace manager is found (single-package projects).
|
|
10
18
|
*/
|
|
11
19
|
function getWorkspaceRoot(cwd, preferredManager) {
|
|
12
|
-
return (
|
|
20
|
+
return getWorkspaceManagerRoot(cwd, preferredManager);
|
|
13
21
|
}
|
|
14
22
|
exports.getWorkspaceRoot = getWorkspaceRoot;
|
|
23
|
+
/**
|
|
24
|
+
* Get the root directory of a monorepo, defined as the directory where the workspace manager
|
|
25
|
+
* config file is located.
|
|
26
|
+
*
|
|
27
|
+
* @param cwd Start searching from here
|
|
28
|
+
* @param preferredManager Search for only this manager's config file
|
|
29
|
+
*/
|
|
30
|
+
function getWorkspaceManagerRoot(cwd, preferredManager) {
|
|
31
|
+
return (0, implementations_1.getWorkspaceManagerAndRoot)(cwd, undefined, preferredManager)?.root;
|
|
32
|
+
}
|
|
33
|
+
exports.getWorkspaceManagerRoot = getWorkspaceManagerRoot;
|
|
15
34
|
//# sourceMappingURL=getWorkspaceRoot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getWorkspaceRoot.js","sourceRoot":"","sources":["../../src/workspaces/getWorkspaceRoot.ts"],"names":[],"mappings":";;;AACA,uDAA+D;AAE/D
|
|
1
|
+
{"version":3,"file":"getWorkspaceRoot.js","sourceRoot":"","sources":["../../src/workspaces/getWorkspaceRoot.ts"],"names":[],"mappings":";;;AACA,uDAA+D;AAE/D;;;;;;;;;;;;;GAaG;AACH,SAAgB,gBAAgB,CAAC,GAAW,EAAE,gBAAmC;IAC/E,OAAO,uBAAuB,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;AACxD,CAAC;AAFD,4CAEC;AAED;;;;;;GAMG;AACH,SAAgB,uBAAuB,CAAC,GAAW,EAAE,gBAAmC;IACtF,OAAO,IAAA,4CAA0B,EAAC,GAAG,EAAE,SAAS,EAAE,gBAAgB,CAAC,EAAE,IAAI,CAAC;AAC5E,CAAC;AAFD,0DAEC"}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { WorkspaceInfos } from "../types/WorkspaceInfo";
|
|
2
2
|
/**
|
|
3
|
-
* Get an array with names, paths, and package.json contents for each package in
|
|
4
|
-
* The list of included packages is based on the workspace
|
|
5
|
-
*
|
|
6
|
-
* The method name is somewhat misleading due to the double meaning of "workspace", but it's retained
|
|
7
|
-
* for compatibility. "Workspace" here refers to an individual package, in the sense of the `workspaces`
|
|
8
|
-
* package.json config used by npm/yarn (instead of referring to the entire monorepo).
|
|
3
|
+
* Get an array with names, paths, and package.json contents for each package ("workspace" in
|
|
4
|
+
* npm/yarn/pnpm terms) within a monorepo. The list of included packages is based on the workspace
|
|
5
|
+
* manager's config file.
|
|
9
6
|
*/
|
|
10
|
-
export declare function getWorkspaces(cwd: string):
|
|
7
|
+
export declare function getWorkspaces(cwd: string): WorkspaceInfos;
|
|
11
8
|
/**
|
|
12
|
-
* Get an array with names, paths, and package.json contents for each package in
|
|
13
|
-
* The list of included packages is based on the workspace
|
|
9
|
+
* Get an array with names, paths, and package.json contents for each package ("workspace" in
|
|
10
|
+
* npm/yarn/pnpm terms) within a monorepo. The list of included packages is based on the workspace
|
|
11
|
+
* manager's config file.
|
|
14
12
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* package.json config used by npm/yarn (instead of referring to the entire monorepo).
|
|
13
|
+
* NOTE: As of writing, this will start promises to read all package.json files in parallel,
|
|
14
|
+
* without direct concurrency control.
|
|
18
15
|
*/
|
|
19
|
-
export declare function getWorkspacesAsync(cwd: string): Promise<
|
|
16
|
+
export declare function getWorkspacesAsync(cwd: string): Promise<WorkspaceInfos>;
|
|
@@ -3,12 +3,9 @@ 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
|
|
7
|
-
* The list of included packages is based on the workspace
|
|
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).
|
|
6
|
+
* Get an array with names, paths, and package.json contents for each package ("workspace" in
|
|
7
|
+
* npm/yarn/pnpm terms) within a monorepo. The list of included packages is based on the workspace
|
|
8
|
+
* manager's config file.
|
|
12
9
|
*/
|
|
13
10
|
function getWorkspaces(cwd) {
|
|
14
11
|
const utils = (0, implementations_1.getWorkspaceUtilities)(cwd);
|
|
@@ -16,12 +13,12 @@ function getWorkspaces(cwd) {
|
|
|
16
13
|
}
|
|
17
14
|
exports.getWorkspaces = getWorkspaces;
|
|
18
15
|
/**
|
|
19
|
-
* Get an array with names, paths, and package.json contents for each package in
|
|
20
|
-
* The list of included packages is based on the workspace
|
|
16
|
+
* Get an array with names, paths, and package.json contents for each package ("workspace" in
|
|
17
|
+
* npm/yarn/pnpm terms) within a monorepo. The list of included packages is based on the workspace
|
|
18
|
+
* manager's config file.
|
|
21
19
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* package.json config used by npm/yarn (instead of referring to the entire monorepo).
|
|
20
|
+
* NOTE: As of writing, this will start promises to read all package.json files in parallel,
|
|
21
|
+
* without direct concurrency control.
|
|
25
22
|
*/
|
|
26
23
|
async function getWorkspacesAsync(cwd) {
|
|
27
24
|
const utils = (0, implementations_1.getWorkspaceUtilities)(cwd);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getWorkspaces.js","sourceRoot":"","sources":["../../src/workspaces/getWorkspaces.ts"],"names":[],"mappings":";;;AAAA,uDAAsF;AAGtF
|
|
1
|
+
{"version":3,"file":"getWorkspaces.js","sourceRoot":"","sources":["../../src/workspaces/getWorkspaces.ts"],"names":[],"mappings":";;;AAAA,uDAAsF;AAGtF;;;;GAIG;AACH,SAAgB,aAAa,CAAC,GAAW;IACvC,MAAM,KAAK,GAAG,IAAA,uCAAqB,EAAC,GAAG,CAAC,CAAC;IACzC,OAAO,KAAK,EAAE,aAAa,CAAC,GAAG,CAAC,IAAI,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,IAAA,4CAA0B,EAAC,GAAG,CAAC,EAAE,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"}
|
|
@@ -1,23 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Catalogs } from "../../types/Catalogs";
|
|
2
|
+
import type { WorkspaceInfos } from "../../types/WorkspaceInfo";
|
|
2
3
|
export interface WorkspaceUtilities {
|
|
3
4
|
/**
|
|
4
|
-
* Get an array of paths to packages in the
|
|
5
|
+
* Get an array of paths to packages ("workspaces") in the monorepo, based on the
|
|
6
|
+
* manager's config file.
|
|
5
7
|
*/
|
|
6
8
|
getWorkspacePackagePaths: (cwd: string) => string[];
|
|
7
9
|
/**
|
|
8
|
-
* Get an array of paths to packages in the
|
|
10
|
+
* Get an array of paths to packages ("workspaces") in the monorepo, based on the
|
|
11
|
+
* manager's config file.
|
|
9
12
|
*/
|
|
10
13
|
getWorkspacePackagePathsAsync?: (cwd: string) => Promise<string[]>;
|
|
11
14
|
/**
|
|
12
|
-
* Get an array with names, paths, and package.json contents for each package
|
|
13
|
-
*
|
|
15
|
+
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
16
|
+
* in a monorepo.
|
|
14
17
|
*/
|
|
15
|
-
getWorkspaces: (cwd: string) =>
|
|
18
|
+
getWorkspaces: (cwd: string) => WorkspaceInfos;
|
|
16
19
|
/**
|
|
17
|
-
* Get an array with names, paths, and package.json contents for each package
|
|
18
|
-
*
|
|
20
|
+
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
21
|
+
* in a monorepo.
|
|
19
22
|
*/
|
|
20
|
-
getWorkspacesAsync
|
|
23
|
+
getWorkspacesAsync: (cwd: string) => Promise<WorkspaceInfos>;
|
|
24
|
+
/**
|
|
25
|
+
* Get version catalogs, if supported by the manager (only pnpm and yarn v4 as of writing).
|
|
26
|
+
*/
|
|
27
|
+
getCatalogs?: (cwd: string) => Catalogs | undefined;
|
|
21
28
|
}
|
|
22
29
|
/**
|
|
23
30
|
* Get utility implementations for the workspace manager of `cwd`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getWorkspaceUtilities.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/getWorkspaceUtilities.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"getWorkspaceUtilities.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/getWorkspaceUtilities.ts"],"names":[],"mappings":";;;AAEA,6EAA0E;AAmC1E;;;GAGG;AACH,SAAgB,qBAAqB,CAAC,GAAW;IAC/C,MAAM,OAAO,GAAG,IAAA,uDAA0B,EAAC,GAAG,CAAC,EAAE,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,2 +1,2 @@
|
|
|
1
|
-
export { getWorkspaceManagerAndRoot, WorkspaceManagerAndRoot } from "./getWorkspaceManagerAndRoot";
|
|
2
|
-
export { getWorkspaceUtilities, WorkspaceUtilities } from "./getWorkspaceUtilities";
|
|
1
|
+
export { getWorkspaceManagerAndRoot, type WorkspaceManagerAndRoot } from "./getWorkspaceManagerAndRoot";
|
|
2
|
+
export { getWorkspaceUtilities, type WorkspaceUtilities } from "./getWorkspaceUtilities";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/index.ts"],"names":[],"mappings":";;;AAAA,2EAAwG;AAA/F,wIAAA,0BAA0B,OAAA;AACnC,iEAAyF;AAAhF,8HAAA,qBAAqB,OAAA"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/** Get
|
|
1
|
+
import type { WorkspaceInfos } from "../../types/WorkspaceInfo";
|
|
2
|
+
/** Get paths for each package ("workspace") in a lerna monorepo. */
|
|
3
3
|
export declare function getWorkspacePackagePaths(cwd: string): string[];
|
|
4
4
|
/**
|
|
5
|
-
* Get an array with names, paths, and package.json contents for each package
|
|
6
|
-
*
|
|
5
|
+
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
6
|
+
* in a lerna monorepo.
|
|
7
7
|
*/
|
|
8
|
-
export declare function getLernaWorkspaces(cwd: string):
|
|
8
|
+
export declare function getLernaWorkspaces(cwd: string): WorkspaceInfos;
|
|
9
9
|
/**
|
|
10
|
-
* Get an array with names, paths, and package.json contents for each package
|
|
11
|
-
*
|
|
10
|
+
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
11
|
+
* in a lerna monorepo.
|
|
12
12
|
*/
|
|
13
|
-
export declare function getLernaWorkspacesAsync(cwd: string): Promise<
|
|
13
|
+
export declare function getLernaWorkspacesAsync(cwd: string): Promise<WorkspaceInfos>;
|
|
14
14
|
export { getLernaWorkspaces as getWorkspaces };
|
|
15
15
|
export { getLernaWorkspacesAsync as getWorkspacesAsync };
|
|
@@ -18,7 +18,7 @@ function getLernaWorkspaceRoot(cwd) {
|
|
|
18
18
|
}
|
|
19
19
|
return root;
|
|
20
20
|
}
|
|
21
|
-
/** Get
|
|
21
|
+
/** Get paths for each package ("workspace") in a lerna monorepo. */
|
|
22
22
|
function getWorkspacePackagePaths(cwd) {
|
|
23
23
|
try {
|
|
24
24
|
const lernaWorkspaceRoot = getLernaWorkspaceRoot(cwd);
|
|
@@ -33,8 +33,8 @@ function getWorkspacePackagePaths(cwd) {
|
|
|
33
33
|
}
|
|
34
34
|
exports.getWorkspacePackagePaths = getWorkspacePackagePaths;
|
|
35
35
|
/**
|
|
36
|
-
* Get an array with names, paths, and package.json contents for each package
|
|
37
|
-
*
|
|
36
|
+
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
37
|
+
* in a lerna monorepo.
|
|
38
38
|
*/
|
|
39
39
|
function getLernaWorkspaces(cwd) {
|
|
40
40
|
try {
|
|
@@ -49,8 +49,8 @@ function getLernaWorkspaces(cwd) {
|
|
|
49
49
|
exports.getLernaWorkspaces = getLernaWorkspaces;
|
|
50
50
|
exports.getWorkspaces = getLernaWorkspaces;
|
|
51
51
|
/**
|
|
52
|
-
* Get an array with names, paths, and package.json contents for each package
|
|
53
|
-
*
|
|
52
|
+
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
53
|
+
* in a lerna monorepo.
|
|
54
54
|
*/
|
|
55
55
|
async function getLernaWorkspacesAsync(cwd) {
|
|
56
56
|
try {
|
|
@@ -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;AAExD,wEAAmG;AACnG,2CAAkD;AAClD,6EAA0E;AAE1E,SAAS,qBAAqB,CAAC,GAAW;IACxC,MAAM,IAAI,GAAG,IAAA,uDAA0B,EAAC,GAAG,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,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
|
|
1
|
+
{"version":3,"file":"lerna.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/lerna.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,8CAAsB;AACtB,gDAAwB;AACxB,2DAAwD;AAExD,wEAAmG;AACnG,2CAAkD;AAClD,6EAA0E;AAE1E,SAAS,qBAAqB,CAAC,GAAW;IACxC,MAAM,IAAI,GAAG,IAAA,uDAA0B,EAAC,GAAG,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,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,oEAAoE;AACpE,SAAgB,wBAAwB,CAAC,GAAW;IAClD,IAAI;QACF,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC;QACtD,MAAM,aAAa,GAAG,cAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAC;QAClE,MAAM,WAAW,GAAG,aAAG,CAAC,KAAK,CAAC,YAAE,CAAC,YAAY,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;QACvE,OAAO,IAAA,iCAAe,EAAC,kBAAkB,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;KAClE;IAAC,OAAO,GAAG,EAAE;QACZ,IAAA,2BAAiB,EAAC,mDAAmD,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC;QACjF,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AAVD,4DAUC;AAED;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,GAAW;IAC5C,IAAI;QACF,MAAM,YAAY,GAAG,wBAAwB,CAAC,GAAG,CAAC,CAAC;QACnD,OAAO,IAAA,iDAAuB,EAAC,YAAY,CAAC,CAAC;KAC9C;IAAC,OAAO,GAAG,EAAE;QACZ,IAAA,2BAAiB,EAAC,sCAAsC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC;QACpE,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AARD,gDAQC;AAgB8B,2CAAa;AAd5C;;;GAGG;AACI,KAAK,UAAU,uBAAuB,CAAC,GAAW;IACvD,IAAI;QACF,MAAM,YAAY,GAAG,wBAAwB,CAAC,GAAG,CAAC,CAAC;QACnD,OAAO,IAAA,sDAA4B,EAAC,YAAY,CAAC,CAAC;KACnD;IAAC,OAAO,GAAG,EAAE;QACZ,IAAA,2BAAiB,EAAC,sCAAsC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC;QACpE,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AARD,0DAQC;AAGmC,qDAAkB"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/** Get
|
|
1
|
+
import type { WorkspaceInfos } from "../../types/WorkspaceInfo";
|
|
2
|
+
/** Get paths for each package ("workspace") in an npm monorepo. */
|
|
3
3
|
export declare function getWorkspacePackagePaths(cwd: string): string[];
|
|
4
|
-
/** Get
|
|
4
|
+
/** Get paths for each package ("workspace") in an npm monorepo. */
|
|
5
5
|
export declare function getWorkspacePackagePathsAsync(cwd: string): Promise<string[]>;
|
|
6
6
|
/**
|
|
7
|
-
* Get an array with names, paths, and package.json contents for each package
|
|
8
|
-
*
|
|
7
|
+
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
8
|
+
* in an npm monorepo.
|
|
9
9
|
*/
|
|
10
|
-
export declare function getNpmWorkspaces(cwd: string):
|
|
10
|
+
export declare function getNpmWorkspaces(cwd: string): WorkspaceInfos;
|
|
11
11
|
/**
|
|
12
|
-
* Get an array with names, paths, and package.json contents for each package
|
|
13
|
-
*
|
|
12
|
+
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
13
|
+
* in an npm monorepo.
|
|
14
14
|
*/
|
|
15
|
-
export declare function getNpmWorkspacesAsync(cwd: string): Promise<
|
|
15
|
+
export declare function getNpmWorkspacesAsync(cwd: string): Promise<WorkspaceInfos>;
|
|
16
16
|
export { getNpmWorkspaces as getWorkspaces };
|
|
17
17
|
export { getNpmWorkspacesAsync as getWorkspacesAsync };
|
|
@@ -10,21 +10,21 @@ function getNpmWorkspaceRoot(cwd) {
|
|
|
10
10
|
}
|
|
11
11
|
return root;
|
|
12
12
|
}
|
|
13
|
-
/** Get
|
|
13
|
+
/** Get paths for each package ("workspace") in an npm monorepo. */
|
|
14
14
|
function getWorkspacePackagePaths(cwd) {
|
|
15
15
|
const npmWorkspacesRoot = getNpmWorkspaceRoot(cwd);
|
|
16
16
|
return (0, packageJsonWorkspaces_1.getPackagePathsFromWorkspaceRoot)(npmWorkspacesRoot);
|
|
17
17
|
}
|
|
18
18
|
exports.getWorkspacePackagePaths = getWorkspacePackagePaths;
|
|
19
|
-
/** Get
|
|
19
|
+
/** Get paths for each package ("workspace") in an npm monorepo. */
|
|
20
20
|
function getWorkspacePackagePathsAsync(cwd) {
|
|
21
21
|
const npmWorkspacesRoot = getNpmWorkspaceRoot(cwd);
|
|
22
22
|
return (0, packageJsonWorkspaces_1.getPackagePathsFromWorkspaceRootAsync)(npmWorkspacesRoot);
|
|
23
23
|
}
|
|
24
24
|
exports.getWorkspacePackagePathsAsync = getWorkspacePackagePathsAsync;
|
|
25
25
|
/**
|
|
26
|
-
* Get an array with names, paths, and package.json contents for each package
|
|
27
|
-
*
|
|
26
|
+
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
27
|
+
* in an npm monorepo.
|
|
28
28
|
*/
|
|
29
29
|
function getNpmWorkspaces(cwd) {
|
|
30
30
|
const npmWorkspacesRoot = getNpmWorkspaceRoot(cwd);
|
|
@@ -33,8 +33,8 @@ function getNpmWorkspaces(cwd) {
|
|
|
33
33
|
exports.getNpmWorkspaces = getNpmWorkspaces;
|
|
34
34
|
exports.getWorkspaces = getNpmWorkspaces;
|
|
35
35
|
/**
|
|
36
|
-
* Get an array with names, paths, and package.json contents for each package
|
|
37
|
-
*
|
|
36
|
+
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
37
|
+
* in an npm monorepo.
|
|
38
38
|
*/
|
|
39
39
|
function getNpmWorkspacesAsync(cwd) {
|
|
40
40
|
const npmWorkspacesRoot = getNpmWorkspaceRoot(cwd);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"npm.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/npm.ts"],"names":[],"mappings":";;;AAAA,wBAA+C;AAE/C,mEAKiC;AAEjC,SAAS,mBAAmB,CAAC,GAAW;IACtC,MAAM,IAAI,GAAG,IAAA,6BAA0B,EAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,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,
|
|
1
|
+
{"version":3,"file":"npm.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/npm.ts"],"names":[],"mappings":";;;AAAA,wBAA+C;AAE/C,mEAKiC;AAEjC,SAAS,mBAAmB,CAAC,GAAW;IACtC,MAAM,IAAI,GAAG,IAAA,6BAA0B,EAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,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,mEAAmE;AACnE,SAAgB,wBAAwB,CAAC,GAAW;IAClD,MAAM,iBAAiB,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACnD,OAAO,IAAA,wDAAgC,EAAC,iBAAiB,CAAC,CAAC;AAC7D,CAAC;AAHD,4DAGC;AAED,mEAAmE;AACnE,SAAgB,6BAA6B,CAAC,GAAW;IACvD,MAAM,iBAAiB,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACnD,OAAO,IAAA,6DAAqC,EAAC,iBAAiB,CAAC,CAAC;AAClE,CAAC;AAHD,sEAGC;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,16 +1,27 @@
|
|
|
1
|
-
export declare function getPackagePathsFromWorkspaceRoot(packageJsonWorkspacesRoot: string): string[];
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Read the `workspaces` property the monorepo root package.json, then process the workspace globs
|
|
3
|
+
* into absolute package paths. Returns an empty array if the `workspaces` property is not found or
|
|
4
|
+
* there's some other issue.
|
|
5
5
|
*/
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function getPackagePathsFromWorkspaceRoot(root: string): string[];
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* Read the `workspaces` property the monorepo root package.json, then process the workspace globs
|
|
9
|
+
* into absolute package paths. Returns an empty array if the `workspaces` property is not found or
|
|
10
|
+
* there's some other issue.
|
|
10
11
|
*/
|
|
11
|
-
export declare function
|
|
12
|
+
export declare function getPackagePathsFromWorkspaceRootAsync(root: string): Promise<string[]>;
|
|
12
13
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
14
|
+
* Read the `workspaces` property the monorepo root package.json, then process the workspace globs
|
|
15
|
+
* into an array with names, paths, and package.json contents for each package (each "workspace"
|
|
16
|
+
* in npm/yarn/pnpm terms). Returns an empty array if there's any issue.
|
|
15
17
|
*/
|
|
16
|
-
export declare function
|
|
18
|
+
export declare function getWorkspaceInfoFromWorkspaceRoot(root: string): import("../..").WorkspaceInfos;
|
|
19
|
+
/**
|
|
20
|
+
* Read the `workspaces` property the monorepo root package.json, then process the workspace globs
|
|
21
|
+
* into an array with names, paths, and package.json contents for each package (each "workspace"
|
|
22
|
+
* in npm/yarn/pnpm terms). Returns an empty array if there's any issue.
|
|
23
|
+
*
|
|
24
|
+
* NOTE: As of writing, this will start promises to read all package.json files in parallel,
|
|
25
|
+
* without direct concurrency control.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getWorkspaceInfoFromWorkspaceRootAsync(root: string): Promise<import("../..").WorkspaceInfos>;
|
|
@@ -10,10 +10,10 @@ const getPackagePaths_1 = require("../../getPackagePaths");
|
|
|
10
10
|
const getWorkspacePackageInfo_1 = require("../getWorkspacePackageInfo");
|
|
11
11
|
const logging_1 = require("../../logging");
|
|
12
12
|
/**
|
|
13
|
-
* Read the
|
|
13
|
+
* Read the monorepo root package.json and get the list of package globs from its `workspaces` property.
|
|
14
14
|
*/
|
|
15
|
-
function getPackages(
|
|
16
|
-
const packageJsonFile = path_1.default.join(
|
|
15
|
+
function getPackages(root) {
|
|
16
|
+
const packageJsonFile = path_1.default.join(root, "package.json");
|
|
17
17
|
let packageJson;
|
|
18
18
|
try {
|
|
19
19
|
packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonFile, "utf-8"));
|
|
@@ -30,58 +30,69 @@ function getPackages(packageJsonWorkspacesRoot) {
|
|
|
30
30
|
}
|
|
31
31
|
return workspaces.packages;
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Read the `workspaces` property the monorepo root package.json, then process the workspace globs
|
|
35
|
+
* into absolute package paths. Returns an empty array if the `workspaces` property is not found or
|
|
36
|
+
* there's some other issue.
|
|
37
|
+
*/
|
|
38
|
+
function getPackagePathsFromWorkspaceRoot(root) {
|
|
34
39
|
try {
|
|
35
|
-
const packageGlobs = getPackages(
|
|
36
|
-
return packageGlobs ? (0, getPackagePaths_1.getPackagePaths)(
|
|
40
|
+
const packageGlobs = getPackages(root);
|
|
41
|
+
return packageGlobs ? (0, getPackagePaths_1.getPackagePaths)(root, packageGlobs) : [];
|
|
37
42
|
}
|
|
38
43
|
catch (err) {
|
|
39
|
-
(0, logging_1.logVerboseWarning)(`Error getting package paths for ${
|
|
44
|
+
(0, logging_1.logVerboseWarning)(`Error getting package paths for ${root}`, err);
|
|
40
45
|
return [];
|
|
41
46
|
}
|
|
42
47
|
}
|
|
43
48
|
exports.getPackagePathsFromWorkspaceRoot = getPackagePathsFromWorkspaceRoot;
|
|
44
49
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
50
|
+
* Read the `workspaces` property the monorepo root package.json, then process the workspace globs
|
|
51
|
+
* into absolute package paths. Returns an empty array if the `workspaces` property is not found or
|
|
52
|
+
* there's some other issue.
|
|
47
53
|
*/
|
|
48
|
-
async function getPackagePathsFromWorkspaceRootAsync(
|
|
54
|
+
async function getPackagePathsFromWorkspaceRootAsync(root) {
|
|
49
55
|
try {
|
|
50
|
-
const packageGlobs = getPackages(
|
|
51
|
-
return packageGlobs ? (0, getPackagePaths_1.getPackagePathsAsync)(
|
|
56
|
+
const packageGlobs = getPackages(root);
|
|
57
|
+
return packageGlobs ? (0, getPackagePaths_1.getPackagePathsAsync)(root, packageGlobs) : [];
|
|
52
58
|
}
|
|
53
59
|
catch (err) {
|
|
54
|
-
(0, logging_1.logVerboseWarning)(`Error getting package paths for ${
|
|
60
|
+
(0, logging_1.logVerboseWarning)(`Error getting package paths for ${root}`, err);
|
|
55
61
|
return [];
|
|
56
62
|
}
|
|
57
63
|
}
|
|
58
64
|
exports.getPackagePathsFromWorkspaceRootAsync = getPackagePathsFromWorkspaceRootAsync;
|
|
59
65
|
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
66
|
+
* Read the `workspaces` property the monorepo root package.json, then process the workspace globs
|
|
67
|
+
* into an array with names, paths, and package.json contents for each package (each "workspace"
|
|
68
|
+
* in npm/yarn/pnpm terms). Returns an empty array if there's any issue.
|
|
62
69
|
*/
|
|
63
|
-
function getWorkspaceInfoFromWorkspaceRoot(
|
|
70
|
+
function getWorkspaceInfoFromWorkspaceRoot(root) {
|
|
64
71
|
try {
|
|
65
|
-
const packagePaths = getPackagePathsFromWorkspaceRoot(
|
|
72
|
+
const packagePaths = getPackagePathsFromWorkspaceRoot(root);
|
|
66
73
|
return (0, getWorkspacePackageInfo_1.getWorkspacePackageInfo)(packagePaths);
|
|
67
74
|
}
|
|
68
75
|
catch (err) {
|
|
69
|
-
(0, logging_1.logVerboseWarning)(`Error getting workspace info for ${
|
|
76
|
+
(0, logging_1.logVerboseWarning)(`Error getting workspace info for ${root}`, err);
|
|
70
77
|
return [];
|
|
71
78
|
}
|
|
72
79
|
}
|
|
73
80
|
exports.getWorkspaceInfoFromWorkspaceRoot = getWorkspaceInfoFromWorkspaceRoot;
|
|
74
81
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
82
|
+
* Read the `workspaces` property the monorepo root package.json, then process the workspace globs
|
|
83
|
+
* into an array with names, paths, and package.json contents for each package (each "workspace"
|
|
84
|
+
* in npm/yarn/pnpm terms). Returns an empty array if there's any issue.
|
|
85
|
+
*
|
|
86
|
+
* NOTE: As of writing, this will start promises to read all package.json files in parallel,
|
|
87
|
+
* without direct concurrency control.
|
|
77
88
|
*/
|
|
78
|
-
async function getWorkspaceInfoFromWorkspaceRootAsync(
|
|
89
|
+
async function getWorkspaceInfoFromWorkspaceRootAsync(root) {
|
|
79
90
|
try {
|
|
80
|
-
const packagePaths = await getPackagePathsFromWorkspaceRootAsync(
|
|
91
|
+
const packagePaths = await getPackagePathsFromWorkspaceRootAsync(root);
|
|
81
92
|
return (0, getWorkspacePackageInfo_1.getWorkspacePackageInfoAsync)(packagePaths);
|
|
82
93
|
}
|
|
83
94
|
catch (err) {
|
|
84
|
-
(0, logging_1.logVerboseWarning)(`Error getting workspace info for ${
|
|
95
|
+
(0, logging_1.logVerboseWarning)(`Error getting workspace info for ${root}`, err);
|
|
85
96
|
return [];
|
|
86
97
|
}
|
|
87
98
|
}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,IAAY;IAC/B,MAAM,eAAe,GAAG,cAAI,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAExD,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,UAAU,EAAE,QAAQ,EAAE;QACzB,MAAM,IAAI,KAAK,CAAC,yFAAyF,CAAC,CAAC;KAC5G;IAED,OAAO,UAAU,CAAC,QAAQ,CAAC;AAC7B,CAAC;AAED;;;;GAIG;AACH,SAAgB,gCAAgC,CAAC,IAAY;IAC3D,IAAI;QACF,MAAM,YAAY,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;QACvC,OAAO,YAAY,CAAC,CAAC,CAAC,IAAA,iCAAe,EAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KAChE;IAAC,OAAO,GAAG,EAAE;QACZ,IAAA,2BAAiB,EAAC,mCAAmC,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC;QAClE,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AARD,4EAQC;AAED;;;;GAIG;AACI,KAAK,UAAU,qCAAqC,CAAC,IAAY;IACtE,IAAI;QACF,MAAM,YAAY,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;QACvC,OAAO,YAAY,CAAC,CAAC,CAAC,IAAA,sCAAoB,EAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KACrE;IAAC,OAAO,GAAG,EAAE;QACZ,IAAA,2BAAiB,EAAC,mCAAmC,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC;QAClE,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AARD,sFAQC;AAED;;;;GAIG;AACH,SAAgB,iCAAiC,CAAC,IAAY;IAC5D,IAAI;QACF,MAAM,YAAY,GAAG,gCAAgC,CAAC,IAAI,CAAC,CAAC;QAC5D,OAAO,IAAA,iDAAuB,EAAC,YAAY,CAAC,CAAC;KAC9C;IAAC,OAAO,GAAG,EAAE;QACZ,IAAA,2BAAiB,EAAC,oCAAoC,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC;QACnE,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AARD,8EAQC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,sCAAsC,CAAC,IAAY;IACvE,IAAI;QACF,MAAM,YAAY,GAAG,MAAM,qCAAqC,CAAC,IAAI,CAAC,CAAC;QACvE,OAAO,IAAA,sDAA4B,EAAC,YAAY,CAAC,CAAC;KACnD;IAAC,OAAO,GAAG,EAAE;QACZ,IAAA,2BAAiB,EAAC,oCAAoC,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC;QACnE,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AARD,wFAQC"}
|