jsr-io / jsr-npm

A cli tool to make installing packages form jsr.io in node easy
https://npmjs.com/package/jsr
MIT License
88 stars 12 forks source link

`jsr` CLI ignores global Bun config #44

Open NuroDev opened 4 months ago

NuroDev commented 4 months ago

What is the issue?

Currently if you run the recommended Bun command to add a dependency (bunx jsr add @std/log) & use a global Bun config (~/.bunfig.toml), such as myself where I already have other scopes / registries declared, it will not check to see if a global Bun config exists & as such it will both:

This seems to be because Bun will not even read a local / relative scope if a global config exists.

Steps to reproduce

➜ bunx jsr add @std/log
Setting up bunfig.toml...ok
Installing @std/log...
$ bun add @std/log@npm:@jsr/std__log
bun add v1.0.30 (1424a196)
  🔍 @jsr/std__log [1/1]
error: package "@jsr/std__log" not found registry.npmjs.org/@jsr%2fstd__log 404
error: @std/log@npm:@jsr/std__log failed to resolve

Possible solution

Currently it seems that JSR already checks the local / relative bunfig.toml file to see if a jsr scope exists & if not it adds it. This pre-script logic just needs to be extended to check if a global Bun config exists (~/.bunfig.toml) & if it does append the JSR scope to either that global config and/or a local config.