workspace-tools 0.31.0 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +63 -1
- package/CHANGELOG.md +28 -2
- package/README.md +4 -0
- package/lib/dependencies/transitiveDeps.js +2 -1
- package/lib/dependencies/transitiveDeps.js.map +1 -1
- package/lib/getPackagePaths.d.ts +10 -2
- package/lib/getPackagePaths.js +32 -33
- package/lib/getPackagePaths.js.map +1 -1
- package/lib/graph/createDependencyMap.js +2 -1
- package/lib/graph/createDependencyMap.js.map +1 -1
- package/lib/graph/getPackageDependencies.d.ts +2 -2
- package/lib/graph/getPackageDependencies.js +23 -6
- package/lib/graph/getPackageDependencies.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.js +10 -3
- package/lib/index.js.map +1 -1
- package/lib/lockfile/index.js +1 -1
- package/lib/lockfile/index.js.map +1 -1
- package/lib/logging.d.ts +5 -0
- package/lib/logging.js +15 -0
- package/lib/logging.js.map +1 -0
- package/lib/paths.js +7 -1
- package/lib/paths.js.map +1 -1
- package/lib/types/WorkspaceInfo.d.ts +7 -0
- package/lib/workspaces/findWorkspacePath.d.ts +7 -0
- package/lib/workspaces/findWorkspacePath.js +9 -4
- package/lib/workspaces/findWorkspacePath.js.map +1 -1
- package/lib/workspaces/getWorkspacePackageInfo.d.ts +22 -2
- package/lib/workspaces/getWorkspacePackageInfo.js +43 -22
- package/lib/workspaces/getWorkspacePackageInfo.js.map +1 -1
- package/lib/workspaces/getWorkspaceRoot.d.ts +8 -1
- package/lib/workspaces/getWorkspaceRoot.js +9 -18
- package/lib/workspaces/getWorkspaceRoot.js.map +1 -1
- package/lib/workspaces/getWorkspaces.d.ts +16 -0
- package/lib/workspaces/getWorkspaces.js +25 -28
- package/lib/workspaces/getWorkspaces.js.map +1 -1
- package/lib/workspaces/implementations/getWorkspaceManagerAndRoot.d.ts +22 -0
- package/lib/workspaces/implementations/getWorkspaceManagerAndRoot.js +63 -0
- package/lib/workspaces/implementations/getWorkspaceManagerAndRoot.js.map +1 -0
- package/lib/workspaces/implementations/getWorkspaceUtilities.d.ts +18 -0
- package/lib/workspaces/implementations/getWorkspaceUtilities.js +26 -0
- package/lib/workspaces/implementations/getWorkspaceUtilities.js.map +1 -0
- package/lib/workspaces/implementations/index.d.ts +2 -14
- package/lib/workspaces/implementations/index.js +5 -55
- package/lib/workspaces/implementations/index.js.map +1 -1
- package/lib/workspaces/implementations/lerna.d.ts +6 -2
- package/lib/workspaces/implementations/lerna.js +17 -10
- package/lib/workspaces/implementations/lerna.js.map +1 -1
- package/lib/workspaces/implementations/npm.d.ts +10 -1
- package/lib/workspaces/implementations/npm.js +19 -8
- package/lib/workspaces/implementations/npm.js.map +1 -1
- package/lib/workspaces/implementations/packageJsonWorkspaces.d.ts +8 -1
- package/lib/workspaces/implementations/packageJsonWorkspaces.js +26 -24
- package/lib/workspaces/implementations/packageJsonWorkspaces.js.map +1 -1
- package/lib/workspaces/implementations/pnpm.d.ts +6 -0
- package/lib/workspaces/implementations/pnpm.js +16 -7
- package/lib/workspaces/implementations/pnpm.js.map +1 -1
- package/lib/workspaces/implementations/rush.d.ts +6 -0
- package/lib/workspaces/implementations/rush.js +16 -7
- package/lib/workspaces/implementations/rush.js.map +1 -1
- package/lib/workspaces/implementations/yarn.d.ts +11 -0
- package/lib/workspaces/implementations/yarn.js +20 -7
- package/lib/workspaces/implementations/yarn.js.map +1 -1
- package/lib/workspaces/workspaces.d.ts +11 -3
- package/lib/workspaces/workspaces.js +13 -5
- package/lib/workspaces/workspaces.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"npm.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/npm.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"npm.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/npm.ts"],"names":[],"mappings":";;;AAAA,wBAA+C;AAE/C,mEAAoH;AAEpH,SAAS,mBAAmB,CAAC,GAAW;;IACtC,MAAM,IAAI,GAAG,MAAA,IAAA,6BAA0B,EAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,0CAAE,IAAI,CAAC;IACrE,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,yCAAyC,GAAG,GAAG,CAAC,CAAC;KAClE;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,GAAW;IAC1C,MAAM,iBAAiB,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACnD,OAAO,IAAA,yDAAiC,EAAC,iBAAiB,CAAC,CAAC;AAC9D,CAAC;AAHD,4CAGC;AAW4B,yCAAa;AAT1C;;;GAGG;AACH,SAAgB,qBAAqB,CAAC,GAAW;IAC/C,MAAM,iBAAiB,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACnD,OAAO,IAAA,8DAAsC,EAAC,iBAAiB,CAAC,CAAC;AACnE,CAAC;AAHD,sDAGC;AAGiC,mDAAkB"}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Get an array with names, paths, and package.json contents for each package in an npm/yarn workspace.
|
|
3
|
+
* (See `../getWorkspaces` for why it's named this way.)
|
|
4
|
+
*/
|
|
2
5
|
export declare function getWorkspaceInfoFromWorkspaceRoot(packageJsonWorkspacesRoot: string): import("../..").WorkspaceInfo;
|
|
6
|
+
/**
|
|
7
|
+
* Get an array with names, paths, and package.json contents for each package in an npm/yarn workspace.
|
|
8
|
+
* (See `../getWorkspaces` for why it's named this way.)
|
|
9
|
+
*/
|
|
3
10
|
export declare function getWorkspaceInfoFromWorkspaceRootAsync(packageJsonWorkspacesRoot: string): Promise<import("../..").WorkspaceInfo>;
|
|
@@ -3,59 +3,61 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getWorkspaceInfoFromWorkspaceRootAsync = exports.getWorkspaceInfoFromWorkspaceRoot =
|
|
6
|
+
exports.getWorkspaceInfoFromWorkspaceRootAsync = exports.getWorkspaceInfoFromWorkspaceRoot = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const _1 = require(".");
|
|
10
9
|
const getPackagePaths_1 = require("../../getPackagePaths");
|
|
11
10
|
const getWorkspacePackageInfo_1 = require("../getWorkspacePackageInfo");
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
exports.getPackageJsonWorkspaceRoot = getPackageJsonWorkspaceRoot;
|
|
19
|
-
function getRootPackageJson(packageJsonWorkspacesRoot) {
|
|
11
|
+
const logging_1 = require("../../logging");
|
|
12
|
+
/**
|
|
13
|
+
* Read the workspace root package.json and get the list of package globs from its `workspaces` property.
|
|
14
|
+
*/
|
|
15
|
+
function getPackages(packageJsonWorkspacesRoot) {
|
|
20
16
|
const packageJsonFile = path_1.default.join(packageJsonWorkspacesRoot, "package.json");
|
|
17
|
+
let packageJson;
|
|
21
18
|
try {
|
|
22
|
-
|
|
23
|
-
return packageJson;
|
|
19
|
+
packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonFile, "utf-8"));
|
|
24
20
|
}
|
|
25
21
|
catch (e) {
|
|
26
22
|
throw new Error("Could not load package.json from workspaces root");
|
|
27
23
|
}
|
|
28
|
-
}
|
|
29
|
-
function getPackages(packageJson) {
|
|
30
24
|
const { workspaces } = packageJson;
|
|
31
|
-
if (
|
|
25
|
+
if (Array.isArray(workspaces)) {
|
|
32
26
|
return workspaces;
|
|
33
27
|
}
|
|
34
|
-
if (!workspaces ||
|
|
28
|
+
if (!(workspaces === null || workspaces === void 0 ? void 0 : workspaces.packages)) {
|
|
35
29
|
throw new Error("Could not find a workspaces object in package.json");
|
|
36
30
|
}
|
|
37
31
|
return workspaces.packages;
|
|
38
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Get an array with names, paths, and package.json contents for each package in an npm/yarn workspace.
|
|
35
|
+
* (See `../getWorkspaces` for why it's named this way.)
|
|
36
|
+
*/
|
|
39
37
|
function getWorkspaceInfoFromWorkspaceRoot(packageJsonWorkspacesRoot) {
|
|
40
38
|
try {
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const packagePaths = (0, getPackagePaths_1.getPackagePaths)(packageJsonWorkspacesRoot, packages);
|
|
39
|
+
const packageGlobs = getPackages(packageJsonWorkspacesRoot);
|
|
40
|
+
const packagePaths = (0, getPackagePaths_1.getPackagePaths)(packageJsonWorkspacesRoot, packageGlobs);
|
|
44
41
|
return (0, getWorkspacePackageInfo_1.getWorkspacePackageInfo)(packagePaths);
|
|
45
42
|
}
|
|
46
|
-
catch {
|
|
43
|
+
catch (err) {
|
|
44
|
+
(0, logging_1.logVerboseWarning)(`Error getting workspace info for ${packageJsonWorkspacesRoot}`, err);
|
|
47
45
|
return [];
|
|
48
46
|
}
|
|
49
47
|
}
|
|
50
48
|
exports.getWorkspaceInfoFromWorkspaceRoot = getWorkspaceInfoFromWorkspaceRoot;
|
|
49
|
+
/**
|
|
50
|
+
* Get an array with names, paths, and package.json contents for each package in an npm/yarn workspace.
|
|
51
|
+
* (See `../getWorkspaces` for why it's named this way.)
|
|
52
|
+
*/
|
|
51
53
|
async function getWorkspaceInfoFromWorkspaceRootAsync(packageJsonWorkspacesRoot) {
|
|
52
54
|
try {
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
const packagePaths = await (0, getPackagePaths_1.getPackagePathsAsync)(packageJsonWorkspacesRoot, packages);
|
|
55
|
+
const packageGlobs = getPackages(packageJsonWorkspacesRoot);
|
|
56
|
+
const packagePaths = await (0, getPackagePaths_1.getPackagePathsAsync)(packageJsonWorkspacesRoot, packageGlobs);
|
|
56
57
|
return (0, getWorkspacePackageInfo_1.getWorkspacePackageInfoAsync)(packagePaths);
|
|
57
58
|
}
|
|
58
|
-
catch {
|
|
59
|
+
catch (err) {
|
|
60
|
+
(0, logging_1.logVerboseWarning)(`Error getting workspace info for ${packageJsonWorkspacesRoot}`, err);
|
|
59
61
|
return [];
|
|
60
62
|
}
|
|
61
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageJsonWorkspaces.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/packageJsonWorkspaces.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"packageJsonWorkspaces.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/packageJsonWorkspaces.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,2DAA8E;AAC9E,wEAAmG;AACnG,2CAAkD;AAWlD;;GAEG;AACH,SAAS,WAAW,CAAC,yBAAiC;IACpD,MAAM,eAAe,GAAG,cAAI,CAAC,IAAI,CAAC,yBAAyB,EAAE,cAAc,CAAC,CAAC;IAE7E,IAAI,WAAsC,CAAC;IAC3C,IAAI;QACF,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAE,CAAC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAA8B,CAAC;KAClG;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;KACrE;IAED,MAAM,EAAE,UAAU,EAAE,GAAG,WAAW,CAAC;IAEnC,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;QAC7B,OAAO,UAAU,CAAC;KACnB;IAED,IAAI,CAAC,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,QAAQ,CAAA,EAAE;QACzB,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;KACvE;IAED,OAAO,UAAU,CAAC,QAAQ,CAAC;AAC7B,CAAC;AAED;;;GAGG;AACH,SAAgB,iCAAiC,CAAC,yBAAiC;IACjF,IAAI;QACF,MAAM,YAAY,GAAG,WAAW,CAAC,yBAAyB,CAAC,CAAC;QAC5D,MAAM,YAAY,GAAG,IAAA,iCAAe,EAAC,yBAAyB,EAAE,YAAY,CAAC,CAAC;QAC9E,OAAO,IAAA,iDAAuB,EAAC,YAAY,CAAC,CAAC;KAC9C;IAAC,OAAO,GAAG,EAAE;QACZ,IAAA,2BAAiB,EAAC,oCAAoC,yBAAyB,EAAE,EAAE,GAAG,CAAC,CAAC;QACxF,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AATD,8EASC;AAED;;;GAGG;AACI,KAAK,UAAU,sCAAsC,CAAC,yBAAiC;IAC5F,IAAI;QACF,MAAM,YAAY,GAAG,WAAW,CAAC,yBAAyB,CAAC,CAAC;QAC5D,MAAM,YAAY,GAAG,MAAM,IAAA,sCAAoB,EAAC,yBAAyB,EAAE,YAAY,CAAC,CAAC;QACzF,OAAO,IAAA,sDAA4B,EAAC,YAAY,CAAC,CAAC;KACnD;IAAC,OAAO,GAAG,EAAE;QACZ,IAAA,2BAAiB,EAAC,oCAAoC,yBAAyB,EAAE,EAAE,GAAG,CAAC,CAAC;QACxF,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AATD,wFASC"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { WorkspaceInfo } from "../../types/WorkspaceInfo";
|
|
2
|
+
/** @deprecated Use `getWorkspaceRoot` */
|
|
2
3
|
export declare function getPnpmWorkspaceRoot(cwd: string): string;
|
|
4
|
+
/**
|
|
5
|
+
* Get an array with names, paths, and package.json contents for each package in a pnpm workspace.
|
|
6
|
+
* (See `../getWorkspaces` for why it's named this way.)
|
|
7
|
+
*/
|
|
3
8
|
export declare function getPnpmWorkspaces(cwd: string): WorkspaceInfo;
|
|
9
|
+
export { getPnpmWorkspaces as getWorkspaces };
|
|
@@ -3,20 +3,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getPnpmWorkspaces = exports.getPnpmWorkspaceRoot = void 0;
|
|
6
|
+
exports.getWorkspaces = exports.getPnpmWorkspaces = exports.getPnpmWorkspaceRoot = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const getPackagePaths_1 = require("../../getPackagePaths");
|
|
9
9
|
const getWorkspacePackageInfo_1 = require("../getWorkspacePackageInfo");
|
|
10
10
|
const readYaml_1 = require("../../lockfile/readYaml");
|
|
11
|
-
const
|
|
11
|
+
const logging_1 = require("../../logging");
|
|
12
|
+
const getWorkspaceManagerAndRoot_1 = require("./getWorkspaceManagerAndRoot");
|
|
13
|
+
/** @deprecated Use `getWorkspaceRoot` */
|
|
12
14
|
function getPnpmWorkspaceRoot(cwd) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
var _a;
|
|
16
|
+
const root = (_a = (0, getWorkspaceManagerAndRoot_1.getWorkspaceManagerAndRoot)(cwd, undefined, "pnpm")) === null || _a === void 0 ? void 0 : _a.root;
|
|
17
|
+
if (!root) {
|
|
18
|
+
throw new Error("Could not find pnpm workspace root from " + cwd);
|
|
16
19
|
}
|
|
17
|
-
return
|
|
20
|
+
return root;
|
|
18
21
|
}
|
|
19
22
|
exports.getPnpmWorkspaceRoot = getPnpmWorkspaceRoot;
|
|
23
|
+
/**
|
|
24
|
+
* Get an array with names, paths, and package.json contents for each package in a pnpm workspace.
|
|
25
|
+
* (See `../getWorkspaces` for why it's named this way.)
|
|
26
|
+
*/
|
|
20
27
|
function getPnpmWorkspaces(cwd) {
|
|
21
28
|
try {
|
|
22
29
|
const pnpmWorkspacesRoot = getPnpmWorkspaceRoot(cwd);
|
|
@@ -26,9 +33,11 @@ function getPnpmWorkspaces(cwd) {
|
|
|
26
33
|
const workspaceInfo = (0, getWorkspacePackageInfo_1.getWorkspacePackageInfo)(packagePaths);
|
|
27
34
|
return workspaceInfo;
|
|
28
35
|
}
|
|
29
|
-
catch {
|
|
36
|
+
catch (err) {
|
|
37
|
+
(0, logging_1.logVerboseWarning)(`Error getting pnpm workspaces for ${cwd}`, err);
|
|
30
38
|
return [];
|
|
31
39
|
}
|
|
32
40
|
}
|
|
33
41
|
exports.getPnpmWorkspaces = getPnpmWorkspaces;
|
|
42
|
+
exports.getWorkspaces = getPnpmWorkspaces;
|
|
34
43
|
//# sourceMappingURL=pnpm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pnpm.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/pnpm.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,2DAAwD;AAExD,wEAAqE;AACrE,sDAAmD;AACnD,
|
|
1
|
+
{"version":3,"file":"pnpm.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/pnpm.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,2DAAwD;AAExD,wEAAqE;AACrE,sDAAmD;AACnD,2CAAkD;AAClD,6EAA0E;AAM1E,yCAAyC;AACzC,SAAgB,oBAAoB,CAAC,GAAW;;IAC9C,MAAM,IAAI,GAAG,MAAA,IAAA,uDAA0B,EAAC,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,0CAAE,IAAI,CAAC;IACtE,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,0CAA0C,GAAG,GAAG,CAAC,CAAC;KACnE;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAND,oDAMC;AAED;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,GAAW;IAC3C,IAAI;QACF,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;QACrD,MAAM,kBAAkB,GAAG,cAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,CAAC;QAEhF,MAAM,cAAc,GAAG,IAAA,mBAAQ,EAAC,kBAAkB,CAAsB,CAAC;QAEzE,MAAM,YAAY,GAAG,IAAA,iCAAe,EAAC,kBAAkB,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;QAClF,MAAM,aAAa,GAAG,IAAA,iDAAuB,EAAC,YAAY,CAAC,CAAC;QAE5D,OAAO,aAAa,CAAC;KACtB;IAAC,OAAO,GAAG,EAAE;QACZ,IAAA,2BAAiB,EAAC,qCAAqC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC;QACnE,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AAfD,8CAeC;AAE6B,0CAAa"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { WorkspaceInfo } from "../../types/WorkspaceInfo";
|
|
2
|
+
/** @deprecated Use getWorkspaceRoot */
|
|
2
3
|
export declare function getRushWorkspaceRoot(cwd: string): string;
|
|
4
|
+
/**
|
|
5
|
+
* Get an array with names, paths, and package.json contents for each package in a rush workspace.
|
|
6
|
+
* (See `../getWorkspaces` for why it's named this way.)
|
|
7
|
+
*/
|
|
3
8
|
export declare function getRushWorkspaces(cwd: string): WorkspaceInfo;
|
|
9
|
+
export { getRushWorkspaces as getWorkspaces };
|
|
@@ -3,20 +3,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getRushWorkspaces = exports.getRushWorkspaceRoot = void 0;
|
|
6
|
+
exports.getWorkspaces = exports.getRushWorkspaces = exports.getRushWorkspaceRoot = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const jju_1 = __importDefault(require("jju"));
|
|
9
9
|
const fs_1 = __importDefault(require("fs"));
|
|
10
10
|
const getWorkspacePackageInfo_1 = require("../getWorkspacePackageInfo");
|
|
11
|
-
const
|
|
11
|
+
const logging_1 = require("../../logging");
|
|
12
|
+
const getWorkspaceManagerAndRoot_1 = require("./getWorkspaceManagerAndRoot");
|
|
13
|
+
/** @deprecated Use getWorkspaceRoot */
|
|
12
14
|
function getRushWorkspaceRoot(cwd) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
var _a;
|
|
16
|
+
const root = (_a = (0, getWorkspaceManagerAndRoot_1.getWorkspaceManagerAndRoot)(cwd, undefined, "rush")) === null || _a === void 0 ? void 0 : _a.root;
|
|
17
|
+
if (!root) {
|
|
18
|
+
throw new Error("Could not find rush workspace root from " + cwd);
|
|
16
19
|
}
|
|
17
|
-
return
|
|
20
|
+
return root;
|
|
18
21
|
}
|
|
19
22
|
exports.getRushWorkspaceRoot = getRushWorkspaceRoot;
|
|
23
|
+
/**
|
|
24
|
+
* Get an array with names, paths, and package.json contents for each package in a rush workspace.
|
|
25
|
+
* (See `../getWorkspaces` for why it's named this way.)
|
|
26
|
+
*/
|
|
20
27
|
function getRushWorkspaces(cwd) {
|
|
21
28
|
try {
|
|
22
29
|
const rushWorkspaceRoot = getRushWorkspaceRoot(cwd);
|
|
@@ -25,9 +32,11 @@ function getRushWorkspaces(cwd) {
|
|
|
25
32
|
const root = path_1.default.dirname(rushJsonPath);
|
|
26
33
|
return (0, getWorkspacePackageInfo_1.getWorkspacePackageInfo)(rushConfig.projects.map((project) => path_1.default.join(root, project.projectFolder)));
|
|
27
34
|
}
|
|
28
|
-
catch {
|
|
35
|
+
catch (err) {
|
|
36
|
+
(0, logging_1.logVerboseWarning)(`Error getting rush workspaces for ${cwd}`, err);
|
|
29
37
|
return [];
|
|
30
38
|
}
|
|
31
39
|
}
|
|
32
40
|
exports.getRushWorkspaces = getRushWorkspaces;
|
|
41
|
+
exports.getWorkspaces = getRushWorkspaces;
|
|
33
42
|
//# sourceMappingURL=rush.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rush.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/rush.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,8CAAsB;AACtB,4CAAoB;AAGpB,wEAAqE;AACrE,uCAAuC;
|
|
1
|
+
{"version":3,"file":"rush.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/rush.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,8CAAsB;AACtB,4CAAoB;AAGpB,wEAAqE;AACrE,2CAAkD;AAClD,6EAA0E;AAE1E,uCAAuC;AACvC,SAAgB,oBAAoB,CAAC,GAAW;;IAC9C,MAAM,IAAI,GAAG,MAAA,IAAA,uDAA0B,EAAC,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,0CAAE,IAAI,CAAC;IACtE,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,0CAA0C,GAAG,GAAG,CAAC,CAAC;KACnE;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAND,oDAMC;AAED;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,GAAW;IAC3C,IAAI;QACF,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;QACpD,MAAM,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC;QAE/D,MAAM,UAAU,GAAmD,aAAG,CAAC,KAAK,CAC1E,YAAE,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CACvC,CAAC;QACF,MAAM,IAAI,GAAG,cAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAExC,OAAO,IAAA,iDAAuB,EAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,cAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;KAC9G;IAAC,OAAO,GAAG,EAAE;QACZ,IAAA,2BAAiB,EAAC,qCAAqC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC;QACnE,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AAfD,8CAeC;AAE6B,0CAAa"}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import { WorkspaceInfo } from "../../types/WorkspaceInfo";
|
|
2
|
+
/** @deprecated Use `getWorkspaceRoot` */
|
|
2
3
|
export declare function getYarnWorkspaceRoot(cwd: string): string;
|
|
4
|
+
/**
|
|
5
|
+
* Get an array with names, paths, and package.json contents for each package in a yarn workspace.
|
|
6
|
+
* (See `../getWorkspaces` for why it's named this way.)
|
|
7
|
+
*/
|
|
3
8
|
export declare function getYarnWorkspaces(cwd: string): WorkspaceInfo;
|
|
9
|
+
/**
|
|
10
|
+
* Get an array with names, paths, and package.json contents for each package in a yarn workspace.
|
|
11
|
+
* (See `../getWorkspaces` for why it's named this way.)
|
|
12
|
+
*/
|
|
4
13
|
export declare function getYarnWorkspacesAsync(cwd: string): Promise<WorkspaceInfo>;
|
|
14
|
+
export { getYarnWorkspaces as getWorkspaces };
|
|
15
|
+
export { getYarnWorkspacesAsync as getWorkspacesAsync };
|
|
@@ -1,23 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getYarnWorkspacesAsync = exports.getYarnWorkspaces = exports.getYarnWorkspaceRoot = void 0;
|
|
3
|
+
exports.getWorkspacesAsync = exports.getWorkspaces = exports.getYarnWorkspacesAsync = exports.getYarnWorkspaces = exports.getYarnWorkspaceRoot = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
4
5
|
const packageJsonWorkspaces_1 = require("./packageJsonWorkspaces");
|
|
6
|
+
/** @deprecated Use `getWorkspaceRoot` */
|
|
5
7
|
function getYarnWorkspaceRoot(cwd) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
var _a;
|
|
9
|
+
const root = (_a = (0, _1.getWorkspaceManagerAndRoot)(cwd, undefined, "yarn")) === null || _a === void 0 ? void 0 : _a.root;
|
|
10
|
+
if (!root) {
|
|
11
|
+
throw new Error("Could not find yarn workspace root from " + cwd);
|
|
9
12
|
}
|
|
10
|
-
return
|
|
13
|
+
return root;
|
|
11
14
|
}
|
|
12
15
|
exports.getYarnWorkspaceRoot = getYarnWorkspaceRoot;
|
|
16
|
+
/**
|
|
17
|
+
* Get an array with names, paths, and package.json contents for each package in a yarn workspace.
|
|
18
|
+
* (See `../getWorkspaces` for why it's named this way.)
|
|
19
|
+
*/
|
|
13
20
|
function getYarnWorkspaces(cwd) {
|
|
14
21
|
const yarnWorkspacesRoot = getYarnWorkspaceRoot(cwd);
|
|
15
22
|
return (0, packageJsonWorkspaces_1.getWorkspaceInfoFromWorkspaceRoot)(yarnWorkspacesRoot);
|
|
16
23
|
}
|
|
17
24
|
exports.getYarnWorkspaces = getYarnWorkspaces;
|
|
18
|
-
|
|
25
|
+
exports.getWorkspaces = getYarnWorkspaces;
|
|
26
|
+
/**
|
|
27
|
+
* Get an array with names, paths, and package.json contents for each package in a yarn workspace.
|
|
28
|
+
* (See `../getWorkspaces` for why it's named this way.)
|
|
29
|
+
*/
|
|
30
|
+
function getYarnWorkspacesAsync(cwd) {
|
|
19
31
|
const yarnWorkspacesRoot = getYarnWorkspaceRoot(cwd);
|
|
20
|
-
return
|
|
32
|
+
return (0, packageJsonWorkspaces_1.getWorkspaceInfoFromWorkspaceRootAsync)(yarnWorkspacesRoot);
|
|
21
33
|
}
|
|
22
34
|
exports.getYarnWorkspacesAsync = getYarnWorkspacesAsync;
|
|
35
|
+
exports.getWorkspacesAsync = getYarnWorkspacesAsync;
|
|
23
36
|
//# sourceMappingURL=yarn.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yarn.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/yarn.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"yarn.js","sourceRoot":"","sources":["../../../src/workspaces/implementations/yarn.ts"],"names":[],"mappings":";;;AAAA,wBAA+C;AAE/C,mEAAoH;AAEpH,yCAAyC;AACzC,SAAgB,oBAAoB,CAAC,GAAW;;IAC9C,MAAM,IAAI,GAAG,MAAA,IAAA,6BAA0B,EAAC,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,0CAAE,IAAI,CAAC;IACtE,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,0CAA0C,GAAG,GAAG,CAAC,CAAC;KACnE;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAND,oDAMC;AAED;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,GAAW;IAC3C,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;IACrD,OAAO,IAAA,yDAAiC,EAAC,kBAAkB,CAAC,CAAC;AAC/D,CAAC;AAHD,8CAGC;AAW6B,0CAAa;AAT3C;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,GAAW;IAChD,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;IACrD,OAAO,IAAA,8DAAsC,EAAC,kBAAkB,CAAC,CAAC;AACpE,CAAC;AAHD,wDAGC;AAGkC,oDAAkB"}
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Get paths to every package.json in the workspace, given a cwd
|
|
3
|
-
*
|
|
2
|
+
* Get paths to every package.json in the workspace, given a cwd.
|
|
3
|
+
*
|
|
4
|
+
* **WARNING**: On first call for a given `cwd`, this will **read ALL package.json files,
|
|
5
|
+
* not only their paths**!
|
|
4
6
|
*/
|
|
5
7
|
export declare function getAllPackageJsonFiles(cwd: string): string[];
|
|
6
|
-
export declare function
|
|
8
|
+
export declare function _resetPackageJsonFilesCache(): void;
|
|
9
|
+
/**
|
|
10
|
+
* Get paths to every package.json in the workspace, given a cwd.
|
|
11
|
+
*
|
|
12
|
+
* **WARNING**: On first call for a given `cwd`, this will **read ALL package.json files,
|
|
13
|
+
* not only their paths**!
|
|
14
|
+
*/
|
|
7
15
|
export declare function getAllPackageJsonFilesAsync(cwd: string): Promise<string[]>;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAllPackageJsonFilesAsync = exports.
|
|
3
|
+
exports.getAllPackageJsonFilesAsync = exports._resetPackageJsonFilesCache = exports.getAllPackageJsonFiles = void 0;
|
|
4
4
|
const getWorkspaces_1 = require("./getWorkspaces");
|
|
5
5
|
const cache = new Map();
|
|
6
6
|
/**
|
|
7
|
-
* Get paths to every package.json in the workspace, given a cwd
|
|
8
|
-
*
|
|
7
|
+
* Get paths to every package.json in the workspace, given a cwd.
|
|
8
|
+
*
|
|
9
|
+
* **WARNING**: On first call for a given `cwd`, this will **read ALL package.json files,
|
|
10
|
+
* not only their paths**!
|
|
9
11
|
*/
|
|
10
12
|
function getAllPackageJsonFiles(cwd) {
|
|
11
13
|
if (cache.has(cwd)) {
|
|
@@ -17,10 +19,16 @@ function getAllPackageJsonFiles(cwd) {
|
|
|
17
19
|
return packageJsonFiles;
|
|
18
20
|
}
|
|
19
21
|
exports.getAllPackageJsonFiles = getAllPackageJsonFiles;
|
|
20
|
-
function
|
|
22
|
+
function _resetPackageJsonFilesCache() {
|
|
21
23
|
cache.clear();
|
|
22
24
|
}
|
|
23
|
-
exports.
|
|
25
|
+
exports._resetPackageJsonFilesCache = _resetPackageJsonFilesCache;
|
|
26
|
+
/**
|
|
27
|
+
* Get paths to every package.json in the workspace, given a cwd.
|
|
28
|
+
*
|
|
29
|
+
* **WARNING**: On first call for a given `cwd`, this will **read ALL package.json files,
|
|
30
|
+
* not only their paths**!
|
|
31
|
+
*/
|
|
24
32
|
async function getAllPackageJsonFilesAsync(cwd) {
|
|
25
33
|
if (cache.has(cwd)) {
|
|
26
34
|
return cache.get(cwd);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspaces.js","sourceRoot":"","sources":["../../src/workspaces/workspaces.ts"],"names":[],"mappings":";;;AAAA,mDAAoE;AAEpE,MAAM,KAAK,GAAG,IAAI,GAAG,EAAoB,CAAC;AAE1C
|
|
1
|
+
{"version":3,"file":"workspaces.js","sourceRoot":"","sources":["../../src/workspaces/workspaces.ts"],"names":[],"mappings":";;;AAAA,mDAAoE;AAEpE,MAAM,KAAK,GAAG,IAAI,GAAG,EAAoB,CAAC;AAE1C;;;;;GAKG;AACH,SAAgB,sBAAsB,CAAC,GAAW;IAChD,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;QAClB,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC;KACxB;IAED,MAAM,UAAU,GAAG,IAAA,6BAAa,EAAC,GAAG,CAAC,CAAC;IACtC,MAAM,gBAAgB,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;IAE9F,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;IAEjC,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAXD,wDAWC;AAED,SAAgB,2BAA2B;IACzC,KAAK,CAAC,KAAK,EAAE,CAAC;AAChB,CAAC;AAFD,kEAEC;AAED;;;;;GAKG;AACI,KAAK,UAAU,2BAA2B,CAAC,GAAW;IAC3D,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;QAClB,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC;KACxB;IAED,MAAM,UAAU,GAAG,MAAM,IAAA,kCAAkB,EAAC,GAAG,CAAC,CAAC;IACjD,MAAM,gBAAgB,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;IAE9F,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;IAEjC,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAXD,kEAWC"}
|