diff --git a/.changeset/palette-ux-improvement.md b/.changeset/palette-ux-improvement.md new file mode 100644 index 00000000..5d2e538f --- /dev/null +++ b/.changeset/palette-ux-improvement.md @@ -0,0 +1,5 @@ +--- +"node-version": patch +--- + +Improve JSDoc for version and EOL_DATES exports to enhance Developer Experience (DX). diff --git a/src/index.ts b/src/index.ts index 625ca808..6dc1c19b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,6 +11,8 @@ export type { NodeVersion }; /** * End-of-Life dates for Node.js major versions. + * Keys are major version strings (e.g. "18"), values are "YYYY-MM-DD" date strings. + * @see https://github.com/nodejs/release#release-schedule */ export const EOL_DATES: Record = { "18": "2025-04-30", @@ -113,6 +115,19 @@ export const getVersion = (): NodeVersion => { }; /** - * Node version information. + * Node version information for the current process. + * + * @example + * import { version } from 'node-version'; + * + * console.log(version.original); // 'v20.10.0' + * + * if (version.isLTS) { + * console.log(`Running on LTS: ${version.ltsName}`); + * } + * + * if (version.isAtLeast('20.0.0')) { + * // Use new features + * } */ export const version: NodeVersion = getVersion();