Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Great project!

One feature request: Running the npx command searched only for the js files, not for the ts files. When I built deprank locally with yarn, it also showed the ts files. After looking at dependency-cruiser figure it has to do with what typescript compilers are available where.

It would be great if the npx command you provide in your readme would work regardless of my local setup - dependency-cruiser has documentation and one example of a suitable npx command here: https://github.com/sverweij/dependency-cruiser/blob/develop/...

My suggestion would be to check if any ts file is part of the extension option (i.e. --ext=".js,.jsx, .ts, .tsx") and only then do the magic needed to also show ts files.



thanks for this comment, I'll look into fixing it. In the meantime I'm curious whether it works when you install deprank directly? e.g.

    yarn add deprank
    yarn run deprank ./src


Thank you! :)

It worked when installing inside the project folder and did not work when installing outside the project folder:

  // Success: Running in the project folder.
  me:~/deprank$ yarn add deprank
  yarn add v1.22.19
  warning ../package.json: No license field
  [1/5] Validating package.json...
  [2/5] Resolving packages...
  [3/5] Fetching packages...
  [4/5] Linking dependencies...
  [5/5] Building fresh packages...
  success Saved lockfile.
  success Saved 1 new dependency.
  info Direct dependencies
  └─ deprank@0.1.1
  info All dependencies
  └─ deprank@0.1.1
  $ tsdx build
  @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.
  @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.
   Creating entry file 602 ms
   Building modules 1.4 secs
  Done in 5.95s.
  me:~/deprank$ yarn run deprank src/
  yarn run v1.22.19
  warning ../package.json: No license field
  $ /home/dan/deprank/node_modules/.bin/deprank src/
  | Filename     | Lines | Dependents | PageRank |
  ------------------------------------------------
  | src/index.ts | 280   | 0          | 1.000000 |
  Done in 0.55s.
  me:~/deprank$ yarn run deprank .
  yarn run v1.22.19
  warning ../package.json: No license field
  $ /home/me/deprank/node_modules/.bin/deprank .
  | Filename                           | Lines | Dependents | PageRank 
  ----------------------------------------------------------------------
  | fixtures/core.js                   | 3     | 1          | 0.191112 |
  | fixtures/utils.js                  | 4     | 3          | 0.180576 |
  | fixtures/user/user.js              | 4     | 1          | 0.088966 |
  | src/index.ts                       | 280   | 1          | 0.069599 |
  | fixtures/todo.js                   | 6     | 1          | 0.060405 |
  | fixtures/user/index.js             | 1     | 1          | 0.060405 |
  | dist/deprank.cjs.development.js    | 829   | 1          | 0.053610 |
  | dist/deprank.cjs.production.min.js | 2     | 1          | 0.053610 |
  | fixtures/concepts.js               | 4     | 1          | 0.053610 |
  | dist/deprank.esm.js                | 820   | 0          | 0.037621 |
  | dist/index.d.ts                    | 36    | 0          | 0.037621 |
  | dist/index.js                      | 8     | 0          | 0.037621 |
  | fixtures/index.js                  | 4     | 0          | 0.037621 |
  | test/deprank.test.ts               | 28    | 0          | 0.037621 |
  Done in 0.60s.

  ------------------------------------------------------------------------------------------------------------------------------------
  // Failure: Running outside of the project folder:
  me:~$ yarn add deprank
  yarn add v1.22.19
  warning package.json: No license field
  warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
  warning No license field
  [1/4] Resolving packages...
  [2/4] Fetching packages...
  [3/4] Linking dependencies...
  [4/4] Building fresh packages...
  success Saved lockfile.
  warning No license field
  success Saved 3 new dependencies.
  info Direct dependencies
  ├─ deprank@0.1.1
  └─ node@18.4.0
  info All dependencies
  ├─ deprank@0.1.1
  ├─ node-bin-setup@1.1.0
  └─ node@18.4.0
  Done in 4.95s.

  me:~$ yarn run deprank deprank/
  yarn run v1.22.19
  warning package.json: No license field
  $ /home/me/node_modules/.bin/deprank deprank/
  | Filename                                   | Lines | Dependents | PageRank |
  ------------------------------------------------------------------------------
  | deprank/fixtures/core.js                   | 3     | 1          | 0.223479 |
  | deprank/fixtures/utils.js                  | 4     | 3          | 0.211161 |
  | deprank/fixtures/user/user.js              | 4     | 1          | 0.104035 |
  | deprank/fixtures/todo.js                   | 6     | 1          | 0.070637 |
  | deprank/fixtures/user/index.js             | 1     | 1          | 0.070637 |
  | deprank/dist/deprank.cjs.development.js    | 829   | 1          | 0.062691 |
  | deprank/dist/deprank.cjs.production.min.js | 2     | 1          | 0.062691 |
  | deprank/fixtures/concepts.js               | 4     | 1          | 0.062691 |
  | deprank/dist/deprank.esm.js                | 820   | 0          | 0.043993 |
  | deprank/dist/index.js                      | 8     | 0          | 0.043993 |
  | deprank/fixtures/index.js                  | 4     | 0          | 0.043993 |
  Done in 0.28s.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: