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

CLI for development #2915

Closed
Tracked by #2472
Boshen opened this issue Apr 25, 2023 · 7 comments
Closed
Tracked by #2472

CLI for development #2915

Boshen opened this issue Apr 25, 2023 · 7 comments
Assignees
Labels
feat New feature or request team The issue/pr is created by the member of Rspack.

Comments

@Boshen
Copy link
Contributor

Boshen commented Apr 25, 2023

What problem does this feature solve?

Developing Rspack is harder than normal Node.js applications due to needing to have both Node.js and Rust installed and run.

It is tedious to look for commands related to both Node.js or Rust, it doesn't make sense to look for commands in either package.json scripts or cargo .cargo/config.toml or other documentation places.

In order to provide better developer experience, a development cli is needed to wrap all commands and provide useful help information.

We will unify all development workflow, GitHub workflows and documentation to this CLI.

Previously we had ./x script but it didn't work on windows. This time we will bring it back, but change the underlying mechanism to use zx.

The CLI will use the commander library to provide the interface.

What does the proposed API of configuration look like?

After this is done, we should be able to run

./x --help

and it will display something like

subcommands:
* test
* build

subcommand ./x test --help will display

* test rust
* test e2e
* test unit
* test example
@Boshen Boshen added feat New feature or request pending triage The issue/PR is currently untouched. labels Apr 25, 2023
@Boshen Boshen self-assigned this Apr 25, 2023
@github-actions github-actions bot added the team The issue/pr is created by the member of Rspack. label Apr 25, 2023
@hardfist
Copy link
Contributor

a bad DX of using ./x before is that we need to go back to project root to execute this command, it would be better it could be executed in any package directory.

@hyf0
Copy link
Contributor

hyf0 commented Apr 25, 2023

a bad DX of using ./x before is that we need to go back to project root to execute this command, it would be better it could be executed in any package directory.

Could we achieve this by making cli a node package and linking to the root package.json?

After pnpm install the CLI is installed to node_modules/.bin and we could use pnpm x.

@Boshen
Copy link
Contributor Author

Boshen commented Apr 25, 2023

a bad DX of using ./x before is that we need to go back to project root to execute this command, it would be better it could be executed in any package directory.

It is also bad DX if you need to CD into directories for development.

@hardfist
Copy link
Contributor

hardfist commented Apr 25, 2023

using ./x before is that we need to go back to project root to execute this command, it would be better it could be executed in any package directory.

that's inevitable,I may need to debug some example so I need to cd to example directory

@hardfist
Copy link
Contributor

hardfist commented Apr 25, 2023

After pnpm install the CLI is installed to node_modules/.bin and we could use pnpm x.

we could just add the cli bin path to $PATH just like other cli does

@Boshen
Copy link
Contributor Author

Boshen commented Apr 25, 2023

using ./x before is that we need to go back to project root to execute this command, it would be better it could be executed in any package directory.

that's inevitable,I may need to debug some example so I need to cd to example directory

The examples are isolated packages, better to call their own package.json scripts?

@Boshen Boshen removed the pending triage The issue/PR is currently untouched. label Apr 25, 2023
Boshen added a commit that referenced this issue Apr 27, 2023
Boshen added a commit that referenced this issue Apr 27, 2023
chore: setup ./x script using `zx`

relates #2915
@Boshen
Copy link
Contributor Author

Boshen commented May 9, 2023

The script is done. We can just add commands as we go.

@Boshen Boshen closed this as completed May 9, 2023
siyou pushed a commit to siyou/rspack that referenced this issue May 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request team The issue/pr is created by the member of Rspack.
Projects
None yet
Development

No branches or pull requests

3 participants