@lage-run/hasher 1.3.0 → 1.3.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 +37 -1
- package/CHANGELOG.md +19 -2
- package/lib/TargetHasher.js +1 -1
- package/lib/__fixtures__/monorepo-with-global-files/some-global2.config.d.ts +1 -1
- package/lib/__fixtures__/monorepo-with-global-files-different-tasks/some-global.config.d.ts +1 -0
- package/lib/__tests__/TargetHasher.test.js +39 -0
- package/package.json +4 -4
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,43 @@
|
|
|
2
2
|
"name": "@lage-run/hasher",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Wed, 11 Sep 2024 20:30:17 GMT",
|
|
6
|
+
"version": "1.3.2",
|
|
7
|
+
"tag": "@lage-run/hasher_v1.3.2",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "kchau@microsoft.com",
|
|
12
|
+
"package": "@lage-run/hasher",
|
|
13
|
+
"commit": "3fb589f859c1215e2f3b93bbdb55fae1d5fef116",
|
|
14
|
+
"comment": "yarn 4"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@lage-run/hasher",
|
|
19
|
+
"comment": "Bump @lage-run/logger to v1.3.1",
|
|
20
|
+
"commit": "not available"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"date": "Wed, 04 Sep 2024 23:25:05 GMT",
|
|
27
|
+
"version": "1.3.1",
|
|
28
|
+
"tag": "@lage-run/hasher_v1.3.1",
|
|
29
|
+
"comments": {
|
|
30
|
+
"patch": [
|
|
31
|
+
{
|
|
32
|
+
"author": "kchau@microsoft.com",
|
|
33
|
+
"package": "@lage-run/hasher",
|
|
34
|
+
"commit": "cbfd60ade539086a6a797c0674e06f26cfc06af3",
|
|
35
|
+
"comment": "Use file hashes instead of just the file names for env glob for targets\\"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"date": "Fri, 30 Aug 2024 18:40:09 GMT",
|
|
6
42
|
"version": "1.3.0",
|
|
7
43
|
"tag": "@lage-run/hasher_v1.3.0",
|
|
8
44
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,29 @@
|
|
|
1
1
|
# Change Log - @lage-run/hasher
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 11 Sep 2024 20:30:17 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.3.2
|
|
8
|
+
|
|
9
|
+
Wed, 11 Sep 2024 20:30:17 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- yarn 4 (kchau@microsoft.com)
|
|
14
|
+
- Bump @lage-run/logger to v1.3.1
|
|
15
|
+
|
|
16
|
+
## 1.3.1
|
|
17
|
+
|
|
18
|
+
Wed, 04 Sep 2024 23:25:05 GMT
|
|
19
|
+
|
|
20
|
+
### Patches
|
|
21
|
+
|
|
22
|
+
- Use file hashes instead of just the file names for env glob for targets\ (kchau@microsoft.com)
|
|
23
|
+
|
|
7
24
|
## 1.3.0
|
|
8
25
|
|
|
9
|
-
Fri, 30 Aug 2024 18:
|
|
26
|
+
Fri, 30 Aug 2024 18:40:09 GMT
|
|
10
27
|
|
|
11
28
|
### Minor changes
|
|
12
29
|
|
package/lib/TargetHasher.js
CHANGED
|
@@ -190,7 +190,7 @@ class TargetHasher {
|
|
|
190
190
|
const fileHashes = this.fileHasher.hash(files) ?? {}; // this list is sorted by file name
|
|
191
191
|
// get target hashes
|
|
192
192
|
const targetDepHashes = target.dependencies?.sort().map((targetDep)=>this.targetHashes[targetDep]);
|
|
193
|
-
const envGlobFiles = target.environmentGlob ? await this.getMemorizedEnvGlobResults(target.environmentGlob) :
|
|
193
|
+
const envGlobFiles = Object.values(target.environmentGlob ? this.fileHasher.hash(await this.getMemorizedEnvGlobResults(target.environmentGlob)) : this.globalInputsHash ?? {});
|
|
194
194
|
const combinedHashes = [
|
|
195
195
|
// Environmental hashes
|
|
196
196
|
...envGlobFiles,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const global2: boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const global: boolean;
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
6
6
|
const _index = require("../index");
|
|
7
|
+
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
7
8
|
const _monorepofixture = require("@lage-run/monorepo-fixture");
|
|
8
9
|
function _interop_require_default(obj) {
|
|
9
10
|
return obj && obj.__esModule ? obj : {
|
|
@@ -152,4 +153,42 @@ describe("The main Hasher class", ()=>{
|
|
|
152
153
|
expect(hash).not.toEqual(hash2);
|
|
153
154
|
monorepo1.cleanup();
|
|
154
155
|
});
|
|
156
|
+
it("creates different hashes when the target has a different env glob for different task types", async ()=>{
|
|
157
|
+
const monorepo1 = await setupFixture("monorepo-with-global-files-different-tasks");
|
|
158
|
+
const hasher = new _index.TargetHasher({
|
|
159
|
+
root: monorepo1.root,
|
|
160
|
+
environmentGlob: []
|
|
161
|
+
});
|
|
162
|
+
const target = createTarget(monorepo1.root, "package-a", "test");
|
|
163
|
+
target.environmentGlob = [
|
|
164
|
+
"some-global*"
|
|
165
|
+
];
|
|
166
|
+
target.inputs = [
|
|
167
|
+
"**/*",
|
|
168
|
+
"^**/*"
|
|
169
|
+
];
|
|
170
|
+
const hash = await getHash(hasher, target);
|
|
171
|
+
const target2 = createTarget(monorepo1.root, "package-a", "lint");
|
|
172
|
+
target2.environmentGlob = [
|
|
173
|
+
".eslintrc.js"
|
|
174
|
+
];
|
|
175
|
+
target2.inputs = [
|
|
176
|
+
"**/*",
|
|
177
|
+
"^**/*"
|
|
178
|
+
];
|
|
179
|
+
const hash2 = await getHash(hasher, target2);
|
|
180
|
+
const target3 = createTarget(monorepo1.root, "package-a", "lint");
|
|
181
|
+
_fs.default.writeFileSync(_path.default.join(monorepo1.root, ".eslintrc.js"), "module.exports = {/*somethingdifferent*/};");
|
|
182
|
+
target3.environmentGlob = [
|
|
183
|
+
".eslintrc.js"
|
|
184
|
+
];
|
|
185
|
+
target3.inputs = [
|
|
186
|
+
"**/*",
|
|
187
|
+
"^**/*"
|
|
188
|
+
];
|
|
189
|
+
const hash3 = await getHash(hasher, target3);
|
|
190
|
+
expect(hash).not.toEqual(hash2);
|
|
191
|
+
expect(hash2).not.toEqual(hash3);
|
|
192
|
+
monorepo1.cleanup();
|
|
193
|
+
});
|
|
155
194
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lage-run/hasher",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Hasher for Lage Targets",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/microsoft/lage"
|
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
"lint": "monorepo-scripts lint"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
+
"@lage-run/logger": "^1.3.1",
|
|
18
19
|
"@lage-run/target-graph": "^0.8.9",
|
|
19
|
-
"@lage-run/logger": "^1.3.0",
|
|
20
20
|
"execa": "5.1.1",
|
|
21
|
-
"workspace-tools": "0.36.4",
|
|
22
21
|
"fast-glob": "3.3.1",
|
|
23
22
|
"glob-hasher": "^1.4.2",
|
|
24
23
|
"graceful-fs": "4.2.11",
|
|
25
|
-
"micromatch": "4.0.5"
|
|
24
|
+
"micromatch": "4.0.5",
|
|
25
|
+
"workspace-tools": "0.36.4"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@lage-run/monorepo-fixture": "*",
|