Skip to content

feat(task-graph): add run.scripts options for package.json scripts - #996

Open
serkodev wants to merge 4 commits into
voidzero-dev:mainfrom
serkodev:feat/run-scripts
Open

serkodev wants to merge 4 commits into
voidzero-dev:mainfrom
serkodev:feat/run-scripts

Conversation

@serkodev

Copy link
Copy Markdown

A package.json script cannot have env, dependsOn, or input, and a task cannot have the same name as a script. A project that keeps its scripts must add a second task name and write the command again. vp run --cache typecheck then runs the plain script without this configuration.

#224 made command required, and this change keeps that rule.

Closes #995

Changes

run.scripts adds configuration to the package.json script with the same name:

export default defineConfig({
  run: {
    scripts: {
      typecheck: {
        dependsOn: ['prepare:types'],
        cache: { env: ['APP_PLATFORM'] },
      },
    },
  },
})
  • An entry accepts cwd, dependsOn, and cache. The command stays in package.json.
  • The script is still a script. cache.scripts and --cache decide if it is cached, and its preX and postX hooks still run.
  • An entry without a script of the same name is an error.
  • A task with the same name as a script is still an error. The error message now names run.scripts.
  • A hook runs inside the execution node of its script, so its dependsOn does not apply there. vp run prints a warning. The dependsOn of a hook applies when you run the hook directly.

serkodev and others added 4 commits November 12, 2026 14:33
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

Add task configuration to a package.json script without a second name

1 participant