{"id":13431513,"url":"https://github.com/M-Izadmehr/deadfile","last_synced_at":"2025-03-16T11:31:54.530Z","repository":{"id":37952395,"uuid":"218157289","full_name":"M-Izadmehr/deadfile","owner":"M-Izadmehr","description":"Simple util to find unused files in any JavaScript project (ES5, ES6, React, Vue, ...)","archived":false,"fork":false,"pushed_at":"2024-03-30T02:52:04.000Z","size":2965,"stargazers_count":375,"open_issues_count":23,"forks_count":20,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-06T17:54:19.356Z","etag":null,"topics":["deadcode","deadfile","deadfile-js","elimination","javascript","js","unrequired","unused","unused-files"],"latest_commit_sha":null,"homepage":"https://m-izadmehr.github.io/deadfile/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/M-Izadmehr.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-28T22:31:19.000Z","updated_at":"2025-02-09T09:17:23.000Z","dependencies_parsed_at":"2024-01-16T01:25:42.572Z","dependency_job_id":"b6548371-5d80-4627-b13c-917cc991a34c","html_url":"https://github.com/M-Izadmehr/deadfile","commit_stats":{"total_commits":89,"total_committers":8,"mean_commits":11.125,"dds":0.3932584269662921,"last_synced_commit":"23fbc9e26d94ee0eeafee98701bc44c29b08e3c9"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M-Izadmehr%2Fdeadfile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M-Izadmehr%2Fdeadfile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M-Izadmehr%2Fdeadfile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M-Izadmehr%2Fdeadfile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/M-Izadmehr","download_url":"https://codeload.github.com/M-Izadmehr/deadfile/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243863217,"owners_count":20360285,"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":["deadcode","deadfile","deadfile-js","elimination","javascript","js","unrequired","unused","unused-files"],"created_at":"2024-07-31T02:01:03.715Z","updated_at":"2025-03-16T11:31:51.061Z","avatar_url":"https://github.com/M-Izadmehr.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"\u003cimg src=\"https://github.com/M-Izadmehr/deadfile/raw/master/docs/images/logo.png\" alt=\"deadfile\" width=\"100\"/\u003e\n\n# deadfile\n\nSimple util to find deadcode and unused files in any JavaScript project (ES5, ES6, React, Vue, ...).\n\n* **Easy to use**\n* Out of box support for ES5, ES6, React, Vue, ESM, CommonJs.\n* **Error tolerant:** deadfile uses loose parsing of your code, so if there are errors in your code, it still works. Even if you use some random babel config, it will parse your code and find imports.\n* **Syntax support:** it supports import/require and even dynamic import.\n* Shows you a warning for the node_modules you import, but do not appear in your package.json\n\n\n![deadfile result](https://github.com/M-Izadmehr/deadfile/raw/master/docs/images/analyzeresult.png \"Code Analysis\")\n![deadfile result](https://github.com/M-Izadmehr/deadfile/raw/master/docs/images/screenshot.png \"Code Analysis\")\n\n## Supported Node Versions\nThis project uses optional chaining, so you need to use **Node v14.0 +** to be able to use it.\n\n\n## Installation\nInstall deadfile cli with the following command:\n\n**npm**\n```bash\n$ npm install -g deadfile\n```\n**yarn**\n```bash\n$ yarn global add deadfile\n```\n**npx**\n```bash\n$ npx deadfile \u003cfile\u003e\n```\n\n## Usage and Examples\nsimple:               \n ```bash\n deadfile ./src/index.js\n ```\n\nmultiple entry:        \n```bash\ndeadfile ./src/index.js ./src/entry2.js\n```\n\nwith custom directory: \n```bash\ndeadfile ./src/index.js --dir /path/to/other/folder\n```\n\nwith  exclude:         \n```bash\ndeadfile ./src/index.js --exclude tests  utils/webpack\n```\n\nwithout the report server or in CI scripts:\n```bash\ndeadfile ./src/index.js --ci\n```\n\n## What it does\n### Supported Syntaxes\nAll major ES Module imports are supported (including dynamic import):\n![Import Syntax](https://github.com/M-Izadmehr/deadfile/raw/master/docs/images/supportedImports.png \"Import Syntax\")\n\nAlso the following export (aggregation) syntaxes are also supported:\n![Export Aggregation Syntax](https://github.com/M-Izadmehr/deadfile/raw/master/docs/images/supportedExports.png \"Export Aggregation Syntax\")\n\n### Development Environment\nYou can use `deadfile` for any JavaScript project, and go crazy with you code, use the latest features and it still works. Here are some examples:\n\n#### JSX\n![React Example](https://github.com/M-Izadmehr/deadfile/raw/master/docs/images/React.png \"React Example\")\n\n### Vue\n![Vue Example](https://github.com/M-Izadmehr/deadfile/raw/master/docs/images/Vue.png \"Vue Example\")\n\n#### Reassigned requires\n\n`deadfile` look for import declarations and calls of the `require` function. As a result, if you assign `require` to another var and use it to load a dependency, it will not handle it.\n\n\n### Options\n- **entry**: all arguments directly after `deadfile` are considered as entries (yes, deadfile supports multiple entries)        \n```bash\ndeadfile ./src/index.js ./src/entry2.js\n```\n- **--dir**: set search in another folder:\n```bash\ndeadfile \u003cfile\u003e --dir /path/to/other/folder\n```\n- **--exclude**: list of paths to ignore:\n\nPaths or files to exclude from search. It supports any valid RegExp expression to exclude:\n``` bash\ndeadfile \u003cfile\u003e --exclude ^(\\w)png$\ndeadfile \u003cfile\u003e --exclude webpack utils docs\n```\n\n-**--output**: used to write report results in `.json` file\n\nYou can specify the file to write, a json file including file lists:\n``` bash\ndeadfile \u003cfile\u003e --output report.json\n```\n\n\n## Todo\n* handle reassigned require\n* look for dead declarations too\n* Add support AMD\n* be able to include/exclude paths/extentions based on relPath/regex\n* allow file extensions for parsing, should default to (.js/.jsx/.ts/.tsx/.vue)\n* Add SASS import\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FM-Izadmehr%2Fdeadfile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FM-Izadmehr%2Fdeadfile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FM-Izadmehr%2Fdeadfile/lists"}