Skip to content

feat(doctor): add Node.js version and Tailwind CSS checks (fix #193) - #194

Open
aosmcleod wants to merge 2 commits into
heroui-inc:mainfrom
aosmcleod:feat/doctor-node-tailwind-checks
Open

feat(doctor): add Node.js version and Tailwind CSS checks (fix #193)#194
aosmcleod wants to merge 2 commits into
heroui-inc:mainfrom
aosmcleod:feat/doctor-node-tailwind-checks

Conversation

@aosmcleod

Copy link
Copy Markdown
Contributor

Closes #193

📝 Description

Expands the doctor command with two additional checks that catch common setup issues before users hit confusing runtime errors.

1. Node.js version check

The README states Node.js 22+ is required, but the doctor command didn't verify this. Users on older Node versions (18/20 LTS are still common) get cryptic errors instead of a clear diagnostic.

2. Tailwind CSS installation check

The TAILWINDCSS constant already existed in src/constants/required.ts but wasn't used in the doctor action. While the generic peer dependency check might catch this, a dedicated check provides a more helpful error message explaining that HeroUI v3 specifically requires Tailwind CSS v4.

Current behavior

heroui doctor
# Only checks: packages installed + peer deps met

New behavior

heroui doctor
# Checks: Node version + packages installed + Tailwind CSS + peer deps met

Each new check follows the existing problemRecord pattern — no new abstractions or dependencies introduced.

💣 Is this a breaking change (Yes/No):

No — strictly additive diagnostics. Existing checks are unchanged.

✅ Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (improve a current implementation without adding a new feature or fixing a bug)
  • Improvement (non-breaking change which improves an existing feature)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

@aosmcleod
aosmcleod requested a review from jrgarciadev as a code owner May 24, 2026 21:20
@wingkwong wingkwong self-assigned this May 25, 2026
Comment thread src/actions/doctor-action.ts Outdated

const problemRecord: ProblemRecord[] = [];

// Check 1: Node.js version meets minimum requirement

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when no heroui package is installed, this will be silently dropped

Comment thread src/actions/doctor-action.ts Outdated
const nodeVersion = process.versions.node;
const [nodeMajor] = nodeVersion.split('.').map(Number);

if (nodeMajor != null && nodeMajor < 22) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node 22.0.0 - 22.21.x gets a false green light.

ref: see package.json

  "engines": {
    "node": ">=22.22.0",
    "pnpm": ">=10.x"
  },

Comment thread src/actions/doctor-action.ts Outdated
});
}

// Check 3: Tailwind CSS is installed

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this one is not required as tailwindcss is a peer dependency where we already have the check below. If we add this check 3 and tw is missing, users will get 2 issues for the same root cause.

@wingkwong wingkwong assigned aosmcleod and unassigned wingkwong May 31, 2026
- Compare Node.js version against the full engines.node value (22.22.0)
  instead of major only, which was greenlighting 22.0.0 - 22.21.x.
- Drop the dedicated Tailwind CSS check. Tailwind is a peer dependency
  of @heroui/react and is covered by the peer-dependency check, so the
  dedicated check produced two issues for the same root cause.
- Convert the "no HeroUI packages" early return into a problemRecord
  entry so an unsupportedNodeVersion issue isn't silently dropped when
  HeroUI itself is missing.
@aosmcleod

Copy link
Copy Markdown
Contributor Author

@wingkwong addressed all three comments:

  1. Node version off-by-one — was only comparing major against 22, which green-lighted 22.0.022.21.x even though package.json declares engines.node: ">=22.22.0". Switched to a full-semver compareVersions(nodeVersion, MIN_NODE_VERSION) check with MIN_NODE_VERSION = '22.22.0' kept at the top of the file with a comment noting it should stay in sync with engines.node.

  2. Tailwind check removed — agreed, it produced two issues for the same root cause when Tailwind was missing. Tailwind CSS is already covered by the peer-dependency check below. Dropped the dedicated Check 3 and removed the now-unused TAILWINDCSS import.

  3. No-HeroUI early return dropping earlier checks — converted the "no HeroUI" case from an early return into a problemRecord entry, so an unsupportedNodeVersion issue (or any earlier check) is still reported in the same output pass when HeroUI itself is missing. The peer-dep check now only runs when at least one HeroUI package is installed (otherwise there's nothing to query peer deps for).

Ready for re-review.

@aosmcleod
aosmcleod requested a review from wingkwong May 31, 2026 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] - Expand doctor command with Node.js version check and Tailwind CSS detection

2 participants