@lage-run/hasher
Advanced tools
Comparing version 1.3.4 to 1.4.0
@@ -5,3 +5,18 @@ { | ||
{ | ||
"date": "Fri, 13 Sep 2024 18:04:33 GMT", | ||
"date": "Wed, 25 Sep 2024 20:27:33 GMT", | ||
"version": "1.4.0", | ||
"tag": "@lage-run/hasher_v1.4.0", | ||
"comments": { | ||
"minor": [ | ||
{ | ||
"author": "kchau@microsoft.com", | ||
"package": "@lage-run/hasher", | ||
"commit": "09313be6a4a5667bf8c50b654428f778f6fa4028", | ||
"comment": "writes out the \"inputs\" as hashes files inside node_modules\\.cache\\lage\\hashes\\**" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"date": "Fri, 13 Sep 2024 18:05:04 GMT", | ||
"version": "1.3.4", | ||
@@ -8,0 +23,0 @@ "tag": "@lage-run/hasher_v1.3.4", |
# Change Log - @lage-run/hasher | ||
<!-- This log was last generated on Fri, 13 Sep 2024 18:04:33 GMT and should not be manually modified. --> | ||
<!-- This log was last generated on Wed, 25 Sep 2024 20:27:33 GMT and should not be manually modified. --> | ||
<!-- Start content --> | ||
## 1.4.0 | ||
Wed, 25 Sep 2024 20:27:33 GMT | ||
### Minor changes | ||
- writes out the "inputs" as hashes files inside node_modules\.cache\lage\hashes\** (kchau@microsoft.com) | ||
## 1.3.4 | ||
Fri, 13 Sep 2024 18:04:33 GMT | ||
Fri, 13 Sep 2024 18:05:04 GMT | ||
@@ -11,0 +19,0 @@ ### Patches |
@@ -33,2 +33,7 @@ import type { Target } from "@lage-run/target-graph"; | ||
private options; | ||
targetHashesLog: Record<string, { | ||
fileHashes: Record<string, string>; | ||
globalFileHashes: Record<string, string>; | ||
}>; | ||
targetHashesDirectory: string; | ||
logger: Logger | undefined; | ||
@@ -52,3 +57,4 @@ fileHasher: FileHasher; | ||
hash(target: Target): Promise<string>; | ||
writeTargetHashesManifest(): void; | ||
cleanup(): Promise<void>; | ||
} |
@@ -193,6 +193,6 @@ "use strict"; | ||
const targetDepHashes = target.dependencies?.sort().map((targetDep)=>this.targetHashes[targetDep]); | ||
const envGlobFiles = Object.values(target.environmentGlob ? this.fileHasher.hash(await this.getMemorizedEnvGlobResults(target.environmentGlob)) : this.globalInputsHash ?? {}); | ||
const globalFileHashes = target.environmentGlob ? this.fileHasher.hash(await this.getMemorizedEnvGlobResults(target.environmentGlob)) : this.globalInputsHash ?? {}; | ||
const combinedHashes = [ | ||
// Environmental hashes | ||
...envGlobFiles, | ||
...Object.values(globalFileHashes), | ||
`${target.id}|${JSON.stringify(this.options.cliArgs)}`, | ||
@@ -208,5 +208,24 @@ this.options.cacheKey || "", | ||
this.targetHashes[target.id] = hashString; | ||
this.targetHashesLog[target.id] = { | ||
fileHashes, | ||
globalFileHashes | ||
}; | ||
return hashString; | ||
} | ||
writeTargetHashesManifest() { | ||
for (const [id, { fileHashes , globalFileHashes }] of Object.entries(this.targetHashesLog)){ | ||
const targetHashesManifestPath = _path.default.join(this.targetHashesDirectory, `${id}.json`); | ||
if (!_fs.default.existsSync(_path.default.dirname(targetHashesManifestPath))) { | ||
_fs.default.mkdirSync(_path.default.dirname(targetHashesManifestPath), { | ||
recursive: true | ||
}); | ||
} | ||
_fs.default.writeFileSync(targetHashesManifestPath, JSON.stringify({ | ||
fileHashes, | ||
globalFileHashes | ||
}), "utf-8"); | ||
} | ||
} | ||
async cleanup() { | ||
this.writeTargetHashesManifest(); | ||
await this.fileHasher.writeManifest(); | ||
@@ -216,2 +235,4 @@ } | ||
_define_property(this, "options", void 0); | ||
_define_property(this, "targetHashesLog", void 0); | ||
_define_property(this, "targetHashesDirectory", void 0); | ||
_define_property(this, "logger", void 0); | ||
@@ -229,2 +250,3 @@ _define_property(this, "fileHasher", void 0); | ||
this.options = options; | ||
this.targetHashesLog = {}; | ||
this.packageInfos = {}; | ||
@@ -242,3 +264,9 @@ this.targetHashes = {}; | ||
}); | ||
this.targetHashesDirectory = _path.default.join(root, "node_modules", ".cache", "lage", "hashes"); | ||
if (!_fs.default.existsSync(this.targetHashesDirectory)) { | ||
_fs.default.mkdirSync(this.targetHashesDirectory, { | ||
recursive: true | ||
}); | ||
} | ||
} | ||
} |
{ | ||
"name": "@lage-run/hasher", | ||
"version": "1.3.4", | ||
"version": "1.4.0", | ||
"description": "Hasher for Lage Targets", | ||
@@ -5,0 +5,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
102611
2467