https://github.com/nguyenngoclongdev/pkgscan
Retrieve information on installed packages across npm, pnpm and yarn.
https://github.com/nguyenngoclongdev/pkgscan
find installed lockfiles npm package package-manager packages pnpm scan search yarn
Last synced: 5 months ago
JSON representation
Retrieve information on installed packages across npm, pnpm and yarn.
- Host: GitHub
- URL: https://github.com/nguyenngoclongdev/pkgscan
- Owner: nguyenngoclongdev
- License: mit
- Created: 2023-06-06T12:26:32.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-12-27T04:42:08.000Z (over 1 year ago)
- Last Synced: 2025-08-09T13:32:15.304Z (10 months ago)
- Topics: find, installed, lockfiles, npm, package, package-manager, packages, pnpm, scan, search, yarn
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/pkgscan
- Size: 6.22 MB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/nguyenngoclongdev/pkgscan/actions/workflows/ci.yml)
[](https://github.com/nguyenngoclongdev/pkgscan/)
[](https://www.npmjs.org/package/pkgscan)
[](https://gitpod.io/#https://github.com/nguyenngoclongdev/pkgscan)
[](https://packagephobia.now.sh/result?p=pkgscan)
[](https://bundlephobia.com/package/pkgscan@latest)
[](https://npm-stat.com/charts.html?package=pkgscan)
# pkgscan
`pkgscan` is a useful tool to inspect installed packages in your project. It provides detailed information about installed packages managed by popular package managers like `npm`, `pnpm` and `yarn`.

If you find this package useful for your projects, please consider supporting me by [Patreon](https://patreon.com/nguyenngoclong), [KO-FI](https://ko-fi.com/nguyenngoclong) or [Paypal](http://paypal.com/paypalme/longnguyenngoc). It's a great way to help me maintain and improve this tool in the future. Your support is truly appreciated!
[](https://ko-fi.com/nguyenngoclong)
[](http://paypal.com/paypalme/longnguyenngoc)
[](https://patreon.com/nguyenngoclong)
## Installation
**npm**
```sh
# Try with npx
npx pkgscan [options]
# Locally in your project.
npm install pkgscan
# Or globally (use as cli)
npm install -g pkgscan
```
## CLI
### Usage
```
pkgscan [options]
Options:
-p, --pkg The name of the package to retrieve information for.
-c, --cwd The current working directory of the project.
-h, --help Show help
```
### Examples
```sh
# Get details about the installed package with automatic package manager detection.
pkgscan --pkg typescript
# Get details about the installed package with glob pattern.
pkgscan --pkg '@types/*'
# To scan all installed packages
pkgscan --pkg '*'
# Get details about the installed package with a user-specified package manager.
pkgscan --pkg typescript --cwd ./project-directory-path
```
## API
```typescript
import { getInstalledPackage } from 'pkgscan';
// Get details about the installed package with automatic package manager detection.
const installedPackage = getInstalledPackage('typescript');
console.log(installedPackage);
/*
[
{
name: 'typescript',
version: '5.1.3',
isDirectProjectDependency: true,
dev: true,
license: 'Apache-2.0',
engines: { node: '>=14.17' }
}
]
*/
// Get details about the installed package with a user-specified package manager.
const cwd = __dirname;
const installedPackage = getInstalledPackage('typescript', cwd);
console.log(installedPackage);
/*
[
{
name: 'typescript',
version: '5.1.3',
isDirectProjectDependency: true,
dev: true,
license: 'Apache-2.0',
engines: { node: '>=14.17' }
}
]
*/
```
> `isDirectProjectDependency` used to determine whether a package is a direct dependency of a project or not. By using this variable, you can check whether a package is directly listed in the dependencies section of the project's package.json file or not.
## Feedback
If you discover a bug, or have a suggestion for a feature request, please
submit an [issue](https://github.com/nguyenngoclongdev/pkgscan/issues).
## LICENSE
This extension is licensed under the [MIT License](LICENSE)