# @mnrendra/use-package

> A utility to provide package.json data.

Latest version **1.0.0** (published 2023-12-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @mnrendra/use-package
pnpm add @mnrendra/use-package
yarn add @mnrendra/use-package
bun add @mnrendra/use-package
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2023-12-02 |
| First published | 2023-12-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Muhammad Rendra |
| Maintainers | mnrendra |
| Keywords | read, package, json, use-package, package-json |

## Links

- npm: https://www.npmjs.com/package/@mnrendra/use-package
- Repository: https://github.com/mnrendra/use-package
- Homepage: https://github.com/mnrendra/use-package#readme
- Issues: https://github.com/mnrendra/use-package/issues
- npm.io page: https://npm.io/package/@mnrendra/use-package

## Dependencies (1)

- [@mnrendra/read-package](https://npm.io/package/@mnrendra/read-package.md) ^2.0.3

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.0 (latest) — 2023-12-02

## README

# @mnrendra/use-package
A utility to provide `package.json` data. Because [@mnrendra/read-package](https://www.npmjs.com/package/@mnrendra/read-package) is expensive, this utility is used to save it.

## Install
```bash
npm i @mnrendra/use-package
```

## Usage

Using `CommonJS`:

`index.js`
```javascript
const { clonePackage } = require('@mnrendra/use-package')
const submodule = require('./submodule')

const main = async () => {
  await clonePackage()
  submodule()
}
```
`submodule.js`
```javascript
const { pack } = require('@mnrendra/use-package')

const main = () => {
  pack.customField = 'customField'

  console.log(pack.name) // Will print your package.json name.
  console.log(pack.version) // Will print your package.json version.
  console.log(pack.customField) // Will print your package.json customField.
}
```

Using `ES Module`:

`index.js`
```javascript
import { clonePackage } from '@mnrendra/use-package'
import submodule from './submodule'

const main = async () => {
  await clonePackage()
  submodule()
}
```
`submodule.js`
```javascript
import { pack } from '@mnrendra/use-package'

const main = () => {
  pack.customField = 'customField'

  console.log(pack.name) // Will print your package.json name.
  console.log(pack.version) // Will print your package.json version.
  console.log(pack.customField) // Will print your package.json customField.
}
```

# Types
```typescript
import type {
  Package // @mnrendra/types-package
} from '@mnrendra/use-package'
```

## License
[MIT](https://github.com/mnrendra/read-packag/blob/HEAD/LICENSE)

## Author
[@mnrendra](https://github.com/mnrendra)

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