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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Changelog

- **Fixed** `vp run --cache` now supports running without a task specifier and opens the interactive task selector, matching bare `vp run` behavior ([#312](https://github.com/voidzero-dev/vite-task/pull/313))
- **Added** object form for `input` entries: `{ "pattern": "...", "base": "workspace" | "package" }` to resolve glob patterns relative to the workspace root instead of the package directory ([#295](https://github.com/voidzero-dev/vite-task/pull/295))
- **Fixed** arguments after the task name being consumed by `vp` instead of passed through to the task ([#286](https://github.com/voidzero-dev/vite-task/pull/286), [#290](https://github.com/voidzero-dev/vite-task/pull/290))
- **Changed** default untracked env patterns to align with Turborepo, covering more CI and platform-specific variables ([#262](https://github.com/voidzero-dev/vite-task/pull/262))
Expand Down
7 changes: 6 additions & 1 deletion crates/vite_task/src/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,12 @@ impl<'a> Session<'a> {
let bare = RunCommand::try_parse_from::<_, &str>([])
.expect("parsing hardcoded bare command should never fail")
.into_resolved();
if run_command != bare {

// Normalize the run_command for comparison by ignoring cache flags, which don't affect task selection.
let mut normalized_run_command = run_command.clone();
normalized_run_command.flags.cache = false;

if normalized_run_command != bare {
return Err(vite_task_plan::Error::MissingTaskSpecifier.into());
}
let qpr = self.handle_no_task(is_interactive, &run_command).await?;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "cache-task-select-test",
"private": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[[e2e]]
name = "cache hit with interactive selector and --cache"
steps = [
{ argv = [
"vt",
"run",
"--cache",
], interactions = [
{ "expect-milestone" = "task-select::0" },
{ "write-key" = "enter" },
] },
{ argv = [
"vt",
"run",
"--cache",
], interactions = [
{ "expect-milestone" = "task-select::0" },
{ "write-key" = "enter" },
] },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
source: crates/vite_task_bin/tests/e2e_snapshots/main.rs
assertion_line: 441
expression: e2e_outputs
---
> vt run --cache
@ expect-milestone: task-select::0
Select a task (↑/↓, Enter to run, type to search):

› build vtt print-file src/main.ts
lint echo lint app
@ write-key: enter
Selected task: build
$ vtt print-file src/main.ts
export const main = 'initial';
> vt run --cache
@ expect-milestone: task-select::0
Select a task (↑/↓, Enter to run, type to search):

› build vtt print-file src/main.ts
lint echo lint app
@ write-key: enter
Selected task: build
$ vtt print-file src/main.ts ◉ cache hit, replaying
export const main = 'initial';

---
vt run: cache hit.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const main = 'initial';
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"tasks": {
"build": {
"command": "vtt print-file src/main.ts",
"cache": true
},
"lint": {
"command": "echo lint app"
}
}
}
35 changes: 35 additions & 0 deletions docs/cache-eviction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Cache Eviction

Available scoped cache eviction through `cache clear`:

```bash
vp cache clear
vp cache clear --task <task-name>
vp cache clear --package <package-name>
```

Examples:

```bash
vp cache clear
vp cache clear --task build
vp cache clear --package @my/abc
```

## Semantics

- `vp cache clear`: evict all cache entries.
- `vp cache clear --task build`: evict entries for task name `build` across workspace.
- `vp cache clear --package @my/abc`: evict entries for package `@my/abc` across all tasks.

Matching is exact (no wildcard/regex in this RFC).

## CLI constraints

- `--task` and `--package` are mutually exclusive.
- No flag means full clear.

## Output

- Success message includes cleared count.
- Non-zero exit only on invalid args or storage errors.
Loading