@juln/npm-pkg-version
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

@juln/npm-pkg-version

install

npm i @juln/npm-pkg-version -S

use

import { getPkgInfo, getLatestVersion, getVersions, validatePkg } from '@juln/npm-pkg-version';
import type { PkgInfo } from '@juln/npm-pkg-version';

(async () => {
  console.log({
    // 第二个参数默认为'https://registry.npmjs.org/'
    pkgInfo: await getPkgInfo('pkgName', 'https://registry.npmjs.org/'),
    latestVersion: await getLatestVersion('pkgName', {
      npmTag: 'latest', // 默认为'latest'
      registryUrl: 'https://registry.npmjs.org/', // 默认为'https://registry.npmjs.org/'
    }),
    // 第二个参数默认为'https://registry.npmjs.org/'
    versions: await getVersions('pkgName', 'https://registry.npmjs.org/'),
    hasNpm: await validatePkg('pkgName', 'version', 'https://registry.npmjs.org/'),
  });
})();

Readme

Keywords

none

Package Sidebar

Install

npm i @juln/npm-pkg-version

Weekly Downloads

0

Version

1.0.8

License

ISC

Unpacked Size

9.35 kB

Total Files

5

Last publish

Collaborators

  • juln