Skip to content

Commit

Permalink
Merge pull request #68 from yu-re-ka/feature/yarn-hash
Browse files Browse the repository at this point in the history
support for updating yarn FOD hash
  • Loading branch information
figsoda committed Sep 6, 2023
2 parents d53a5d7 + 8b3e81e commit 8e3c8af
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
2 changes: 2 additions & 0 deletions nix_update/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -157,6 +158,7 @@ def eval_expression(
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;
Expand Down
8 changes: 8 additions & 0 deletions nix_update/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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

0 comments on commit 8e3c8af

Please sign in to comment.