# get-current-package

> Get the package.json of the currently executing bin.

Latest version **1.0.1** (published 2025-01-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install get-current-package
pnpm add get-current-package
yarn add get-current-package
bun add get-current-package
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2025-01-12 |
| First published | 2023-02-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Maintainers | fabiospampinato |
| Keywords | cli, get, current, package |

## Links

- npm: https://www.npmjs.com/package/get-current-package
- Repository: https://github.com/fabiospampinato/get-current-package
- Homepage: https://github.com/fabiospampinato/get-current-package#readme
- Issues: https://github.com/fabiospampinato/get-current-package/issues
- npm.io page: https://npm.io/package/get-current-package

## Dependencies (1)

- [find-up-json](https://npm.io/package/find-up-json.md) ^2.0.5

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2025-01-12
- 1.0.0 — 2023-02-09

## README

# Get Current Package

Get the `package.json` of the currently executing bin.

This is meant to be used in combination with [`tiny-updater`](https://github.com/fabiospampinato/tiny-updater) or similar, in order to get the name and the version of the currently executing bin very conveniently, without importing a "package.json" and without hard-coding the values yourself.

## Install

```sh
npm install get-current-package
```

## Usage

You should have something like this in your bin app:

```ts
import getCurrentPackage from 'get-current-package';

console.log ( getCurrentPackage () );
```

Then executing the bin would produce this:

```
> my-bin
< { name: 'my-bin', version: '1.0.0', ... }
```

Basically it detects which entrypoint file is being executed and retrieves its `package.json`.

## License

MIT © Fabio Spampinato

---
_Source: https://npm.io/package/get-current-package · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
