{"id":14971623,"url":"https://github.com/badisi/latest-version","last_synced_at":"2025-10-26T16:30:54.685Z","repository":{"id":57100143,"uuid":"355265452","full_name":"Badisi/latest-version","owner":"Badisi","description":"📦  Get latest versions of packages","archived":false,"fork":false,"pushed_at":"2024-10-24T16:41:09.000Z","size":1455,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-27T09:19:14.678Z","etag":null,"topics":["check","current","dependencies","latest","module","next","npm","package","package-json","pkg","updates","version"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Badisi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-06T16:54:44.000Z","updated_at":"2024-12-12T17:05:58.000Z","dependencies_parsed_at":"2023-02-15T15:35:30.408Z","dependency_job_id":"f93baf7c-9125-440e-9cfa-ab93a693d335","html_url":"https://github.com/Badisi/latest-version","commit_stats":{"total_commits":175,"total_committers":1,"mean_commits":175.0,"dds":0.0,"last_synced_commit":"49c0cb7f028fdad334540e8b7ceb251b830f4f37"},"previous_names":[],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Badisi%2Flatest-version","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Badisi%2Flatest-version/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Badisi%2Flatest-version/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Badisi%2Flatest-version/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Badisi","download_url":"https://codeload.github.com/Badisi/latest-version/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238366797,"owners_count":19460186,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["check","current","dependencies","latest","module","next","npm","package","package-json","pkg","updates","version"],"created_at":"2024-09-24T13:45:33.875Z","updated_at":"2025-10-26T16:30:54.174Z","avatar_url":"https://github.com/Badisi.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n    @badisi/latest-version\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ci\u003e📦 Get latest versions of packages.\u003c/i\u003e\u003cbr/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://www.npmjs.com/package/@badisi/latest-version\"\u003e\n        \u003cimg src=\"https://img.shields.io/npm/v/@badisi/latest-version.svg?color=blue\u0026logo=npm\" alt=\"npm version\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://npmcharts.com/compare/@badisi/latest-version?minimal=true\"\u003e\n        \u003cimg src=\"https://img.shields.io/npm/dw/@badisi/latest-version.svg?color=7986CB\u0026logo=npm\" alt=\"npm donwloads\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/badisi/latest-version/blob/main/LICENSE\"\u003e\n        \u003cimg src=\"https://img.shields.io/npm/l/@badisi/latest-version.svg?color=ff69b4\" alt=\"license\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/Badisi/latest-version/actions/workflows/ci_tests.yml\"\u003e\n        \u003cimg src=\"https://github.com/Badisi/latest-version/actions/workflows/ci_tests.yml/badge.svg\" alt=\"build status\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/badisi/latest-version/blob/main/CONTRIBUTING.md#-submitting-a-pull-request-pr\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/PRs-welcome-brightgreen.svg\" alt=\"PRs welcome\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003chr/\u003e\n\n## Features\n\n✅ Get `installed` versions of packages *(if installed locally or globally with npm or yarn)*\u003cbr/\u003e\n✅ Get `latest` and `next` versions of packages *(from package registries)*\u003cbr/\u003e\n✅ Get `wanted` version of packages *(if a version range or a tag is provided)*\u003cbr/\u003e\n✅ Check if any `updates` are available\u003cbr/\u003e\n✅ Cache support to increase data retrieval performance\u003cbr/\u003e\n✅ Support public/private repositories and proxies\u003cbr/\u003e\n✅ [Command line tool](#command-line-tool) that helps visualize packages updates\u003cbr/\u003e\n\n## Installation\n\n```sh\nnpm install @badisi/latest-version --save\n```\n\n```sh\nyarn add @badisi/latest-version\n```\n\n## Usage\n\n__Example__\n\n```ts\n/** CommonJS */\n// const { readFileSync } = require('fs');\n// const latestVersion = require('@badisi/latest-version');\n\n/** ESM / Typescript */\nimport { readFileSync } from 'fs';\nimport latestVersion from '@badisi/latest-version';\n\n(async () =\u003e {\n    // Single package\n    const pkg = await latestVersion('npm');\n\n    // List of packages\n    const pkgs = await latestVersion(['npm', 'npm@1.3.2', 'npm@beta', '@scope/name@^5.0.2']);\n\n    // Package.json\n    const pkgs = await latestVersion(JSON.parse(readFileSync('package.json').toString()));\n\n    // Using cache\n    const pkg = await latestVersion('npm@^5.0.2', { useCache: true });\n})();\n```\n\n__Return__\n\nEither a collection or a single `LatestVersionPackage` object:\n\n```ts\ninterface LatestVersionPackage {\n    /**\n     * The name of the package.\n     */\n    name: string;\n    /**\n     * The current local installed version of the package (if installed).\n     */\n    local?: string;\n    /**\n     * The current npm global installed version of the package (if installed).\n     */\n    globalNpm?: string;\n    /**\n     * The current yarn global installed version of the package (if installed).\n     */\n    globalYarn?: string;\n    /**\n     * The latest version of the package found on the registry (if found).\n     */\n    latest?: string;\n    /**\n     * The next version of the package found on the registry (if found).\n     */\n    next?: string;\n    /**\n     * The tag or version range that was provided (if provided).\n     *\n     * @default \"latest\"\n     */\n    wantedTagOrRange?: string;\n    /**\n     * The latest version of the package found on the registry and satisfied by the wanted tag or version range.\n     */\n    wanted?: string;\n    /**\n     * Whether the local or global installed versions (if any) could be upgraded or not, based on the wanted version.\n     */\n    updatesAvailable: {\n        local: string | false;\n        globalNpm: string | false;\n        globalYarn: string | false;\n    } | false;\n    /**\n     * Any error that might have occurred during the process.\n     */\n    error?: Error;\n}\n```\n\n__Options__\n\n```ts\ninterface LatestVersionOptions {\n    /**\n     * Awaiting the api to return might take time, depending on the network, and might impact your package loading performance.\n     * You can use the cache mechanism to improve load performance and reduce unnecessary network requests.\n     * If `useCache` is not supplied, the api will always check for updates and wait for every requests to return before returning itself.\n     * If `useCache` is used, the api will either (for each provided packages):\n     * 1) return immediately if a cache was found.\n     * 2) fetch and wait for updates of that particular package then creates a cache for it so that it is available for the next call to the api.\n     *\n     * @default false\n     */\n    useCache?: boolean;\n\n    /**\n     * How long the cache for each provided packages should be used before being refreshed (in milliseconds).\n     * If `useCache` is not supplied, this option has no effect.\n     * If `0` is used, this will force the cache to refresh immediately:\n     * 1) New updates will be fetched and waited\n     * 2) The cache for each provided packages will be refreshed and made available for the next call to the api\n     *\n     * @default ONE_DAY\n     */\n    cacheMaxAge?: number;\n\n    /**\n     * A JavaScript package registry url that implements the CommonJS Package Registry specification.\n     *\n     * @default \"Looks at any registry urls in the .npmrc file or fallback to the default npm registry instead\"\n     * @example \u003ccaption\u003e.npmrc\u003c/caption\u003e\n     * registry = 'https://custom-registry.com/'\n     * @pkgscope:registry = 'https://custom-registry.com/'\n     */\n    registryUrl?: string;\n\n    /**\n     * Set of options to be passed down to Node.js http/https request.\n     *\n     * @example \u003ccaption\u003eBehind a proxy with self-signed certificate\u003c/caption\u003e\n     * { ca: fs.readFileSync('proxy-cert.pem') }\n     * @example \u003ccaption\u003eBypassing certificate validation\u003c/caption\u003e\n     * { rejectUnauthorized: false }\n     */\n    requestOptions?: RequestOptions;\n}\n```\n\n\n## Command line tool\n\nThe CLI utility will help you visualize any available updates for a given *package.json* file, a local *package.json* file or any provided package names.\n\n```sh\n$ latest-version \u003cpackageJson|packageName...\u003e\n\n  Examples:\n    $ lv\n    $ latest-version path/to/package.json\n    $ latest-version package1 package2 package3 --skip-missing\n```\n\n![CLI utility preview][clipreview]\n\n\n\n## Development\n\nSee the [developer docs][developer].\n\n\n## Contributing\n\n#### \u003e Want to Help ?\n\nWant to file a bug, contribute some code or improve documentation ? Excellent!\n\nBut please read up first on the guidelines for [contributing][contributing], and learn about submission process, coding rules and more.\n\n#### \u003e Code of Conduct\n\nPlease read and follow the [Code of Conduct][codeofconduct] and help me keep this project open and inclusive.\n\n\n\n\n[clipreview]: https://github.com/badisi/latest-version/blob/main/cli_preview.png\n[developer]: https://github.com/badisi/latest-version/blob/main/DEVELOPER.md\n[contributing]: https://github.com/badisi/latest-version/blob/main/CONTRIBUTING.md\n[codeofconduct]: https://github.com/badisi/latest-version/blob/main/CODE_OF_CONDUCT.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbadisi%2Flatest-version","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbadisi%2Flatest-version","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbadisi%2Flatest-version/lists"}