0.0.2 â€ĸ Published 12 months ago

pkg-infoh v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

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 💞

0.0.2

12 months ago

0.0.1

12 months ago