{"id":13447117,"url":"https://github.com/alanshaw/david","last_synced_at":"2025-05-15T11:01:38.092Z","repository":{"id":6499378,"uuid":"7739877","full_name":"alanshaw/david","owner":"alanshaw","description":" :eyeglasses: Node.js module that tells you when your package npm dependencies are out of date.","archived":false,"fork":false,"pushed_at":"2022-12-10T10:06:02.000Z","size":481,"stargazers_count":968,"open_issues_count":40,"forks_count":70,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-04-14T18:58:38.927Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://david-dm.org","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/alanshaw.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-21T20:34:40.000Z","updated_at":"2025-02-20T01:15:11.000Z","dependencies_parsed_at":"2023-01-11T17:01:06.262Z","dependency_job_id":null,"html_url":"https://github.com/alanshaw/david","commit_stats":null,"previous_names":[],"tags_count":54,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alanshaw%2Fdavid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alanshaw%2Fdavid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alanshaw%2Fdavid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alanshaw%2Fdavid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alanshaw","download_url":"https://codeload.github.com/alanshaw/david/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254328384,"owners_count":22052632,"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":[],"created_at":"2024-07-31T05:01:08.671Z","updated_at":"2025-05-15T11:01:37.522Z","avatar_url":"https://github.com/alanshaw.png","language":"JavaScript","readme":"\u003cp align=\"center\"\u003e\u003ca href=\"https://david-dm.org\"\u003e\u003cimg src=\"https://raw.github.com/alanshaw/david-www/master/david-logo.png\" alt=\"David\" height=\"50\" /\u003e\u003c/a\u003e\u003c/p\u003e\r\n\u003cp align=\"center\"\u003e\r\n\u003ca href=\"https://www.npmjs.com/package/david\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/david.svg\" alt=\"npm version\"\u003e\u003c/a\u003e\r\n\u003ca href=\"http://inch-ci.org/github/alanshaw/david\"\u003e\u003cimg src=\"http://inch-ci.org/github/alanshaw/david.svg?branch=master\" alt=\"Inline docs\"\u003e\u003c/a\u003e\r\n\u003ca href=\"https://travis-ci.org/alanshaw/david\"\u003e\u003cimg src=\"https://travis-ci.org/alanshaw/david.svg\" alt=\"Build Status\"\u003e\u003c/a\u003e\r\n\u003ca href=\"https://coveralls.io/r/alanshaw/david?branch=master\"\u003e\u003cimg src=\"http://img.shields.io/coveralls/alanshaw/david.svg?style=flat\" alt=\"Coverage Status\"\u003e\u003c/a\u003e\r\n\u003ca href=\"https://david-dm.org/alanshaw/david\"\u003e\u003cimg src=\"https://david-dm.org/alanshaw/david.svg\" alt=\"Dependency Status\"\u003e\u003c/a\u003e\r\n\u003ca href=\"https://david-dm.org/alanshaw/david/?type=dev\"\u003e\u003cimg src=\"https://david-dm.org/alanshaw/david/dev-status.svg\" alt=\"devDependency Status\"\u003e\u003c/a\u003e\r\n\u003c/p\u003e\r\n\r\nNode.js module that tells you when your package npm dependencies are out of date.\r\n\r\n\r\n## Getting Started\r\n\r\nInstall [Node.js](http://nodejs.org/).\r\n\r\nInstall david:\r\n\r\n```sh\r\ncd /your/project/directory\r\nnpm install david\r\n```\r\n\r\nUse:\r\n\r\n```javascript\r\nvar david = require('david');\r\n\r\n// Your package.json\r\nvar manifest = {\r\n  name: 'xxx',\r\n  dependencies: {\r\n    'aaa': '~0.0.0',\r\n    'bbb': '~0.0.0'\r\n  },\r\n  devDependencies: {\r\n    'yyy': '~0.0.0',\r\n    'zzz': '~0.0.0'\r\n  }\r\n};\r\n\r\ndavid.getDependencies(manifest, function (er, deps) {\r\n  console.log('latest dependencies information for', manifest.name);\r\n  listDependencies(deps);\r\n});\r\n\r\ndavid.getDependencies(manifest, { dev: true }, function (er, deps) {\r\n  console.log('latest devDependencies information for', manifest.name);\r\n  listDependencies(deps);\r\n});\r\n\r\ndavid.getUpdatedDependencies(manifest, function (er, deps) {\r\n  console.log('dependencies with newer versions for', manifest.name);\r\n  listDependencies(deps);\r\n});\r\n\r\ndavid.getUpdatedDependencies(manifest, { dev: true }, function (er, deps) {\r\n  console.log('devDependencies with newer versions for', manifest.name);\r\n  listDependencies(deps);\r\n});\r\n\r\ndavid.getUpdatedDependencies(manifest, { stable: true }, function (er, deps) {\r\n  console.log('dependencies with newer STABLE versions for', manifest.name);\r\n  listDependencies(deps);\r\n});\r\n\r\ndavid.getUpdatedDependencies(manifest, { dev: true, stable: true }, function (er, deps) {\r\n  console.log('devDependencies with newer STABLE versions for', manifest.name);\r\n  listDependencies(deps);\r\n});\r\n\r\nfunction listDependencies(deps) {\r\n  Object.keys(deps).forEach(function(depName) {\r\n    var required = deps[depName].required || '*';\r\n    var stable = deps[depName].stable || 'None';\r\n    var latest = deps[depName].latest;\r\n    console.log('%s Required: %s Stable: %s Latest: %s', depName, required, stable, latest);\r\n  });\r\n}\r\n```\r\n\r\nBoth `getDependencies` and `getUpdatedDependencies` return an object result,\r\nwhose keys are package names. The values are objects which contain the following properties:\r\n\r\n* `required` - The version required according to the manifest\r\n* `stable` - The latest stable version available\r\n* `latest` - The latest version available (including build and patch versions)\r\n\r\n\r\n## CLI\r\n\r\nIf you install David globally with `npm install -g david`, you can run `david`\r\nin your project directory to see which dependencies are out of date.\r\n\r\nYou can also run `david --global` to see your outdated global dependencies.\r\n\r\n### Update to latest\r\n\r\nTo update all your project dependencies to the latest **stable** versions,\r\nand save to your `package.json`, run:\r\n\r\n```sh\r\ndavid update\r\n```\r\n\r\nTo update a particular project dependency to the latest **stable** version,\r\nand save to your `package.json`, run:\r\n\r\n```sh\r\ndavid update package-name\r\n```\r\n\r\nYou can also update global dependencies to latest versions:\r\n\r\n```sh\r\ndavid update --global\r\n```\r\n\r\nTo update all your project dependencies to the latest versions\r\n(including unstable versions), pass the `--unstable` flag:\r\n\r\n```sh\r\ndavid update --unstable\r\n```\r\n\r\n### Alternate registry\r\n\r\n```sh\r\ndavid update --registry http://registry.nodejitsu.com/\r\n```\r\n\r\n### Non-npm and SCM (Git) dependencies\r\n\r\nIf you have dependencies that are not published to npm, david will print a warning message by default. To throw an error and exit, pass the `error404` option:\r\n\r\n```sh\r\ndavid --error404\r\n```\r\n\r\nIf using david programmatically, pass `error: {E404: true}` in the options object.\r\n\r\nIf you have dependencies whose versions are SCM URLs, david will print a warning message by default. To throw an error and exit, pass the `errorSCM` option:\r\n\r\n```sh\r\ndavid --errorSCM\r\n```\r\n\r\nIf using david programmatically, pass `error: {ESCM: true}` in the options object.\r\n\r\n### Specify package.json path\r\n\r\nUse `-p, --package` to specify the path to your package.json.\r\n\r\n### Ignore dependencies\r\n\r\nTo tell david to ignore dependencies, add a `david.ignore` property to your `package.json` which lists the dependencies david should ignore. If using david programmatically you can also pass this as an option. Globs are also supported. e.g.\r\n\r\n**package.json**\r\n```json\r\n{\r\n  \"david\": {\r\n    \"ignore\": [\"async\", \"underscore\", \"@types/*\"]\r\n  }\r\n}\r\n```\r\n\r\n---\r\n\r\n\u003cp align=\"center\"\u003e\r\n\u003ca href=\"https://github.com/feross/standard\"\u003e\u003cimg src=\"https://cdn.rawgit.com/feross/standard/master/badge.svg\" alt=\"js-standard-style\"\u003e\u003c/a\u003e\r\n\u003c/p\u003e\r\n","funding_links":[],"categories":["Packages","JavaScript","包","目录","Command-line apps","Uncategorized"],"sub_categories":["Command-line apps","Other","命令行程序","命令行应用","Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falanshaw%2Fdavid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falanshaw%2Fdavid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falanshaw%2Fdavid/lists"}