{"id":13754632,"url":"https://github.com/vercel/update-check","last_synced_at":"2025-05-07T10:41:25.248Z","repository":{"id":57387088,"uuid":"128489629","full_name":"vercel/update-check","owner":"vercel","description":"Minimalistic update notifications for command line interfaces","archived":false,"fork":false,"pushed_at":"2024-06-10T09:41:53.000Z","size":30,"stargazers_count":167,"open_issues_count":5,"forks_count":16,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-20T11:39:17.938Z","etag":null,"topics":["checker","notification","package","update"],"latest_commit_sha":null,"homepage":"https://npmjs.com/update-check","language":"JavaScript","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/vercel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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":"2018-04-07T02:32:40.000Z","updated_at":"2025-04-10T08:31:31.000Z","dependencies_parsed_at":"2024-11-23T22:46:45.844Z","dependency_job_id":null,"html_url":"https://github.com/vercel/update-check","commit_stats":{"total_commits":54,"total_committers":7,"mean_commits":7.714285714285714,"dds":"0.11111111111111116","last_synced_commit":"4338e215c9d089f46c6edff45ba41941c070d39f"},"previous_names":["zeit/update-check"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vercel%2Fupdate-check","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vercel%2Fupdate-check/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vercel%2Fupdate-check/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vercel%2Fupdate-check/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vercel","download_url":"https://codeload.github.com/vercel/update-check/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252861765,"owners_count":21815746,"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":["checker","notification","package","update"],"created_at":"2024-08-03T10:00:31.508Z","updated_at":"2025-05-07T10:41:25.221Z","avatar_url":"https://github.com/vercel.png","language":"JavaScript","readme":"# update-check \n\n[![npm version](https://img.shields.io/npm/v/update-check.svg)](https://www.npmjs.com/package/update-check)\n[![install size](https://packagephobia.now.sh/badge?p=update-check)](https://packagephobia.now.sh/result?p=update-check)\n\nThis is a very minimal approach to update checking for [globally installed](https://docs.npmjs.com/getting-started/installing-npm-packages-globally) packages.\n\nBecause it's so simple, the error surface is very tiny and your user's are guaranteed to receive the update message if there's a new version.\n\nYou can read more about the reasoning behind this project [here](https://twitter.com/notquiteleo/status/983193273224200192).\n\n## Usage\n\nFirstly, install the package with [yarn](https://yarnpkg.com/en/)...\n\n```bash\nyarn add update-check\n```\n\n...or [npm](https://www.npmjs.com/):\n\n```bash\nnpm install update-check\n```\n\nNext, initialize it.\n\nIf there's a new update available, the package will return the content of latest version's `package.json` file:\n\n```js\nconst pkg = require('./package');\nconst checkForUpdate = require('update-check');\n\nlet update = null;\n\ntry {\n\tupdate = await checkForUpdate(pkg);\n} catch (err) {\n\tconsole.error(`Failed to check for updates: ${err}`);\n}\n\nif (update) {\n\tconsole.log(`The latest version is ${update.latest}. Please update!`);\n}\n```\n\nThat's it! You're done.\n\n### Configuration\n\nIf you want, you can also pass options to customize the package's behavior:\n\n```js\nconst pkg = require('./package');\nconst checkForUpdate = require('update-check');\n\nlet update = null;\n\ntry {\n\tupdate = await checkForUpdate(pkg, {\n\t\tinterval: 3600000,  // For how long to cache latest version (default: 1 day)\n\t\tdistTag: 'canary'   // A npm distribution tag for comparision (default: 'latest')\n\t});\n} catch (err) {\n\tconsole.error(`Failed to check for updates: ${err}`);\n}\n\nif (update) {\n\tconsole.log(`The latest version is ${update.latest}. Please update!`);\n}\n```\n\n## Contributing\n\n1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device\n2. Link the package to the global module directory: `npm link`\n3. Within the module you want to test your local development instance of the package, just link it: `npm link update-check`. Instead of the default one from npm, node will now use your clone.\n\n## Author\n\nLeo Lamprecht ([@notquiteleo](https://x.com/leo)) - [Vercel](https://vercel.com)\n\n","funding_links":[],"categories":["3. 命令行程序","JavaScript","JavaScript (485)","Uncategorized"],"sub_categories":["3.1 开发库","Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvercel%2Fupdate-check","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvercel%2Fupdate-check","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvercel%2Fupdate-check/lists"}