get-npm-meta
v0.1.2
Published
A minimal, auth-aware npm metadata client with private registry support.
Maintainers
Readme
get-npm-meta
Minimal, auth-aware npm metadata utilities for projects that rely on .npmrc, scoped registries, or private registries.
pnpm add get-npm-metaUsage
import { getLatestVersion, getVersions } from 'get-npm-meta'
const react = await getLatestVersion('react')
const internal = await getLatestVersion('@org/pkg@^1', {
cwd: process.cwd(),
metadata: true,
})
const versions = await getVersions('@org/pkg', {
cwd: process.cwd(),
metadata: true,
})get-npm-meta reads user and project .npmrc, applies npm_config_* overrides, resolves scoped registries, and forwards registry auth when needed.
Supported specs are registry package specs such as foo, foo@latest, foo@^1, and @scope/foo@beta.
API
[!TIP] The request options extend
fast-npm-metawith npm config loading controls:cwd,env,userConfigPath, andprojectConfigPath.
getLatestVersion(spec, options)getLatestVersionBatch(specs, options)getVersions(spec, options)getVersionsBatch(specs, options)loadNpmConfig(options)parseNpmSpec({ spec })
Compared to fast-npm-meta
fast-npm-meta is the recommended choice when you only use the default npm registry.
get-npm-meta is for npm-style registry resolution: it loads .npmrc, picks scoped registries, reuses auth config, and keeps the return shape aligned with fast-npm-meta where practical.
When a package resolves to the default npm registry (https://registry.npmjs.org/), this package delegates the request to fast-npm-meta.
Credits
License
MIT License © jinghaihan
