pkg-infoh
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

npm version npm downloads bundle JSDocs License

ℹ️ pkg-infoh

📦 Retrieve details of local packages. Works on both CJS and ESM.

⬇️ Install:

# nyxi
nyxi pkg-infoh

# pnpm 
pnpm add pkg-infoh

# npm 
npm i pkg-infoh

# yarn
yarn add pkg-infoh

Usage

import {
   getPackageInfo,
   importModule,
   isPackageExists,
   resolveModule,
} from 'pkg-infoh'

isPackageExists('pkg-infoh') // true
isPackageExists('foo') // false

await getPackageInfo('pkg-infoh')
/* {
 *   name: "local-pkg",
 *   version: "0.1.0",
 *   rootPath: "/path/to/node_modules/pkg-infoh",
 *   packageJson: {
 *     ...
 *   }
 * }
 */

// similar to `require.resolve` but works also in ESM
resolveModule('pkg-infoh')
// '/path/to/node_modules/local-pkg/dist/index.cjs'

// similar to `await import()` but works also in CJS
const { importModule } = await importModule('pkg-infoh')

📜 License

MIT - Made with 💞

Readme

Keywords

Package Sidebar

Install

npm i pkg-infoh

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

6.87 kB

Total Files

4

Last publish

Collaborators

  • dennisollhoff