{"id":28504799,"url":"https://github.com/glideapps/ts-helper","last_synced_at":"2025-07-06T09:31:02.485Z","repository":{"id":45448066,"uuid":"426364996","full_name":"glideapps/ts-helper","owner":"glideapps","description":"Analyze TypeScript projects","archived":false,"fork":false,"pushed_at":"2025-05-29T12:02:42.000Z","size":29,"stargazers_count":14,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-04T20:14:38.120Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/glideapps.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2021-11-09T19:47:56.000Z","updated_at":"2025-07-04T19:20:00.000Z","dependencies_parsed_at":"2024-06-18T20:06:50.292Z","dependency_job_id":"d43ba332-6387-4e02-a3b0-f4ea81bc696e","html_url":"https://github.com/glideapps/ts-helper","commit_stats":{"total_commits":18,"total_committers":1,"mean_commits":18.0,"dds":0.0,"last_synced_commit":"0ca5a0987c22f03c3c61a8301cf20ca381191efb"},"previous_names":["glideapps/ts-helper"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/glideapps/ts-helper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glideapps%2Fts-helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glideapps%2Fts-helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glideapps%2Fts-helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glideapps%2Fts-helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/glideapps","download_url":"https://codeload.github.com/glideapps/ts-helper/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glideapps%2Fts-helper/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263877942,"owners_count":23523871,"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":"2025-06-08T18:30:52.060Z","updated_at":"2025-07-06T09:31:02.479Z","avatar_url":"https://github.com/glideapps.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ts-helper\n\nThis is a simple TypeScript tool we use at Glide for two purposes so far:\n\n1. It finds cyclic imports in our source files. We used to\n   use [ESLint's `import/no-cycle` rule](https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-cycle.md)\n   for this, but on our project it's both very slow and sometimes doesn't find existing cycles.\n2. It outputs a dependency graph of all the TypeScript source files in our project which we can use for further\n   analysis.\n\n## Caveats\n\nWe've only implemented as much as we needed to make this work on our codebase, so there might be cases it doesn't\nsupport, or on which it crashes on. If you run into such a case, please considering sending us a PR, or at least report\nthe issue with a reproduction.\n\nA few of the things that are missing, in particular:\n\n* We don't respect `exclude` in the project configuration.\n* We only look at `import` (and `export`), not `require`.\n* We treat type import calls such as `type X = import(\"foo\").Bar` as regular \"strong\" imports. \n\n## Usage\n\n### `-p|--project TS-PROJECT`\n\nAdds a project.  `TS-PROJECT` can be either a directory with a `tsconfig.json` file in it, or the path to a TypeScript\nconfig file. ts-helper will add project references recursively, but you can add more than one root project if you need\nto.\n\n### `-r|--root SOURCE-FILE`\n\nAdds a root TypeScript source file. This file must be in one of the specified projects. You can add more than one.\n\n### `-c|--detect-cycles`\n\nRuns cycle detection on all the source files reachable from the roots. If it detects a cycle it will print one of the\ncycles it found and exit with an error status.\n\nNote that it only considers \"strong\" imports for cycle detection, vs `type` imports and lazy imports.\n\n### `-o|--output FILENAME`\n\nOutputs a JSON file with the dependency graph.\n\n### `-v|--verbose`\n\nPrint messages when it's reading and processing projects.\n\n## Example\n\nIn our main repository for Glide we have two TypeScript projects - one for the frontend and one for the backend. The\nfrontend one has one root source file and the backend has two - one for the actual backend and one for a CLI. Here's how\nwe run ts-helper to detect cycles in that codebase:\n\n```shell\nnpx \"@glideapps/ts-helper\" \\\n    -p ~/Work/glide/functions \\\n    -r ~/Work/glide/functions/src/cli.ts \\\n    -r ~/Work/glide/functions/src/index.ts \\\n    -p ~/Work/glide/app \\\n    -r ~/Work/glide/app/src/index.tsx \\\n    -c\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglideapps%2Fts-helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fglideapps%2Fts-helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglideapps%2Fts-helper/lists"}