DhanushNehru / DhanushNehru/lockcheck
Warn if Node.js version is below 18.0.0
- Dominant language
- JavaScript
- Stars
- 11
- Forks
- 3
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 3
Description
`lockcheck` heavily relies on the native `fetch()` API for the npm registry freshness checks. The native `fetch()` API was only introduced permanently in Node.js 18.0.0.
If a user runs the tool on an older Node version (like Node 16), it will crash with a confusing `fetch is not defined` error. We should catch this early and provide a helpful error message.
**Acceptance Criteria:**
- At the very top of `bin/lockcheck.js`, parse `process.version` to check the Node major version.
- If the major version is `< 18`, immediately `const { red } = require('../src/utils/colors.js')` (using older syntax if needed, or stick to our ESM imports) and print a clear error: `Error: lockcheck requires Node.js v18.0.0 or higher.`
- Call `process.exit(1)`.
Contributor guide
Research direction
Start in bin/lockcheck.js and inspect the existing color utility at src/utils/colors.js. Run the CLI with Node.js 16 and a supported Node.js version to compare startup behavior. Done means versions below 18 exit immediately with the exact required error and status 1, while supported versions continue normally.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 70/100