Skip to content

Commit

Permalink
Merge pull request #307 from Moraxyc/yarnofflinecache
Browse files Browse the repository at this point in the history
feat: support yarnOfflineCache
  • Loading branch information
mergify[bot] authored Dec 13, 2024
2 parents 2f7610a + b46418b commit e3f3d83
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nix_update/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {{}});
Expand Down
8 changes: 8 additions & 0 deletions nix_update/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit e3f3d83

Please sign in to comment.