@lage-run/cache 0.4.0 → 0.4.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 +22 -1
- package/CHANGELOG.md +11 -2
- package/lib/TargetHasher.js +4 -11
- package/lib/salt.js +1 -8
- package/package.json +2 -2
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,28 @@
|
|
|
2
2
|
"name": "@lage-run/cache",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "Wed, 08 Mar 2023
|
|
5
|
+
"date": "Wed, 08 Mar 2023 17:35:15 GMT",
|
|
6
|
+
"tag": "@lage-run/cache_v0.4.1",
|
|
7
|
+
"version": "0.4.1",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "kchau@microsoft.com",
|
|
12
|
+
"package": "@lage-run/cache",
|
|
13
|
+
"commit": "dfce517d96aacaa7d2e145c18a67e8b7cff00da8",
|
|
14
|
+
"comment": "deleted unused sortObjects"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@lage-run/cache",
|
|
19
|
+
"comment": "Bump @lage-run/hasher to v0.2.1",
|
|
20
|
+
"commit": "dfce517d96aacaa7d2e145c18a67e8b7cff00da8"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"date": "Wed, 08 Mar 2023 00:05:27 GMT",
|
|
6
27
|
"tag": "@lage-run/cache_v0.4.0",
|
|
7
28
|
"version": "0.4.0",
|
|
8
29
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
# Change Log - @lage-run/cache
|
|
2
2
|
|
|
3
|
-
This log was last generated on Wed, 08 Mar 2023
|
|
3
|
+
This log was last generated on Wed, 08 Mar 2023 17:35:15 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.4.1
|
|
8
|
+
|
|
9
|
+
Wed, 08 Mar 2023 17:35:15 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- deleted unused sortObjects (kchau@microsoft.com)
|
|
14
|
+
- Bump @lage-run/hasher to v0.2.1
|
|
15
|
+
|
|
7
16
|
## 0.4.0
|
|
8
17
|
|
|
9
|
-
Wed, 08 Mar 2023 00:05:
|
|
18
|
+
Wed, 08 Mar 2023 00:05:27 GMT
|
|
10
19
|
|
|
11
20
|
### Minor changes
|
|
12
21
|
|
package/lib/TargetHasher.js
CHANGED
|
@@ -10,12 +10,6 @@ const _hasher = require("@lage-run/hasher");
|
|
|
10
10
|
const _saltJs = require("./salt.js");
|
|
11
11
|
const _globHasher = require("glob-hasher");
|
|
12
12
|
const _hashStringsJs = require("./hashStrings.js");
|
|
13
|
-
function sortObject(unordered) {
|
|
14
|
-
return Object.keys(unordered).sort((a, b)=>a.localeCompare(b)).reduce((obj, key)=>{
|
|
15
|
-
obj[key] = unordered[key];
|
|
16
|
-
return obj;
|
|
17
|
-
}, {});
|
|
18
|
-
}
|
|
19
13
|
class TargetHasher {
|
|
20
14
|
async hash(target) {
|
|
21
15
|
const { root } = this.options;
|
|
@@ -26,14 +20,13 @@ class TargetHasher {
|
|
|
26
20
|
if (!target.inputs) {
|
|
27
21
|
throw new Error("Root-level targets must have `inputs` defined if it has cache enabled.");
|
|
28
22
|
}
|
|
29
|
-
const
|
|
23
|
+
const fileFashes = (0, _globHasher.hashGlobGit)(target.inputs, {
|
|
30
24
|
cwd: root,
|
|
31
25
|
gitignore: false
|
|
32
26
|
}) ?? {};
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return (0, _hashStringsJs.hashStrings)(sortedHashes);
|
|
27
|
+
const hashes = Object.values(fileFashes);
|
|
28
|
+
hashes.push(hashKey);
|
|
29
|
+
return (0, _hashStringsJs.hashStrings)(hashes);
|
|
37
30
|
}
|
|
38
31
|
const hasher = new _hasher.Hasher(target.cwd);
|
|
39
32
|
return hasher.createPackageHash(hashKey);
|
package/lib/salt.js
CHANGED
|
@@ -31,12 +31,6 @@ async function salt(environmentGlobFiles, command, repoRoot, customKey = "") {
|
|
|
31
31
|
function envHashKey(environmentGlobFiles) {
|
|
32
32
|
return environmentGlobFiles.sort().join("|");
|
|
33
33
|
}
|
|
34
|
-
function sortObject(unordered) {
|
|
35
|
-
return Object.keys(unordered).sort((a, b)=>a.localeCompare(b)).reduce((obj, key)=>{
|
|
36
|
-
obj[key] = unordered[key];
|
|
37
|
-
return obj;
|
|
38
|
-
}, {});
|
|
39
|
-
}
|
|
40
34
|
async function getEnvHash(environmentGlobFiles, repoRoot) {
|
|
41
35
|
const key = envHashKey(environmentGlobFiles);
|
|
42
36
|
// We want to make sure that we only call getEnvHashOneAtTime one at a time
|
|
@@ -60,7 +54,6 @@ function getEnvHashOneAtTime(environmentGlobFiles, repoRoot) {
|
|
|
60
54
|
cwd: repoRoot,
|
|
61
55
|
gitignore: false
|
|
62
56
|
});
|
|
63
|
-
|
|
64
|
-
envHashes[key] = Object.values(sortedHashes);
|
|
57
|
+
envHashes[key] = Object.values(hashes);
|
|
65
58
|
return envHashes[key];
|
|
66
59
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lage-run/cache",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Cache for Lage",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/microsoft/lage"
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"lint": "monorepo-scripts lint"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@lage-run/hasher": "^0.2.
|
|
18
|
+
"@lage-run/hasher": "^0.2.1",
|
|
19
19
|
"@lage-run/target-graph": "^0.7.0",
|
|
20
20
|
"@lage-run/logger": "^1.2.2",
|
|
21
21
|
"backfill-config": "^6.3.0",
|