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
|
@@ -1,32 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getWorkspacesAsync = exports.getWorkspaces = exports.getYarnWorkspacesAsync = exports.getYarnWorkspaces = exports.getWorkspacePackagePathsAsync = exports.getWorkspacePackagePaths = exports.getYarnWorkspaceRoot = void 0;
|
|
4
|
-
const
|
|
6
|
+
exports.getCatalogs = exports.getWorkspacesAsync = exports.getWorkspaces = exports.getYarnCatalogs = exports.getYarnWorkspacesAsync = exports.getYarnWorkspaces = exports.getWorkspacePackagePathsAsync = exports.getWorkspacePackagePaths = exports.getYarnWorkspaceRoot = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const index_1 = require("./index");
|
|
5
10
|
const packageJsonWorkspaces_1 = require("./packageJsonWorkspaces");
|
|
6
|
-
|
|
11
|
+
const getPackageInfo_1 = require("../../getPackageInfo");
|
|
12
|
+
const logging_1 = require("../../logging");
|
|
13
|
+
const readYaml_1 = require("../../lockfile/readYaml");
|
|
14
|
+
/** @deprecated Use `getWorkspaceManagerRoot` */
|
|
7
15
|
function getYarnWorkspaceRoot(cwd) {
|
|
8
|
-
const root = (0,
|
|
16
|
+
const root = (0, index_1.getWorkspaceManagerAndRoot)(cwd, undefined, "yarn")?.root;
|
|
9
17
|
if (!root) {
|
|
10
18
|
throw new Error("Could not find yarn workspace root from " + cwd);
|
|
11
19
|
}
|
|
12
20
|
return root;
|
|
13
21
|
}
|
|
14
22
|
exports.getYarnWorkspaceRoot = getYarnWorkspaceRoot;
|
|
15
|
-
/** Get
|
|
23
|
+
/** Get paths for each package ("workspace") in a yarn monorepo. */
|
|
16
24
|
function getWorkspacePackagePaths(cwd) {
|
|
17
25
|
const yarnWorkspacesRoot = getYarnWorkspaceRoot(cwd);
|
|
18
26
|
return (0, packageJsonWorkspaces_1.getPackagePathsFromWorkspaceRoot)(yarnWorkspacesRoot);
|
|
19
27
|
}
|
|
20
28
|
exports.getWorkspacePackagePaths = getWorkspacePackagePaths;
|
|
21
|
-
/** Get
|
|
29
|
+
/** Get paths for each package ("workspace") in a yarn monorepo. */
|
|
22
30
|
function getWorkspacePackagePathsAsync(cwd) {
|
|
23
31
|
const yarnWorkspacesRoot = getYarnWorkspaceRoot(cwd);
|
|
24
32
|
return (0, packageJsonWorkspaces_1.getPackagePathsFromWorkspaceRootAsync)(yarnWorkspacesRoot);
|
|
25
33
|
}
|
|
26
34
|
exports.getWorkspacePackagePathsAsync = getWorkspacePackagePathsAsync;
|
|
27
35
|
/**
|
|
28
|
-
* Get an array with names, paths, and package.json contents for each package
|
|
29
|
-
*
|
|
36
|
+
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
37
|
+
* in a yarn monorepo.
|
|
30
38
|
*/
|
|
31
39
|
function getYarnWorkspaces(cwd) {
|
|
32
40
|
const yarnWorkspacesRoot = getYarnWorkspaceRoot(cwd);
|
|
@@ -35,8 +43,8 @@ function getYarnWorkspaces(cwd) {
|
|
|
35
43
|
exports.getYarnWorkspaces = getYarnWorkspaces;
|
|
36
44
|
exports.getWorkspaces = getYarnWorkspaces;
|
|
37
45
|
/**
|
|
38
|
-
* Get an array with names, paths, and package.json contents for each package
|
|
39
|
-
*
|
|
46
|
+
* Get an array with names, paths, and package.json contents for each package ("workspace")
|
|
47
|
+
* in a yarn monorepo.
|
|
40
48
|
*/
|
|
41
49
|
function getYarnWorkspacesAsync(cwd) {
|
|
42
50
|
const yarnWorkspacesRoot = getYarnWorkspaceRoot(cwd);
|
|
@@ -44,4 +52,37 @@ function getYarnWorkspacesAsync(cwd) {
|
|
|
44
52
|
}
|
|
45
53
|
exports.getYarnWorkspacesAsync = getYarnWorkspacesAsync;
|
|
46
54
|
exports.getWorkspacesAsync = getYarnWorkspacesAsync;
|
|
55
|
+
/**
|
|
56
|
+
* Get version catalogs if present.
|
|
57
|
+
* Returns undefined if there's no catalog, or any issue reading or parsing.
|
|
58
|
+
* @see https://yarnpkg.com/features/catalogs
|
|
59
|
+
*/
|
|
60
|
+
function getYarnCatalogs(cwd) {
|
|
61
|
+
try {
|
|
62
|
+
const root = getYarnWorkspaceRoot(cwd);
|
|
63
|
+
const yarnrcYmlPath = path_1.default.join(root, ".yarnrc.yml");
|
|
64
|
+
if (fs_1.default.existsSync(yarnrcYmlPath)) {
|
|
65
|
+
const yarnrcYml = (0, readYaml_1.readYaml)(yarnrcYmlPath);
|
|
66
|
+
if (yarnrcYml?.catalog || yarnrcYml?.catalogs) {
|
|
67
|
+
// Yarn v4+ format
|
|
68
|
+
return { default: yarnrcYml.catalog, named: yarnrcYml.catalogs };
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
// Check for midgard-yarn-strict definition of catalogs in package.json
|
|
73
|
+
const workspaceSettings = (0, getPackageInfo_1.getPackageInfo)(root)?.workspaces;
|
|
74
|
+
if (workspaceSettings &&
|
|
75
|
+
!Array.isArray(workspaceSettings) &&
|
|
76
|
+
(workspaceSettings?.catalog || workspaceSettings?.catalogs)) {
|
|
77
|
+
return { named: workspaceSettings.catalogs, default: workspaceSettings.catalog };
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
(0, logging_1.logVerboseWarning)(`Error getting yarn catalogs for ${cwd}`, err);
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.getYarnCatalogs = getYarnCatalogs;
|
|
87
|
+
exports.getCatalogs = getYarnCatalogs;
|
|
47
88
|
//# 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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AjCrD;;;;GAIG;AACH,SAAgB,eAAe,CAAC,GAAW;IACzC,IAAI;QACF,MAAM,IAAI,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;QACvC,MAAM,aAAa,GAAG,cAAI,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QACrD,IAAI,YAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE;YAChC,MAAM,SAAS,GAAG,IAAA,mBAAQ,EAAkD,aAAa,CAAC,CAAC;YAC3F,IAAI,SAAS,EAAE,OAAO,IAAI,SAAS,EAAE,QAAQ,EAAE;gBAC7C,kBAAkB;gBAClB,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,QAAQ,EAAE,CAAC;aAClE;SACF;aAAM;YACL,uEAAuE;YACvE,MAAM,iBAAiB,GAAG,IAAA,+BAAc,EAAC,IAAI,CAAC,EAAE,UAAU,CAAC;YAC3D,IACE,iBAAiB;gBACjB,CAAC,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC;gBACjC,CAAC,iBAAiB,EAAE,OAAO,IAAI,iBAAiB,EAAE,QAAQ,CAAC,EAC3D;gBACA,OAAO,EAAE,KAAK,EAAE,iBAAiB,CAAC,QAAQ,EAAE,OAAO,EAAE,iBAAiB,CAAC,OAAO,EAAE,CAAC;aAClF;SACF;KACF;IAAC,OAAO,GAAG,EAAE;QACZ,IAAA,2BAAiB,EAAC,mCAAmC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC;QACjE,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AAzBD,0CAyBC;AAI2B,sCAAW"}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type { WorkspaceInfos } from "../types/WorkspaceInfo";
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Just write `workspaces.map(w => w.name)` directly
|
|
4
|
+
*/
|
|
5
|
+
export declare function listOfWorkspacePackageNames(workspaces: WorkspaceInfos): string[];
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.listOfWorkspacePackageNames = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Just write `workspaces.map(w => w.name)` directly
|
|
6
|
+
*/
|
|
4
7
|
function listOfWorkspacePackageNames(workspaces) {
|
|
5
8
|
return workspaces.map(({ name }) => name);
|
|
6
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listOfWorkspacePackageNames.js","sourceRoot":"","sources":["../../src/workspaces/listOfWorkspacePackageNames.ts"],"names":[],"mappings":";;;AAEA,SAAgB,2BAA2B,CAAC,
|
|
1
|
+
{"version":3,"file":"listOfWorkspacePackageNames.js","sourceRoot":"","sources":["../../src/workspaces/listOfWorkspacePackageNames.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,SAAgB,2BAA2B,CAAC,UAA0B;IACpE,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC;AAFD,kEAEC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "workspace-tools",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
],
|
|
15
15
|
"scripts": {
|
|
16
16
|
"api": "ws-tools-scripts api",
|
|
17
|
-
"build": "tsc",
|
|
17
|
+
"build": "tsc --pretty",
|
|
18
18
|
"start": "tsc -w --preserveWatchOutput",
|
|
19
19
|
"test": "jest"
|
|
20
20
|
},
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
"micromatch": "^4.0.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"lodash": "^4.17.21",
|
|
32
31
|
"@ws-tools/scripts": "*"
|
|
33
32
|
}
|
|
34
33
|
}
|