configure-vite-plus
GitHub配置 Vite+ 工作流,涵盖构建、打包、任务编排及缓存管理。指导如何定义任务依赖、保持构建边界、优化本地与 CI/CD 缓存策略,并处理 GitHub Actions 集成中的注意事项。
触发场景
安装
npx skills add videojs/video.js --skill configure-vite-plus -g -y
SKILL.md
Frontmatter
{
"name": "configure-vite-plus",
"description": "Configure Vite+. Use for tasks, cache, migration, or CI."
}
Configure Vite+ workflows
Inspect the installed vite-plus version, root and owning-package manifests and vite.config.ts files, build/pack.ts, relevant CI workflows, and the command's current clean-run behavior before editing. Use pnpm exec vp <command> --help and installed types when they differ from online documentation.
Read references/official-guide.md only for the sections that match the work: task graphs, cache diagnosis, GitHub Actions cache, Pack, or migration.
Workflow
- Classify each operation:
vp buildfor applications,vp packfor libraries, andvp runfor orchestration and caching. Invoke a script or configured task asvp run <name>; barevp <name>selects a built-in command. - Preserve build boundaries. Keep historically separate packaging workflows in separate Vite+ configs unless they are genuinely variants of one build. A named
packarray supportsvp pack --filter <name>within one workflow; a nestedvite.config.tssupports an independent workflow viavp -C <dir> pack. - Define ordering in
run.tasks, not in serial shell pipelines. Every configured task needscommandand cannot duplicate a same-namedpackage.jsonscript. Use{ task: 'build', from: ['dependencies', 'devDependencies'] }for declared direct workspace edges andpackage#taskfor synthetic edges such as generated CDN assets.-rselects workspace tasks; it does not replace missing task dependencies. - Let the graph expose independent work to Vite+'s scheduler. Do not lower concurrency to repair missing edges. Reserve
--parallel, which ignores dependencies, for independent persistent tasks such as development servers. - Keep root scripts as thin selectors. Put package-specific commands, inputs, outputs, environment, and dependencies in the owning package's config.
- Prove local cache stability before configuring cross-run cache. Only
vp runuses Vite Task caching. Run the exact task twice and require the second run to hit. Prefer automatic tracking, then addcache.input,cache.output,cache.env, orcache.untrackedEnvonly from observed misses. Avoid generators that rewrite unchanged inputs. - In GitHub Actions, install first, restore
node_modules/.vite/task-cache, run the samevp runtasks used locally, and save only after success. Keep source and lockfile hashes out of the Actions cache key because Vite Task fingerprints task inputs.
Repository gotchas
- Reuse packaging defaults from
build/pack.ts; keep package entries, platform, and exceptional plugins local. - Top-level Vite
resolve.aliasand Pack'spack.aliasserve different consumers. Do not assume one configures the other; share alias constants when both commands need identical mappings and test both paths. - Vite+ loads a package config before it can schedule that package's dependencies. Config-time imports from private workspace packages must be available without relying on their built output.
vp packuses file-system cache tracking rather thanvp build's cooperative Vite metadata. Diagnose its observed reads and writes before adding manual globs.
Example
Input: The sandbox build consumes normal workspace packages and generated HTML CDN files.
Output: A configured build task with declared workspace and generated-artifact dependencies.
build: {
command: 'vp build',
dependsOn: [
{ task: 'build', from: ['dependencies', 'devDependencies'] },
'@videojs/html#build:cdn',
],
}
Validation
Run the narrow target from a clean output state, inspect vp run -v ordering, and run it immediately again to verify cache hits and restored outputs. Then run the affected package tests/build, pnpm typecheck when types or configs changed, and pnpm check:workspace. For CI changes, verify restore occurs after install, save uses the restore step's primary key, and logs show both an Actions cache restore and Vite Task cache hits.
版本历史
- 8a0a3d8 当前 2026-10-20 08:02


