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

Support --dev/-D and support dependency flags on bun install #3989

Merged
merged 1 commit into from
Aug 5, 2023

Conversation

colinhacks
Copy link
Contributor

@colinhacks colinhacks commented Aug 4, 2023

What does this PR do?

Support --dev/-D. Yarn and pnpm use --dev so it is more expected.
Support dependency flags on bun install (long overdue)

Ideally we'd rework clap to support "hidden flags". Currently the helptext looks as below. Separate lines for both -d, --dev and -D, --development but visually they share a description.

bun-debug add -h    
[SYS] read(3, 4096) = 4096 (0.211ms)
[SYS] close(3)
	-c, --config <STR>?            	Load config (bunfig.toml)
	-y, --yarn                     	Write a yarn.lock file (yarn v1)
	-p, --production               	Don't install devDependencies
	    --no-save                  	Don't save a lockfile
	    --save                     	Save to package.json
	    --dry-run                  	Don't install anything
	    --lockfile <PATH>          	Store & load a lockfile at a specific filepath
	    --frozen-lockfile          	Disallow changes to lockfile
	-f, --force                    	Always request the latest versions from the registry & reinstall all dependencies
	    --cache-dir <PATH>         	Store & load cached data from a specific directory path
	    --no-cache                 	Ignore manifest cache entirely
	    --silent                   	Don't log anything
	    --verbose                  	Excessively verbose logging
	    --no-progress              	Disable the progress bar
	    --no-summary               	Don't print a summary
	    --no-verify                	Skip verifying integrity of newly downloaded packages
	    --ignore-scripts           	Skip lifecycle scripts in the project's package.json (dependency scripts are never run)
	-g, --global                   	Install globally
	    --cwd <STR>                	Set a specific cwd
	    --backend <STR>            	Platform-specific optimizations for installing dependencies. Possible values: "clonefile" (default), "hardlink", "symlink", "copyfile"
	    --link-native-bins <STR>...	Link "bin" from a matching platform-specific "optionalDependencies" instead. Default: esbuild, turbo
	    --help                     	Print this help menu
	-d, --dev                      	Add dependency to "devDependencies"
	-D, --development              	
	    --optional                 	Add dependency to "optionalDependencies"
	    --exact                    	Add the exact version instead of the ^range

@github-actions
Copy link
Contributor

github-actions bot commented Aug 4, 2023

@colinhacks 1 files with test failures on linux-x64-baseline:

  • test/js/third_party/prisma/prisma.test.ts

View test output

#0b1e6dc7132468afe3a3b0e87e3ed4fd495adf02

@github-actions
Copy link
Contributor

github-actions bot commented Aug 4, 2023

@colinhacks 1 files with test failures on linux-x64:

  • test/js/third_party/prisma/prisma.test.ts

View test output

#0b1e6dc7132468afe3a3b0e87e3ed4fd495adf02

@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2023

@colinhacks 5 files with test failures on bun-darwin-aarch64:

  • test/bundler/bundler_cjs2esm.test.ts
  • test/cli/install/bunx.test.ts
  • test/js/bun/spawn/spawn.test.ts
  • test/js/bun/test/test-test.test.ts
  • test/js/node/http/node-http.test.ts

View test output

#0b1e6dc7132468afe3a3b0e87e3ed4fd495adf02

@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2023

@colinhacks 4 files with test failures on bun-darwin-x64-baseline:

  • test/js/bun/spawn/spawn-streaming-stdin.test.ts
  • test/js/bun/sqlite/sqlite.test.js
  • test/js/third_party/webpack/webpack.test.ts
  • test/js/web/timers/setTimeout.test.js

View test output

#0b1e6dc7132468afe3a3b0e87e3ed4fd495adf02

@Jarred-Sumner
Copy link
Collaborator

you manually checked this works, right? i remember clap had weird issues with single-letter uppercase CLI arguments

@colinhacks
Copy link
Contributor Author

colinhacks commented Aug 5, 2023

@Jarred-Sumner Yep. Also verified that this is adding to devDependencies in all cases. It also works when the flag is after the package name(s).

$ bun-debug remove lodash && bun-debug add --dev lodash
[SYS] read(3, 4096) = 4096 (0.019ms)
[SYS] close(3)
[0.05ms] ".env.local", ".env"
bun remove v0.7.3_debug (18a2e18a)
 - lodash

 1 packages removed [34.00ms]
[SYS] read(3, 4096) = 4096 (0.019ms)
[SYS] close(3)
[0.04ms] ".env.local", ".env"
bun add v0.7.3_debug (18a2e18a)

 installed lodash@4.17.21

[25.00ms] done
$ bun-debug remove lodash && bun-debug add --development lodash
[SYS] read(3, 4096) = 4096 (0.037ms)
[SYS] close(3)
[0.07ms] ".env.local", ".env"
bun remove v0.7.3_debug (18a2e18a)
 - lodash

 1 packages removed [30.00ms]
[SYS] read(3, 4096) = 4096 (0.019ms)
[SYS] close(3)
[0.04ms] ".env.local", ".env"
bun add v0.7.3_debug (18a2e18a)

 installed lodash@4.17.21

[26.00ms] done
$ bun-debug remove lodash && bun-debug add -D lodash           
[SYS] read(3, 4096) = 4096 (0.034ms)
[SYS] close(3)
[0.08ms] ".env.local", ".env"
bun remove v0.7.3_debug (18a2e18a)
 - lodash

 1 packages removed [34.00ms]
[SYS] read(3, 4096) = 4096 (0.024ms)
[SYS] close(3)
[0.04ms] ".env.local", ".env"
bun add v0.7.3_debug (18a2e18a)

 installed lodash@4.17.21

[25.00ms] done
$ bun-debug remove lodash && bun-debug add -d lodash
[SYS] read(3, 4096) = 4096 (0.057ms)
[SYS] close(3)
[0.13ms] ".env.local", ".env"
bun remove v0.7.3_debug (18a2e18a)
 - lodash

 1 packages removed [40.00ms]
[SYS] read(3, 4096) = 4096 (0.020ms)
[SYS] close(3)
[0.05ms] ".env.local", ".env"
bun add v0.7.3_debug (18a2e18a)

 installed lodash@4.17.21

[27.00ms] done

@Jarred-Sumner Jarred-Sumner merged commit 78081cb into main Aug 5, 2023
@Jarred-Sumner Jarred-Sumner deleted the dev-flag branch August 5, 2023 03:41
@Jarred-Sumner
Copy link
Collaborator

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants