CLI — vsh
The CLI currently generates basic pages and copies reference layout/locales/API/stores. It is not a verified clone of the current v2 product apps: generated dependencies/bootstrap still need alignment with shared mobile UI and Query integration. Use an existing H5 app as the reference and run type checks, build and browser tests before using a generated app.
The project bundles a small command-line tool, @vh5/vsh (invoked as vsh), built on cac. It wraps linting, dependency checks, scaffolding, and workspace management so contributors don't have to memorize long command chains.
Running commands
The CLI is a workspace package whose binary is vsh. You can invoke it in two ways:
# Via pnpm (preferred)
pnpm exec vsh <command>
# Or through the root npm scripts that already wrap the common commands
pnpm lint # vsh lint
pnpm format # vsh lint --format
pnpm publint # vsh publint
pnpm create-app # vsh create-appRun pnpm exec vsh --help to list all commands, or pnpm exec vsh <command> --help for a single command's options.
Commands
vsh lint
Runs the full lint/format check suite. The tool picks serial or parallel execution based on CPU cores (≤ 4 cores → serial, to avoid memory spikes on low-end machines).
pnpm exec vsh lint
pnpm exec vsh lint --threads 4 # explicit thread count for oxfmt / oxlintIt runs, in order:
| Tool | Command |
|---|---|
| Oxfmt (check) | oxfmt --check --threads=N |
| OxLint | oxlint --type-aware --threads=N |
| ESLint | eslint . --cache |
| Stylelint | stylelint "**/*.{vue,css,less,scss}" --cache |
Add --format to auto-fix issues instead of only reporting them:
pnpm format
# runs: stylelint --fix, oxfmt, oxlint --fix --type-aware, eslint --fixvsh publint
Checks every package's package.json against publint publishing standards.
pnpm publintvsh create-app
Interactively scaffolds a new H5 app under apps/. It prompts for a UI framework (Varlet / Vant / NutUI) and an app name, then generates a full boilerplate (package.json, vite.config.ts, router, views, i18n, stores) and copies layout/, locales/, api/, and stores/ from the matching reference app.
pnpm create-appAfter it finishes, follow the printed next steps: run pnpm install, then add dev:<name> / build:<name> scripts to the root package.json.
vsh check-circular
Scans the workspace for circular (import) dependencies using circular-dependency-scanner. Findings are reported as a warning and do not fail the build.
pnpm exec vsh check-circular
pnpm exec vsh check-circular --staged # only scan staged files
pnpm exec vsh check-circular --verbose # show detail (on by default)
pnpm exec vsh check-circular --threshold 2 # minimum cycle length
pnpm exec vsh check-circular --ignore-dirs dist,node_modulesBy default it ignores dist, .turbo, output, .cache, scripts, internal, and a few heavy UI-kit packages.
vsh check-dep
Uses depcheck to find missing or unused dependencies across all workspace packages.
pnpm exec vsh check-dep
pnpm exec vsh check-dep --ignore-packages @vh5/foo,@vh5/bar
pnpm exec vsh check-dep --ignore-matches vite,vitest
pnpm exec vsh check-dep --ignore-patterns dist,publicA curated set of build-only packages (e.g. @vh5/tsconfig, @vh5/vite-config) is ignored by default.
vsh code-workspace
Regenerates the vh5.code-workspace file from the current workspace packages so VS Code's multi-root workspace stays in sync.
pnpm exec vsh code-workspace
pnpm exec vsh code-workspace --spaces 4
pnpm exec vsh code-workspace --auto-commit # git add the resultSee Code Standards for the lint toolchain that vsh lint drives.