Skip to content

fix: read version dynamically from package.json#10

Merged
bigknoxy merged 1 commit into
mainfrom
fix/dynamic-version
Mar 3, 2026
Merged

fix: read version dynamically from package.json#10
bigknoxy merged 1 commit into
mainfrom
fix/dynamic-version

Conversation

@bigknoxy

@bigknoxy bigknoxy commented Mar 2, 2026

Copy link
Copy Markdown
Owner

Problem

The CLI version was hardcoded as '0.1.0' in src/index.ts. When package.json was bumped to 0.1.2, the CLI still reported 0.1.0.

Solution

Read version dynamically from package.json at runtime using createRequire from node:module.

Changes

  • Import createRequire from node:module
  • Load package.json using require() (ESM-compatible approach)
  • Use pkg.version instead of hardcoded string

Testing

$ npm run build
$ node dist/index.js --version
0.1.2

Previously version was hardcoded as '0.1.0' which caused the CLI to show
incorrect version after package.json was bumped. Now reads version from
package.json at runtime using createRequire.
@bigknoxy
bigknoxy merged commit c4b367e into main Mar 3, 2026
5 checks passed
@bigknoxy
bigknoxy deleted the fix/dynamic-version branch March 3, 2026 00:01
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.

1 participant