https://github.com/codemix/deprank Skip to content Sign up * Product + Features + Mobile + Actions + Codespaces + Copilot + Packages + Security + Code review + Issues + Integrations + GitHub Sponsors + Customer stories * Team * Enterprise * Explore + Explore GitHub + Learn and contribute + Topics + Collections + Trending + Skills + GitHub Sponsors + Open source guides + Connect with others + The ReadME Project + Events + Community forum + GitHub Education + GitHub Stars program * Marketplace * Pricing + Plans + Compare plans + Contact Sales + Education [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this organization All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} codemix / deprank Public * Notifications * Fork 7 * Star 265 Use PageRank to find the most important files in your codebase. License MIT license 265 stars 7 forks Star Notifications * Code * Issues 1 * Pull requests 0 * Actions * Projects 0 * Wiki * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Wiki * Security * Insights codemix/deprank This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 1 branch 0 tags Code Latest commit @phpnode phpnode Merge pull request #2 from dan-blank/patch-1 ... 8bb9cf4 Jul 2, 2022 Merge pull request #2 from dan-blank/patch-1 Add build instructions 8bb9cf4 Git stats * 11 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github/workflows bin fixtures src test .gitignore .prettierrc LICENSE README.md package.json tsconfig.json yarn.lock View code Deprank Usage Example Building Locally TypeScript Conversion Author README.md Deprank Deprank uses the PageRank algorithm to find the most important files in your JavaScript or TypeScript codebase. It uses dependency-cruiser to build a dependency graph of your source files, then ranks those dependencies based on their importance. We define importance as those files which are directly or indirectly depended upon the most by other files in the codebase. Deprank is particularly useful when converting an existing JavaScript codebase to TypeScript. Performing the conversion in strict PageRank order can dramatically increase type-precision, reduce the need for any and minimizes the amount of rework that is usually inherent in converting large codebases. Usage Rank all files in the src directory: npx deprank ./src Rank all .js and .jsx files in the src and test directories: npx deprank --ext=".js,.jsx" ./src ./test Example npx deprank ./fixtures | Filename | Lines | Dependents | PageRank | ---------------------------------------------------------- | fixtures/core.js | 3 | 1 | 0.284098 | | fixtures/utils.js | 4 | 3 | 0.268437 | | fixtures/user/user.js | 4 | 1 | 0.132253 | | fixtures/todo.js | 6 | 1 | 0.089796 | | fixtures/user/index.js | 1 | 1 | 0.089796 | | fixtures/concepts.js | 4 | 1 | 0.079694 | | fixtures/index.js | 4 | 0 | 0.055926 | Building Locally 1. Clone this repository: git clone git@github.com:codemix/ deprank.git 2. Get yarn. 3. Navigate into the project folder: cd deprank/. 4. Run yarn install && yarn build. 5. Run ./bin/deprank --help TypeScript Conversion To help convert your codebase to TypeScript whilst minimizing the amount of effort required, we suggest converting files in deprank --deps-first order. This option lifts the files that are depended upon by the most important files in the codebase to the top of the list. By tackling each file in order we help ensure that type errors are solved at their origin, rather than their point of use. This can reduce the number of type errors much more quickly than the more typical, ad-hoc order that such conversions usually take, and it helps TypeScript use inference which reduces the amount of manual typing required. It's not uncommon to see hundreds or thousands of type errors disappear just by fixing a few key files. The following command will find all .js or .jsx files in a src folder, and sort them in dependency-first order. npx deprank --ext=".js,.jsx" --deps-first ./src Author deprank was written by Charles Pick at Codemix About Use PageRank to find the most important files in your codebase. Resources Readme License MIT license Stars 265 stars Watchers 6 watching Forks 7 forks Releases No releases published Packages 0 No packages published Contributors 2 * @phpnode phpnode Charles Pick * @dan-blank dan-blank Daniel Blank Languages * TypeScript 84.6% * JavaScript 15.4% Footer (c) 2022 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.