Description
Vite+ positions itself as a unified toolchain that consolidates JS/TS dev-tooling config into vite.config.ts. The staged block has already absorbed lint-staged, so pre-commit enforcement is a single config block + one auto-generated hook.
Conventional Commits enforcement is the symmetric missing piece. A Vite+ project that wants commit-message validation today must:
- Install
@commitlint/cli and a config preset (typically @commitlint/config-conventional).
- Add a config entry in
package.json or a separate commitlint.config.* file.
- Hand-write
.vite-hooks/commit-msg to invoke commitlint --edit "$1".
Two devDeps, a second config location, and a manual hook file — for what is, in most projects, a one-line preset choice.
Use cases
- Projects adopting Conventional Commits for changelog automation (release-please, semantic-release).
- Monorepos already using
vp staged, where the asymmetry between pre-commit (one config block) and commit-msg (three files/deps) is most visible.
vp create / vp migrate flows, which today can't offer a "yes, enforce conventional commits" prompt because the integration does not exist.
Motivation
Conventional Commits is the most-adopted commit message convention in the JS ecosystem and the natural complement to the existing staged integration. Absorbing it keeps Vite+'s "config in one place" promise consistent across both git hook points and eliminates a recurring scaffolding step.
I don't currently intend to submit a PR — opening this to gauge interest first.
Suggested solution
Add a commitMsg block to the Vite+ config schema, mirroring the existing staged integration:
import { defineConfig } from 'vite-plus';
export default defineConfig({
commitMsg: {
convention: 'conventional',
},
});
Behavior:
- New command
vp commit-msg <path> — reads the message file at <path> and exits non-zero on violation (equivalent to commitlint --edit "$1").
vp config detects the commitMsg block and generates .vite-hooks/commit-msg running vp commit-msg "$1", in the same pass that generates .vite-hooks/pre-commit for staged.
- Absence of the block = no hook generated. Symmetric with how
staged works today.
- No new user devDependencies. Conventional Commits parsing can live inside
vite-plus (or be vendored from an upstream library) so the user only sees the config block.
Future extensions could accept named presets ('angular'), an extends field for shareable configs, or inline rules — but the MVP is a single boolean-or-preset toggle for the 90% case.
Alternative
-
Status quo (current workaround): Install @commitlint/cli + @commitlint/config-conventional, drop config in package.json or commitlint.config.*, and hand-write .vite-hooks/commit-msg. Works, but it's three extra moving parts (two devDeps + a hand-rolled hook) for what is, in the common case, a single canonical preset.
-
Generic hooks block in vite.config.ts: Expose a freeform hooks: { 'commit-msg': '...' } map that vp config materializes. More flexible than a commitMsg-specific block, but it does not reduce devDeps — the user still installs commitlint; the hook content just relocates. Could be a complementary addition, not a substitute.
-
Scaffolding only: vp config --commit-msg writes the commitlint setup (deps, config, hook) once. Lighter to implement, but the result is unmanaged — vp can't keep the hook in sync if the preset or hook layout evolves.
Additional context
No response
Validations
Description
Vite+ positions itself as a unified toolchain that consolidates JS/TS dev-tooling config into
vite.config.ts. Thestagedblock has already absorbedlint-staged, sopre-commitenforcement is a single config block + one auto-generated hook.Conventional Commits enforcement is the symmetric missing piece. A Vite+ project that wants commit-message validation today must:
@commitlint/cliand a config preset (typically@commitlint/config-conventional).package.jsonor a separatecommitlint.config.*file..vite-hooks/commit-msgto invokecommitlint --edit "$1".Two devDeps, a second config location, and a manual hook file — for what is, in most projects, a one-line preset choice.
Use cases
vp staged, where the asymmetry betweenpre-commit(one config block) andcommit-msg(three files/deps) is most visible.vp create/vp migrateflows, which today can't offer a "yes, enforce conventional commits" prompt because the integration does not exist.Motivation
Conventional Commits is the most-adopted commit message convention in the JS ecosystem and the natural complement to the existing
stagedintegration. Absorbing it keeps Vite+'s "config in one place" promise consistent across both git hook points and eliminates a recurring scaffolding step.I don't currently intend to submit a PR — opening this to gauge interest first.
Suggested solution
Add a
commitMsgblock to the Vite+ config schema, mirroring the existingstagedintegration:Behavior:
vp commit-msg <path>— reads the message file at<path>and exits non-zero on violation (equivalent tocommitlint --edit "$1").vp configdetects thecommitMsgblock and generates.vite-hooks/commit-msgrunningvp commit-msg "$1", in the same pass that generates.vite-hooks/pre-commitforstaged.stagedworks today.vite-plus(or be vendored from an upstream library) so the user only sees the config block.Future extensions could accept named presets (
'angular'), anextendsfield for shareable configs, or inlinerules— but the MVP is a single boolean-or-preset toggle for the 90% case.Alternative
Status quo (current workaround): Install
@commitlint/cli+@commitlint/config-conventional, drop config inpackage.jsonorcommitlint.config.*, and hand-write.vite-hooks/commit-msg. Works, but it's three extra moving parts (two devDeps + a hand-rolled hook) for what is, in the common case, a single canonical preset.Generic
hooksblock invite.config.ts: Expose a freeformhooks: { 'commit-msg': '...' }map thatvp configmaterializes. More flexible than acommitMsg-specific block, but it does not reduce devDeps — the user still installs commitlint; the hook content just relocates. Could be a complementary addition, not a substitute.Scaffolding only:
vp config --commit-msgwrites the commitlint setup (deps, config, hook) once. Lighter to implement, but the result is unmanaged — vp can't keep the hook in sync if the preset or hook layout evolves.Additional context
No response
Validations