Skip to content
Merged
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
46 changes: 40 additions & 6 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,36 @@ vp run <task> # run task in current package
vp run <package>#<task> # run task in specific package
vp run <task> -r # run task in all packages (recursive)
vp run <task> -t # run task in current package + transitive deps
vp run <task> --extra --args # pass extra args to the task command
vp run <task> -- --extra --args # pass extra args to the task command
vp run # interactive task selector (fuzzy search)

# Built-in commands (run tools from node_modules/.bin)
vp test [args...] # run vitest
vp lint [args...] # run oxlint

# Flags
-r, --recursive # run across all packages
-t, --transitive # run in current package and its dependencies
# Cache management
vp cache clean # remove the cache database

# Package selection flags
-r, --recursive # select all packages in the workspace
-t, --transitive # select current package + transitive deps
-w, --workspace-root # select the workspace root package
-F, --filter <pattern> # pnpm-style filter (repeatable, see below)

# Run flags
--ignore-depends-on # skip explicit dependsOn dependencies
-v, --verbose # show full detailed summary after execution
--cache # force caching on for all tasks and scripts
--no-cache # force caching off for all tasks and scripts
--last-details # show detailed summary of the last run

# Filter patterns (pnpm-style)
-F <name> # select by package name
-F '@scope/*' # select by glob pattern
-F ./<dir> # select packages under a directory
-F '<pattern>...' # select package and its dependencies
-F '...<pattern>' # select package and its dependents
-F '!<pattern>' # exclude packages matching pattern
```

## Key Architecture
Expand All @@ -105,16 +125,30 @@ Tasks are defined in `vite-task.json`:

```json
{
"cache": true | false | { "scripts": bool, "tasks": bool },
"tasks": {
"test": {
"command": "vitest run",
"dependsOn": ["build", "lint"],
"cache": true
"cwd": "relative/path",
"dependsOn": ["build", "package#task"],
"cache": true,
"envs": ["NODE_ENV"],
"passThroughEnvs": ["CI"],
"inputs": ["src/**", "!dist/**", { "auto": true }]
}
}
}
```

- `cache` (root): workspace-wide cache toggle. Default: `{ "scripts": false, "tasks": true }`
- `command`: shell command to run (falls back to package.json script if omitted)
- `cwd`: working directory relative to the package root
- `dependsOn`: explicit task dependencies (`taskName` or `package#task`)
- `cache` (task): enable/disable caching for this task (default: `true`)
- `envs`: env var names to fingerprint and pass to the task
- `passThroughEnvs`: env var names to pass without fingerprinting
- `inputs`: files for cache fingerprinting (globs, `{ "auto": true }`, negation patterns)

## Task Dependencies

1. **Explicit**: Defined via `dependsOn` in `vite-task.json` (skip with `--ignore-depends-on`)
Expand Down
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file removed a.js
Empty file.
1 change: 0 additions & 1 deletion crates/vite_task/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ bincode = { workspace = true, features = ["derive"] }
bstr = { workspace = true }
clap = { workspace = true, features = ["derive"] }
derive_more = { workspace = true, features = ["from"] }
diff-struct = { workspace = true }
fspy = { workspace = true }
futures-util = { workspace = true }
once_cell = { workspace = true }
Expand Down
86 changes: 30 additions & 56 deletions crates/vite_task/docs/boolean-flags.md
Original file line number Diff line number Diff line change
@@ -1,80 +1,54 @@
# Boolean Flags in vite-plus
# Boolean Flags in Vite Task

This document describes how boolean flags work in vite-plus commands.

## Negation Pattern

All boolean flags in vite-plus support a negation pattern using the `--no-` prefix. When a `--no-*` flag is used, it explicitly sets the corresponding boolean option to `false`.
This document describes how boolean flags work in `vp` commands.

## Available Boolean Flags

### Global Flags

- `--debug` / `--no-debug` - Enable or disable cache debugging output
- Short form: `-d` (only for positive form)

### Run Command Flags

- `--recursive` / `--no-recursive` - Enable or disable recursive task execution across all packages
- Short form: `-r` (only for positive form)

- `--parallel` / `--no-parallel` - Enable or disable parallel task execution
- Short form: `-p` (only for positive form)
- `--recursive` / `-r` — Run task in all packages in the workspace
- `--transitive` / `-t` — Run task in the current package and its transitive dependencies
- `--workspace-root` / `-w` — Run task in the workspace root package
- `--ignore-depends-on` — Skip explicit `dependsOn` dependencies
- `--verbose` / `-v` — Show full detailed summary after execution
- `--cache` / `--no-cache` — Force caching on or off for all tasks and scripts

- `--sequential` / `--no-sequential` - Enable or disable sequential task execution
- Short form: `-s` (only for positive form)
### Negation Pattern

- `--topological` / `--no-topological` - Enable or disable topological ordering based on package dependencies
- Short form: `-t` (only for positive form)

## Behavior

### Conflicts

The positive and negative forms of a flag are mutually exclusive. You cannot use both `--flag` and `--no-flag` in the same command:
The `--cache` flag supports a `--no-cache` negation form. When `--no-cache` is used, caching is explicitly disabled for all tasks in that run:

```bash
# This will result in an error
vp run --recursive --no-recursive build
```
# Force caching off
vp run build --no-cache

### Precedence

When only the negative form is used, it takes precedence and explicitly sets the value to `false`:

```bash
# Explicitly disable topological ordering
vp run build -r --no-topological
# Force caching on (even for scripts that default to uncached)
vp run build --cache
```

### Default Values

The negative flags are particularly useful for overriding default behaviors:

- `--recursive` with `--no-topological`: By default, recursive runs enable topological ordering. Use `--no-topological` to disable it:
```bash
# Recursive run WITHOUT topological ordering
vp run build -r --no-topological
```
The positive and negative forms are mutually exclusive — you cannot use both `--cache` and `--no-cache` in the same command.

## Examples

```bash
# Run with debugging disabled (useful if debug is enabled by default in config)
vp --no-debug build
# Recursive build (all packages in dependency order)
vp run build -r

# Current package + transitive dependencies
vp run build -t

# Recursive build without topological ordering
vp run build --recursive --no-topological
# Run in workspace root
vp run build -w

# Explicitly disable parallel execution
vp run build --no-parallel
# Skip explicit dependsOn edges
vp run build --ignore-depends-on

# Run tests sequentially, not in parallel
vp run test --no-parallel
# Verbose output
vp run build -v

# Force caching off for this run
vp run build --no-cache
```

## Implementation Details

The `--no-*` flags use clap's `conflicts_with` attribute to ensure they cannot be used together with their positive counterparts. When processing flags, vite-plus uses a `resolve_bool_flag` function that gives precedence to the negative form when present.

This pattern provides a consistent and intuitive way to explicitly disable features that might be enabled by default or through configuration files.
The flags use clap's argument parsing. The `--cache`/`--no-cache` pair uses clap's `conflicts_with` attribute to ensure they cannot be used together.
Loading