Skip to content

nyxb/pkg-infoh

Repository files navigation

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 💞

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published