@vexcms/cli
v0.0.8
Published
The CLI tool for [VEX CMS](https://github.com/ianyimi/vex) — handles schema generation, type generation, file watching, auto-migration, and Convex process management during development and deployment.
Downloads
789
Readme
@vexcms/cli
The CLI tool for VEX CMS — handles schema generation, type generation, file watching, auto-migration, and Convex process management during development and deployment.
Installation
pnpm add -D @vexcms/cliThe CLI is exposed as the vex binary.
Commands
vex dev
Starts the development workflow:
vex dev [--once]- Loads your
vex.config.ts - Generates Convex schema (
vex.schema.ts) and types (vex.types.ts) - Generates typed collection API files (
convex/vex/api/*.ts) - Starts
convex devin the background - Watches for config changes and regenerates on save
- Traces import dependencies to watch only relevant files
--once — Generate schema, push to Convex, and exit (no long-running watch).
vex deploy
Handles production deployment:
vex deploy- Generates schema for production
- Runs auto-migration if enabled (interim schema → mutations → final schema)
- Executes
convex deploy
Use this instead of convex deploy directly to ensure VEX schema is up to date.
vex generate
Force-regenerates all typed collection API files:
vex generateRegenerates all files in convex/vex/api/ and convex/vex/model/api/, runs ESLint auto-fix, and cleans up stale files from removed collections.
What It Generates
| Output | Path | Description |
|--------|------|-------------|
| VEX Schema | convex/vex.schema.ts | Convex defineTable() exports for all collections |
| VEX Types | convex/vex.types.ts | TypeScript types for all collections |
| Collection APIs | convex/vex/api/{slug}.ts | Query and mutation exports per collection |
| Model APIs | convex/vex/model/api/{slug}.ts | Typed helper functions per collection |
| Schema sync | convex/schema.ts | Auto-updated to import VEX tables |
All generated files include a // ⚠️ AUTO-GENERATED BY VEX CMS — DO NOT EDIT ⚠️ header. Stale files from removed collections are automatically cleaned up.
File Watching
- Uses Chokidar for file system monitoring with debouncing
- Traces imports from
vex.config.tsto build a dependency tree - Only watches files that your config actually imports
- Re-traces imports after each regeneration to pick up new dependencies
Auto-Migration
When schema changes are detected during vex dev or vex deploy:
- Diffs old vs new schema
- Creates an interim schema (new required fields become optional, removed fields re-added as optional)
- Deploys interim schema
- Executes field removal and backfill mutations
- Deploys final schema
Config Resolution
Looks for config files in this order: vex.config.ts, vex.config.mts, vex.config.js, vex.config.mjs. Uses Jiti for dynamic TypeScript loading with tsconfig path alias support.
Peer Dependencies
@vexcms/core— Core VEX CMS types and utilitiesconvex— Convex backend (>=1.0.0)
