Merge pull request #68 from yu-re-ka/feature/yarn-hash

support for updating yarn FOD hash
This commit is contained in:
figsoda 2023-09-06 17:37:55 -04:00 committed by GitHub
commit 8e3c8afa5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View File

@ -17,6 +17,7 @@ designed to work with nixpkgs but also other package sets.
- update buildRustPackage's cargoHash/cargoSha256 and cargoSetupHook's cargoDeps
- update buildGoModule's vendorHash/vendorSha256
- update buildNpmPackage's npmDepsHash and npmConfigHook's npmDeps
- update fetchYarnDeps offlineCache output hash
- update flake outputs (see `--flake`)
- build and run the resulting package (see `--build`,
`--run` or `--shell`

View File

@ -53,6 +53,7 @@ class Package:
go_modules_old: str | None
cargo_deps: str | None
npm_deps: str | None
yarn_deps: str | None
tests: list[str]
has_update_script: bool
@ -157,6 +158,7 @@ in {{
else
null;
npm_deps = pkg.npmDeps.outputHash or null;
yarn_deps = pkg.offlineCache.outputHash or null;
tests = builtins.attrNames (pkg.passthru.tests or {{}});
has_update_script = {has_update_script};
src_homepage = pkg.src.meta.homepage or null;

View File

@ -257,6 +257,11 @@ def update_npm_deps_hash(opts: Options, filename: str, current_hash: str) -> Non
replace_hash(filename, current_hash, target_hash)
def update_yarn_deps_hash(opts: Options, filename: str, current_hash: str) -> None:
target_hash = nix_prefetch(opts, "offlineCache")
replace_hash(filename, current_hash, target_hash)
def update_version(
package: Package, version: str, preference: VersionPreference, version_regex: str
) -> bool:
@ -362,4 +367,7 @@ def update(opts: Options) -> Package:
if package.npm_deps:
update_npm_deps_hash(opts, package.filename, package.npm_deps)
if package.yarn_deps:
update_yarn_deps_hash(opts, package.filename, package.yarn_deps)
return package