oven-sh / bun

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

Support `bun install <pkg> {--d|--optional}` #1819

Closed colinhacks closed 1 year ago

colinhacks commented 1 year ago

What version of Bun is running?

No response

What platform is your computer?

No response

What steps can reproduce the bug?

$ bun install zod -d
Failed to parse argument due to unexpected single dash

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

Electroid commented 1 year ago

This is blocked until we update zig-clap, which seems to have added support for lowecase flags.

jwhear commented 1 year ago

This is currently blocked by https://github.com/Hejsil/zig-clap/issues/84, which in turn is blocked by https://github.com/ziglang/zig/issues/13779

Electroid commented 1 year ago

@jwhear Could we still workaround the issue if we provide a long name for every flag? Do we have any flags that are single char only?

jwhear commented 1 year ago

@jwhear Could we still workaround the issue if we provide a long name for every flag? Do we have any flags that are single char only?

Probably, I'm working on that now. The only parameter that was short-form only is

-i          Automatically install dependencies and use global cache in bun's runtime, equivalent to --install=fallback

I am adding long-form --install-fallback for now.

Parzival-3141 commented 1 year ago

This seems to be fixed as of 4b63ced72.

> bun-debug install zod -d                                       
bun add v0.8.2_debug (4b63ced7)
  🔍 Resolving [1/1] [uws] connect(registry.npmjs.org, 443)
  🔒 Saving lockfile...

 installed zod@3.22.2

 1 packages installed [159.00ms]
"devDependencies": {
    "zod": "^3.22.2"
  }

It also works for -D, --dev, and --optional, and when passing package URLs.