https://github.com/stabldev/pkgversion
A tiny Node.js utility to retrieve the installed version of a package.
https://github.com/stabldev/pkgversion
nodejs package utility-library version-checker
Last synced: about 1 month ago
JSON representation
A tiny Node.js utility to retrieve the installed version of a package.
- Host: GitHub
- URL: https://github.com/stabldev/pkgversion
- Owner: stabldev
- License: mit
- Created: 2025-08-03T02:45:07.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-08-03T05:05:06.000Z (11 months ago)
- Last Synced: 2025-09-03T19:06:07.099Z (10 months ago)
- Topics: nodejs, package, utility-library, version-checker
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/@stabldev/pkgversion
- Size: 9.77 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pkgversion




A tiny Node.js utility to retrieve the installed version of a package.
## Installation
```bash
npm i @stabldev/pkgversion
````
## Usage
```js
import pkgversion from "@stabldev/pkgversion"
const reactVersion = pkgversion("react")
console.log(reactVersion) // e.g., "19.1.1"
```
## API Reference
```ts
pkgversion(pkgName: string, baseDir?: string): string | null
```
* `pkgName`: The name of the installed package (e.g., `"react"`).
* `baseDir` (optional): Directory to start from (defaults to `process.cwd()`).
## License
[MIT](https://github.com/stabldev/pkgversion/blob/main/LICENSE) Copyright (c) [stabldev](https://github.com/stabldev)