Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support yarnOfflineCache #307

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading