Skip to content

vp migrate false-positive husky version check when version is a dist-tag or non-semver string ("latest", "next", etc.) #1114

@mildlyfunctional

Description

@mildlyfunctional

Describe the bug

vp migrate reports "Detected husky <9.0.0 — please upgrade to husky v9+ first, then re-run migration." even when husky v9 is installed. The check reads the version string from package.json devDependencies and uses semver.coerce() on it. When the version is "latest", semver.coerce("latest") returns null, which falls back to "0.0.0" and incorrectly satisfies < 9.0.0.

Reproduction

https://github.com/mildlyfunctional/vp-migrate-repro

Steps to reproduce

Steps to reproduce:

  1. Clone the reproduction repo
  2. Run vp migrate
  3. See: Detected husky <9.0.0 — please upgrade to husky v9+ first, then re-run migration.

System Info

Environment:
  Version  24.14.0
  Source   lts

Tool Paths:
  node  /Users/mrwokkel/.vite-plus/js_runtime/node/24.14.0/bin/node
  npm   /Users/mrwokkel/.vite-plus/js_runtime/node/24.14.0/bin/npm
  npx   /Users/mrwokkel/.vite-plus/js_runtime/node/24.14.0/bin/npx


vp v0.1.13

Local vite-plus:
  vite-plus  Not found

Tools:
  vite             Not found
  rolldown         Not found
  vitest           Not found
  oxfmt            Not found
  oxlint           Not found
  oxlint-tsgolint  Not found
  tsdown           Not found

Environment:
  Package manager  pnpm v10.32.1
  Node.js          v24.14.0

Used Package Manager

npm

Logs

Validations

Metadata

Metadata

Assignees

Type

Priority

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions