get-current-package
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Get Current Package

Get the package.json of the currently executing bin.

This is meant to be used in combination with 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

npm install --save get-current-package

Usage

You should have something like this in your bin app:

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

Readme

Keywords

Package Sidebar

Install

npm i get-current-package

Weekly Downloads

15,983

Version

1.0.0

License

none

Unpacked Size

4.35 kB

Total Files

9

Last publish

Collaborators

  • fabiospampinato