{"id":19274126,"url":"https://github.com/marco-eckstein/dependency-analysis","last_synced_at":"2025-02-23T20:45:29.586Z","repository":{"id":42876680,"uuid":"97165340","full_name":"marco-eckstein/dependency-analysis","owner":"marco-eckstein","description":"Tools that supplements the dependency analysis tool madge. So far, there is one tool which allows you to collapse dependencies.","archived":false,"fork":false,"pushed_at":"2022-03-26T13:25:20.000Z","size":111,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-05T18:46:31.509Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/marco-eckstein.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-13T21:12:00.000Z","updated_at":"2020-04-21T01:42:21.000Z","dependencies_parsed_at":"2022-09-07T20:01:09.154Z","dependency_job_id":null,"html_url":"https://github.com/marco-eckstein/dependency-analysis","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marco-eckstein%2Fdependency-analysis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marco-eckstein%2Fdependency-analysis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marco-eckstein%2Fdependency-analysis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marco-eckstein%2Fdependency-analysis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marco-eckstein","download_url":"https://codeload.github.com/marco-eckstein/dependency-analysis/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240378873,"owners_count":19792039,"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-11-09T20:45:15.966Z","updated_at":"2025-02-23T20:45:29.554Z","avatar_url":"https://github.com/marco-eckstein.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm version](https://badge.fury.io/js/%40marco-eckstein%2Fdependency-analysis.svg)](https://badge.fury.io/js/%40marco-eckstein%2Fdependency-analysis)\n\nTools that supplement the JavaScript module dependency analysis tool \n[madge](https://www.npmjs.com/package/madge).\n\nSo far, there is only one tool: `collapse`. It allows you to collapse module dependencies, i.e., \nto view dependencies between the folders in which the models are contained. You can thus get a more \ncoarse-grained overview of your project structure.\n\n# Usage\n\n## Command-line\n\nMadge analyzes your dependencies and lets you output them in various format, e.g. JSON: `madge --json modules-base-dir \u003e dependencies.json`\n\nAn example output may be:\n\n```\n{\n  \"a/aa1\": [\"b/bb/bbb1\"],\n  \"a/aa2\": [\"b/bb/bbb1\", \"c/cc1\"],\n  \"b/bb/bbb1\": [\"b/bb/bbb2\"],\n  \"b/bb/bbb2\": [\"c/cc1\"],\n  \"b/bb/bbb3\": [\"d/dd1\"],\n  \"c/cc1\": [],\n  \"d/dd1\": [],\n};\n```\n\nIf your project is large, your dependencies (especially when viewed as an image) may become overwhelming.\nUse `dependency-analysis collapse \u003c dependencies.json` to collapse them by a level:\n\n```\n{\n  \"a\": [\"b/bb\", \"c\"],\n  \"b/bb\": [\"c\", \"d\"],\n  \"c\": [],\n  \"d\": [],\n};\n```\n\nYou can also collapse by multiple levels:\n`dependency-analysis collapse --levels 2 \u003c dependencies.json`\n\nInput:\n\n```\n{\n  \"a/aa/aaa\": [\"b/bb/bbb\"],\n  \"b/bb/bbb\": [],\n};\n```\n\nOutput:\n\n```\n{\n  \"a\": [\"b\"],\n  \"b\": [],\n};\n```\n\nNote that the minimum level of nesting in your input file must be equal to or larger than the levels \nyou are collapsing!\n\nInteraction with the madge command:\n\n`madge --json modules-base-dir | dependency-analysis collapse \u003e dependencies-collapsed.json`\n\n## API\n\n```\nimport { collapse } from \"@marco-eckstein/dependency-analysis\";\n\nconst dependencies = JSON.parse(fs.readFileSync(\"deps.json\", \"utf8\"));\nconst levels = 2;\nconst dependenciesCollapsed = collapse(dependencies, levels);\n```\n\n# Development\n\nNo global modules other than `npm` are necessary.\n\n- Run `npm install` once after checking out.\n- Then, run either `npm test` for a single full build cycle (clean, compile, lint, test), \n  or `npm start` for running the full cycle initially and then watch for file changes which will \n  trigger appropriate parts of the build cycle (compile, lint, test). The watch mode is not bulletproof:\n  It works for file updates, but you may get problems if you rename or delete files.\n- Publish with `npm publish --access public`. This will run the full build cycle before publishing.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarco-eckstein%2Fdependency-analysis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarco-eckstein%2Fdependency-analysis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarco-eckstein%2Fdependency-analysis/lists"}