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

Update version when a version tag is specified in bun install #1609

Closed
Tracked by #2450
colinhacks opened this issue Dec 13, 2022 · 3 comments
Closed
Tracked by #2450

Update version when a version tag is specified in bun install #1609

colinhacks opened this issue Dec 13, 2022 · 3 comments
Labels
bug Something isn't working bun install Something that relates to the npm-compatible client

Comments

@colinhacks
Copy link
Contributor

What version of Bun is running?

0.3.0

What platform is your computer?

Darwin 22.1.0 arm64 arm

What steps can reproduce the bug?

When the a version tag is specified in bun install Bun should do a network call to pull down the latest version with that tag.

  1. bun install pkg@latest - installs version x
  2. pkg publishes version x + 1
  3. bun install pkg@latest re-installs x - no network call

npm allows arbitrary version tag names, though latest and next are common. If a version tag is specified in the install command Bun should always re-check the registry

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

@colinhacks colinhacks added the bug Something isn't working label Dec 13, 2022
@Electroid Electroid added the bun install Something that relates to the npm-compatible client label Dec 13, 2022
@colinhacks
Copy link
Contributor Author

colinhacks commented Mar 5, 2023

Follow up: even -f doesn't seem to refresh the registry cache.

Shortly after publishing a new version of zod@canary:

$ npm add zod@canary                          
up to date, audited 3 packages in 165ms
1 package is looking for funding
  run `npm fund` for details
found 0 vulnerabilities
$ (cd node_modules/zod && npm pkg get version)
"3.22.0-canary.20230305T082229"

$ yarn add zod@canary
yarn add v1.22.19
warning package.json: No license field
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
warning No license field
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...
success Saved lockfile.
warning No license field
success Saved 1 new dependency.
info Direct dependencies
└─ zod@3.22.0-canary.20230305T082229
info All dependencies
└─ zod@3.22.0-canary.20230305T082229
✨  Done in 0.14s.
$ (cd node_modules/zod && npm pkg get version)
"3.22.0-canary.20230305T082229"

$ bun add zod@canary                      
bun add v0.5.8 (c0a49e40)
  installed zod@1.10.2-canary
  1 packages installed [10.00ms]
$ (cd node_modules/zod && npm pkg get version)
"1.10.2-canary"

$ bun add -f zod@canary
bun add v0.5.8 (c0a49e40)
  + typescript@4.9.5
  installed zod@1.10.2-canary
  2 packages installed [30.00ms]
$ (cd node_modules/zod && npm pkg get version)
"1.10.2-canary"

@Jarred-Sumner
Copy link
Collaborator

it caches to the TTL of the registry + 300 seconds

so thats about 5 minutes

@Electroid
Copy link
Contributor

We recently changed this so if @latest is specified, it will always check the registry and not use the cache. e.g. bun install zod@latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working bun install Something that relates to the npm-compatible client
Projects
None yet
Development

No branches or pull requests

3 participants