From b46418b5d3403c2e20e1f41e22567a74b611ea9b Mon Sep 17 00:00:00 2001 From: Moraxyc Date: Fri, 13 Dec 2024 16:08:03 +0800 Subject: [PATCH] feat: support yarnOfflineCache --- nix_update/eval.py | 4 +++- nix_update/update.py | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/nix_update/eval.py b/nix_update/eval.py index 6516014..b4a553f 100644 --- a/nix_update/eval.py +++ b/nix_update/eval.py @@ -57,6 +57,7 @@ class Package: npm_deps: str | None pnpm_deps: str | None yarn_deps: str | None + yarn_deps_old: str | None composer_deps: str | None composer_deps_old: str | None maven_deps: str | None @@ -194,7 +195,8 @@ def eval_expression( composer_deps_old = pkg.composerRepository.outputHash or null; npm_deps = pkg.npmDeps.outputHash or null; pnpm_deps = pkg.pnpmDeps.outputHash or null; - yarn_deps = pkg.offlineCache.outputHash or null; + yarn_deps = pkg.yarnOfflineCache.outputHash or null; + yarn_deps_old = pkg.offlineCache.outputHash or null; maven_deps = pkg.fetchedMavenDeps.outputHash or null; mix_deps = pkg.mixFodDeps.outputHash or null; tests = builtins.attrNames (pkg.passthru.tests or {{}}); diff --git a/nix_update/update.py b/nix_update/update.py index 55b8be3..16e6b85 100644 --- a/nix_update/update.py +++ b/nix_update/update.py @@ -372,6 +372,11 @@ def update_npm_deps_hash(opts: Options, filename: str, current_hash: str) -> Non def update_yarn_deps_hash(opts: Options, filename: str, current_hash: str) -> None: + target_hash = nix_prefetch(opts, "yarnOfflineCache") + replace_hash(filename, current_hash, target_hash) + + +def update_yarn_deps_hash_old(opts: Options, filename: str, current_hash: str) -> None: target_hash = nix_prefetch(opts, "offlineCache") replace_hash(filename, current_hash, target_hash) @@ -512,6 +517,9 @@ def update(opts: Options) -> Package: if package.yarn_deps: update_yarn_deps_hash(opts, package.filename, package.yarn_deps) + if package.yarn_deps_old: + update_yarn_deps_hash_old(opts, package.filename, package.yarn_deps_old) + if package.maven_deps: update_maven_deps_hash(opts, package.filename, package.maven_deps)