@lage-run/hasher 0.1.1 → 0.1.2
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__/createPackageHashes.test.js +13 -12
- package/lib/__tests__/getPackageDeps.test.js +149 -131
- package/lib/__tests__/getRepoDeps.test.js +106 -91
- package/lib/__tests__/getRepoState.test.js +70 -33
- package/lib/__tests__/hashOfFiles.test.js +71 -68
- package/lib/__tests__/helpers.test.js +12 -11
- package/lib/__tests__/index.test.js +50 -39
- package/lib/__tests__/resolveDependenciesHelper.js +44 -25
- package/lib/__tests__/resolveExternalDependencies.test.js +114 -68
- package/lib/__tests__/resolveInternalDependencies.test.js +98 -67
- package/lib/createPackageHashes.js +27 -20
- package/lib/getPackageDeps.js +118 -125
- package/lib/getRepoState.js +86 -101
- package/lib/hashOfFiles.js +59 -53
- package/lib/hashOfPackage.js +41 -28
- package/lib/helpers.js +35 -19
- package/lib/index.js +50 -41
- package/lib/repoInfo.js +26 -29
- package/lib/resolveExternalDependencies.js +32 -22
- package/lib/resolveInternalDependencies.js +16 -8
- package/package.json +2 -2
- package/lib/__fixtures__/config/backfill.config.js +0 -5
- package/lib/__fixtures__/config/backfill.config.js.map +0 -1
- package/lib/__fixtures__/config/packages/package-1/backfill.config.js +0 -2
- package/lib/__fixtures__/config/packages/package-1/backfill.config.js.map +0 -1
- package/lib/__tests__/createPackageHashes.test.js.map +0 -1
- package/lib/__tests__/getPackageDeps.test.js.map +0 -1
- package/lib/__tests__/getRepoDeps.test.js.map +0 -1
- package/lib/__tests__/getRepoState.test.js.map +0 -1
- package/lib/__tests__/hashOfFiles.test.js.map +0 -1
- package/lib/__tests__/helpers.test.js.map +0 -1
- package/lib/__tests__/index.test.js.map +0 -1
- package/lib/__tests__/resolveDependenciesHelper.js.map +0 -1
- package/lib/__tests__/resolveExternalDependencies.test.js.map +0 -1
- package/lib/__tests__/resolveInternalDependencies.test.js.map +0 -1
- package/lib/createPackageHashes.js.map +0 -1
- package/lib/getPackageDeps.js.map +0 -1
- package/lib/getRepoState.js.map +0 -1
- package/lib/hashOfFiles.js.map +0 -1
- package/lib/hashOfPackage.js.map +0 -1
- package/lib/helpers.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/repoInfo.js.map +0 -1
- package/lib/resolveExternalDependencies.js.map +0 -1
- package/lib/resolveInternalDependencies.js.map +0 -1
|
@@ -1,100 +1,103 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
|
6
|
+
const _fsExtra = /*#__PURE__*/ _interopRequireDefault(require("fs-extra"));
|
|
7
|
+
const _monorepoFixture = require("@lage-run/monorepo-fixture");
|
|
8
|
+
const _hashOfFiles = require("../hashOfFiles");
|
|
9
|
+
const _repoInfo = require("../repoInfo");
|
|
10
|
+
function _interopRequireDefault(obj) {
|
|
11
|
+
return obj && obj.__esModule ? obj : {
|
|
12
|
+
default: obj
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
const fixturesPath = _path.default.join(__dirname, "..", "__fixtures__");
|
|
16
|
+
describe("generateHashOfFiles()", ()=>{
|
|
17
|
+
it("creates different hashes for different hashes", async ()=>{
|
|
18
|
+
const monorepo = new _monorepoFixture.Monorepo("monorepo");
|
|
19
|
+
await monorepo.init(_path.default.join(fixturesPath, "monorepo"));
|
|
16
20
|
const packageRoot = monorepo.root;
|
|
17
|
-
let repoInfo = await (0,
|
|
18
|
-
const hashOfPackage = await (0,
|
|
19
|
-
|
|
20
|
-
repoInfo = await (0,
|
|
21
|
-
const hashOfPackageWithFoo = await (0,
|
|
21
|
+
let repoInfo = await (0, _repoInfo.getRepoInfoNoCache)(packageRoot);
|
|
22
|
+
const hashOfPackage = await (0, _hashOfFiles.generateHashOfFiles)(packageRoot, repoInfo);
|
|
23
|
+
_fsExtra.default.writeFileSync(_path.default.join(packageRoot, "foo.txt"), "bar");
|
|
24
|
+
repoInfo = await (0, _repoInfo.getRepoInfoNoCache)(packageRoot);
|
|
25
|
+
const hashOfPackageWithFoo = await (0, _hashOfFiles.generateHashOfFiles)(packageRoot, repoInfo);
|
|
22
26
|
expect(hashOfPackage).not.toEqual(hashOfPackageWithFoo);
|
|
23
|
-
|
|
24
|
-
repoInfo = await (0,
|
|
25
|
-
const hashOfPackageWithFoo2 = await (0,
|
|
27
|
+
_fsExtra.default.writeFileSync(_path.default.join(packageRoot, "foo.txt"), "foo");
|
|
28
|
+
repoInfo = await (0, _repoInfo.getRepoInfoNoCache)(packageRoot);
|
|
29
|
+
const hashOfPackageWithFoo2 = await (0, _hashOfFiles.generateHashOfFiles)(packageRoot, repoInfo);
|
|
26
30
|
expect(hashOfPackageWithFoo).not.toEqual(hashOfPackageWithFoo2);
|
|
27
|
-
|
|
28
|
-
repoInfo = await (0,
|
|
29
|
-
const hashOfPackageWithoutFoo = await (0,
|
|
31
|
+
_fsExtra.default.unlinkSync(_path.default.join(packageRoot, "foo.txt"));
|
|
32
|
+
repoInfo = await (0, _repoInfo.getRepoInfoNoCache)(packageRoot);
|
|
33
|
+
const hashOfPackageWithoutFoo = await (0, _hashOfFiles.generateHashOfFiles)(packageRoot, repoInfo);
|
|
30
34
|
expect(hashOfPackage).toEqual(hashOfPackageWithoutFoo);
|
|
31
35
|
await monorepo.cleanup();
|
|
32
36
|
});
|
|
33
|
-
it("is not confused by package names being substring of other packages", async ()
|
|
34
|
-
const monorepo = new
|
|
35
|
-
await monorepo.init(
|
|
37
|
+
it("is not confused by package names being substring of other packages", async ()=>{
|
|
38
|
+
const monorepo = new _monorepoFixture.Monorepo("monorepo");
|
|
39
|
+
await monorepo.init(_path.default.join(fixturesPath, "monorepo"));
|
|
36
40
|
const packageRoot = monorepo.root;
|
|
37
|
-
let repoInfo = await (0,
|
|
38
|
-
const hashOfPackageA = await (0,
|
|
39
|
-
await
|
|
40
|
-
await
|
|
41
|
-
repoInfo = await (0,
|
|
42
|
-
const newHashOfPackageA = await (0,
|
|
41
|
+
let repoInfo = await (0, _repoInfo.getRepoInfoNoCache)(packageRoot);
|
|
42
|
+
const hashOfPackageA = await (0, _hashOfFiles.generateHashOfFiles)(_path.default.join(packageRoot, "packages", "package-a"), repoInfo);
|
|
43
|
+
await _fsExtra.default.mkdir(_path.default.join(packageRoot, "packages", "package-abc"));
|
|
44
|
+
await _fsExtra.default.writeFile(_path.default.join(packageRoot, "packages", "package-abc", "foo"), "bar");
|
|
45
|
+
repoInfo = await (0, _repoInfo.getRepoInfoNoCache)(packageRoot);
|
|
46
|
+
const newHashOfPackageA = await (0, _hashOfFiles.generateHashOfFiles)(_path.default.join(packageRoot, "packages", "package-a"), repoInfo);
|
|
43
47
|
expect(hashOfPackageA).toEqual(newHashOfPackageA);
|
|
44
48
|
await monorepo.cleanup();
|
|
45
49
|
});
|
|
46
|
-
it("file paths are included in hash", async ()
|
|
47
|
-
const monorepo = new
|
|
48
|
-
await monorepo.init(
|
|
50
|
+
it("file paths are included in hash", async ()=>{
|
|
51
|
+
const monorepo = new _monorepoFixture.Monorepo("monorepo");
|
|
52
|
+
await monorepo.init(_path.default.join(fixturesPath, "empty"));
|
|
49
53
|
const packageRoot = monorepo.root;
|
|
50
|
-
|
|
51
|
-
let repoInfo = await (0,
|
|
52
|
-
const hashOfPackageWithFoo = await (0,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
repoInfo = await (0,
|
|
56
|
-
const hashOfPackageWithBar = await (0,
|
|
54
|
+
_fsExtra.default.writeFileSync(_path.default.join(packageRoot, "foo.txt"), "bar");
|
|
55
|
+
let repoInfo = await (0, _repoInfo.getRepoInfoNoCache)(packageRoot);
|
|
56
|
+
const hashOfPackageWithFoo = await (0, _hashOfFiles.generateHashOfFiles)(packageRoot, repoInfo);
|
|
57
|
+
_fsExtra.default.unlinkSync(_path.default.join(packageRoot, "foo.txt"));
|
|
58
|
+
_fsExtra.default.writeFileSync(_path.default.join(packageRoot, "bar.txt"), "bar");
|
|
59
|
+
repoInfo = await (0, _repoInfo.getRepoInfoNoCache)(packageRoot);
|
|
60
|
+
const hashOfPackageWithBar = await (0, _hashOfFiles.generateHashOfFiles)(packageRoot, repoInfo);
|
|
57
61
|
expect(hashOfPackageWithFoo).not.toEqual(hashOfPackageWithBar);
|
|
58
62
|
await monorepo.cleanup();
|
|
59
63
|
});
|
|
60
64
|
// This test will be run on Windows and on Linux on the CI
|
|
61
|
-
it("file paths are consistent across platforms", async ()
|
|
62
|
-
const monorepo = new
|
|
63
|
-
await monorepo.init(
|
|
65
|
+
it("file paths are consistent across platforms", async ()=>{
|
|
66
|
+
const monorepo = new _monorepoFixture.Monorepo("monorepo");
|
|
67
|
+
await monorepo.init(_path.default.join(fixturesPath, "empty"));
|
|
64
68
|
const packageRoot = monorepo.root;
|
|
65
69
|
// Create a folder to make sure we get folder separators as part of the file name
|
|
66
|
-
const folder =
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
let repoInfo = await (0,
|
|
70
|
-
const hashOfPackage = await (0,
|
|
70
|
+
const folder = _path.default.join(packageRoot, "foo");
|
|
71
|
+
_fsExtra.default.mkdirpSync(folder);
|
|
72
|
+
_fsExtra.default.writeFileSync(_path.default.join(folder, "foo.txt"), "bar");
|
|
73
|
+
let repoInfo = await (0, _repoInfo.getRepoInfoNoCache)(packageRoot);
|
|
74
|
+
const hashOfPackage = await (0, _hashOfFiles.generateHashOfFiles)(packageRoot, repoInfo);
|
|
71
75
|
expect(hashOfPackage).toEqual("4d4ca2ecc436e1198554f5d03236ea8f956ac0c4");
|
|
72
76
|
await monorepo.cleanup();
|
|
73
77
|
});
|
|
74
78
|
// This test will be run on Windows and on Linux on the CI
|
|
75
|
-
it("file paths in a package not defined in a workspace (malformed monorepo) are consistent across platforms (uses slow path)", async ()
|
|
76
|
-
const monorepo = new
|
|
77
|
-
await monorepo.init(
|
|
79
|
+
it("file paths in a package not defined in a workspace (malformed monorepo) are consistent across platforms (uses slow path)", async ()=>{
|
|
80
|
+
const monorepo = new _monorepoFixture.Monorepo("monorepo");
|
|
81
|
+
await monorepo.init(_path.default.join(fixturesPath, "empty"));
|
|
78
82
|
const workspaceRoot = monorepo.root;
|
|
79
83
|
// Create a folder to make sure we get folder separators as part of the file name
|
|
80
|
-
const folder =
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
let repoInfo = await (0,
|
|
84
|
-
const hashOfPackage = await (0,
|
|
84
|
+
const folder = _path.default.join(workspaceRoot, "packages", "foo");
|
|
85
|
+
_fsExtra.default.mkdirpSync(folder);
|
|
86
|
+
_fsExtra.default.writeFileSync(_path.default.join(folder, "foo.txt"), "bar");
|
|
87
|
+
let repoInfo = await (0, _repoInfo.getRepoInfoNoCache)(workspaceRoot);
|
|
88
|
+
const hashOfPackage = await (0, _hashOfFiles.generateHashOfFiles)(folder, repoInfo);
|
|
85
89
|
expect(hashOfPackage).toEqual("438b5f734e6de1ef0eb9114a28ef230a9ff83f54");
|
|
86
90
|
await monorepo.cleanup();
|
|
87
91
|
});
|
|
88
|
-
it("file paths in a monorepo are consistent across platforms (uses fast path)", async ()
|
|
89
|
-
const monorepo = new
|
|
90
|
-
await monorepo.init(
|
|
92
|
+
it("file paths in a monorepo are consistent across platforms (uses fast path)", async ()=>{
|
|
93
|
+
const monorepo = new _monorepoFixture.Monorepo("monorepo");
|
|
94
|
+
await monorepo.init(_path.default.join(fixturesPath, "monorepo"));
|
|
91
95
|
const workspaceRoot = monorepo.root;
|
|
92
|
-
const folder =
|
|
93
|
-
|
|
94
|
-
let repoInfo = await (0,
|
|
95
|
-
const hashOfPackage = await (0,
|
|
96
|
+
const folder = _path.default.join(workspaceRoot, "packages", "package-a");
|
|
97
|
+
_fsExtra.default.writeFileSync(_path.default.join(folder, "foo.txt"), "bar");
|
|
98
|
+
let repoInfo = await (0, _repoInfo.getRepoInfoNoCache)(workspaceRoot);
|
|
99
|
+
const hashOfPackage = await (0, _hashOfFiles.generateHashOfFiles)(folder, repoInfo);
|
|
96
100
|
expect(hashOfPackage).toEqual("b91634233c6a3768136391c804967bf0e0a6578d");
|
|
97
101
|
await monorepo.cleanup();
|
|
98
102
|
});
|
|
99
103
|
});
|
|
100
|
-
//# sourceMappingURL=hashOfFiles.test.js.map
|
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
const _helpers = require("../helpers");
|
|
6
|
+
describe("hashStrings()", ()=>{
|
|
7
|
+
it("creates different hashes given different lists", ()=>{
|
|
6
8
|
const list = [];
|
|
7
9
|
list.push("foo");
|
|
8
10
|
list.push("bar");
|
|
9
|
-
const hash = (0,
|
|
11
|
+
const hash = (0, _helpers.hashStrings)(list);
|
|
10
12
|
list.push("baz");
|
|
11
|
-
const hashWithBaz = (0,
|
|
13
|
+
const hashWithBaz = (0, _helpers.hashStrings)(list);
|
|
12
14
|
expect(hash).not.toEqual(hashWithBaz);
|
|
13
15
|
list.pop();
|
|
14
|
-
const hashWithoutBaz = (0,
|
|
16
|
+
const hashWithoutBaz = (0, _helpers.hashStrings)(list);
|
|
15
17
|
expect(hash).toEqual(hashWithoutBaz);
|
|
16
18
|
});
|
|
17
|
-
it("lists of different order produce the same hash", ()
|
|
19
|
+
it("lists of different order produce the same hash", ()=>{
|
|
18
20
|
const list = [];
|
|
19
21
|
list.push("foo");
|
|
20
22
|
list.push("bar");
|
|
21
|
-
const hash = (0,
|
|
23
|
+
const hash = (0, _helpers.hashStrings)(list);
|
|
22
24
|
list.reverse();
|
|
23
|
-
const hashReverse = (0,
|
|
25
|
+
const hashReverse = (0, _helpers.hashStrings)(list);
|
|
24
26
|
expect(hash).toEqual(hashReverse);
|
|
25
27
|
});
|
|
26
28
|
});
|
|
27
|
-
//# sourceMappingURL=helpers.test.js.map
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
|
6
|
+
const _index = require("../index");
|
|
7
|
+
const _monorepoFixture = require("@lage-run/monorepo-fixture");
|
|
8
|
+
function _interopRequireDefault(obj) {
|
|
9
|
+
return obj && obj.__esModule ? obj : {
|
|
10
|
+
default: obj
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
const fixturesPath = _path.default.join(__dirname, "..", "__fixtures__");
|
|
14
|
+
describe("addToQueue", ()=>{
|
|
15
|
+
const setupAddToQueue = async ()=>{
|
|
16
|
+
const monorepo = new _monorepoFixture.Monorepo("monorepo");
|
|
17
|
+
await monorepo.init(_path.default.join(fixturesPath, "monorepo"));
|
|
14
18
|
const packageRoot = monorepo.root;
|
|
15
19
|
const packageToAdd = "package-a";
|
|
16
|
-
const packagePath =
|
|
20
|
+
const packagePath = _path.default.join(packageRoot, "packages", packageToAdd);
|
|
17
21
|
const workspaces = [
|
|
18
22
|
{
|
|
19
23
|
name: packageToAdd,
|
|
@@ -21,11 +25,13 @@ describe("addToQueue", () => {
|
|
|
21
25
|
packageJson: {
|
|
22
26
|
name: "",
|
|
23
27
|
packageJsonPath: "",
|
|
24
|
-
version: ""
|
|
25
|
-
}
|
|
26
|
-
}
|
|
28
|
+
version: ""
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
];
|
|
32
|
+
const internalDependencies = [
|
|
33
|
+
packageToAdd
|
|
27
34
|
];
|
|
28
|
-
const internalDependencies = [packageToAdd];
|
|
29
35
|
const queue = [];
|
|
30
36
|
const done = [];
|
|
31
37
|
return {
|
|
@@ -34,49 +40,55 @@ describe("addToQueue", () => {
|
|
|
34
40
|
done,
|
|
35
41
|
workspaces,
|
|
36
42
|
packageToAdd,
|
|
37
|
-
packagePath
|
|
43
|
+
packagePath
|
|
38
44
|
};
|
|
39
45
|
};
|
|
40
|
-
it("adds internal dependencies to the queue", async ()
|
|
41
|
-
const { internalDependencies, queue, done, workspaces, packagePath
|
|
42
|
-
(0,
|
|
43
|
-
const expectedQueue = [
|
|
46
|
+
it("adds internal dependencies to the queue", async ()=>{
|
|
47
|
+
const { internalDependencies , queue , done , workspaces , packagePath } = await setupAddToQueue();
|
|
48
|
+
(0, _index.addToQueue)(internalDependencies, queue, done, workspaces);
|
|
49
|
+
const expectedQueue = [
|
|
50
|
+
packagePath
|
|
51
|
+
];
|
|
44
52
|
expect(queue).toEqual(expectedQueue);
|
|
45
53
|
});
|
|
46
|
-
it("doesn't add to the queue if the package has been evaluated", async ()
|
|
47
|
-
let { internalDependencies, queue, done, workspaces, packageToAdd
|
|
54
|
+
it("doesn't add to the queue if the package has been evaluated", async ()=>{
|
|
55
|
+
let { internalDependencies , queue , done , workspaces , packageToAdd } = await setupAddToQueue();
|
|
48
56
|
// Override
|
|
49
57
|
done = [
|
|
50
58
|
{
|
|
51
59
|
name: packageToAdd,
|
|
52
60
|
filesHash: "",
|
|
53
61
|
dependenciesHash: "",
|
|
54
|
-
internalDependencies: []
|
|
55
|
-
}
|
|
62
|
+
internalDependencies: []
|
|
63
|
+
}
|
|
56
64
|
];
|
|
57
|
-
(0,
|
|
65
|
+
(0, _index.addToQueue)(internalDependencies, queue, done, workspaces);
|
|
58
66
|
expect(queue).toEqual([]);
|
|
59
67
|
});
|
|
60
|
-
it("doesn't add to the queue if the package is already in the queue", async ()
|
|
61
|
-
let { internalDependencies, queue, done, workspaces, packagePath
|
|
68
|
+
it("doesn't add to the queue if the package is already in the queue", async ()=>{
|
|
69
|
+
let { internalDependencies , queue , done , workspaces , packagePath } = await setupAddToQueue();
|
|
62
70
|
// Override
|
|
63
|
-
queue = [
|
|
64
|
-
|
|
65
|
-
|
|
71
|
+
queue = [
|
|
72
|
+
packagePath
|
|
73
|
+
];
|
|
74
|
+
(0, _index.addToQueue)(internalDependencies, queue, done, workspaces);
|
|
75
|
+
const expectedQueue = [
|
|
76
|
+
packagePath
|
|
77
|
+
];
|
|
66
78
|
expect(queue).toEqual(expectedQueue);
|
|
67
79
|
});
|
|
68
80
|
});
|
|
69
|
-
describe("The main Hasher class", ()
|
|
70
|
-
const setupFixtureAndReturnHash = async (fixture = "monorepo")
|
|
71
|
-
const monorepo = new
|
|
72
|
-
await monorepo.init(
|
|
81
|
+
describe("The main Hasher class", ()=>{
|
|
82
|
+
const setupFixtureAndReturnHash = async (fixture = "monorepo")=>{
|
|
83
|
+
const monorepo = new _monorepoFixture.Monorepo("monorepo");
|
|
84
|
+
await monorepo.init(_path.default.join(fixturesPath, fixture));
|
|
73
85
|
const packageRoot = monorepo.root;
|
|
74
86
|
const buildSignature = "yarn build";
|
|
75
|
-
const hasher = new
|
|
87
|
+
const hasher = new _index.Hasher(packageRoot);
|
|
76
88
|
const hash = await hasher.createPackageHash(buildSignature);
|
|
77
89
|
return hash;
|
|
78
90
|
};
|
|
79
|
-
it("creates different hashes given different fixtures", async ()
|
|
91
|
+
it("creates different hashes given different fixtures", async ()=>{
|
|
80
92
|
const hash = await setupFixtureAndReturnHash();
|
|
81
93
|
const hashOfBasic = await setupFixtureAndReturnHash("basic");
|
|
82
94
|
expect(hash).not.toEqual(hashOfBasic);
|
|
@@ -84,4 +96,3 @@ describe("The main Hasher class", () => {
|
|
|
84
96
|
expect(hash).toEqual(hashOfMonorepoAgain);
|
|
85
97
|
});
|
|
86
98
|
});
|
|
87
|
-
//# sourceMappingURL=index.test.js.map
|
|
@@ -1,41 +1,60 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
filterDependenciesInYarnFixture: ()=>filterDependenciesInYarnFixture,
|
|
13
|
+
filterDependenciesInPnpmFixture: ()=>filterDependenciesInPnpmFixture,
|
|
14
|
+
filterDependenciesInRushFixture: ()=>filterDependenciesInRushFixture
|
|
15
|
+
});
|
|
16
|
+
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
|
17
|
+
const _monorepoFixture = require("@lage-run/monorepo-fixture");
|
|
18
|
+
const _workspaceTools = require("workspace-tools");
|
|
19
|
+
function _interopRequireDefault(obj) {
|
|
20
|
+
return obj && obj.__esModule ? obj : {
|
|
21
|
+
default: obj
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const fixturesPath = _path.default.join(__dirname, "..", "__fixtures__");
|
|
11
25
|
async function filterDependenciesInYarnFixture(fixture, filterFunction) {
|
|
12
|
-
const monorepo = new
|
|
13
|
-
await monorepo.init(
|
|
26
|
+
const monorepo = new _monorepoFixture.Monorepo("monorepo");
|
|
27
|
+
await monorepo.init(_path.default.join(fixturesPath, fixture));
|
|
14
28
|
const packageRoot = monorepo.root;
|
|
15
|
-
const workspacesPackageInfo = (0,
|
|
16
|
-
const dependencies = {
|
|
29
|
+
const workspacesPackageInfo = (0, _workspaceTools.getYarnWorkspaces)(packageRoot);
|
|
30
|
+
const dependencies = {
|
|
31
|
+
"package-a": "1.0.0",
|
|
32
|
+
foo: "1.0.0"
|
|
33
|
+
};
|
|
17
34
|
const filteredDependencies = filterFunction(dependencies, workspacesPackageInfo);
|
|
18
35
|
return filteredDependencies;
|
|
19
36
|
}
|
|
20
|
-
exports.filterDependenciesInYarnFixture = filterDependenciesInYarnFixture;
|
|
21
37
|
async function filterDependenciesInPnpmFixture(fixture, filterFunction) {
|
|
22
|
-
const monorepo = new
|
|
23
|
-
await monorepo.init(
|
|
38
|
+
const monorepo = new _monorepoFixture.Monorepo("monorepo");
|
|
39
|
+
await monorepo.init(_path.default.join(fixturesPath, fixture));
|
|
24
40
|
const packageRoot = monorepo.root;
|
|
25
|
-
const workspacesPackageInfo = (0,
|
|
26
|
-
const dependencies = {
|
|
41
|
+
const workspacesPackageInfo = (0, _workspaceTools.getPnpmWorkspaces)(packageRoot);
|
|
42
|
+
const dependencies = {
|
|
43
|
+
"package-a": "1.0.0",
|
|
44
|
+
foo: "1.0.0"
|
|
45
|
+
};
|
|
27
46
|
const filteredDependencies = filterFunction(dependencies, workspacesPackageInfo);
|
|
28
47
|
return filteredDependencies;
|
|
29
48
|
}
|
|
30
|
-
exports.filterDependenciesInPnpmFixture = filterDependenciesInPnpmFixture;
|
|
31
49
|
async function filterDependenciesInRushFixture(fixture, filterFunction) {
|
|
32
|
-
const monorepo = new
|
|
33
|
-
await monorepo.init(
|
|
50
|
+
const monorepo = new _monorepoFixture.Monorepo("monorepo");
|
|
51
|
+
await monorepo.init(_path.default.join(fixturesPath, fixture));
|
|
34
52
|
const packageRoot = monorepo.root;
|
|
35
|
-
const workspacesPackageInfo = (0,
|
|
36
|
-
const dependencies = {
|
|
53
|
+
const workspacesPackageInfo = (0, _workspaceTools.getRushWorkspaces)(packageRoot);
|
|
54
|
+
const dependencies = {
|
|
55
|
+
"package-a": "1.0.0",
|
|
56
|
+
foo: "1.0.0"
|
|
57
|
+
};
|
|
37
58
|
const filteredDependencies = filterFunction(dependencies, workspacesPackageInfo);
|
|
38
59
|
return filteredDependencies;
|
|
39
60
|
}
|
|
40
|
-
exports.filterDependenciesInRushFixture = filterDependenciesInRushFixture;
|
|
41
|
-
//# sourceMappingURL=resolveDependenciesHelper.js.map
|