{"id":29275867,"url":"https://github.com/peterroe/finse","last_synced_at":"2025-07-13T07:04:52.582Z","repository":{"id":63160265,"uuid":"556189743","full_name":"peterroe/finse","owner":"peterroe","description":"Find which files reference the target file","archived":false,"fork":false,"pushed_at":"2023-12-15T11:34:50.000Z","size":506,"stargazers_count":5,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-29T05:18:17.380Z","etag":null,"topics":["command-line","finse"],"latest_commit_sha":null,"homepage":"","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/peterroe.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}},"created_at":"2022-10-23T09:13:56.000Z","updated_at":"2023-11-11T10:44:33.000Z","dependencies_parsed_at":"2023-12-15T12:48:20.454Z","dependency_job_id":null,"html_url":"https://github.com/peterroe/finse","commit_stats":{"total_commits":72,"total_committers":1,"mean_commits":72.0,"dds":0.0,"last_synced_commit":"ea01d8568b33d3aa47fb8d2f2389edf34c992c59"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/peterroe/finse","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterroe%2Ffinse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterroe%2Ffinse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterroe%2Ffinse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterroe%2Ffinse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peterroe","download_url":"https://codeload.github.com/peterroe/finse/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterroe%2Ffinse/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263699785,"owners_count":23497963,"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":["command-line","finse"],"created_at":"2025-07-05T07:11:22.493Z","updated_at":"2025-07-05T07:11:25.464Z","avatar_url":"https://github.com/peterroe.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./logo.svg\" height=300/\u003e  \n\u003c/p\u003e\n\n## finse\n\nFind which files reference the target file\n\n### Features\n\n* Friendly output\n* Supports alias via `tsconfig.json`\n* Supports `esm` and `cjs`\n* Detect the project root directory\n* Unlimited file types\n\n### Install\n\n```shell\n$ npm i -g finse\n$ finse -h # help\n```\n\n### Usage\n\nSuppose we have a project, its directory structure is like this：\n\n```txt\nfinse\n  └─ test\n      └─ demo\n          ├─ bar\n              ├─ corge\n                  └─ nacho.vue\n              └─ oop.ts\n          ├─ foo\n              └─ sharp.js # sdf\n          └─ thud.tsx\n```\n\nAnd you want to find out which files reference `oop.ts`，just run：\n\n```shell\n$ finse test/demo/bar/oop.ts\n```\n\nMaybe you will see the output similar to this:\n\n\u003cimg src=\"./img/img.png\" width=\"500\"/\u003e\n\nThe yellow background represents the file you want to match, the cyan background is the file that \"uses\" it\n\n### API\n\n**--root [rootname]**\n\n* Specify the project root directory\n\n**--expand**\n\n* Expand collapsed file tree\n\n**--link**\n\n* Display the absolute path of the file. That way other files can be accessed directly through the terminal\n\n**--ignore**\n\n* Ignore file does not exist errors\n\n### Motivation\n\n* It's hard to find which other files use the target file\n\n* Search in IDEA is not enough, it's difficult to give exact search keywords\n\n### How is works ?\n\n* First, it will detect the project root directory if no directory is specified\n* By default, the directory where `package.json` is located is selected as the root directory\n* Next, all reasonable files in the directory will be scanned\n* Then match the contents of the file to see if there is an import statement\n* `finse` will recognize the following imports\n\n```js\n// static import\nimport xx from 'xxx'\n\nif (Math.random() \u003e 0.5) {\n  // dynamic import\n  import('xx.ts')\n}\n\n// require import\nrequire('./xx/xx')\n```\n\n`finse` works with regular expressions, But don't worry about \"accidental recognition\":\n\n```js\n// Yes, legal import\nimport xx from 'xxx'\n\n// No，Imports in comments are not recognized\n// comment: import xx from 'xxx'\n```\n\nAnd supports identifying paths with alias:\n\n```html\n\u003cscript setup\u003e\nimport xx from '@/xx'\n// or:\nimport xxx from '~/xx'\n\u003c/script\u003e\n```\n\nBut have to make sure there is such a configuration in `[t|j]sconfig.json`:\n\n```json\n{\n  \"compilerOptions\": {\n    \"paths\": {\n      \"~/*\": [\"test/demo/bar/*\"],\n      \"@/*\": [\"src/*\"]\n    }\n  }\n}\n```\n\n### finse\n\nit's mean find use\n\n### Acknowledgement\n\nThanks for the proposal for `jsconfig.json` by [Artsmp](https://github.com/Artsmp)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterroe%2Ffinse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeterroe%2Ffinse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterroe%2Ffinse/lists"}