oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
72.8k stars 2.64k forks source link

Enhance `bun install` for auto-install without `package.json` #10142

Open way-zer opened 4 months ago

way-zer commented 4 months ago

What is the problem this feature would solve?

One solution for IDE support with auto-install.

I'm using bun to write a Github Action script. The script only one .ts source. To get IDE support, I have to create a package.json with only dependencies, and do bun install, also generate useless bun.lockb file.

What is the feature you are proposing to solve the problem?

Add a option to bun install, to create node_modules based on included source files without package.json, in favour of auto-install development.

  1. Create node_modules based on included source files without package.json
  2. May auto install @types/bun into node_modules
  3. not create bun.lockb or inside node_modules

What alternatives have you considered?

No response

touhidurrr commented 4 months ago

I don't see the issue here. Auto install should install packages normally. If you want something to be run on the fly then maybe use something like bunx and if the same issue occurs on bunx the create a new issue for bunx closing this.

way-zer commented 4 months ago

I don't see the issue here. Auto install should install packages normally. If you want something to be run on the fly then maybe use something like bunx and if the same issue occurs on bunx the create a new issue for bunx closing this.

I don't mean issue for bun run. bun install is for better IDE supporting.

touhidurrr commented 4 months ago

I don't mean issue for bun run. bun install is for better IDE supporting.

I think you might have confused how auto-install work. auto-install happens when you try to run some script with trying to import some module but there is no node-module directory to import them from. It is related to bun run not bun install. You are not running the bun install command manually here.

way-zer commented 4 months ago

I don't mean issue for bun run. bun install is for better IDE supporting.

I think you might have confused how auto-install work. auto-install happens when you try to run some script with trying to import some module but there is no node-module directory to import them from. It is related to bun run not bun install. You are not running the bun install command manually here.

I know what auto-install is. Enhancing bun install is to get IDE type supporting, as IDE don't support auto-install.

Deno implements IDE supporting using Language Server, but that behaves bader than IDE typescript support. I want to enhance bun install, so I don't need package.json to get IDE typescript support.

touhidurrr commented 4 months ago

I want to enhance bun install, so I don't need package.json to get IDE typescript support.

Still I don't get the point. If package.json is giving you the IDE support then why not just keep it. I don't think it is recommended not to have package.json to begin with when you are using packages from npm. Again, despite your explanation I have to say that I don't see any reason to modify the current behavior of auto-install or bun install. As it would only make things complicated.

Anyways, it is a choice that maintainers has to make. So, good luck.

way-zer commented 4 months ago

Still I don't get the point. If package.json is giving you the IDE support then why not just keep it. I don't think it is recommended not to have package.json to begin with when you are using packages from npm.

Not package.json is giving you the IDE support, It is node-module.

Again, despite your explanation I have to say that I don't see any reason to modify the current behavior of auto-install or bun install.

Just add a option to create node-module without package.json in favour of auto-install when develop, that is not necessary to run.