Files
vue-tui/vite.config.ts
T
Yunfei He 1f73c9ecea refactor(ci): cover all packages without polluting the test contract
The previous fix (b77f42e, reverted in f0cc614) added a test:integration
script to runtime and testing just so `vp run -r test:integration` would match
them — polluting every package's contract to satisfy the CI graph.

Restore the clean contract: normal packages (runtime, testing, cli) have only
a plain `test`; only runtime-tests splits into test:integration + test:pty.
The ci graph adapts instead of the packages:

  ci:test:misc        -> vp run --filter "@vue-tui/*" --filter "!@vue-tui/runtime-tests" test
  ci:test:integration -> vp run @vue-tui/runtime-tests#test:integration
  ci:test:pty         -> vp run @vue-tui/runtime-tests#test:pty

misc runs every normal package's own `test` (the glob auto-covers future
packages); runtime-tests' two suites are separate parallel branches, keeping
the slow PTY suite off the critical path. Verified `CI=true vp run ci` on a
fresh checkout: runtime (309) + testing (7) + integration (756) + pty (110),
PTY runs exactly once, exit 0.
2026-05-29 16:54:13 +08:00

71 lines
2.9 KiB
TypeScript

import { defineConfig } from "vite-plus";
export default defineConfig({
staged: {
"*": "vp check --fix",
},
fmt: {},
lint: {
options: { typeAware: true, typeCheck: false },
rules: {
// This is a terminal UI library: parsing keyboard escape sequences and
// stripping ANSI requires regexes that match control characters (ESC,
// BEL, etc.) by design. no-control-regex flags every such pattern as a
// false positive across the codebase, so disable it library-wide. We
// already write them as \x1b /  unicode escapes (the rule's own
// suggested form), not raw bytes.
"no-control-regex": "off",
},
},
run: {
cache: false,
// `ci` is the parallel verification graph used by .github/workflows/ci.yml.
// The task runner fans out independent branches concurrently; the wall-clock
// critical path is build -> test:pty. fmt and lint have no build dependency,
// so they run immediately alongside build. check:type and the test suites
// need the built dist (@vue-tui/runtime exposes no "types" export — its
// consumers resolve types and runtime from dist/*.d.mts), so they depend on
// build. The serial `ready` script in package.json stays for simple local use.
tasks: {
"ci:build": { command: "vp run build" },
"ci:fmt": { command: "vp run check:fmt" },
// lint depends on build: type-aware rules (e.g. no-implied-eval) on the
// PTY fixtures need @vue-tui/runtime's built types resolved, or they
// misfire on a fresh checkout. build is already on the critical path, so
// this doesn't change overall wall-clock.
"ci:lint": { command: "vp run check:lint", dependsOn: ["ci:build"] },
"ci:type": { command: "vp run check:type", dependsOn: ["ci:build"] },
// Test branches. Normal packages keep a plain `test` script; only
// runtime-tests splits into test:integration + test:pty. So the graph
// runs every normal package's own `test` (misc), and runtime-tests' two
// suites as separate branches — keeping the slow PTY suite on its own
// parallel branch instead of serial inside runtime-tests' `test`.
// misc: select all @vue-tui/* packages, exclude runtime-tests. The glob
// means new normal packages are covered automatically.
"ci:test:misc": {
command: 'vp run --filter "@vue-tui/*" --filter "!@vue-tui/runtime-tests" test',
dependsOn: ["ci:build"],
},
"ci:test:integration": {
command: "vp run @vue-tui/runtime-tests#test:integration",
dependsOn: ["ci:build"],
},
"ci:test:pty": {
command: "vp run @vue-tui/runtime-tests#test:pty",
dependsOn: ["ci:build"],
},
ci: {
command: "echo ci ok",
dependsOn: [
"ci:fmt",
"ci:lint",
"ci:type",
"ci:test:misc",
"ci:test:integration",
"ci:test:pty",
],
},
},
},
});