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

Consolidate cli command code into a separate folder #16344

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

fel1x-developer
Copy link
Contributor

@fel1x-developer fel1x-developer commented Jan 12, 2025

What does this PR do?

Currently, commands that are directly and indirectly executed coexist in src/cli folder. This has two problems:

  1. There are too many files with file name ending *_command.zig
  2. When adding a new command or importing files under src/cli, it is hard to know if a command is directly executed by users. (e.g. run is directly executed by bun run while pack does not. There is no bun pack command)

When there is bun <command>, the code that executes the command is in src/cli/<command>.zig, with exception of bunx/bun x which is under src/cli/bunx.zig, not src/cli/x.zig.

  • Documentation or TypeScript types (it's okay to leave the rest blank in this case)
  • Code changes

How did you verify your code works?

Build success on Ubuntu 24.04.1 LTS WSL kernel 6.12.8

@RiskyMH
Copy link
Member

RiskyMH commented Jan 12, 2025

Copy link
Member

@RiskyMH RiskyMH Jan 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moving these files may cause issues with how the site redirects and other linkings to github raw

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have access to the code for https://bun.sh because it is closed source.
For documentation files, I finished following grep in bun repository.

$ grep -inr --include \*.md "_command.zig"
$ grep -inr --include \*.md "src/cli/"

@fel1x-developer
Copy link
Contributor Author

Screenshot 2025-01-12 151638

Propably caused by: src/codegen/bundle-modules.ts

Is it prohibited to have two zig files with same filename? If it is, this is a huge issue in DX.

@fel1x-developer fel1x-developer marked this pull request as draft January 14, 2025 02:46
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