diff options
author | 2023-08-04 20:41:16 -0700 | |
---|---|---|
committer | 2023-08-04 20:41:16 -0700 | |
commit | 78081cbb40b3149be3fcd7f050ec365c499421d0 (patch) | |
tree | 50cafc60e3a69323352a0b00b0acdb1b04382a02 | |
parent | 6bdee80cfce0205ea1b59679fda93f816a66eed0 (diff) | |
download | bun-78081cbb40b3149be3fcd7f050ec365c499421d0.tar.gz bun-78081cbb40b3149be3fcd7f050ec365c499421d0.tar.zst bun-78081cbb40b3149be3fcd7f050ec365c499421d0.zip |
Support --dev/-D and support more flags on bun install (#3989)
-rw-r--r-- | completions/bun.zsh | 6 | ||||
-rw-r--r-- | docs/cli/install.md | 2 | ||||
-rw-r--r-- | docs/guides/install/add-dev.md | 2 | ||||
-rw-r--r-- | docs/install/index.md | 2 | ||||
-rw-r--r-- | src/install/install.zig | 11 |
5 files changed, 14 insertions, 9 deletions
diff --git a/completions/bun.zsh b/completions/bun.zsh index a8f66b4fa..59df1db47 100644 --- a/completions/bun.zsh +++ b/completions/bun.zsh @@ -49,7 +49,7 @@ _bun() { '--production[Don'"'"'t install devDependencies]' \ '--frozen-lockfile[Disallow changes to lockfile]' \ '--optional[Add dependency to optionalDependencies]' \ - '--development[Add dependency to devDependencies]' \ + '--dev[Add dependency to devDependencies]' \ '-d[Add dependency to devDependencies]' \ '-p[Don'"'"'t install devDependencies]' \ '--no-save[]' \ @@ -91,7 +91,7 @@ _bun() { '--production[Don'"'"'t install devDependencies]' \ '--frozen-lockfile[Disallow changes to lockfile]' \ '--optional[Add dependency to optionalDependencies]' \ - '--development[Add dependency to devDependencies]' \ + '--dev[Add dependency to devDependencies]' \ '-d[Add dependency to devDependencies]' \ '-p[Don'"'"'t install devDependencies]' \ '--no-save[]' \ @@ -127,7 +127,7 @@ _bun() { '--production[Don'"'"'t install devDependencies]' \ '--frozen-lockfile[Disallow changes to lockfile]' \ '--optional[Add dependency to optionalDependencies]' \ - '--development[Add dependency to devDependencies]' \ + '--dev[Add dependency to devDependencies]' \ '-d[Add dependency to devDependencies]' \ '-p[Don'"'"'t install devDependencies]' \ '--no-save[]' \ diff --git a/docs/cli/install.md b/docs/cli/install.md index 02f095d61..9b323a8aa 100644 --- a/docs/cli/install.md +++ b/docs/cli/install.md @@ -114,7 +114,7 @@ $ bun add zod@latest To add a package as a dev dependency (`"devDependencies"`): ```bash -$ bun add --development @types/react +$ bun add --dev @types/react $ bun add -d @types/react ``` diff --git a/docs/guides/install/add-dev.md b/docs/guides/install/add-dev.md index 833f8cfa2..3f7b74f9c 100644 --- a/docs/guides/install/add-dev.md +++ b/docs/guides/install/add-dev.md @@ -5,7 +5,7 @@ name: Add a development dependency To add an npm package as a development dependency, use `bun add --development`. ```sh -$ bun add zod --development +$ bun add zod --dev $ bun add zod -d # shorthand ``` diff --git a/docs/install/index.md b/docs/install/index.md index 162a4abac..540ade9f0 100644 --- a/docs/install/index.md +++ b/docs/install/index.md @@ -114,7 +114,7 @@ $ bun add zod@latest To add a package as a dev dependency (`"devDependencies"`): ```bash -$ bun add --development @types/react +$ bun add --dev @types/react $ bun add -d @types/react ``` diff --git a/src/install/install.zig b/src/install/install.zig index 2c78c81a2..13338c53b 100644 --- a/src/install/install.zig +++ b/src/install/install.zig @@ -5763,6 +5763,10 @@ pub const PackageManager = struct { }; const install_params = install_params_ ++ [_]ParamType{ + clap.parseParam("-d, --dev Add dependency to \"devDependencies\"") catch unreachable, + clap.parseParam("-D, --development") catch unreachable, + clap.parseParam("--optional Add dependency to \"optionalDependencies\"") catch unreachable, + clap.parseParam("--exact Add the exact version instead of the ^range") catch unreachable, clap.parseParam("<POS> ... ") catch unreachable, }; @@ -5771,7 +5775,8 @@ pub const PackageManager = struct { }; const add_params = install_params_ ++ [_]ParamType{ - clap.parseParam("-d, --development Add dependency to \"devDependencies\"") catch unreachable, + clap.parseParam("-d, --dev Add dependency to \"devDependencies\"") catch unreachable, + clap.parseParam("-D, --development") catch unreachable, clap.parseParam("--optional Add dependency to \"optionalDependencies\"") catch unreachable, clap.parseParam("--exact Add the exact version instead of the ^range") catch unreachable, clap.parseParam("<POS> ... \"name\" or \"name@version\" of packages to install") catch unreachable, @@ -5901,8 +5906,8 @@ pub const PackageManager = struct { cli.link_native_bins = args.options("--link-native-bins"); - if (comptime subcommand == .add) { - cli.development = args.flag("--development"); + if (comptime subcommand == .add or subcommand == .install) { + cli.development = args.flag("--development") or args.flag("--dev"); cli.optional = args.flag("--optional"); cli.exact = args.flag("--exact"); } |