workspace-tools 0.38.4 → 0.38.6
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/getPackageInfo.d.ts +13 -0
- package/lib/getPackageInfo.js +52 -0
- package/lib/getPackageInfo.js.map +1 -0
- 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 +33 -0
- package/lib/workspaces/catalogs.js +66 -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/package.json +2 -3
package/lib/paths.d.ts
CHANGED
|
@@ -18,4 +18,7 @@ export declare function findPackageRoot(cwd: string): string | undefined;
|
|
|
18
18
|
* falling back to the git root if no workspace is detected.
|
|
19
19
|
*/
|
|
20
20
|
export declare function findProjectRoot(cwd: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Determines if `child` path is a subdirectory of `parent` path.
|
|
23
|
+
*/
|
|
21
24
|
export declare function isChildOf(child: string, parent: string): boolean;
|
package/lib/paths.js
CHANGED
|
@@ -57,7 +57,7 @@ exports.findPackageRoot = findPackageRoot;
|
|
|
57
57
|
function findProjectRoot(cwd) {
|
|
58
58
|
let workspaceRoot;
|
|
59
59
|
try {
|
|
60
|
-
workspaceRoot = (0, getWorkspaceRoot_1.
|
|
60
|
+
workspaceRoot = (0, getWorkspaceRoot_1.getWorkspaceManagerRoot)(cwd);
|
|
61
61
|
}
|
|
62
62
|
catch (err) {
|
|
63
63
|
(0, logging_1.logVerboseWarning)(`Error getting workspace root for ${cwd}`, err);
|
|
@@ -68,6 +68,9 @@ function findProjectRoot(cwd) {
|
|
|
68
68
|
return workspaceRoot || findGitRoot(cwd);
|
|
69
69
|
}
|
|
70
70
|
exports.findProjectRoot = findProjectRoot;
|
|
71
|
+
/**
|
|
72
|
+
* Determines if `child` path is a subdirectory of `parent` path.
|
|
73
|
+
*/
|
|
71
74
|
function isChildOf(child, parent) {
|
|
72
75
|
const relativePath = path_1.default.relative(child, parent);
|
|
73
76
|
return /^[.\/\\]+$/.test(relativePath);
|
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,
|
|
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,MAAM,IAAI,GAAG,cAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;IAElC,IAAI,SAA6B,CAAC;IAElC,OAAO,CAAC,SAAS,IAAI,GAAG,KAAK,IAAI,EAAE;QACjC,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAChE,IAAI,SAAS,EAAE;YACb,MAAM;SACP;QAED,GAAG,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;KACzB;IAED,OAAO,SAAS,CAAC,CAAC,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3D,CAAC;AAlBD,4BAkBC;AAED;;;GAGG;AACH,SAAgB,WAAW,CAAC,GAAW;IACrC,MAAM,MAAM,GAAG,IAAA,SAAG,EAAC,CAAC,WAAW,EAAE,iBAAiB,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;IAC9D,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;QACnB,MAAM,IAAI,KAAK,CAAC,cAAc,GAAG,8BAA8B,CAAC,CAAC;KAClE;IAED,OAAO,cAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACvC,CAAC;AAPD,kCAOC;AAED;;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;;;GAGG;AACH,SAAgB,eAAe,CAAC,GAAW;IACzC,IAAI,aAAiC,CAAC;IACtC,IAAI;QACF,aAAa,GAAG,IAAA,0CAAuB,EAAC,GAAG,CAAC,CAAC;KAC9C;IAAC,OAAO,GAAG,EAAE;QACZ,IAAA,2BAAiB,EAAC,oCAAoC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC;KACnE;IAED,IAAI,CAAC,aAAa,EAAE;QAClB,IAAA,2BAAiB,EAAC,qCAAqC,GAAG,6BAA6B,CAAC,CAAC;KAC1F;IACD,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"}
|
package/lib/tsdoc-metadata.json
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mapping from package name to package version.
|
|
3
|
+
* @see https://pnpm.io/catalogs#default-catalog
|
|
4
|
+
* @see https://yarnpkg.com/features/catalogs#basic-usage
|
|
5
|
+
*/
|
|
6
|
+
export interface Catalog {
|
|
7
|
+
[packageName: string]: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Mapping from catalog name (non-default) to catalog definition
|
|
11
|
+
* @see https://pnpm.io/catalogs#named-catalogs
|
|
12
|
+
* @see https://yarnpkg.com/features/catalogs#named-catalogs
|
|
13
|
+
*/
|
|
14
|
+
export interface NamedCatalogs {
|
|
15
|
+
[catalogName: string]: Catalog;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Package version catalogs
|
|
19
|
+
* @see https://pnpm.io/catalogs
|
|
20
|
+
* @see https://yarnpkg.com/features/catalogs
|
|
21
|
+
*/
|
|
22
|
+
export interface Catalogs {
|
|
23
|
+
/**
|
|
24
|
+
* The default catalog if present.
|
|
25
|
+
* (This can't be combined with the named catalogs because "default" could be a catalog name.)
|
|
26
|
+
*/
|
|
27
|
+
default?: Catalog;
|
|
28
|
+
/** Mapping from catalog name to catalog definition, if present */
|
|
29
|
+
named?: NamedCatalogs;
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Catalogs.js","sourceRoot":"","sources":["../../src/types/Catalogs.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import type { Catalog, NamedCatalogs } from "./Catalogs";
|
|
2
|
+
/** Contents of `package.json`, plus the `packageJsonPath` */
|
|
1
3
|
export interface PackageInfo {
|
|
2
|
-
|
|
4
|
+
/** Absolute path to this package.json file */
|
|
3
5
|
packageJsonPath: string;
|
|
6
|
+
name: string;
|
|
4
7
|
version: string;
|
|
5
8
|
dependencies?: {
|
|
6
9
|
[dep: string]: string;
|
|
@@ -25,7 +28,22 @@ export interface PackageInfo {
|
|
|
25
28
|
directory?: string;
|
|
26
29
|
};
|
|
27
30
|
[key: string]: any;
|
|
31
|
+
/**
|
|
32
|
+
* Workspace info, only in the root package.json for certain managers.
|
|
33
|
+
* If an array of strings, it's a list of workspace package patterns.
|
|
34
|
+
*/
|
|
35
|
+
workspaces?: string[] | {
|
|
36
|
+
/** List of workspace package patterns */
|
|
37
|
+
packages: string[];
|
|
38
|
+
nohoist?: string[];
|
|
39
|
+
/** `midgard-yarn-strict` catalog definition (yarn4/pnpm use yaml config) */
|
|
40
|
+
catalog?: Catalog;
|
|
41
|
+
/** `midgard-yarn-strict` named catalog definition (yarn4/pnpm use yaml config) */
|
|
42
|
+
catalogs?: NamedCatalogs;
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
};
|
|
28
45
|
}
|
|
46
|
+
/** Mapping from package name to info (`package.json`) for packages within a monorepo. */
|
|
29
47
|
export interface PackageInfos {
|
|
30
48
|
[pkgName: string]: PackageInfo;
|
|
31
49
|
}
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import { PackageInfo } from "./PackageInfo";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Info about a single package ("workspace" in npm/yarn/pnpm terms) within a monorepo.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* package.json config used by npm/yarn (instead of referring to the entire monorepo).
|
|
5
|
+
* Ideally this should be called just `WorkspaceInfo`, but that name was previously used for the
|
|
6
|
+
* aggregate type.
|
|
8
7
|
*/
|
|
9
|
-
export
|
|
8
|
+
export interface WorkspacePackageInfo {
|
|
9
|
+
/** Package name */
|
|
10
10
|
name: string;
|
|
11
|
+
/** Absolute path to the package root */
|
|
11
12
|
path: string;
|
|
13
|
+
/** `package.json` contents + path */
|
|
12
14
|
packageJson: PackageInfo;
|
|
13
|
-
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Array with names, paths, and package.json contents for each package ("workspace" in
|
|
18
|
+
* npm/yarn/pnpm terms) within a monorepo.
|
|
19
|
+
*/
|
|
20
|
+
export type WorkspaceInfos = WorkspacePackageInfo[];
|
|
21
|
+
/** @deprecated Use `WorkspaceInfos` */
|
|
22
|
+
export type WorkspaceInfo = WorkspaceInfos;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Catalogs } from "../types/Catalogs";
|
|
2
|
+
/**
|
|
3
|
+
* Get version catalogs, if supported by the manager (only pnpm and yarn v4 as of writing).
|
|
4
|
+
* Returns undefined if no catalogs are present or the manager doesn't support them.
|
|
5
|
+
* @see https://pnpm.io/catalogs
|
|
6
|
+
* @see https://yarnpkg.com/features/catalogs
|
|
7
|
+
*/
|
|
8
|
+
export declare function getCatalogs(cwd: string): Catalogs | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Returns true if the version starts with `catalog:`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isCatalogVersion(version: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Given a dependency package name and a version spec string, if the version starts with `catalog:`,
|
|
15
|
+
* look up the actual version spec (not the final resolved version) from the given catalogs.
|
|
16
|
+
*
|
|
17
|
+
* Throws an error if there's anything invalid about the catalog spec (no catalogs defined,
|
|
18
|
+
* no matching catalog, catalog doesn't contain `name`, recursive catalog version).
|
|
19
|
+
*
|
|
20
|
+
* Returns undefined if the version doesn't start with `catalog:`.
|
|
21
|
+
* @see https://pnpm.io/catalogs
|
|
22
|
+
* @see https://yarnpkg.com/features/catalogs
|
|
23
|
+
*
|
|
24
|
+
* @param name - Dependency package name
|
|
25
|
+
* @param version - Dependency version spec, e.g. `catalog:my-catalog` or `catalog:`,
|
|
26
|
+
* or some non-catalog spec like `^1.2.3`
|
|
27
|
+
* @returns Actual version spec from the catalog, or undefined if not a catalog version
|
|
28
|
+
*/
|
|
29
|
+
export declare function getCatalogVersion(params: {
|
|
30
|
+
name: string;
|
|
31
|
+
version: string;
|
|
32
|
+
catalogs: Catalogs | undefined;
|
|
33
|
+
}): string | undefined;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCatalogVersion = exports.isCatalogVersion = exports.getCatalogs = void 0;
|
|
4
|
+
const implementations_1 = require("./implementations");
|
|
5
|
+
/**
|
|
6
|
+
* Get version catalogs, if supported by the manager (only pnpm and yarn v4 as of writing).
|
|
7
|
+
* Returns undefined if no catalogs are present or the manager doesn't support them.
|
|
8
|
+
* @see https://pnpm.io/catalogs
|
|
9
|
+
* @see https://yarnpkg.com/features/catalogs
|
|
10
|
+
*/
|
|
11
|
+
function getCatalogs(cwd) {
|
|
12
|
+
const utils = (0, implementations_1.getWorkspaceUtilities)(cwd);
|
|
13
|
+
return utils?.getCatalogs?.(cwd);
|
|
14
|
+
}
|
|
15
|
+
exports.getCatalogs = getCatalogs;
|
|
16
|
+
const catalogPrefix = "catalog:";
|
|
17
|
+
/**
|
|
18
|
+
* Returns true if the version starts with `catalog:`.
|
|
19
|
+
*/
|
|
20
|
+
function isCatalogVersion(version) {
|
|
21
|
+
return version.startsWith(catalogPrefix);
|
|
22
|
+
}
|
|
23
|
+
exports.isCatalogVersion = isCatalogVersion;
|
|
24
|
+
/**
|
|
25
|
+
* Given a dependency package name and a version spec string, if the version starts with `catalog:`,
|
|
26
|
+
* look up the actual version spec (not the final resolved version) from the given catalogs.
|
|
27
|
+
*
|
|
28
|
+
* Throws an error if there's anything invalid about the catalog spec (no catalogs defined,
|
|
29
|
+
* no matching catalog, catalog doesn't contain `name`, recursive catalog version).
|
|
30
|
+
*
|
|
31
|
+
* Returns undefined if the version doesn't start with `catalog:`.
|
|
32
|
+
* @see https://pnpm.io/catalogs
|
|
33
|
+
* @see https://yarnpkg.com/features/catalogs
|
|
34
|
+
*
|
|
35
|
+
* @param name - Dependency package name
|
|
36
|
+
* @param version - Dependency version spec, e.g. `catalog:my-catalog` or `catalog:`,
|
|
37
|
+
* or some non-catalog spec like `^1.2.3`
|
|
38
|
+
* @returns Actual version spec from the catalog, or undefined if not a catalog version
|
|
39
|
+
*/
|
|
40
|
+
function getCatalogVersion(params) {
|
|
41
|
+
const { name, version, catalogs } = params;
|
|
42
|
+
if (!isCatalogVersion(version)) {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
if (!catalogs) {
|
|
46
|
+
throw new Error(`Dependency "${name}" uses a catalog version "${version}" but no catalogs are defined.`);
|
|
47
|
+
}
|
|
48
|
+
const catalogName = version.slice(catalogPrefix.length);
|
|
49
|
+
// If there's no name specified after "catalog:", use the default catalog.
|
|
50
|
+
// Otherwise use the named catalog.
|
|
51
|
+
const checkCatalog = catalogName ? catalogs.named?.[catalogName] : catalogs.default;
|
|
52
|
+
const catalogNameStr = catalogName ? `catalogs.${catalogName}` : "the default catalog";
|
|
53
|
+
if (!checkCatalog) {
|
|
54
|
+
throw new Error(`Dependency "${name}" uses a catalog version "${version}" but ${catalogNameStr} is not defined.`);
|
|
55
|
+
}
|
|
56
|
+
const actualSpec = checkCatalog[name];
|
|
57
|
+
if (!actualSpec) {
|
|
58
|
+
throw new Error(`Dependency "${name}" uses a catalog version "${version}", but ${catalogNameStr} doesn't define a version for "${name}".`);
|
|
59
|
+
}
|
|
60
|
+
if (isCatalogVersion(actualSpec)) {
|
|
61
|
+
throw new Error(`Dependency "${name}" resolves to a recursive catalog version "${actualSpec}", which is not supported.`);
|
|
62
|
+
}
|
|
63
|
+
return actualSpec;
|
|
64
|
+
}
|
|
65
|
+
exports.getCatalogVersion = getCatalogVersion;
|
|
66
|
+
//# sourceMappingURL=catalogs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalogs.js","sourceRoot":"","sources":["../../src/workspaces/catalogs.ts"],"names":[],"mappings":";;;AACA,uDAA0D;AAE1D;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,GAAW;IACrC,MAAM,KAAK,GAAG,IAAA,uCAAqB,EAAC,GAAG,CAAC,CAAC;IACzC,OAAO,KAAK,EAAE,WAAW,EAAE,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC;AAHD,kCAGC;AAED,MAAM,aAAa,GAAG,UAAU,CAAC;AAEjC;;GAEG;AACH,SAAgB,gBAAgB,CAAC,OAAe;IAC9C,OAAO,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAC3C,CAAC;AAFD,4CAEC;AAED;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,iBAAiB,CAAC,MAIjC;IACC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IAE3C,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE;QAC9B,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CAAC,eAAe,IAAI,6BAA6B,OAAO,gCAAgC,CAAC,CAAC;KAC1G;IAED,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IACxD,0EAA0E;IAC1E,mCAAmC;IACnC,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC;IACpF,MAAM,cAAc,GAAG,WAAW,CAAC,CAAC,CAAC,YAAY,WAAW,EAAE,CAAC,CAAC,CAAC,qBAAqB,CAAC;IAEvF,IAAI,CAAC,YAAY,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,eAAe,IAAI,6BAA6B,OAAO,SAAS,cAAc,kBAAkB,CAAC,CAAC;KACnH;IAED,MAAM,UAAU,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,IAAI,KAAK,CACb,eAAe,IAAI,6BAA6B,OAAO,UAAU,cAAc,kCAAkC,IAAI,IAAI,CAC1H,CAAC;KACH;IAED,IAAI,gBAAgB,CAAC,UAAU,CAAC,EAAE;QAChC,MAAM,IAAI,KAAK,CACb,eAAe,IAAI,8CAA8C,UAAU,4BAA4B,CACxG,CAAC;KACH;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAvCD,8CAuCC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { WorkspaceInfos } from "../types/WorkspaceInfo";
|
|
2
2
|
/**
|
|
3
|
-
* Find the path for a particular package name from an array of info about packages
|
|
4
|
-
*
|
|
5
|
-
* @param workspaces Array of info about packages within a
|
|
3
|
+
* Find the path for a particular package name from an array of info about packages ("workspaces"
|
|
4
|
+
* in npm/yarn/pnpm terms) within a monorepo.
|
|
5
|
+
* @param workspaces Array of info about packages within a monorepo
|
|
6
6
|
* @param packageName Package name to find
|
|
7
7
|
* @returns Package path if found, or undefined
|
|
8
8
|
*/
|
|
9
|
-
export declare function findWorkspacePath(workspaces:
|
|
9
|
+
export declare function findWorkspacePath(workspaces: WorkspaceInfos, packageName: string): string | undefined;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.findWorkspacePath = void 0;
|
|
4
4
|
/**
|
|
5
|
-
* Find the path for a particular package name from an array of info about packages
|
|
6
|
-
*
|
|
7
|
-
* @param workspaces Array of info about packages within a
|
|
5
|
+
* Find the path for a particular package name from an array of info about packages ("workspaces"
|
|
6
|
+
* in npm/yarn/pnpm terms) within a monorepo.
|
|
7
|
+
* @param workspaces Array of info about packages within a monorepo
|
|
8
8
|
* @param packageName Package name to find
|
|
9
9
|
* @returns Package path if found, or undefined
|
|
10
10
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findWorkspacePath.js","sourceRoot":"","sources":["../../src/workspaces/findWorkspacePath.ts"],"names":[],"mappings":";;;AAEA;;;;;;GAMG;AACH,SAAgB,iBAAiB,CAAC,
|
|
1
|
+
{"version":3,"file":"findWorkspacePath.js","sourceRoot":"","sources":["../../src/workspaces/findWorkspacePath.ts"],"names":[],"mappings":";;;AAEA;;;;;;GAMG;AACH,SAAgB,iBAAiB,CAAC,UAA0B,EAAE,WAAmB;IAC/E,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,KAAK,WAAW,CAAC,EAAE,IAAI,CAAC;AACnE,CAAC;AAFD,8CAEC"}
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { WorkspaceInfos } from "../types/WorkspaceInfo";
|
|
2
2
|
/**
|
|
3
3
|
* Get an array with names, paths, and package.json contents for each of the given package paths
|
|
4
|
-
* within a
|
|
4
|
+
* ("workspace" paths in npm/yarn/pnpm terms) within a monorepo.
|
|
5
5
|
*
|
|
6
6
|
* This is an internal helper used by `getWorkspaces` implementations for different managers.
|
|
7
|
-
*
|
|
8
|
-
* @param packagePaths Paths to packages within a
|
|
7
|
+
*
|
|
8
|
+
* @param packagePaths Paths to packages within a monorepo
|
|
9
9
|
* @returns Array of workspace package infos
|
|
10
10
|
* @internal
|
|
11
11
|
*/
|
|
12
|
-
export declare function getWorkspacePackageInfo(packagePaths: string[]):
|
|
12
|
+
export declare function getWorkspacePackageInfo(packagePaths: string[]): WorkspaceInfos;
|
|
13
13
|
/**
|
|
14
14
|
* Get an array with names, paths, and package.json contents for each of the given package paths
|
|
15
|
-
* within a
|
|
15
|
+
* ("workspace" paths in npm/yarn/pnpm terms) within a monorepo.
|
|
16
|
+
*
|
|
17
|
+
* NOTE: As of writing, this will start promises to read all package.json files in parallel,
|
|
18
|
+
* without direct concurrency control.
|
|
16
19
|
*
|
|
17
20
|
* This is an internal helper used by `getWorkspaces` implementations for different managers.
|
|
18
|
-
*
|
|
19
|
-
* @param packagePaths Paths to packages within a
|
|
21
|
+
*
|
|
22
|
+
* @param packagePaths Paths to packages within a monorepo
|
|
20
23
|
* @returns Array of workspace package infos
|
|
21
24
|
* @internal
|
|
22
25
|
*/
|
|
23
|
-
export declare function getWorkspacePackageInfoAsync(packagePaths: string[]): Promise<
|
|
26
|
+
export declare function getWorkspacePackageInfoAsync(packagePaths: string[]): Promise<WorkspaceInfos>;
|
|
@@ -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 getPackageInfo_1 = require("../getPackageInfo");
|
|
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, getPackageInfo_1.getPackageInfo)(workspacePath);
|
|
29
|
+
if (!packageJson) {
|
|
30
|
+
return null; // getPackageInfo 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,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,EAAE,EAAE;QAClD,MAAM,WAAW,GAAG,IAAA,+BAAc,EAAC,aAAa,CAAC,CAAC;QAClD,IAAI,CAAC,WAAW,EAAE;YAChB,OAAO,IAAI,CAAC,CAAC,0CAA0C;SACxD;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"}
|