[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-10075":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":23,"hasPages":25,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":38,"readmeContent":39,"aiSummary":40,"trendingCount":16,"starSnapshotCount":16,"syncStatus":41,"lastSyncTime":42,"discoverSource":43},10075,"dependency-cruiser","sverweij\u002Fdependency-cruiser","sverweij","Validate and visualize dependencies. Your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.","https:\u002F\u002Fnpmjs.com\u002Fdependency-cruiser",null,"JavaScript",6748,286,22,35,0,4,24,120,18,93.37,"MIT License",false,"main",true,[27,28,29,30,5,31,32,33,34,35,36,37],"architecture-diagram","circular-dependencies","dependencies","dependency-analysis","dependency-graph","javascript","jsx","static-analysis","tsx","typescript","vue","2026-06-12 04:00:48","# Dependency cruiser ![Dependency cruiser](https:\u002F\u002Fraw.githubusercontent.com\u002Fsverweij\u002Fdependency-cruiser\u002Fmain\u002Fdoc\u002Fassets\u002FZKH-Dependency-recolored-160.png)\n\n_Validate and visualise dependencies. With your rules._ JavaScript. TypeScript. CoffeeScript. ES6, CommonJS, AMD.\n\n## What's this do?\n\n![Snazzy dot output to whet your appetite](https:\u002F\u002Fraw.githubusercontent.com\u002Fsverweij\u002Fdependency-cruiser\u002Fmain\u002Fdoc\u002Fassets\u002Fsample-dot-output.png)\n\nThis runs through the dependencies in any JavaScript, TypeScript, LiveScript or CoffeeScript project and ...\n\n- ... **validates** them against (your own) [rules](.\u002Fdoc\u002Frules-reference.md)\n- ... **reports** violated rules\n  - in text (for your builds)\n  - in graphics (for your eyeballs)\n\nAs a side effect it can generate dependency graphs in various output formats including [**cool visualizations**](.\u002Fdoc\u002Freal-world-samples.md)\nyou can stick on the wall to impress your grandma.\n\n## How do I use it?\n\n### Install it ...\n\n```shell\nnpm install --save-dev dependency-cruiser\n# or\nyarn add -D dependency-cruiser\npnpm add -D dependency-cruiser\n```\n\n### ... and generate a config\n\n```shell\nnpx depcruise --init\n```\n\nThis will look around in your environment a bit, ask you some questions and create\na `.dependency-cruiser.js` configuration file attuned to your project[^1][^2].\n\n[^1]:\n    We're using `npx` in the example scripts for convenience. When you use the\n    commands in a script in `package.json` it's not necessary to prefix them with\n    `npx`.\n\n[^2]:\n    If you don't want to use `npx`, but instead `pnpx` (from the `pnpm`\n    package manager) or `yarn` - please refer to that tool's documentation.\n    Particularly `pnpx` has semantics that differ from `npx` quite significantly\n    and that you want to be aware of before using it. In the mean time: `npx`\n    _should_ work even when you installed the dependency with a package manager\n    different from `npm`.\n\n### Show stuff to your grandma\n\nTo create a graph of the dependencies in your src folder, you'd run dependency\ncruiser with output type `dot` and run _GraphViz dot_[^3] on the result. In\na one liner:\n\n```shell\nnpx depcruise src --include-only \"^src\" --output-type dot | dot -T svg > dependency-graph.svg\n```\n\n> \u003Cdetails>\n> \u003Csummary>dependency-cruiser v12 and older: add --config option\u003C\u002Fsummary>\n>\n> While not necessary from dependency-cruiser v13 and later, in v12 and older\n> you'll have to pass the --config option to make it find the .dependency-cruiser.js\n> configuration file:\n>\n> ```shell\n> npx depcruise src --include-only \"^src\" --config --output-type dot | dot -T svg > dependency-graph.svg\n> ```\n\n\u003C\u002Fdetails>\n\n- You can read more about what you can do with `--include-only` and other command line\n  options in the [command line interface](.\u002Fdoc\u002Fcli.md) documentation.\n- _[Real world samples](.\u002Fdoc\u002Freal-world-samples.md)_\n  contains dependency cruises of some of the most used projects on npm.\n- If your grandma is more into formats like `mermaid`, `json`, `csv`, `html` or plain text\n  we've [got her covered](.\u002Fdoc\u002Fcli.md#--output-type-specify-the-output-format)\n  as well.\n\n[^3]:\n    This assumes the GraphViz `dot` command is available - on most linux and\n    comparable systems this will be. In case it's not, see\n    [GraphViz' download page](https:\u002F\u002Fwww.graphviz.org\u002Fdownload\u002F) for instructions\n    on how to get it on your machine.\n\n### Validate things\n\n#### Declare some rules\n\nWhen you ran `depcruise --init` above, the command also added some rules\nto `.dependency-cruiser.js` that make sense in most projects, like detecting\n**circular dependencies**, dependencies **missing** in package.json, **orphans**,\nand production code relying on dev- or optionalDependencies.\n\nStart adding your own rules by tweaking that file.\n\nSample rule:\n\n```json\n{\n  \"forbidden\": [\n    {\n      \"name\": \"not-to-test\",\n      \"comment\": \"don't allow dependencies from outside the test folder to test\",\n      \"severity\": \"error\",\n      \"from\": { \"pathNot\": \"^test\" },\n      \"to\": { \"path\": \"^test\" }\n    }\n  ]\n}\n```\n\n- To read more about writing rules check the\n  [writing rules](.\u002Fdoc\u002Frules-tutorial.md) tutorial\n  or the [rules reference](.\u002Fdoc\u002Frules-reference.md)\n\n#### Report them\n\n```sh\nnpx depcruise src\n```\n\n> \u003Cdetails>\n> \u003Csummary>dependency-cruiser v12 and older: add --config option\u003C\u002Fsummary>\n>\n> While not necessary from dependency-cruiser v13, in v12 and older you'll have\n> to pass the --config option to make it find the .dependency-cruiser.js\n> configuration file:\n>\n> ```shell\n> npx depcruise --config .dependency-cruiser.js src\n> ```\n\n\u003C\u002Fdetails>\n\nThis will validate against your rules and shows any violations in an eslint-like format:\n\n![sample err output](https:\u002F\u002Fraw.githubusercontent.com\u002Fsverweij\u002Fdependency-cruiser\u002Fmain\u002Fdoc\u002Fassets\u002Fsample-err-output.png)\n\nThere's more ways to report validations; in a graph (like the one on top of this\nreadme) or in an self-containing `html` file.\n\n- Read more about the err, dot, csv and html reporters in the\n  [command line interface](.\u002Fdoc\u002Fcli.md)\n  documentation.\n- dependency-cruiser uses itself to check on itself in its own build process;\n  see the `depcruise` script in the\n  [package.json](https:\u002F\u002Fgithub.com\u002Fsverweij\u002Fdependency-cruiser\u002Fblob\u002Fmain\u002Fpackage.json#L76)\n\n## I want to know more!\n\nYou've come to the right place :-) :\n\n- Usage\n  - [Command line reference](.\u002Fdoc\u002Fcli.md)\n  - [Writing rules](.\u002Fdoc\u002Frules-tutorial.md)\n  - [Rules reference](.\u002Fdoc\u002Frules-reference.md)\n  - [Options reference](.\u002Fdoc\u002Foptions-reference.md)\n  - [FAQ](.\u002Fdoc\u002Ffaq.md)\n- Hacking on dependency-cruiser\n  - [API](.\u002Fdoc\u002Fapi.md)\n  - [Output format](.\u002Fdoc\u002Foutput-format.md)\n  - [Adding other output formats](.\u002Fdoc\u002Ffaq.md#q-how-do-i-add-a-new-output-format)\n  - [Adding support for other alt-js languages](.\u002Fdoc\u002Ffaq.md#q-how-do-i-add-support-for-my-favorite-alt-js-language)\n- Other things\n  - [Road map](https:\u002F\u002Fgithub.com\u002Fsverweij\u002Fdependency-cruiser\u002Fprojects\u002F1)\n  - [Contact](.\u002Fdoc\u002Ffaq.md#contact)\n  - [Real world show cases](.\u002Fdoc\u002Freal-world-samples.md)\n  - [TypeScript, CoffeeScript and LiveScript support](.\u002Fdoc\u002Ffaq.md#features)\n  - [Support for .jsx, .tsx, .csx\u002F .cjsx, .vue and .svelte](.\u002Fdoc\u002Ffaq.md#q-im-developing-in-react-and-use-jsx-tsx-csx-cjsx-how-do-i-get-that-to-work)\n  - [Webpack alias\u002F modules support](.\u002Fdoc\u002Ffaq.md#q-does-this-work-with-webpack-configs-eg-alias-and-modules)\n\n## License\n\n[MIT](LICENSE)\n\n## Thanks\n\n- [Marijn Haverbeke](http:\u002F\u002Fmarijnhaverbeke.nl) and other people who\n  collaborated on [acorn](https:\u002F\u002Fgithub.com\u002Fternjs\u002Facorn) -\n  the excellent JavaScript parser dependency-cruiser uses to infer\n  dependencies.\n- [Katerina Limpitsouni](https:\u002F\u002Ftwitter.com\u002FninaLimpi) of [unDraw](https:\u002F\u002Fundraw.co\u002F)\n  for the ollie in dependency-cruiser's\n  [social media image](https:\u002F\u002Frepository-images.githubusercontent.com\u002F74299372\u002F239ed080-370b-11ea-8fe7-140cf7b90a33).\n- All members of the open source community who have been kind enough to raise issues,\n  ask questions and make pull requests to get dependency-cruiser to be a better\n  tool.\n\n## Build status\n\n[![GitHub Workflow Status](https:\u002F\u002Fgithub.com\u002Fsverweij\u002Fdependency-cruiser\u002Factions\u002Fworkflows\u002Fci.yml\u002Fbadge.svg?branch=main)](https:\u002F\u002Fgithub.com\u002Fsverweij\u002Fdependency-cruiser\u002Factions\u002Fworkflows\u002Fci.yml)\n[![coverage](https:\u002F\u002Fgitlab.com\u002Fsverweij\u002Fdependency-cruiser\u002Fbadges\u002Fmaster\u002Fcoverage.svg)](https:\u002F\u002Fgitlab.com\u002Fsverweij\u002Fdependency-cruiser\u002Fbuilds)\n[![total downloads on npm](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fdt\u002Fdependency-cruiser.svg?maxAge=2591999)](https:\u002F\u002Fnpmjs.com\u002Fpackage\u002Fdependency-cruiser)\n\nMade with :metal: in Holland.\n","Dependency Cruiser 是一个用于验证和可视化项目依赖关系的工具，支持 JavaScript、TypeScript 和 CoffeeScript 项目。其核心功能包括根据自定义规则验证依赖关系，并以文本或图形形式报告违反规则的情况。此外，它还能生成多种格式的依赖关系图，如 DOT、SVG 等，便于团队理解和沟通代码结构。该工具特别适合于需要维护复杂代码库架构、避免循环依赖以及进行静态分析的开发场景中使用。",2,"2026-06-11 03:26:25","top_topic"]