Skip to content

fix(vite_task): pass raw args to dev command#198

Merged
fengmk2 merged 2 commits intomainfrom
09-24-fix_task_vite_dev_support_options
Sep 24, 2025
Merged

fix(vite_task): pass raw args to dev command#198
fengmk2 merged 2 commits intomainfrom
09-24-fix_task_vite_dev_support_options

Conversation

@fengmk2
Copy link
Copy Markdown
Member

@fengmk2 fengmk2 commented Sep 24, 2025

TL;DR

Fix argument handling for the vite dev command and improve debugging information.

What changed?

  • Fixed argument handling for the vite dev command by replacing #[clap(last = true)] with #[arg(allow_hyphen_values = true, trailing_var_arg = true)] to properly support hyphenated arguments
  • Removed an unnecessary debug log in TaskEnvs
  • Added detailed debug logging for executed commands, including duration and exit status
  • Added a new snapshot test to verify that the vite dev command correctly handles port arguments

How to test?

Run the new snapshot test to verify that the vite dev command correctly handles the --port argument:

cd packages/cli/snap-tests/command-dev-with-port
vite dev --port 12312312312

The command should properly pass the port argument to the dev server and show the expected RangeError.

Why make this change?

The previous implementation didn't properly handle hyphenated arguments for the vite dev command, which could cause issues when users tried to pass options like --port. This change ensures that all arguments, including those with hyphens, are correctly passed to the underlying Vite process. The additional logging also helps with debugging task execution.

Copy link
Copy Markdown
Member Author

fengmk2 commented Sep 24, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@fengmk2 fengmk2 changed the title fix(task): vite dev support options fix(vite_task): support hyphen values in dev command args Sep 24, 2025
@fengmk2 fengmk2 changed the title fix(vite_task): support hyphen values in dev command args fix(vite_task): pass all raw args to dev command Sep 24, 2025
@fengmk2 fengmk2 changed the title fix(vite_task): pass all raw args to dev command fix(vite_task): pass raw args to dev command Sep 24, 2025
@fengmk2 fengmk2 self-assigned this Sep 24, 2025
@fengmk2 fengmk2 marked this pull request as ready for review September 24, 2025 08:09
Copilot AI review requested due to automatic review settings September 24, 2025 08:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes argument handling for the vite dev command and enhances debugging capabilities. The main issue was that hyphenated arguments (like --port) weren't being properly passed to the Vite dev server due to incorrect clap configuration.

  • Fixed argument parsing for vite dev command to properly handle hyphenated arguments
  • Enhanced debugging output with command execution details including duration and exit status
  • Added test coverage for the port argument handling scenario

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

File Description
crates/vite_task/src/lib.rs Updated clap attribute to properly handle hyphenated arguments in dev command
crates/vite_task/src/schedule.rs Added detailed debug logging for executed commands
crates/vite_task/src/execute.rs Removed unnecessary debug log output
packages/cli/snap-tests/command-dev-with-port/ Added new snapshot test to verify port argument handling

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread crates/vite_task/src/lib.rs
Comment thread packages/cli/snap-tests/command-dev-with-port/steps.json Outdated
@fengmk2 fengmk2 force-pushed the 09-24-fix_task_vite_dev_support_options branch from 579a25a to a1cbc54 Compare September 24, 2025 08:12
Copilot AI review requested due to automatic review settings September 24, 2025 08:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@fengmk2 fengmk2 merged commit dadc841 into main Sep 24, 2025
9 checks passed
Copy link
Copy Markdown
Member Author

fengmk2 commented Sep 24, 2025

Merge activity

@fengmk2 fengmk2 deleted the 09-24-fix_task_vite_dev_support_options branch September 24, 2025 08:58
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.

3 participants