workspace-tools 0.18.0 → 0.18.1
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 +16 -1
- package/CHANGELOG.md +10 -2
- package/lib/__tests__/dependencies.test.js +6 -6
- package/lib/__tests__/getChangedPackages.test.js +31 -31
- package/lib/__tests__/getDefaultRemote.test.js +6 -6
- package/lib/__tests__/getInitDefaultBranch.test.js +6 -6
- package/lib/__tests__/getScopedPackages.test.js +9 -9
- package/lib/__tests__/getWorkspaceRoot.test.js +11 -11
- package/lib/__tests__/getWorkspaces.test.js +15 -15
- package/lib/__tests__/lockfile.test.js +12 -12
- package/lib/dependencies.js +1 -0
- package/lib/getPackageInfos.js +10 -4
- package/lib/getPackagePaths.js +1 -0
- package/lib/git.js +30 -23
- package/lib/graph.js +2 -1
- package/lib/helpers/setupFixture.js +6 -5
- package/lib/index.js +28 -19
- package/lib/infoFromPackageJson.js +1 -0
- package/lib/lockfile/index.js +29 -12
- package/lib/lockfile/nameAtVersion.js +1 -0
- package/lib/lockfile/parseNpmLock.js +3 -1
- package/lib/lockfile/parsePnpmLock.js +2 -1
- package/lib/lockfile/queryLockFile.js +2 -1
- package/lib/paths.js +1 -0
- package/lib/scope.js +3 -2
- package/lib/workspaces/findWorkspacePath.js +1 -0
- package/lib/workspaces/getChangedPackages.js +8 -7
- package/lib/workspaces/getWorkspacePackageInfo.js +1 -0
- package/lib/workspaces/getWorkspaceRoot.js +2 -1
- package/lib/workspaces/getWorkspaces.js +2 -1
- package/lib/workspaces/implementations/index.js +1 -0
- package/lib/workspaces/implementations/lerna.js +3 -2
- package/lib/workspaces/implementations/npm.js +3 -2
- package/lib/workspaces/implementations/packageJsonWorkspaces.js +4 -3
- package/lib/workspaces/implementations/pnpm.js +3 -2
- package/lib/workspaces/implementations/rush.js +2 -1
- package/lib/workspaces/implementations/yarn.js +3 -2
- package/lib/workspaces/listOfWorkspacePackageNames.js +1 -0
- package/lib/workspaces/workspaces.js +2 -1
- package/package.json +2 -2
|
@@ -3,6 +3,7 @@ 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
7
|
const path_1 = __importDefault(require("path"));
|
|
7
8
|
const find_up_1 = __importDefault(require("find-up"));
|
|
8
9
|
const getPackagePaths_1 = require("../../getPackagePaths");
|
|
@@ -21,8 +22,8 @@ function getPnpmWorkspaces(cwd) {
|
|
|
21
22
|
const pnpmWorkspacesFile = path_1.default.join(pnpmWorkspacesRoot, "pnpm-workspace.yaml");
|
|
22
23
|
const readYaml = require("read-yaml-file").sync;
|
|
23
24
|
const pnpmWorkspaces = readYaml(pnpmWorkspacesFile);
|
|
24
|
-
const packagePaths = getPackagePaths_1.getPackagePaths(pnpmWorkspacesRoot, pnpmWorkspaces.packages);
|
|
25
|
-
const workspaceInfo = getWorkspacePackageInfo_1.getWorkspacePackageInfo(packagePaths);
|
|
25
|
+
const packagePaths = (0, getPackagePaths_1.getPackagePaths)(pnpmWorkspacesRoot, pnpmWorkspaces.packages);
|
|
26
|
+
const workspaceInfo = (0, getWorkspacePackageInfo_1.getWorkspacePackageInfo)(packagePaths);
|
|
26
27
|
return workspaceInfo;
|
|
27
28
|
}
|
|
28
29
|
catch (_a) {
|
|
@@ -3,6 +3,7 @@ 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
7
|
const find_up_1 = __importDefault(require("find-up"));
|
|
7
8
|
const path_1 = __importDefault(require("path"));
|
|
8
9
|
const jju_1 = __importDefault(require("jju"));
|
|
@@ -22,7 +23,7 @@ function getRushWorkspaces(cwd) {
|
|
|
22
23
|
const rushJsonPath = path_1.default.join(rushWorkspaceRoot, "rush.json");
|
|
23
24
|
const rushConfig = jju_1.default.parse(fs_1.default.readFileSync(rushJsonPath, "utf-8"));
|
|
24
25
|
const root = path_1.default.dirname(rushJsonPath);
|
|
25
|
-
return getWorkspacePackageInfo_1.getWorkspacePackageInfo(rushConfig.projects.map((project) => path_1.default.join(root, project.projectFolder)));
|
|
26
|
+
return (0, getWorkspacePackageInfo_1.getWorkspacePackageInfo)(rushConfig.projects.map((project) => path_1.default.join(root, project.projectFolder)));
|
|
26
27
|
}
|
|
27
28
|
catch (_a) {
|
|
28
29
|
return [];
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getYarnWorkspaces = exports.getYarnWorkspaceRoot = void 0;
|
|
3
4
|
const packageJsonWorkspaces_1 = require("./packageJsonWorkspaces");
|
|
4
5
|
function getYarnWorkspaceRoot(cwd) {
|
|
5
|
-
const yarnWorkspacesRoot = packageJsonWorkspaces_1.getPackageJsonWorkspaceRoot(cwd);
|
|
6
|
+
const yarnWorkspacesRoot = (0, packageJsonWorkspaces_1.getPackageJsonWorkspaceRoot)(cwd);
|
|
6
7
|
if (!yarnWorkspacesRoot) {
|
|
7
8
|
throw new Error("Could not find yarn workspaces root");
|
|
8
9
|
}
|
|
@@ -11,6 +12,6 @@ function getYarnWorkspaceRoot(cwd) {
|
|
|
11
12
|
exports.getYarnWorkspaceRoot = getYarnWorkspaceRoot;
|
|
12
13
|
function getYarnWorkspaces(cwd) {
|
|
13
14
|
const yarnWorkspacesRoot = getYarnWorkspaceRoot(cwd);
|
|
14
|
-
return packageJsonWorkspaces_1.getWorkspaceInfoFromWorkspaceRoot(yarnWorkspacesRoot);
|
|
15
|
+
return (0, packageJsonWorkspaces_1.getWorkspaceInfoFromWorkspaceRoot)(yarnWorkspacesRoot);
|
|
15
16
|
}
|
|
16
17
|
exports.getYarnWorkspaces = getYarnWorkspaces;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports._resetCache = exports.getAllPackageJsonFiles = void 0;
|
|
3
4
|
const getWorkspaces_1 = require("./getWorkspaces");
|
|
4
5
|
const cache = new Map();
|
|
5
6
|
/**
|
|
@@ -10,7 +11,7 @@ function getAllPackageJsonFiles(cwd) {
|
|
|
10
11
|
if (cache.has(cwd)) {
|
|
11
12
|
return cache.get(cwd);
|
|
12
13
|
}
|
|
13
|
-
const workspaces = getWorkspaces_1.getWorkspaces(cwd);
|
|
14
|
+
const workspaces = (0, getWorkspaces_1.getWorkspaces)(cwd);
|
|
14
15
|
const packageJsonFiles = workspaces.map((workspace) => workspace.packageJson.packageJsonPath);
|
|
15
16
|
cache.set(cwd, packageJsonFiles);
|
|
16
17
|
return packageJsonFiles;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "workspace-tools",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,6 +38,6 @@
|
|
|
38
38
|
"jest": "^25.0.0",
|
|
39
39
|
"tmp": "^0.2.1",
|
|
40
40
|
"ts-jest": "^25.5.1",
|
|
41
|
-
"typescript": "
|
|
41
|
+
"typescript": "^4.5.4"
|
|
42
42
|
}
|
|
43
43
|
}
|