workspace-tools 0.40.2 → 0.40.3
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/README.md +1 -1
- package/lib/getPackageInfos.d.ts +5 -5
- package/lib/getPackageInfos.js +5 -5
- package/lib/getPackagePaths.d.ts +2 -2
- package/lib/getPackagePaths.js +2 -2
- package/lib/graph/getPackageDependencies.d.ts +1 -1
- package/lib/graph/getPackageDependencies.js +1 -1
- package/lib/paths.d.ts +7 -2
- package/lib/paths.js +11 -6
- package/lib/paths.js.map +1 -1
- package/lib/workspaces/getAllPackageJsonFiles.d.ts +2 -2
- package/lib/workspaces/getAllPackageJsonFiles.js +2 -2
- package/lib/workspaces/getWorkspacePackageInfo.d.ts +2 -2
- package/lib/workspaces/getWorkspacePackageInfo.js +3 -3
- package/lib/workspaces/getWorkspacePackageInfo.js.map +1 -1
- package/lib/workspaces/getWorkspacePackagePaths.d.ts +2 -2
- package/lib/workspaces/getWorkspacePackagePaths.js +2 -2
- package/lib/workspaces/getWorkspaceRoot.d.ts +6 -5
- package/lib/workspaces/getWorkspaceRoot.js +6 -5
- package/lib/workspaces/getWorkspaceRoot.js.map +1 -1
- package/lib/workspaces/getWorkspaces.d.ts +4 -4
- package/lib/workspaces/getWorkspaces.js +4 -4
- package/lib/workspaces/implementations/getWorkspaceManagerAndRoot.d.ts +5 -5
- package/lib/workspaces/implementations/getWorkspaceManagerAndRoot.js +4 -4
- package/lib/workspaces/implementations/getWorkspaceUtilities.d.ts +6 -2
- package/lib/workspaces/implementations/getWorkspaceUtilities.js +2 -2
- package/lib/workspaces/implementations/getWorkspaceUtilities.js.map +1 -1
- package/lib/workspaces/implementations/lerna.d.ts +6 -1
- package/lib/workspaces/implementations/lerna.js +13 -8
- package/lib/workspaces/implementations/lerna.js.map +1 -1
- package/lib/workspaces/implementations/npm.js +10 -10
- package/lib/workspaces/implementations/npm.js.map +1 -1
- package/lib/workspaces/implementations/packageJsonWorkspaces.d.ts +6 -2
- package/lib/workspaces/implementations/packageJsonWorkspaces.js +9 -5
- package/lib/workspaces/implementations/packageJsonWorkspaces.js.map +1 -1
- package/lib/workspaces/implementations/pnpm.d.ts +6 -1
- package/lib/workspaces/implementations/pnpm.js +12 -7
- package/lib/workspaces/implementations/pnpm.js.map +1 -1
- package/lib/workspaces/implementations/rush.d.ts +6 -1
- package/lib/workspaces/implementations/rush.js +11 -7
- package/lib/workspaces/implementations/rush.js.map +1 -1
- package/lib/workspaces/implementations/yarn.d.ts +10 -2
- package/lib/workspaces/implementations/yarn.js +19 -11
- package/lib/workspaces/implementations/yarn.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ Override the `maxBuffer` value for git processes, for example if the repo is ver
|
|
|
20
20
|
|
|
21
21
|
### PREFERRED_WORKSPACE_MANAGER
|
|
22
22
|
|
|
23
|
-
Sometimes if multiple workspace manager files are checked in, it's necessary to hint which manager is used: `npm`, `yarn`, `pnpm`, `rush`, or `lerna`.
|
|
23
|
+
Sometimes if multiple workspace/monorepo manager files are checked in, it's necessary to hint which manager is used: `npm`, `yarn`, `pnpm`, `rush`, or `lerna`.
|
|
24
24
|
|
|
25
25
|
### VERBOSE
|
|
26
26
|
|
package/lib/getPackageInfos.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { PackageInfos } from "./types/PackageInfo";
|
|
2
2
|
/**
|
|
3
|
-
* Read all the package.json files in a monorepo.
|
|
4
|
-
* use a supported workspace manager.
|
|
5
|
-
* @param cwd Start looking for the
|
|
3
|
+
* Read all the package.json files in a monorepo.
|
|
4
|
+
* Only works for monorepos which use a supported workspace/monorepo manager.
|
|
5
|
+
* @param cwd Start looking for the manager config from here
|
|
6
6
|
*/
|
|
7
7
|
export declare function getPackageInfos(cwd: string): PackageInfos;
|
|
8
8
|
/**
|
|
9
9
|
* Read all the package.json files in a monorepo. Only works for monorepos which
|
|
10
|
-
* use a supported workspace manager.
|
|
10
|
+
* use a supported workspace/monorepo manager.
|
|
11
11
|
*
|
|
12
12
|
* NOTE: As of writing, this will start promises to read all package.json files in parallel,
|
|
13
13
|
* without direct concurrency control.
|
|
14
14
|
*
|
|
15
|
-
* @param cwd Start looking for the
|
|
15
|
+
* @param cwd Start looking for the manager config from here
|
|
16
16
|
*/
|
|
17
17
|
export declare function getPackageInfosAsync(cwd: string): Promise<PackageInfos>;
|
package/lib/getPackageInfos.js
CHANGED
|
@@ -4,9 +4,9 @@ exports.getPackageInfosAsync = exports.getPackageInfos = void 0;
|
|
|
4
4
|
const getWorkspaces_1 = require("./workspaces/getWorkspaces");
|
|
5
5
|
const getPackageInfo_1 = require("./getPackageInfo");
|
|
6
6
|
/**
|
|
7
|
-
* Read all the package.json files in a monorepo.
|
|
8
|
-
* use a supported workspace manager.
|
|
9
|
-
* @param cwd Start looking for the
|
|
7
|
+
* Read all the package.json files in a monorepo.
|
|
8
|
+
* Only works for monorepos which use a supported workspace/monorepo manager.
|
|
9
|
+
* @param cwd Start looking for the manager config from here
|
|
10
10
|
*/
|
|
11
11
|
function getPackageInfos(cwd) {
|
|
12
12
|
const packageInfos = {};
|
|
@@ -27,12 +27,12 @@ function getPackageInfos(cwd) {
|
|
|
27
27
|
exports.getPackageInfos = getPackageInfos;
|
|
28
28
|
/**
|
|
29
29
|
* Read all the package.json files in a monorepo. Only works for monorepos which
|
|
30
|
-
* use a supported workspace manager.
|
|
30
|
+
* use a supported workspace/monorepo manager.
|
|
31
31
|
*
|
|
32
32
|
* NOTE: As of writing, this will start promises to read all package.json files in parallel,
|
|
33
33
|
* without direct concurrency control.
|
|
34
34
|
*
|
|
35
|
-
* @param cwd Start looking for the
|
|
35
|
+
* @param cwd Start looking for the manager config from here
|
|
36
36
|
*/
|
|
37
37
|
async function getPackageInfosAsync(cwd) {
|
|
38
38
|
const packageInfos = {};
|
package/lib/getPackagePaths.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Given package folder globs (such as those from package.json `workspaces`) and a
|
|
2
|
+
* Given package folder globs (such as those from package.json `workspaces`) and a monorepo root
|
|
3
3
|
* directory, get absolute paths to actual package folders.
|
|
4
4
|
*/
|
|
5
5
|
export declare function getPackagePaths(root: string, packageGlobs: string[]): string[];
|
|
6
6
|
/**
|
|
7
|
-
* Given package folder globs (such as those from package.json `workspaces`) and a
|
|
7
|
+
* Given package folder globs (such as those from package.json `workspaces`) and a monorepo root
|
|
8
8
|
* directory, get absolute paths to actual package folders.
|
|
9
9
|
*/
|
|
10
10
|
export declare function getPackagePathsAsync(root: string, packageGlobs: string[]): Promise<string[]>;
|
package/lib/getPackagePaths.js
CHANGED
|
@@ -14,7 +14,7 @@ const globOptions = {
|
|
|
14
14
|
stats: false,
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
|
-
* Given package folder globs (such as those from package.json `workspaces`) and a
|
|
17
|
+
* Given package folder globs (such as those from package.json `workspaces`) and a monorepo root
|
|
18
18
|
* directory, get absolute paths to actual package folders.
|
|
19
19
|
*/
|
|
20
20
|
function getPackagePaths(root, packageGlobs) {
|
|
@@ -28,7 +28,7 @@ function getPackagePaths(root, packageGlobs) {
|
|
|
28
28
|
}
|
|
29
29
|
exports.getPackagePaths = getPackagePaths;
|
|
30
30
|
/**
|
|
31
|
-
* Given package folder globs (such as those from package.json `workspaces`) and a
|
|
31
|
+
* Given package folder globs (such as those from package.json `workspaces`) and a monorepo root
|
|
32
32
|
* directory, get absolute paths to actual package folders.
|
|
33
33
|
*/
|
|
34
34
|
async function getPackagePathsAsync(root, packageGlobs) {
|
|
@@ -5,7 +5,7 @@ export interface PackageDependenciesOptions {
|
|
|
5
5
|
withOptionalDependencies?: boolean;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
|
-
* Gets the
|
|
8
|
+
* Gets the monorepo package dependencies for a given package (excluding `file:` or `npm:` versions).
|
|
9
9
|
* It only considers `dependencies` unless options specify otherwise.
|
|
10
10
|
*
|
|
11
11
|
* @param info - The package information containing dependencies
|
|
@@ -17,7 +17,7 @@ function isValidDependency(info, dep) {
|
|
|
17
17
|
return !range.startsWith("npm:") && !range.startsWith("file:");
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
* Gets the
|
|
20
|
+
* Gets the monorepo package dependencies for a given package (excluding `file:` or `npm:` versions).
|
|
21
21
|
* It only considers `dependencies` unless options specify otherwise.
|
|
22
22
|
*
|
|
23
23
|
* @param info - The package information containing dependencies
|
package/lib/paths.d.ts
CHANGED
|
@@ -14,8 +14,13 @@ export declare function findGitRoot(cwd: string): string;
|
|
|
14
14
|
*/
|
|
15
15
|
export declare function findPackageRoot(cwd: string): string | undefined;
|
|
16
16
|
/**
|
|
17
|
-
* Starting from `cwd`, searches up the directory hierarchy for the
|
|
18
|
-
* falling back to the git root if no
|
|
17
|
+
* Starting from `cwd`, searches up the directory hierarchy for the project root (workspace/monorepo
|
|
18
|
+
* manager root), falling back to the git root if no manager root is detected. Results are cached by
|
|
19
|
+
* `cwd`, and an error is thrown if no project root is found and it's not a git repo.
|
|
20
|
+
*
|
|
21
|
+
* To skip the git root fallback, use `getWorkspaceManagerRoot`. Usually the monorepo manager root
|
|
22
|
+
* is the same as the git root, but this may not be the case with multiple "monorepos" in a single
|
|
23
|
+
* git repo, or in project structures with multiple languages where the JS is not at the root.
|
|
19
24
|
*/
|
|
20
25
|
export declare function findProjectRoot(cwd: string): string;
|
|
21
26
|
/**
|
package/lib/paths.js
CHANGED
|
@@ -51,19 +51,24 @@ function findPackageRoot(cwd) {
|
|
|
51
51
|
}
|
|
52
52
|
exports.findPackageRoot = findPackageRoot;
|
|
53
53
|
/**
|
|
54
|
-
* Starting from `cwd`, searches up the directory hierarchy for the
|
|
55
|
-
* falling back to the git root if no
|
|
54
|
+
* Starting from `cwd`, searches up the directory hierarchy for the project root (workspace/monorepo
|
|
55
|
+
* manager root), falling back to the git root if no manager root is detected. Results are cached by
|
|
56
|
+
* `cwd`, and an error is thrown if no project root is found and it's not a git repo.
|
|
57
|
+
*
|
|
58
|
+
* To skip the git root fallback, use `getWorkspaceManagerRoot`. Usually the monorepo manager root
|
|
59
|
+
* is the same as the git root, but this may not be the case with multiple "monorepos" in a single
|
|
60
|
+
* git repo, or in project structures with multiple languages where the JS is not at the root.
|
|
56
61
|
*/
|
|
57
62
|
function findProjectRoot(cwd) {
|
|
58
63
|
let workspaceRoot;
|
|
59
64
|
try {
|
|
60
65
|
workspaceRoot = (0, getWorkspaceRoot_1.getWorkspaceManagerRoot)(cwd);
|
|
66
|
+
if (!workspaceRoot) {
|
|
67
|
+
(0, logging_1.logVerboseWarning)(`Could not find workspace manager root for ${cwd}. Falling back to git root.`);
|
|
68
|
+
}
|
|
61
69
|
}
|
|
62
70
|
catch (err) {
|
|
63
|
-
(0, logging_1.logVerboseWarning)(`Error getting workspace root for ${cwd}`, err);
|
|
64
|
-
}
|
|
65
|
-
if (!workspaceRoot) {
|
|
66
|
-
(0, logging_1.logVerboseWarning)(`Could not find workspace root for ${cwd}. Falling back to git root.`);
|
|
71
|
+
(0, logging_1.logVerboseWarning)(`Error getting workspace manager root for ${cwd} (will fall back to git root)`, err);
|
|
67
72
|
}
|
|
68
73
|
return workspaceRoot || findGitRoot(cwd);
|
|
69
74
|
}
|
package/lib/paths.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,4CAAoB;AACpB,oEAAwE;AACxE,+BAA4B;AAC5B,uCAA8C;AAE9C;;;;GAIG;AACH,SAAgB,QAAQ,CAAC,QAA2B,EAAE,GAAW;IAC/D,MAAM,KAAK,GAAG,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IACnE,wCAAwC;IACxC,GAAG,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACxB,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GAEG;AACH,SAAgB,eAAe,CAAC,GAAW;IACzC,MAAM,QAAQ,GAAG,QAAQ,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;IAC/C,OAAO,QAAQ,IAAI,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5C,CAAC;AAHD,0CAGC;AAED;;;;;;;;GAQG;AACH,SAAgB,eAAe,CAAC,GAAW;IACzC,IAAI,aAAiC,CAAC;IACtC,IAAI;QACF,aAAa,GAAG,IAAA,0CAAuB,EAAC,GAAG,CAAC,CAAC;QAC7C,IAAI,CAAC,aAAa,EAAE;YAClB,IAAA,2BAAiB,EAAC,6CAA6C,GAAG,6BAA6B,CAAC,CAAC;SAClG;KACF;IAAC,OAAO,GAAG,EAAE;QACZ,IAAA,2BAAiB,EAAC,4CAA4C,GAAG,+BAA+B,EAAE,GAAG,CAAC,CAAC;KACxG;IAED,OAAO,aAAa,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC;AAC3C,CAAC;AAZD,0CAYC;AAED;;GAEG;AACH,SAAgB,SAAS,CAAC,KAAa,EAAE,MAAc;IACrD,MAAM,YAAY,GAAG,cAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAClD,OAAO,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;AACzC,CAAC;AAHD,8BAGC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Get paths to every package.json in the
|
|
2
|
+
* Get paths to every package.json in the monorepo, given a cwd.
|
|
3
3
|
*/
|
|
4
4
|
export declare function getAllPackageJsonFiles(cwd: string): string[];
|
|
5
5
|
export declare function _resetPackageJsonFilesCache(): void;
|
|
6
6
|
/**
|
|
7
|
-
* Get paths to every package.json in the
|
|
7
|
+
* Get paths to every package.json in the monorepo, given a cwd.
|
|
8
8
|
*/
|
|
9
9
|
export declare function getAllPackageJsonFilesAsync(cwd: string): Promise<string[]>;
|
|
@@ -9,7 +9,7 @@ const getWorkspacePackagePaths_1 = require("./getWorkspacePackagePaths");
|
|
|
9
9
|
const isCachingEnabled_1 = require("../isCachingEnabled");
|
|
10
10
|
const cache = new Map();
|
|
11
11
|
/**
|
|
12
|
-
* Get paths to every package.json in the
|
|
12
|
+
* Get paths to every package.json in the monorepo, given a cwd.
|
|
13
13
|
*/
|
|
14
14
|
function getAllPackageJsonFiles(cwd) {
|
|
15
15
|
if ((0, isCachingEnabled_1.isCachingEnabled)() && cache.has(cwd)) {
|
|
@@ -25,7 +25,7 @@ function _resetPackageJsonFilesCache() {
|
|
|
25
25
|
}
|
|
26
26
|
exports._resetPackageJsonFilesCache = _resetPackageJsonFilesCache;
|
|
27
27
|
/**
|
|
28
|
-
* Get paths to every package.json in the
|
|
28
|
+
* Get paths to every package.json in the monorepo, given a cwd.
|
|
29
29
|
*/
|
|
30
30
|
async function getAllPackageJsonFilesAsync(cwd) {
|
|
31
31
|
if ((0, isCachingEnabled_1.isCachingEnabled)() && cache.has(cwd)) {
|
|
@@ -6,7 +6,7 @@ import type { WorkspaceInfos } from "../types/WorkspaceInfo";
|
|
|
6
6
|
* This is an internal helper used by `getWorkspaces` implementations for different managers.
|
|
7
7
|
*
|
|
8
8
|
* @param packagePaths Paths to packages within a monorepo
|
|
9
|
-
* @returns Array of
|
|
9
|
+
* @returns Array of monorepo package infos
|
|
10
10
|
* @internal
|
|
11
11
|
*/
|
|
12
12
|
export declare function getWorkspacePackageInfo(packagePaths: string[]): WorkspaceInfos;
|
|
@@ -20,7 +20,7 @@ export declare function getWorkspacePackageInfo(packagePaths: string[]): Workspa
|
|
|
20
20
|
* This is an internal helper used by `getWorkspaces` implementations for different managers.
|
|
21
21
|
*
|
|
22
22
|
* @param packagePaths Paths to packages within a monorepo
|
|
23
|
-
* @returns Array of
|
|
23
|
+
* @returns Array of monorepo package infos
|
|
24
24
|
* @internal
|
|
25
25
|
*/
|
|
26
26
|
export declare function getWorkspacePackageInfoAsync(packagePaths: string[]): Promise<WorkspaceInfos>;
|
|
@@ -16,7 +16,7 @@ const getPackageInfo_1 = require("../getPackageInfo");
|
|
|
16
16
|
* This is an internal helper used by `getWorkspaces` implementations for different managers.
|
|
17
17
|
*
|
|
18
18
|
* @param packagePaths Paths to packages within a monorepo
|
|
19
|
-
* @returns Array of
|
|
19
|
+
* @returns Array of monorepo package infos
|
|
20
20
|
* @internal
|
|
21
21
|
*/
|
|
22
22
|
function getWorkspacePackageInfo(packagePaths) {
|
|
@@ -48,7 +48,7 @@ exports.getWorkspacePackageInfo = getWorkspacePackageInfo;
|
|
|
48
48
|
* This is an internal helper used by `getWorkspaces` implementations for different managers.
|
|
49
49
|
*
|
|
50
50
|
* @param packagePaths Paths to packages within a monorepo
|
|
51
|
-
* @returns Array of
|
|
51
|
+
* @returns Array of monorepo package infos
|
|
52
52
|
* @internal
|
|
53
53
|
*/
|
|
54
54
|
async function getWorkspacePackageInfoAsync(packagePaths) {
|
|
@@ -66,7 +66,7 @@ async function getWorkspacePackageInfoAsync(packagePaths) {
|
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
catch (err) {
|
|
69
|
-
(0, logging_1.logVerboseWarning)(`Error reading or parsing ${packageJsonPath} while getting
|
|
69
|
+
(0, logging_1.logVerboseWarning)(`Error reading or parsing ${packageJsonPath} while getting monorepo package info`, err);
|
|
70
70
|
return null;
|
|
71
71
|
}
|
|
72
72
|
});
|
|
@@ -1 +1 @@
|
|
|
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,sDAAmD;AAEnD;;;;;;;;;GASG;AACH,SAAgB,uBAAuB,CAAC,YAAsB;IAC5D,IAAI,CAAC,YAAY,EAAE;QACjB,OAAO,EAAE,CAAC;KACX;IAED,OAAO,YAAY;SAChB,GAAG,CAA8B,CAAC,aAAa,EAA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D,oEAsBC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Get a list of package folder paths in the
|
|
2
|
+
* Get a list of package folder paths in the monorepo. The list of included packages is based on
|
|
3
3
|
* the manager's config file and matching package folders (which must contain package.json) on disk.
|
|
4
4
|
*/
|
|
5
5
|
export declare function getWorkspacePackagePaths(cwd: string): string[];
|
|
6
6
|
/**
|
|
7
|
-
* Get a list of package folder paths in the
|
|
7
|
+
* Get a list of package folder paths in the monorepo. The list of included packages is based on
|
|
8
8
|
* the manager's config file and matching package folders (which must contain package.json) on disk.
|
|
9
9
|
*/
|
|
10
10
|
export declare function getWorkspacePackagePathsAsync(cwd: string): Promise<string[]>;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getWorkspacePackagePathsAsync = exports.getWorkspacePackagePaths = void 0;
|
|
4
4
|
const implementations_1 = require("./implementations");
|
|
5
5
|
/**
|
|
6
|
-
* Get a list of package folder paths in the
|
|
6
|
+
* Get a list of package folder paths in the monorepo. The list of included packages is based on
|
|
7
7
|
* the manager's config file and matching package folders (which must contain package.json) on disk.
|
|
8
8
|
*/
|
|
9
9
|
function getWorkspacePackagePaths(cwd) {
|
|
@@ -12,7 +12,7 @@ function getWorkspacePackagePaths(cwd) {
|
|
|
12
12
|
}
|
|
13
13
|
exports.getWorkspacePackagePaths = getWorkspacePackagePaths;
|
|
14
14
|
/**
|
|
15
|
-
* Get a list of package folder paths in the
|
|
15
|
+
* Get a list of package folder paths in the monorepo. The list of included packages is based on
|
|
16
16
|
* the manager's config file and matching package folders (which must contain package.json) on disk.
|
|
17
17
|
*/
|
|
18
18
|
async function getWorkspacePackagePathsAsync(cwd) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { WorkspaceManager } from "./WorkspaceManager";
|
|
2
2
|
/**
|
|
3
|
-
* Get the root directory of a monorepo, defined as the directory where the workspace manager
|
|
4
|
-
* config file is located.
|
|
3
|
+
* Get the root directory of a monorepo, defined as the directory where the workspace/monorepo manager
|
|
4
|
+
* config file is located. (Does not rely in any way on git, and the result is cached by `cwd`.)
|
|
5
5
|
*
|
|
6
|
-
* NOTE: "Workspace" here refers to the entire project, not an individual package the way it does
|
|
6
|
+
* NOTE: "Workspace" here refers to the entire project/monorepo, not an individual package the way it does
|
|
7
7
|
* in e.g. npm/yarn/pnpm "workspaces."
|
|
8
8
|
*
|
|
9
9
|
* @param cwd Start searching from here
|
|
@@ -15,10 +15,11 @@ import { WorkspaceManager } from "./WorkspaceManager";
|
|
|
15
15
|
*/
|
|
16
16
|
export declare function getWorkspaceRoot(cwd: string, preferredManager?: WorkspaceManager): string | undefined;
|
|
17
17
|
/**
|
|
18
|
-
* Get the root directory of a monorepo, defined as the directory where the workspace manager
|
|
19
|
-
* config file is located.
|
|
18
|
+
* Get the root directory of a monorepo, defined as the directory where the workspace/monorepo manager
|
|
19
|
+
* config file is located. (Does not rely in any way on git, and the result is cached by `cwd`.)
|
|
20
20
|
*
|
|
21
21
|
* @param cwd Start searching from here
|
|
22
22
|
* @param preferredManager Search for only this manager's config file
|
|
23
|
+
* @returns Workspace manager root directory, or undefined if not found
|
|
23
24
|
*/
|
|
24
25
|
export declare function getWorkspaceManagerRoot(cwd: string, preferredManager?: WorkspaceManager): string | undefined;
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getWorkspaceManagerRoot = exports.getWorkspaceRoot = void 0;
|
|
4
4
|
const implementations_1 = require("./implementations");
|
|
5
5
|
/**
|
|
6
|
-
* Get the root directory of a monorepo, defined as the directory where the workspace manager
|
|
7
|
-
* config file is located.
|
|
6
|
+
* Get the root directory of a monorepo, defined as the directory where the workspace/monorepo manager
|
|
7
|
+
* config file is located. (Does not rely in any way on git, and the result is cached by `cwd`.)
|
|
8
8
|
*
|
|
9
|
-
* NOTE: "Workspace" here refers to the entire project, not an individual package the way it does
|
|
9
|
+
* NOTE: "Workspace" here refers to the entire project/monorepo, not an individual package the way it does
|
|
10
10
|
* in e.g. npm/yarn/pnpm "workspaces."
|
|
11
11
|
*
|
|
12
12
|
* @param cwd Start searching from here
|
|
@@ -21,11 +21,12 @@ function getWorkspaceRoot(cwd, preferredManager) {
|
|
|
21
21
|
}
|
|
22
22
|
exports.getWorkspaceRoot = getWorkspaceRoot;
|
|
23
23
|
/**
|
|
24
|
-
* Get the root directory of a monorepo, defined as the directory where the workspace manager
|
|
25
|
-
* config file is located.
|
|
24
|
+
* Get the root directory of a monorepo, defined as the directory where the workspace/monorepo manager
|
|
25
|
+
* config file is located. (Does not rely in any way on git, and the result is cached by `cwd`.)
|
|
26
26
|
*
|
|
27
27
|
* @param cwd Start searching from here
|
|
28
28
|
* @param preferredManager Search for only this manager's config file
|
|
29
|
+
* @returns Workspace manager root directory, or undefined if not found
|
|
29
30
|
*/
|
|
30
31
|
function getWorkspaceManagerRoot(cwd, preferredManager) {
|
|
31
32
|
return (0, implementations_1.getWorkspaceManagerAndRoot)(cwd, undefined, preferredManager)?.root;
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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;;;;;;;GAOG;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,14 +1,14 @@
|
|
|
1
1
|
import type { WorkspaceInfos } from "../types/WorkspaceInfo";
|
|
2
2
|
/**
|
|
3
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
|
|
5
|
-
* manager's config file.
|
|
4
|
+
* npm/yarn/pnpm terms) within a monorepo. The list of included packages is based on the
|
|
5
|
+
* workspace/monorepo manager's config file.
|
|
6
6
|
*/
|
|
7
7
|
export declare function getWorkspaces(cwd: string): WorkspaceInfos;
|
|
8
8
|
/**
|
|
9
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
|
|
11
|
-
* manager's config file.
|
|
10
|
+
* npm/yarn/pnpm terms) within a monorepo. The list of included packages is based on the
|
|
11
|
+
* workspace/monorepo manager's config file.
|
|
12
12
|
*
|
|
13
13
|
* NOTE: As of writing, this will start promises to read all package.json files in parallel,
|
|
14
14
|
* without direct concurrency control.
|
|
@@ -4,8 +4,8 @@ exports.getWorkspacesAsync = exports.getWorkspaces = void 0;
|
|
|
4
4
|
const implementations_1 = require("./implementations");
|
|
5
5
|
/**
|
|
6
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
|
|
8
|
-
* manager's config file.
|
|
7
|
+
* npm/yarn/pnpm terms) within a monorepo. The list of included packages is based on the
|
|
8
|
+
* workspace/monorepo manager's config file.
|
|
9
9
|
*/
|
|
10
10
|
function getWorkspaces(cwd) {
|
|
11
11
|
const utils = (0, implementations_1.getWorkspaceUtilities)(cwd);
|
|
@@ -14,8 +14,8 @@ function getWorkspaces(cwd) {
|
|
|
14
14
|
exports.getWorkspaces = getWorkspaces;
|
|
15
15
|
/**
|
|
16
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
|
|
18
|
-
* manager's config file.
|
|
17
|
+
* npm/yarn/pnpm terms) within a monorepo. The list of included packages is based on the
|
|
18
|
+
* workspace/monorepo manager's config file.
|
|
19
19
|
*
|
|
20
20
|
* NOTE: As of writing, this will start promises to read all package.json files in parallel,
|
|
21
21
|
* without direct concurrency control.
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { WorkspaceManager } from "../WorkspaceManager";
|
|
2
2
|
export interface WorkspaceManagerAndRoot {
|
|
3
|
-
/** Workspace manager name */
|
|
3
|
+
/** Workspace/monorepo manager name */
|
|
4
4
|
manager: WorkspaceManager;
|
|
5
|
-
/**
|
|
5
|
+
/** Monorepo root, where the manager configuration file is located */
|
|
6
6
|
root: string;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* Get the preferred workspace manager based on `process.env.PREFERRED_WORKSPACE_MANAGER`
|
|
9
|
+
* Get the preferred workspace/monorepo manager based on `process.env.PREFERRED_WORKSPACE_MANAGER`
|
|
10
10
|
* (if valid).
|
|
11
11
|
*/
|
|
12
12
|
export declare function getPreferredWorkspaceManager(): WorkspaceManager | undefined;
|
|
13
13
|
/**
|
|
14
|
-
* Get the workspace manager name and
|
|
14
|
+
* Get the workspace/monorepo manager name and root directory for `cwd`, with caching.
|
|
15
15
|
* Also respects the `process.env.PREFERRED_WORKSPACE_MANAGER` override, provided the relevant
|
|
16
16
|
* manager file exists.
|
|
17
17
|
* @param cwd Directory to search up from
|
|
18
18
|
* @param cache Optional override cache for testing
|
|
19
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
|
|
20
|
+
* @returns Workspace/monorepo manager and root, or undefined if it can't be determined
|
|
21
21
|
*/
|
|
22
22
|
export declare function getWorkspaceManagerAndRoot(cwd: string, cache?: Map<string, WorkspaceManagerAndRoot | undefined>, preferredManager?: WorkspaceManager): WorkspaceManagerAndRoot | undefined;
|
|
@@ -9,7 +9,7 @@ const paths_1 = require("../../paths");
|
|
|
9
9
|
const isCachingEnabled_1 = require("../../isCachingEnabled");
|
|
10
10
|
const workspaceCache = new Map();
|
|
11
11
|
/**
|
|
12
|
-
* Files indicating the
|
|
12
|
+
* Files indicating the monorepo root for each manager.
|
|
13
13
|
*
|
|
14
14
|
* DO NOT REORDER! The order of keys determines the precedence of the files, which is
|
|
15
15
|
* important for cases like lerna where lerna.json and e.g. yarn.lock may both exist.
|
|
@@ -23,7 +23,7 @@ const managerFiles = {
|
|
|
23
23
|
npm: "package-lock.json",
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
|
-
* Get the preferred workspace manager based on `process.env.PREFERRED_WORKSPACE_MANAGER`
|
|
26
|
+
* Get the preferred workspace/monorepo manager based on `process.env.PREFERRED_WORKSPACE_MANAGER`
|
|
27
27
|
* (if valid).
|
|
28
28
|
*/
|
|
29
29
|
function getPreferredWorkspaceManager() {
|
|
@@ -32,13 +32,13 @@ function getPreferredWorkspaceManager() {
|
|
|
32
32
|
}
|
|
33
33
|
exports.getPreferredWorkspaceManager = getPreferredWorkspaceManager;
|
|
34
34
|
/**
|
|
35
|
-
* Get the workspace manager name and
|
|
35
|
+
* Get the workspace/monorepo manager name and root directory for `cwd`, with caching.
|
|
36
36
|
* Also respects the `process.env.PREFERRED_WORKSPACE_MANAGER` override, provided the relevant
|
|
37
37
|
* manager file exists.
|
|
38
38
|
* @param cwd Directory to search up from
|
|
39
39
|
* @param cache Optional override cache for testing
|
|
40
40
|
* @param preferredManager Optional override manager (if provided, only searches for this manager's file)
|
|
41
|
-
* @returns Workspace manager and root, or undefined if it can't be determined
|
|
41
|
+
* @returns Workspace/monorepo manager and root, or undefined if it can't be determined
|
|
42
42
|
*/
|
|
43
43
|
function getWorkspaceManagerAndRoot(cwd, cache, preferredManager) {
|
|
44
44
|
cache = cache || workspaceCache;
|
|
@@ -4,21 +4,25 @@ export interface WorkspaceUtilities {
|
|
|
4
4
|
/**
|
|
5
5
|
* Get an array of paths to packages ("workspaces") in the monorepo, based on the
|
|
6
6
|
* manager's config file.
|
|
7
|
+
* @returns Array of monorepo package paths, or an empty array on error
|
|
7
8
|
*/
|
|
8
9
|
getWorkspacePackagePaths: (cwd: string) => string[];
|
|
9
10
|
/**
|
|
10
11
|
* Get an array of paths to packages ("workspaces") in the monorepo, based on the
|
|
11
12
|
* manager's config file.
|
|
13
|
+
* @returns Array of monorepo package paths, or an empty array on error
|
|
12
14
|
*/
|
|
13
15
|
getWorkspacePackagePathsAsync?: (cwd: string) => Promise<string[]>;
|
|
14
16
|
/**
|
|
15
17
|
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
16
18
|
* in a monorepo.
|
|
19
|
+
* @returns Array of monorepo package infos, or an empty array on error
|
|
17
20
|
*/
|
|
18
21
|
getWorkspaces: (cwd: string) => WorkspaceInfos;
|
|
19
22
|
/**
|
|
20
23
|
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
21
24
|
* in a monorepo.
|
|
25
|
+
* @returns Array of monorepo package infos, or an empty array on error
|
|
22
26
|
*/
|
|
23
27
|
getWorkspacesAsync: (cwd: string) => Promise<WorkspaceInfos>;
|
|
24
28
|
/**
|
|
@@ -27,8 +31,8 @@ export interface WorkspaceUtilities {
|
|
|
27
31
|
getCatalogs?: (cwd: string) => Catalogs | undefined;
|
|
28
32
|
}
|
|
29
33
|
/**
|
|
30
|
-
* Get utility implementations for the workspace manager of `cwd`.
|
|
31
|
-
* It will search up from `cwd` to find a manager file and
|
|
34
|
+
* Get utility implementations for the workspace/monorepo manager of `cwd`.
|
|
35
|
+
* It will search up from `cwd` to find a manager file and monorepo root, with caching.
|
|
32
36
|
* Returns undefined if the manager can't be determined.
|
|
33
37
|
*/
|
|
34
38
|
export declare function getWorkspaceUtilities(cwd: string): WorkspaceUtilities | undefined;
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getWorkspaceUtilities = void 0;
|
|
4
4
|
const getWorkspaceManagerAndRoot_1 = require("./getWorkspaceManagerAndRoot");
|
|
5
5
|
/**
|
|
6
|
-
* Get utility implementations for the workspace manager of `cwd`.
|
|
7
|
-
* It will search up from `cwd` to find a manager file and
|
|
6
|
+
* Get utility implementations for the workspace/monorepo manager of `cwd`.
|
|
7
|
+
* It will search up from `cwd` to find a manager file and monorepo root, with caching.
|
|
8
8
|
* Returns undefined if the manager can't be determined.
|
|
9
9
|
*/
|
|
10
10
|
function getWorkspaceUtilities(cwd) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getWorkspaceUtilities.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/getWorkspaceUtilities.ts"],"names":[],"mappings":";;;AAEA,6EAA0E;
|
|
1
|
+
{"version":3,"file":"getWorkspaceUtilities.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/getWorkspaceUtilities.ts"],"names":[],"mappings":";;;AAEA,6EAA0E;AAuC1E;;;;GAIG;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,14 +1,19 @@
|
|
|
1
1
|
import type { WorkspaceInfos } from "../../types/WorkspaceInfo";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Get paths for each package ("workspace") in a lerna monorepo.
|
|
4
|
+
* @returns Array of monorepo package paths, or an empty array on error
|
|
5
|
+
*/
|
|
3
6
|
export declare function getWorkspacePackagePaths(cwd: string): string[];
|
|
4
7
|
/**
|
|
5
8
|
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
6
9
|
* in a lerna monorepo.
|
|
10
|
+
* @returns Array of monorepo package infos, or an empty array on error
|
|
7
11
|
*/
|
|
8
12
|
export declare function getLernaWorkspaces(cwd: string): WorkspaceInfos;
|
|
9
13
|
/**
|
|
10
14
|
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
11
15
|
* in a lerna monorepo.
|
|
16
|
+
* @returns Array of monorepo package infos, or an empty array on error
|
|
12
17
|
*/
|
|
13
18
|
export declare function getLernaWorkspacesAsync(cwd: string): Promise<WorkspaceInfos>;
|
|
14
19
|
export { getLernaWorkspaces as getWorkspaces };
|
|
@@ -11,20 +11,23 @@ const getPackagePaths_1 = require("../../getPackagePaths");
|
|
|
11
11
|
const getWorkspacePackageInfo_1 = require("../getWorkspacePackageInfo");
|
|
12
12
|
const logging_1 = require("../../logging");
|
|
13
13
|
const getWorkspaceManagerAndRoot_1 = require("./getWorkspaceManagerAndRoot");
|
|
14
|
-
function
|
|
14
|
+
function getLernaRoot(cwd) {
|
|
15
15
|
const root = (0, getWorkspaceManagerAndRoot_1.getWorkspaceManagerAndRoot)(cwd, undefined, "lerna")?.root;
|
|
16
16
|
if (!root) {
|
|
17
|
-
throw new Error("Could not find lerna
|
|
17
|
+
throw new Error("Could not find lerna root from " + cwd);
|
|
18
18
|
}
|
|
19
19
|
return root;
|
|
20
20
|
}
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Get paths for each package ("workspace") in a lerna monorepo.
|
|
23
|
+
* @returns Array of monorepo package paths, or an empty array on error
|
|
24
|
+
*/
|
|
22
25
|
function getWorkspacePackagePaths(cwd) {
|
|
23
26
|
try {
|
|
24
|
-
const
|
|
25
|
-
const lernaJsonPath = path_1.default.join(
|
|
27
|
+
const root = getLernaRoot(cwd);
|
|
28
|
+
const lernaJsonPath = path_1.default.join(root, "lerna.json");
|
|
26
29
|
const lernaConfig = jju_1.default.parse(fs_1.default.readFileSync(lernaJsonPath, "utf-8"));
|
|
27
|
-
return (0, getPackagePaths_1.getPackagePaths)(
|
|
30
|
+
return (0, getPackagePaths_1.getPackagePaths)(root, lernaConfig.packages);
|
|
28
31
|
}
|
|
29
32
|
catch (err) {
|
|
30
33
|
(0, logging_1.logVerboseWarning)(`Error getting lerna workspace package paths for ${cwd}`, err);
|
|
@@ -35,6 +38,7 @@ exports.getWorkspacePackagePaths = getWorkspacePackagePaths;
|
|
|
35
38
|
/**
|
|
36
39
|
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
37
40
|
* in a lerna monorepo.
|
|
41
|
+
* @returns Array of monorepo package infos, or an empty array on error
|
|
38
42
|
*/
|
|
39
43
|
function getLernaWorkspaces(cwd) {
|
|
40
44
|
try {
|
|
@@ -42,7 +46,7 @@ function getLernaWorkspaces(cwd) {
|
|
|
42
46
|
return (0, getWorkspacePackageInfo_1.getWorkspacePackageInfo)(packagePaths);
|
|
43
47
|
}
|
|
44
48
|
catch (err) {
|
|
45
|
-
(0, logging_1.logVerboseWarning)(`Error getting lerna
|
|
49
|
+
(0, logging_1.logVerboseWarning)(`Error getting lerna workspace package infos for ${cwd}`, err);
|
|
46
50
|
return [];
|
|
47
51
|
}
|
|
48
52
|
}
|
|
@@ -51,6 +55,7 @@ exports.getWorkspaces = getLernaWorkspaces;
|
|
|
51
55
|
/**
|
|
52
56
|
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
53
57
|
* in a lerna monorepo.
|
|
58
|
+
* @returns Array of monorepo package infos, or an empty array on error
|
|
54
59
|
*/
|
|
55
60
|
async function getLernaWorkspacesAsync(cwd) {
|
|
56
61
|
try {
|
|
@@ -58,7 +63,7 @@ async function getLernaWorkspacesAsync(cwd) {
|
|
|
58
63
|
return (0, getWorkspacePackageInfo_1.getWorkspacePackageInfoAsync)(packagePaths);
|
|
59
64
|
}
|
|
60
65
|
catch (err) {
|
|
61
|
-
(0, logging_1.logVerboseWarning)(`Error getting lerna
|
|
66
|
+
(0, logging_1.logVerboseWarning)(`Error getting lerna workspace package infos for ${cwd}`, err);
|
|
62
67
|
return [];
|
|
63
68
|
}
|
|
64
69
|
}
|
|
@@ -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,
|
|
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,YAAY,CAAC,GAAW;IAC/B,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,iCAAiC,GAAG,GAAG,CAAC,CAAC;KAC1D;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,SAAgB,wBAAwB,CAAC,GAAW;IAClD,IAAI;QACF,MAAM,IAAI,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QAC/B,MAAM,aAAa,GAAG,cAAI,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QACpD,MAAM,WAAW,GAAG,aAAG,CAAC,KAAK,CAAC,YAAE,CAAC,YAAY,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;QACvE,OAAO,IAAA,iCAAe,EAAC,IAAI,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;KACpD;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;;;;GAIG;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,mDAAmD,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC;QACjF,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AARD,gDAQC;AAiB8B,2CAAa;AAf5C;;;;GAIG;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,mDAAmD,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC;QACjF,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AARD,0DAQC;AAGmC,qDAAkB"}
|
|
@@ -3,23 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getWorkspacesAsync = exports.getWorkspaces = exports.getNpmWorkspacesAsync = exports.getNpmWorkspaces = exports.getWorkspacePackagePathsAsync = exports.getWorkspacePackagePaths = void 0;
|
|
4
4
|
const _1 = require(".");
|
|
5
5
|
const packageJsonWorkspaces_1 = require("./packageJsonWorkspaces");
|
|
6
|
-
function
|
|
6
|
+
function getNpmRoot(cwd) {
|
|
7
7
|
const root = (0, _1.getWorkspaceManagerAndRoot)(cwd, undefined, "npm")?.root;
|
|
8
8
|
if (!root) {
|
|
9
|
-
throw new Error("Could not find npm
|
|
9
|
+
throw new Error("Could not find npm root from " + cwd);
|
|
10
10
|
}
|
|
11
11
|
return root;
|
|
12
12
|
}
|
|
13
13
|
/** Get paths for each package ("workspace") in an npm monorepo. */
|
|
14
14
|
function getWorkspacePackagePaths(cwd) {
|
|
15
|
-
const
|
|
16
|
-
return (0, packageJsonWorkspaces_1.getPackagePathsFromWorkspaceRoot)(
|
|
15
|
+
const root = getNpmRoot(cwd);
|
|
16
|
+
return (0, packageJsonWorkspaces_1.getPackagePathsFromWorkspaceRoot)(root);
|
|
17
17
|
}
|
|
18
18
|
exports.getWorkspacePackagePaths = getWorkspacePackagePaths;
|
|
19
19
|
/** Get paths for each package ("workspace") in an npm monorepo. */
|
|
20
20
|
function getWorkspacePackagePathsAsync(cwd) {
|
|
21
|
-
const
|
|
22
|
-
return (0, packageJsonWorkspaces_1.getPackagePathsFromWorkspaceRootAsync)(
|
|
21
|
+
const root = getNpmRoot(cwd);
|
|
22
|
+
return (0, packageJsonWorkspaces_1.getPackagePathsFromWorkspaceRootAsync)(root);
|
|
23
23
|
}
|
|
24
24
|
exports.getWorkspacePackagePathsAsync = getWorkspacePackagePathsAsync;
|
|
25
25
|
/**
|
|
@@ -27,8 +27,8 @@ exports.getWorkspacePackagePathsAsync = getWorkspacePackagePathsAsync;
|
|
|
27
27
|
* in an npm monorepo.
|
|
28
28
|
*/
|
|
29
29
|
function getNpmWorkspaces(cwd) {
|
|
30
|
-
const
|
|
31
|
-
return (0, packageJsonWorkspaces_1.getWorkspaceInfoFromWorkspaceRoot)(
|
|
30
|
+
const root = getNpmRoot(cwd);
|
|
31
|
+
return (0, packageJsonWorkspaces_1.getWorkspaceInfoFromWorkspaceRoot)(root);
|
|
32
32
|
}
|
|
33
33
|
exports.getNpmWorkspaces = getNpmWorkspaces;
|
|
34
34
|
exports.getWorkspaces = getNpmWorkspaces;
|
|
@@ -37,8 +37,8 @@ exports.getWorkspaces = getNpmWorkspaces;
|
|
|
37
37
|
* in an npm monorepo.
|
|
38
38
|
*/
|
|
39
39
|
function getNpmWorkspacesAsync(cwd) {
|
|
40
|
-
const
|
|
41
|
-
return (0, packageJsonWorkspaces_1.getWorkspaceInfoFromWorkspaceRootAsync)(
|
|
40
|
+
const root = getNpmRoot(cwd);
|
|
41
|
+
return (0, packageJsonWorkspaces_1.getWorkspaceInfoFromWorkspaceRootAsync)(root);
|
|
42
42
|
}
|
|
43
43
|
exports.getNpmWorkspacesAsync = getNpmWorkspacesAsync;
|
|
44
44
|
exports.getWorkspacesAsync = getNpmWorkspacesAsync;
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"npm.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/npm.ts"],"names":[],"mappings":";;;AAAA,wBAA+C;AAE/C,mEAKiC;AAEjC,SAAS,UAAU,CAAC,GAAW;IAC7B,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,+BAA+B,GAAG,GAAG,CAAC,CAAC;KACxD;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,mEAAmE;AACnE,SAAgB,wBAAwB,CAAC,GAAW;IAClD,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAC7B,OAAO,IAAA,wDAAgC,EAAC,IAAI,CAAC,CAAC;AAChD,CAAC;AAHD,4DAGC;AAED,mEAAmE;AACnE,SAAgB,6BAA6B,CAAC,GAAW;IACvD,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAC7B,OAAO,IAAA,6DAAqC,EAAC,IAAI,CAAC,CAAC;AACrD,CAAC;AAHD,sEAGC;AAED;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,GAAW;IAC1C,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAC7B,OAAO,IAAA,yDAAiC,EAAC,IAAI,CAAC,CAAC;AACjD,CAAC;AAHD,4CAGC;AAW4B,yCAAa;AAT1C;;;GAGG;AACH,SAAgB,qBAAqB,CAAC,GAAW;IAC/C,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAC7B,OAAO,IAAA,8DAAsC,EAAC,IAAI,CAAC,CAAC;AACtD,CAAC;AAHD,sDAGC;AAGiC,mDAAkB"}
|
|
@@ -13,15 +13,19 @@ export declare function getPackagePathsFromWorkspaceRootAsync(root: string): Pro
|
|
|
13
13
|
/**
|
|
14
14
|
* Read the `workspaces` property the monorepo root package.json, then process the workspace globs
|
|
15
15
|
* into an array with names, paths, and package.json contents for each package (each "workspace"
|
|
16
|
-
* in npm/yarn/pnpm terms).
|
|
16
|
+
* in npm/yarn/pnpm terms).
|
|
17
|
+
*
|
|
18
|
+
* @returns Array of monorepo package infos, or an empty array on error
|
|
17
19
|
*/
|
|
18
20
|
export declare function getWorkspaceInfoFromWorkspaceRoot(root: string): import("../..").WorkspaceInfos;
|
|
19
21
|
/**
|
|
20
22
|
* Read the `workspaces` property the monorepo root package.json, then process the workspace globs
|
|
21
23
|
* into an array with names, paths, and package.json contents for each package (each "workspace"
|
|
22
|
-
* in npm/yarn/pnpm terms).
|
|
24
|
+
* in npm/yarn/pnpm terms).
|
|
23
25
|
*
|
|
24
26
|
* NOTE: As of writing, this will start promises to read all package.json files in parallel,
|
|
25
27
|
* without direct concurrency control.
|
|
28
|
+
*
|
|
29
|
+
* @returns Array of monorepo package infos, or an empty array on error
|
|
26
30
|
*/
|
|
27
31
|
export declare function getWorkspaceInfoFromWorkspaceRootAsync(root: string): Promise<import("../..").WorkspaceInfos>;
|
|
@@ -19,7 +19,7 @@ function getPackages(root) {
|
|
|
19
19
|
packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonFile, "utf-8"));
|
|
20
20
|
}
|
|
21
21
|
catch (e) {
|
|
22
|
-
throw new Error("Could not load package.json from
|
|
22
|
+
throw new Error("Could not load package.json from monorepo root");
|
|
23
23
|
}
|
|
24
24
|
const { workspaces } = packageJson;
|
|
25
25
|
if (Array.isArray(workspaces)) {
|
|
@@ -65,7 +65,9 @@ exports.getPackagePathsFromWorkspaceRootAsync = getPackagePathsFromWorkspaceRoot
|
|
|
65
65
|
/**
|
|
66
66
|
* Read the `workspaces` property the monorepo root package.json, then process the workspace globs
|
|
67
67
|
* into an array with names, paths, and package.json contents for each package (each "workspace"
|
|
68
|
-
* in npm/yarn/pnpm terms).
|
|
68
|
+
* in npm/yarn/pnpm terms).
|
|
69
|
+
*
|
|
70
|
+
* @returns Array of monorepo package infos, or an empty array on error
|
|
69
71
|
*/
|
|
70
72
|
function getWorkspaceInfoFromWorkspaceRoot(root) {
|
|
71
73
|
try {
|
|
@@ -73,7 +75,7 @@ function getWorkspaceInfoFromWorkspaceRoot(root) {
|
|
|
73
75
|
return (0, getWorkspacePackageInfo_1.getWorkspacePackageInfo)(packagePaths);
|
|
74
76
|
}
|
|
75
77
|
catch (err) {
|
|
76
|
-
(0, logging_1.logVerboseWarning)(`Error getting workspace
|
|
78
|
+
(0, logging_1.logVerboseWarning)(`Error getting workspace package infos for ${root}`, err);
|
|
77
79
|
return [];
|
|
78
80
|
}
|
|
79
81
|
}
|
|
@@ -81,10 +83,12 @@ exports.getWorkspaceInfoFromWorkspaceRoot = getWorkspaceInfoFromWorkspaceRoot;
|
|
|
81
83
|
/**
|
|
82
84
|
* Read the `workspaces` property the monorepo root package.json, then process the workspace globs
|
|
83
85
|
* into an array with names, paths, and package.json contents for each package (each "workspace"
|
|
84
|
-
* in npm/yarn/pnpm terms).
|
|
86
|
+
* in npm/yarn/pnpm terms).
|
|
85
87
|
*
|
|
86
88
|
* NOTE: As of writing, this will start promises to read all package.json files in parallel,
|
|
87
89
|
* without direct concurrency control.
|
|
90
|
+
*
|
|
91
|
+
* @returns Array of monorepo package infos, or an empty array on error
|
|
88
92
|
*/
|
|
89
93
|
async function getWorkspaceInfoFromWorkspaceRootAsync(root) {
|
|
90
94
|
try {
|
|
@@ -92,7 +96,7 @@ async function getWorkspaceInfoFromWorkspaceRootAsync(root) {
|
|
|
92
96
|
return (0, getWorkspacePackageInfo_1.getWorkspacePackageInfoAsync)(packagePaths);
|
|
93
97
|
}
|
|
94
98
|
catch (err) {
|
|
95
|
-
(0, logging_1.logVerboseWarning)(`Error getting workspace
|
|
99
|
+
(0, logging_1.logVerboseWarning)(`Error getting workspace package infos for ${root}`, err);
|
|
96
100
|
return [];
|
|
97
101
|
}
|
|
98
102
|
}
|
|
@@ -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;
|
|
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;AAKlD;;GAEG;AACH,SAAS,WAAW,CAAC,IAAY;IAC/B,MAAM,eAAe,GAAG,cAAI,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAExD,IAAI,WAAsC,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;AARD,sFAQC;AAED;;;;;;GAMG;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,6CAA6C,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC;QAC5E,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AARD,8EAQC;AAED;;;;;;;;;GASG;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,6CAA6C,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC;QAC5E,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AARD,wFAQC"}
|
|
@@ -2,16 +2,21 @@ import type { WorkspaceInfos } from "../../types/WorkspaceInfo";
|
|
|
2
2
|
import type { Catalogs } from "../../types/Catalogs";
|
|
3
3
|
/** @deprecated Use `getWorkspaceManagerRoot` */
|
|
4
4
|
export declare function getPnpmWorkspaceRoot(cwd: string): string;
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Get paths for each package ("workspace") in a pnpm monorepo.
|
|
7
|
+
* @returns Array of monorepo package paths, or an empty array on error
|
|
8
|
+
*/
|
|
6
9
|
export declare function getWorkspacePackagePaths(cwd: string): string[];
|
|
7
10
|
/**
|
|
8
11
|
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
9
12
|
* in a pnpm monorepo.
|
|
13
|
+
* @returns Array of monorepo package infos, or an empty array on error
|
|
10
14
|
*/
|
|
11
15
|
export declare function getPnpmWorkspaces(cwd: string): WorkspaceInfos;
|
|
12
16
|
/**
|
|
13
17
|
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
14
18
|
* in a pnpm monorepo.
|
|
19
|
+
* @returns Array of monorepo package infos, or an empty array on error
|
|
15
20
|
*/
|
|
16
21
|
export declare function getPnpmWorkspacesAsync(cwd: string): Promise<WorkspaceInfos>;
|
|
17
22
|
/**
|
|
@@ -10,7 +10,7 @@ const getWorkspacePackageInfo_1 = require("../getWorkspacePackageInfo");
|
|
|
10
10
|
const readYaml_1 = require("../../lockfile/readYaml");
|
|
11
11
|
const logging_1 = require("../../logging");
|
|
12
12
|
const getWorkspaceManagerAndRoot_1 = require("./getWorkspaceManagerAndRoot");
|
|
13
|
-
function
|
|
13
|
+
function getPnpmRootAndYaml(cwd) {
|
|
14
14
|
const root = getPnpmWorkspaceRoot(cwd);
|
|
15
15
|
const pnpmWorkspacesFile = path_1.default.join(root, "pnpm-workspace.yaml");
|
|
16
16
|
return { root, workspaceYaml: (0, readYaml_1.readYaml)(pnpmWorkspacesFile) };
|
|
@@ -19,15 +19,18 @@ function getPnpmWorkspaceRootAndYaml(cwd) {
|
|
|
19
19
|
function getPnpmWorkspaceRoot(cwd) {
|
|
20
20
|
const root = (0, getWorkspaceManagerAndRoot_1.getWorkspaceManagerAndRoot)(cwd, undefined, "pnpm")?.root;
|
|
21
21
|
if (!root) {
|
|
22
|
-
throw new Error("Could not find pnpm
|
|
22
|
+
throw new Error("Could not find pnpm root from " + cwd);
|
|
23
23
|
}
|
|
24
24
|
return root;
|
|
25
25
|
}
|
|
26
26
|
exports.getPnpmWorkspaceRoot = getPnpmWorkspaceRoot;
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Get paths for each package ("workspace") in a pnpm monorepo.
|
|
29
|
+
* @returns Array of monorepo package paths, or an empty array on error
|
|
30
|
+
*/
|
|
28
31
|
function getWorkspacePackagePaths(cwd) {
|
|
29
32
|
try {
|
|
30
|
-
const { root, workspaceYaml } =
|
|
33
|
+
const { root, workspaceYaml } = getPnpmRootAndYaml(cwd);
|
|
31
34
|
return (0, getPackagePaths_1.getPackagePaths)(root, workspaceYaml.packages);
|
|
32
35
|
}
|
|
33
36
|
catch (err) {
|
|
@@ -39,6 +42,7 @@ exports.getWorkspacePackagePaths = getWorkspacePackagePaths;
|
|
|
39
42
|
/**
|
|
40
43
|
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
41
44
|
* in a pnpm monorepo.
|
|
45
|
+
* @returns Array of monorepo package infos, or an empty array on error
|
|
42
46
|
*/
|
|
43
47
|
function getPnpmWorkspaces(cwd) {
|
|
44
48
|
try {
|
|
@@ -46,7 +50,7 @@ function getPnpmWorkspaces(cwd) {
|
|
|
46
50
|
return (0, getWorkspacePackageInfo_1.getWorkspacePackageInfo)(packagePaths);
|
|
47
51
|
}
|
|
48
52
|
catch (err) {
|
|
49
|
-
(0, logging_1.logVerboseWarning)(`Error getting pnpm
|
|
53
|
+
(0, logging_1.logVerboseWarning)(`Error getting pnpm workspace package infos for ${cwd}`, err);
|
|
50
54
|
return [];
|
|
51
55
|
}
|
|
52
56
|
}
|
|
@@ -55,6 +59,7 @@ exports.getWorkspaces = getPnpmWorkspaces;
|
|
|
55
59
|
/**
|
|
56
60
|
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
57
61
|
* in a pnpm monorepo.
|
|
62
|
+
* @returns Array of monorepo package infos, or an empty array on error
|
|
58
63
|
*/
|
|
59
64
|
async function getPnpmWorkspacesAsync(cwd) {
|
|
60
65
|
try {
|
|
@@ -62,7 +67,7 @@ async function getPnpmWorkspacesAsync(cwd) {
|
|
|
62
67
|
return (0, getWorkspacePackageInfo_1.getWorkspacePackageInfoAsync)(packagePaths);
|
|
63
68
|
}
|
|
64
69
|
catch (err) {
|
|
65
|
-
(0, logging_1.logVerboseWarning)(`Error getting pnpm
|
|
70
|
+
(0, logging_1.logVerboseWarning)(`Error getting pnpm workspace package infos for ${cwd}`, err);
|
|
66
71
|
return [];
|
|
67
72
|
}
|
|
68
73
|
}
|
|
@@ -75,7 +80,7 @@ exports.getWorkspacesAsync = getPnpmWorkspacesAsync;
|
|
|
75
80
|
*/
|
|
76
81
|
function getPnpmCatalogs(cwd) {
|
|
77
82
|
try {
|
|
78
|
-
const { workspaceYaml } =
|
|
83
|
+
const { workspaceYaml } = getPnpmRootAndYaml(cwd);
|
|
79
84
|
if (!workspaceYaml.catalog && !workspaceYaml.catalogs) {
|
|
80
85
|
return undefined;
|
|
81
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pnpm.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/pnpm.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,2DAAwD;AAExD,wEAAmG;AACnG,sDAAmD;AACnD,2CAAkD;AAClD,6EAA0E;AAU1E,SAAS,
|
|
1
|
+
{"version":3,"file":"pnpm.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/pnpm.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,2DAAwD;AAExD,wEAAmG;AACnG,sDAAmD;AACnD,2CAAkD;AAClD,6EAA0E;AAU1E,SAAS,kBAAkB,CAAC,GAAW;IACrC,MAAM,IAAI,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;IACvC,MAAM,kBAAkB,GAAG,cAAI,CAAC,IAAI,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;IAClE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,IAAA,mBAAQ,EAAoB,kBAAkB,CAAC,EAAE,CAAC;AAClF,CAAC;AAED,gDAAgD;AAChD,SAAgB,oBAAoB,CAAC,GAAW;IAC9C,MAAM,IAAI,GAAG,IAAA,uDAA0B,EAAC,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC;IACtE,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,gCAAgC,GAAG,GAAG,CAAC,CAAC;KACzD;IACD,OAAO,IAAI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AO,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE;YACrD,OAAO,SAAS,CAAC;SAClB;QACD,yFAAyF;QACzF,kEAAkE;QAClE,MAAM,EAAE,OAAO,EAAE,mBAAmB,EAAE,GAAG,aAAa,EAAE,GAAG,aAAa,CAAC,QAAQ,IAAI,EAAE,CAAC;QACxF,OAAO;YACL,OAAO,EAAE,aAAa,CAAC,OAAO,IAAI,mBAAmB;YACrD,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS;SACrE,CAAC;KACH;IAAC,OAAO,GAAG,EAAE;QACZ,IAAA,2BAAiB,EAAC,mCAAmC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC;QACjE,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AAjBD,0CAiBC;AAI2B,sCAAW"}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import type { WorkspaceInfos } from "../../types/WorkspaceInfo";
|
|
2
2
|
/** @deprecated Use getWorkspaceRoot */
|
|
3
3
|
export declare function getRushWorkspaceRoot(cwd: string): string;
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Get paths for each package ("workspace") in a rush monorepo.
|
|
6
|
+
* @returns Array of monorepo package paths, or an empty array on error
|
|
7
|
+
*/
|
|
5
8
|
export declare function getWorkspacePackagePaths(cwd: string): string[];
|
|
6
9
|
/**
|
|
7
10
|
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
8
11
|
* in a rush monorepo.
|
|
12
|
+
* @returns Array of monorepo package infos, or an empty array on error
|
|
9
13
|
*/
|
|
10
14
|
export declare function getRushWorkspaces(cwd: string): WorkspaceInfos;
|
|
11
15
|
/**
|
|
12
16
|
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
13
17
|
* in a rush monorepo.
|
|
18
|
+
* @returns Array of monorepo package infos, or an empty array on error
|
|
14
19
|
*/
|
|
15
20
|
export declare function getRushWorkspacesAsync(cwd: string): Promise<WorkspaceInfos>;
|
|
16
21
|
export { getRushWorkspaces as getWorkspaces };
|
|
@@ -14,18 +14,20 @@ const getWorkspaceManagerAndRoot_1 = require("./getWorkspaceManagerAndRoot");
|
|
|
14
14
|
function getRushWorkspaceRoot(cwd) {
|
|
15
15
|
const root = (0, getWorkspaceManagerAndRoot_1.getWorkspaceManagerAndRoot)(cwd, undefined, "rush")?.root;
|
|
16
16
|
if (!root) {
|
|
17
|
-
throw new Error("Could not find rush
|
|
17
|
+
throw new Error("Could not find rush root from " + cwd);
|
|
18
18
|
}
|
|
19
19
|
return root;
|
|
20
20
|
}
|
|
21
21
|
exports.getRushWorkspaceRoot = getRushWorkspaceRoot;
|
|
22
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Get paths for each package ("workspace") in a rush monorepo.
|
|
24
|
+
* @returns Array of monorepo package paths, or an empty array on error
|
|
25
|
+
*/
|
|
23
26
|
function getWorkspacePackagePaths(cwd) {
|
|
24
27
|
try {
|
|
25
|
-
const
|
|
26
|
-
const rushJsonPath = path_1.default.join(
|
|
28
|
+
const root = getRushWorkspaceRoot(cwd);
|
|
29
|
+
const rushJsonPath = path_1.default.join(root, "rush.json");
|
|
27
30
|
const rushConfig = jju_1.default.parse(fs_1.default.readFileSync(rushJsonPath, "utf-8"));
|
|
28
|
-
const root = path_1.default.dirname(rushJsonPath);
|
|
29
31
|
return rushConfig.projects.map((project) => path_1.default.join(root, project.projectFolder));
|
|
30
32
|
}
|
|
31
33
|
catch (err) {
|
|
@@ -37,6 +39,7 @@ exports.getWorkspacePackagePaths = getWorkspacePackagePaths;
|
|
|
37
39
|
/**
|
|
38
40
|
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
39
41
|
* in a rush monorepo.
|
|
42
|
+
* @returns Array of monorepo package infos, or an empty array on error
|
|
40
43
|
*/
|
|
41
44
|
function getRushWorkspaces(cwd) {
|
|
42
45
|
try {
|
|
@@ -44,7 +47,7 @@ function getRushWorkspaces(cwd) {
|
|
|
44
47
|
return (0, getWorkspacePackageInfo_1.getWorkspacePackageInfo)(packagePaths);
|
|
45
48
|
}
|
|
46
49
|
catch (err) {
|
|
47
|
-
(0, logging_1.logVerboseWarning)(`Error getting rush
|
|
50
|
+
(0, logging_1.logVerboseWarning)(`Error getting rush workspace package infos for ${cwd}`, err);
|
|
48
51
|
return [];
|
|
49
52
|
}
|
|
50
53
|
}
|
|
@@ -53,6 +56,7 @@ exports.getWorkspaces = getRushWorkspaces;
|
|
|
53
56
|
/**
|
|
54
57
|
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
55
58
|
* in a rush monorepo.
|
|
59
|
+
* @returns Array of monorepo package infos, or an empty array on error
|
|
56
60
|
*/
|
|
57
61
|
async function getRushWorkspacesAsync(cwd) {
|
|
58
62
|
try {
|
|
@@ -60,7 +64,7 @@ async function getRushWorkspacesAsync(cwd) {
|
|
|
60
64
|
return (0, getWorkspacePackageInfo_1.getWorkspacePackageInfoAsync)(packagePaths);
|
|
61
65
|
}
|
|
62
66
|
catch (err) {
|
|
63
|
-
(0, logging_1.logVerboseWarning)(`Error getting rush
|
|
67
|
+
(0, logging_1.logVerboseWarning)(`Error getting rush workspace package infos for ${cwd}`, err);
|
|
64
68
|
return [];
|
|
65
69
|
}
|
|
66
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rush.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/rush.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,8CAAsB;AACtB,4CAAoB;AAGpB,wEAAmG;AACnG,2CAAkD;AAClD,6EAA0E;AAE1E,uCAAuC;AACvC,SAAgB,oBAAoB,CAAC,GAAW;IAC9C,MAAM,IAAI,GAAG,IAAA,uDAA0B,EAAC,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC;IACtE,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CAAC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,CAAC,CAAC;KAC9C;IAAC,OAAO,GAAG,EAAE;QACZ,IAAA,2BAAiB,EAAC,kDAAkD,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC;QAChF,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AARD,8CAQC;AAiB6B,0CAAa;AAf3C;;;;GAIG;AACI,KAAK,UAAU,sBAAsB,CAAC,GAAW;IACtD,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,kDAAkD,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC;QAChF,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AARD,wDAQC;AAGkC,oDAAkB"}
|
|
@@ -2,18 +2,26 @@ import type { WorkspaceInfos } from "../../types/WorkspaceInfo";
|
|
|
2
2
|
import type { Catalogs } from "../../types/Catalogs";
|
|
3
3
|
/** @deprecated Use `getWorkspaceManagerRoot` */
|
|
4
4
|
export declare function getYarnWorkspaceRoot(cwd: string): string;
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Get paths for each package ("workspace") in a yarn monorepo.
|
|
7
|
+
* @returns Array of monorepo package paths, or an empty array on error
|
|
8
|
+
*/
|
|
6
9
|
export declare function getWorkspacePackagePaths(cwd: string): string[];
|
|
7
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Get paths for each package ("workspace") in a yarn monorepo.
|
|
12
|
+
* @returns Array of monorepo package paths, or an empty array on error
|
|
13
|
+
*/
|
|
8
14
|
export declare function getWorkspacePackagePathsAsync(cwd: string): Promise<string[]>;
|
|
9
15
|
/**
|
|
10
16
|
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
11
17
|
* in a yarn monorepo.
|
|
18
|
+
* @returns Array of monorepo package infos, or an empty array on error
|
|
12
19
|
*/
|
|
13
20
|
export declare function getYarnWorkspaces(cwd: string): WorkspaceInfos;
|
|
14
21
|
/**
|
|
15
22
|
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
16
23
|
* in a yarn monorepo.
|
|
24
|
+
* @returns Array of monorepo package infos, or an empty array on error
|
|
17
25
|
*/
|
|
18
26
|
export declare function getYarnWorkspacesAsync(cwd: string): Promise<WorkspaceInfos>;
|
|
19
27
|
/**
|
|
@@ -15,40 +15,48 @@ const readYaml_1 = require("../../lockfile/readYaml");
|
|
|
15
15
|
function getYarnWorkspaceRoot(cwd) {
|
|
16
16
|
const root = (0, index_1.getWorkspaceManagerAndRoot)(cwd, undefined, "yarn")?.root;
|
|
17
17
|
if (!root) {
|
|
18
|
-
throw new Error("Could not find yarn
|
|
18
|
+
throw new Error("Could not find yarn root from " + cwd);
|
|
19
19
|
}
|
|
20
20
|
return root;
|
|
21
21
|
}
|
|
22
22
|
exports.getYarnWorkspaceRoot = getYarnWorkspaceRoot;
|
|
23
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* Get paths for each package ("workspace") in a yarn monorepo.
|
|
25
|
+
* @returns Array of monorepo package paths, or an empty array on error
|
|
26
|
+
*/
|
|
24
27
|
function getWorkspacePackagePaths(cwd) {
|
|
25
|
-
const
|
|
26
|
-
return (0, packageJsonWorkspaces_1.getPackagePathsFromWorkspaceRoot)(
|
|
28
|
+
const root = getYarnWorkspaceRoot(cwd);
|
|
29
|
+
return (0, packageJsonWorkspaces_1.getPackagePathsFromWorkspaceRoot)(root);
|
|
27
30
|
}
|
|
28
31
|
exports.getWorkspacePackagePaths = getWorkspacePackagePaths;
|
|
29
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Get paths for each package ("workspace") in a yarn monorepo.
|
|
34
|
+
* @returns Array of monorepo package paths, or an empty array on error
|
|
35
|
+
*/
|
|
30
36
|
function getWorkspacePackagePathsAsync(cwd) {
|
|
31
|
-
const
|
|
32
|
-
return (0, packageJsonWorkspaces_1.getPackagePathsFromWorkspaceRootAsync)(
|
|
37
|
+
const root = getYarnWorkspaceRoot(cwd);
|
|
38
|
+
return (0, packageJsonWorkspaces_1.getPackagePathsFromWorkspaceRootAsync)(root);
|
|
33
39
|
}
|
|
34
40
|
exports.getWorkspacePackagePathsAsync = getWorkspacePackagePathsAsync;
|
|
35
41
|
/**
|
|
36
42
|
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
37
43
|
* in a yarn monorepo.
|
|
44
|
+
* @returns Array of monorepo package infos, or an empty array on error
|
|
38
45
|
*/
|
|
39
46
|
function getYarnWorkspaces(cwd) {
|
|
40
|
-
const
|
|
41
|
-
return (0, packageJsonWorkspaces_1.getWorkspaceInfoFromWorkspaceRoot)(
|
|
47
|
+
const root = getYarnWorkspaceRoot(cwd);
|
|
48
|
+
return (0, packageJsonWorkspaces_1.getWorkspaceInfoFromWorkspaceRoot)(root);
|
|
42
49
|
}
|
|
43
50
|
exports.getYarnWorkspaces = getYarnWorkspaces;
|
|
44
51
|
exports.getWorkspaces = getYarnWorkspaces;
|
|
45
52
|
/**
|
|
46
53
|
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
47
54
|
* in a yarn monorepo.
|
|
55
|
+
* @returns Array of monorepo package infos, or an empty array on error
|
|
48
56
|
*/
|
|
49
57
|
function getYarnWorkspacesAsync(cwd) {
|
|
50
|
-
const
|
|
51
|
-
return (0, packageJsonWorkspaces_1.getWorkspaceInfoFromWorkspaceRootAsync)(
|
|
58
|
+
const root = getYarnWorkspaceRoot(cwd);
|
|
59
|
+
return (0, packageJsonWorkspaces_1.getWorkspaceInfoFromWorkspaceRootAsync)(root);
|
|
52
60
|
}
|
|
53
61
|
exports.getYarnWorkspacesAsync = getYarnWorkspacesAsync;
|
|
54
62
|
exports.getWorkspacesAsync = getYarnWorkspacesAsync;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yarn.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/yarn.ts"],"names":[],"mappings":";;;;;;AAAA,4CA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