Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions crates/vite_shared/src/env_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,6 @@ pub struct EnvConfig {
/// Env: `VITE_GLOBAL_CLI_JS_SCRIPTS_DIR`
pub js_scripts_dir: Option<String>,

/// Filter for update task types.
///
/// Env: `VITE_UPDATE_TASK_TYPES`
pub update_task_types: Option<String>,

/// Override Node.js version (takes highest priority in version resolution).
///
/// Env: `VP_NODE_VERSION`
Expand Down Expand Up @@ -146,7 +141,6 @@ impl EnvConfig {
env_use_eval_enable: std::env::var(env_vars::VP_ENV_USE_EVAL_ENABLE).is_ok(),
tool_recursion: std::env::var(env_vars::VP_TOOL_RECURSION).ok(),
js_scripts_dir: std::env::var(env_vars::VITE_GLOBAL_CLI_JS_SCRIPTS_DIR).ok(),
update_task_types: std::env::var(env_vars::VITE_UPDATE_TASK_TYPES).ok(),
node_version: std::env::var(env_vars::VP_NODE_VERSION).ok(),
user_home: std::env::var("HOME")
.or_else(|_| std::env::var("USERPROFILE"))
Expand Down Expand Up @@ -233,7 +227,6 @@ impl EnvConfig {
env_use_eval_enable: false,
tool_recursion: None,
js_scripts_dir: None,
update_task_types: None,
node_version: None,
user_home: None,
vp_shell: None,
Expand Down
3 changes: 0 additions & 3 deletions crates/vite_shared/src/env_vars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ pub const VP_ENV_USE_EVAL_ENABLE: &str = "VP_ENV_USE_EVAL_ENABLE";
/// Explicitly specify the current shell.
pub const VP_SHELL: &str = "VP_SHELL";

/// Filter for update task types.
pub const VITE_UPDATE_TASK_TYPES: &str = "VITE_UPDATE_TASK_TYPES";

/// Override directory for global CLI JS scripts.
pub const VITE_GLOBAL_CLI_JS_SCRIPTS_DIR: &str = "VITE_GLOBAL_CLI_JS_SCRIPTS_DIR";

Expand Down
16 changes: 4 additions & 12 deletions packages/cli/binding/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,17 +464,9 @@ mod tests {
let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set");
let run_config_path = PathBuf::from(manifest_dir).join("../src/run-config.ts");

if std::env::var("VITE_UPDATE_TASK_TYPES").as_deref() == Ok("1") {
std::fs::write(&run_config_path, &ts_type).expect("Failed to write run-config.ts");
} else {
let current = std::fs::read_to_string(&run_config_path)
.expect("Failed to read run-config.ts")
.replace('\r', "");
pretty_assertions::assert_eq!(
current,
ts_type,
"run-config.ts is out of sync. Run `VITE_UPDATE_TASK_TYPES=1 cargo test -p vite-plus-cli run_config_types_in_sync` to update."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

VITE_UPDATE_TASK_TYPES should not be removed. It's supposed to be manually set for this test to update the config.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for clarifying. In that case, should we keep the manual update mode and rename the variable to VP_UPDATE_TASK_TYPES instead?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes please keep it. VP_UPDATE_TASK_TYPES LGTM.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'll close this PR and update #2312 with an additional commit that renames the variable to VP_UPDATE_TASK_TYPES 🙇‍♂️

);
}
let current = std::fs::read_to_string(&run_config_path)
.expect("Failed to read run-config.ts")
.replace('\r', "");
pretty_assertions::assert_eq!(current, ts_type, "run-config.ts is out of sync.");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve a regeneration path for run-config.ts

When an upstream UserRunConfig change alters TS_TYPE, this test now only reports the mismatch and no repository command can regenerate packages/cli/src/run-config.ts; that file still explicitly says it is auto-generated by cargo test and must not be edited manually. Keep the update mode or replace it with a documented generator so contributors can update the checked-in public TypeScript types instead of being left with a permanently failing test.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

^ This is the correct explanation of VITE_UPDATE_TASK_TYPES's purpose.

}
}
Loading