rev-dep 2.0.0-alpha-8 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/Readme.md +700 -3
  2. package/package.json +3 -3
package/Readme.md CHANGED
@@ -1,5 +1,702 @@
1
- Alpha version of [rev-dep](https://www.npmjs.com/package/rev-dep) v2.
1
+ <p align="center">
2
+ <img src="https://github.com/jayu/rev-dep/raw/master/logo.png" width="400">
3
+ </p>
4
+ <p align="center">
5
+ <a href="#about-">About</a>&nbsp;&nbsp;•&nbsp;&nbsp;
6
+ <a href="#getting-started-">Getting Started</a>&nbsp;&nbsp;•&nbsp;&nbsp;
7
+ <a href="#recipes-️">Recipes</a>&nbsp;&nbsp;•&nbsp;&nbsp;
8
+ <a href="#cli-reference-">CLI Reference</a>
9
+ </p>
2
10
 
3
- Reimplemented from scratch in go to achieve 40x speedup.
11
+ <p align="center">
12
+ Dependency analysis and optimization toolkit for modern TypeScript projects.
13
+ <br>
14
+ <a href="#reimplemented-to-achieve-7x-37x-speedup">Completely rewritten in Go for maximum speed and efficiency ⚡</a>
15
+ </p>
4
16
 
5
- Published from Opole 🇵🇱
17
+ ---
18
+
19
+ <img alt="rev-dep version" src="https://img.shields.io/npm/v/rev-dep"> <img alt="rev-dep license" src="https://img.shields.io/npm/l/rev-dep"> <img alt="rev-dep PRs welcome" src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square">
20
+
21
+
22
+ ## About 📣
23
+
24
+ The tool was created to help with daily development struggles by answering these questions:
25
+
26
+ 👉 What entry points does my codebase have?
27
+
28
+ 👉 Which entry points use a given file?
29
+
30
+ 👉 Which dependencies does a given file have?
31
+
32
+ 👉 Do any circular dependencies exist in the project?
33
+
34
+ 👉 Which node modules are unused or not listed in package.json?
35
+
36
+ 👉 Which node modules take up the most space on disk?
37
+
38
+
39
+ This helps to debug project dependencies, plan refactoring, optimize bundles or plan code splitting.
40
+
41
+ It's especially useful in JS world without TypeScript or tests coverage.
42
+
43
+ It also helps to identify and eliminate dead files, understand the complexity of the file dependencies
44
+
45
+ [🦘 Jump to CLI reference](#cli-reference-)
46
+
47
+ ### Use cases 🧑‍💻
48
+
49
+ - [You plan to refactor some file and you wonder which entry points are affected](#how-to-identify-where-a-file-is-used-in-the-project)
50
+ - [You are wondering wether a given source file is used](#how-to-check-if-a-file-is-used-in-the-project)
51
+ - [You wonder if there are any dead files in your project](#how-to-identify-dead-files-in-the-project)
52
+ - [You want to verify if a given entry point imports only the required files](#how-to-check-which-files-are-imported-by-a-given-file)
53
+ - [You want to optimize the amount of files imported by an entry point](#how-to-reduce-amount-of-files-imported-by-entry-point)
54
+ - [You want to detect circular dependencies in your project](#how-to-detect-circular-dependencies-in-the-project)
55
+ - [You want to find unused node modules to clean up dependencies](#how-to-find-unused-node-modules)
56
+ - [You want to identify which node modules are consuming the most disk space](#how-to-identify-space-consuming-node-modules)
57
+
58
+ ### How about dependency or bundle graphs?
59
+
60
+ There are tool that can output nice, visual representation of project dependencies like [webpack-bundle-analyzer](https://www.npmjs.com/package/webpack-bundle-analyzer) or [dependency-cruiser](https://www.npmjs.com/package/dependency-cruiser) (_which btw rev-dep uses for non-TS codebases_)
61
+
62
+ While graphs can be useful to identify major problems like too big bundle size or to visualize mess in your deps, it's hard to take any action based on them (_at least it was hard for me_ 🤷‍♂️)
63
+
64
+ `rev-dep` visualize dependencies as lists, so it's really easy to see where to cut the line to solve the problem.
65
+
66
+ ## Getting Started 🎉
67
+
68
+ ### Install globally to use as CLI tool
69
+
70
+ `yarn global add rev-dep`
71
+
72
+ `npm -g install rev-dep`
73
+
74
+ `pnpm global add rev-dep`
75
+
76
+ ## Recipes 🌶️
77
+
78
+ ### How to identify where a file is used in the project?
79
+
80
+ Just use `rev-dep resolve --file path/to/file.ts`
81
+
82
+ You will see all the entry points that implicitly require given file together with resolution path.
83
+
84
+ [`resolve` Command CLI reference](#rev-dep-resolve)
85
+
86
+ #### Getting more details about file resolution in given entry point
87
+
88
+ To find out all paths combination use `rev-dep resolve` with `-a` flag
89
+
90
+ > You might be surprised how complex dependency tree can be!
91
+
92
+ </details>
93
+
94
+ ### How to check if a file is used in the project?
95
+
96
+ Use `rev-dep resolve --file path/to/file.ts --compact-summary`
97
+
98
+ As a result you will see total amount of entry points requiring a given file.
99
+
100
+ > Note that among the entry points list there might be some dead files importing the searched file
101
+
102
+ [`resolve` Command CLI reference](#rev-dep-resolve)
103
+
104
+ ### How to identify dead files in the project?
105
+
106
+ Use `rev-dep entry-points` to get list of all files that are not required by any other files in the project.
107
+
108
+ You might want to exclude some file paths that are meant to be actual entry point like `index.js` or `**/pages/**` in `next.js` projects using `--result-exclude` flag. The same for configuration files like `babel.config.js`
109
+
110
+ Review the list and look for suspicious files like `src/ui/components/SomeComponent/index.js`
111
+
112
+ [`entry-points` command CLI reference](#rev-dep-entry-points)
113
+
114
+ ### How to check which files are imported by a given file?
115
+
116
+ To get a full list of files imported by given entry point use `rev-dep files --entry-point path/to/file.ts`.
117
+
118
+ You can use `--count` flag if you are interested in the amount.
119
+
120
+ This is a good indicator of how heavy a given entry point or component is
121
+
122
+ [`files` command CLI reference](#rev-dep-files)
123
+
124
+ ### How to reduce amount of files imported by entry point?
125
+
126
+ There is no easy how to for this process, but you can do it iteratively using `rev-dep` commands `files` and `resolve`
127
+
128
+ 1. Get the list of files imported by entry-point
129
+
130
+ `rev-dep files --entry-point path/to/entry-point`
131
+
132
+ 2. Identify some suspicious files on the list, components that should not be used on the given page or not related utility files
133
+ 3. Get all resolution paths for a suspicious file
134
+
135
+ `rev-dep resolve --file path/to/suspicious-file --entry-points path/to/entry-point --all`
136
+
137
+ 4. You would usually find out that there is some file, like directory `index` file that given entry point is using, which is mandatory, but as a side effect it imports a few files that are redundant for your entry point. In most cases you should be able to decouple the imports or reverse the dependency to cut off the resolution path for the unwanted file
138
+
139
+ ### How to detect circular dependencies in the project?
140
+
141
+ Use `rev-dep circular` to find all circular dependencies between modules in your project.
142
+
143
+ Circular dependencies can cause runtime errors, memory leaks, and make code difficult to understand and maintain. It's important to identify and resolve them early.
144
+
145
+ You can use `--ignore-type-imports` flag to exclude type-only imports from the analysis if they're not relevant to your use case.
146
+
147
+ [`circular` command CLI reference](#rev-dep-circular)
148
+
149
+ ### How to find unused node modules?
150
+
151
+ Use `rev-dep node-modules unused` to identify packages that are installed but not actually imported in your code.
152
+
153
+ This helps clean up your `package.json` and reduce the size of your `node_modules` directory. You might want to exclude type definitions using `--exclude-modules=@types/*` since they're often used indirectly.
154
+
155
+ [`node-modules unused` command CLI reference](#rev-dep-node-modules-unused)
156
+
157
+ ### How to identify space-consuming node modules?
158
+
159
+ Use `rev-dep node-modules dirs-size` to calculate and display the size of `node_modules` directories.
160
+
161
+ This helps identify which packages are taking up the most disk space, allowing you to make informed decisions about dependency management or look for lighter alternatives.
162
+
163
+ For detailed analysis of specific modules, use `rev-dep node-modules analyze-size` with the package names you want to investigate.
164
+
165
+ [`node-modules dirs-size` command CLI reference](#rev-dep-node-modules-dirs-size)
166
+
167
+ ## Reimplemented to achieve 7x-37x speedup
168
+
169
+ Rev-dep@2.0.0 was reimplemented in Go from scratch to leverage it's concurrency features and better memory management of compiled languages.
170
+
171
+ As a result v2 is up to 37x faster than v1 and consumes up to 13x less memory.
172
+
173
+ ### Performance comparison
174
+
175
+ To compare performance rev-dep was benchmarked with hyperfine using 8 runs per test, taking mean time values as a result.
176
+ Benchmark was run on TypeScript codebase with 507658 lines of code and 5977 source code files.
177
+
178
+ Memory usage on Mac was measure using `/usr/bin/time` utility. Memory usage on Linux was not measured because I could't find reliable way to measure RAM usage on Linux. Subsequent runs had too much fluctuation.
179
+
180
+ ### Mac book Pro M1 256GB, power save off;
181
+
182
+ | Command | V1 Time | V2 Time | Time Change | V1 RAM | V2 RAM | RAM Change |
183
+ | ------------------------------------------------------------ | ------- | ------- | ----------- | ------ | ------ | ---------- |
184
+ | List entry-points `rev-dep entry-points` | 6500ms | 347ms | 19x | ~680MB | ~51MB | 13x |
185
+ | List entry-points with dependent files count `-pdc` | 8333ms | 782ms | 11x | ~885MB | ~110MB | 8x |
186
+ | List entry-point files `rev-dep files` | 2729ms | 400ms | 7x | ~330MB | ~36MB | 9x |
187
+ | Resolve dependency path `rev-dep resolve` | 2984ms | 359ms | 8x | ~330MB | ~35MB | 9x |
188
+
189
+ ### WSL Linux Debian Intel(R) Core(TM) i9-14900KF CPU @ 2.80GHz
190
+
191
+ | Command | V1 Time | V2 Time | Time Change |
192
+ | ----------------------------------------------------------------------- | ------- | ------- | ----------- |
193
+ | List entry-points `rev-dep entry-points` | 9904ms | 270ms | 37x |
194
+ | List entry-points with dependent files count `--print-deps-count` | 10562ms | 458ms | 23x |
195
+ | List entry-point files `rev-dep files` | 3097ms | 230ms | 13x |
196
+ | Resolve dependency path `rev-dep resolve` | 3146ms | 230ms | 14x |
197
+
198
+ ### New features
199
+
200
+ V2 comes with bunch of new commands
201
+
202
+ - `circular` - detects circular dependencies in the project
203
+ - `lines-of-code` - counts actual lines of code in the project excluding comments and blank lines
204
+ - `list-cwd-files` - lists all files in the current working directory
205
+ - `node-modules used` - lists all used node modules
206
+ - `node-modules unused` - lists all unused node modules
207
+ - `node-modules missing` - lists all missing node modules
208
+ - `node-modules installed` - lists all installed node modules
209
+ - `node-modules installed-duplicates` - lists all installed node modules that exist in file system with the same version multiple times
210
+ - `node-modules analyze-size` - analyzes size of specific node modules and helps to identify space-hogging dependencies
211
+ - `node-modules dirs-size` - calculates cumulative files size in node_modules directories
212
+
213
+ ### ⚠️ What's not supported
214
+
215
+ Comparing to previous versions, these tsconfig features are not supported
216
+
217
+ #### Config extends
218
+
219
+ If you tsconfig uses extends, and you have some paths defined in config being extended, paths from extended config won't be used during resolution
220
+
221
+ eg.
222
+
223
+ ```json
224
+ // tsconfig.json
225
+ {
226
+ "extends": "./tsconfig.base.json",
227
+ "paths": {
228
+ "@/components": ["src/components/*"]
229
+ }
230
+ }
231
+ ```
232
+
233
+ ```json
234
+ // tsconfig.base.json
235
+ {
236
+ "paths": {
237
+ "@/utils": ["src/utils/*"]
238
+ }
239
+ }
240
+ ```
241
+
242
+ In that scenario imports with `@/utils` won't be resolved.
243
+
244
+ Why it's not supported ? I consider this typescript capability as an usage edge-case. I forgot to to implement it at the begging and I don't feel like investing more time now, before this package get some reasonable adoption and people will be actually requesting this feature.
245
+
246
+ #### Multiple path aliases
247
+
248
+ Only first path will be used in resolution.
249
+
250
+ ```json
251
+ // tsconfig.json
252
+ {
253
+ "paths": {
254
+ "@/components": ["src/components/*", "src/components2/*"]
255
+ }
256
+ }
257
+ ```
258
+
259
+ Imports that should resolve to `src/components2/*` will be considered unresolved.
260
+
261
+ Why it's not supported? I consider this typescript capability as an anti-pattern. It introduces unnecessary ambiguity in module resolution.
262
+ Implementing this would make code more complex, less maintainable and slower.
263
+
264
+ #### Using rev-dep as node module
265
+
266
+ Importing rev-dep in JS/TS is no longer supported. Preferred way is to run rev-dep using child process.
267
+
268
+ #### Other discrepancies
269
+
270
+ Any other discrepancies between TypeScript module resolution and rev-dep should be considered as a bug.
271
+
272
+ ### Supported Platforms
273
+
274
+ - Linux x64
275
+ - MacOS Apple Silicon
276
+
277
+ There are the platforms I use and know. For these I build and tested binaries.
278
+ Go allows for cross-compiling, so I'm happy to build and distribute binaries for other platforms as well, but I haven't tested it.
279
+ Feel free to open an issue if you need support for another platform.
280
+
281
+ ## CLI reference 📖
282
+
283
+ <!-- cli-docs-start -->
284
+
285
+ ### rev-dep circular
286
+
287
+ Detect circular dependencies in your project
288
+
289
+ #### Synopsis
290
+
291
+ Analyzes the project to find circular dependencies between modules.
292
+ Circular dependencies can cause hard-to-debug issues and should generally be avoided.
293
+
294
+ ```
295
+ rev-dep circular [flags]
296
+ ```
297
+
298
+ #### Examples
299
+
300
+ ```
301
+ rev-dep circular --ignore-types-imports
302
+ ```
303
+
304
+ #### Options
305
+
306
+ ```
307
+ -c, --cwd string Working directory for the command (default "$PWD")
308
+ -h, --help help for circular
309
+ -t, --ignore-type-imports Exclude type imports from the analysis
310
+ --package-json string Path to package.json (default: ./package.json) (default "package.json")
311
+ --tsconfig-json string Path to tsconfig.json (default: ./tsconfig.json) (default "tsconfig.json")
312
+ ```
313
+
314
+
315
+ ### rev-dep entry-points
316
+
317
+ Discover and list all entry points in the project
318
+
319
+ #### Synopsis
320
+
321
+ Analyzes the project structure to identify all potential entry points.
322
+ Useful for understanding your application's architecture and dependencies.
323
+
324
+ ```
325
+ rev-dep entry-points [flags]
326
+ ```
327
+
328
+ #### Examples
329
+
330
+ ```
331
+ rev-dep entry-points --print-deps-count
332
+ ```
333
+
334
+ #### Options
335
+
336
+ ```
337
+ -n, --count Only display the number of entry points found
338
+ -c, --cwd string Working directory for the command (default "$PWD")
339
+ --graph-exclude strings Exclude files matching these glob patterns from analysis
340
+ -h, --help help for entry-points
341
+ -t, --ignore-type-imports Exclude type imports from the analysis
342
+ --package-json string Path to package.json (default: ./package.json) (default "package.json")
343
+ --print-deps-count Show the number of dependencies for each entry point
344
+ --result-exclude strings Exclude files matching these glob patterns from results
345
+ --result-include strings Only include files matching these glob patterns in results
346
+ --tsconfig-json string Path to tsconfig.json (default: ./tsconfig.json) (default "tsconfig.json")
347
+ ```
348
+
349
+
350
+ ### rev-dep files
351
+
352
+ List all files in the dependency tree of an entry point
353
+
354
+ #### Synopsis
355
+
356
+ Recursively finds and lists all files that are required
357
+ by the specified entry point.
358
+
359
+ ```
360
+ rev-dep files [flags]
361
+ ```
362
+
363
+ #### Examples
364
+
365
+ ```
366
+ rev-dep files --entry-point src/index.ts
367
+ ```
368
+
369
+ #### Options
370
+
371
+ ```
372
+ -n, --count Only display the count of files in the dependency tree
373
+ -c, --cwd string Working directory for the command (default "$PWD")
374
+ -p, --entry-point string Entry point file to analyze (required)
375
+ -h, --help help for files
376
+ -t, --ignore-type-imports Exclude type imports from the analysis
377
+ --package-json string Path to package.json (default: ./package.json) (default "package.json")
378
+ --tsconfig-json string Path to tsconfig.json (default: ./tsconfig.json) (default "tsconfig.json")
379
+ ```
380
+
381
+
382
+ ### rev-dep lines-of-code
383
+
384
+ Count actual lines of code in the project excluding comments and blank lines
385
+
386
+ ```
387
+ rev-dep lines-of-code [flags]
388
+ ```
389
+
390
+ #### Examples
391
+
392
+ ```
393
+ rev-dep lines-of-code
394
+ ```
395
+
396
+ #### Options
397
+
398
+ ```
399
+ -c, --cwd string Directory to analyze (default "$PWD")
400
+ -h, --help help for lines-of-code
401
+ ```
402
+
403
+
404
+ ### rev-dep list-cwd-files
405
+
406
+ List all files in the current working directory
407
+
408
+ #### Synopsis
409
+
410
+ Recursively lists all files in the specified directory,
411
+ with options to filter results.
412
+
413
+ ```
414
+ rev-dep list-cwd-files [flags]
415
+ ```
416
+
417
+ #### Examples
418
+
419
+ ```
420
+ rev-dep list-cwd-files --include='*.ts' --exclude='*.test.ts'
421
+ ```
422
+
423
+ #### Options
424
+
425
+ ```
426
+ --count Only display the count of matching files
427
+ --cwd string Directory to list files from (default "$PWD")
428
+ --exclude strings Exclude files matching these glob patterns
429
+ -h, --help help for list-cwd-files
430
+ --include strings Only include files matching these glob patterns
431
+ ```
432
+
433
+
434
+ ### rev-dep node-modules
435
+
436
+ Analyze and manage Node.js dependencies
437
+
438
+ #### Synopsis
439
+
440
+ Tools for analyzing and managing Node.js module dependencies.
441
+ Helps identify unused, missing, or duplicate dependencies in your project.
442
+
443
+ #### Examples
444
+
445
+ ```
446
+ rev-dep node-modules used -p src/index.ts
447
+ rev-dep node-modules unused --exclude-modules=@types/*
448
+ rev-dep node-modules missing --entry-points=src/main.ts
449
+ ```
450
+
451
+ #### Options
452
+
453
+ ```
454
+ -h, --help help for node-modules
455
+ ```
456
+
457
+
458
+ ### rev-dep node-modules dirs-size
459
+
460
+ Calculates cumulative files size in node_modules directories
461
+
462
+ #### Synopsis
463
+
464
+ Calculates and displays the size of node_modules folders
465
+ in the current directory and subdirectories. Sizes will be smaller than actual file size taken on disk. Tool is calculating actual file size rather than file size on disk (related to disk blocks usage)
466
+
467
+ ```
468
+ rev-dep node-modules dirs-size [flags]
469
+ ```
470
+
471
+ #### Examples
472
+
473
+ ```
474
+ rev-dep node-modules dirs-size
475
+ ```
476
+
477
+ #### Options
478
+
479
+ ```
480
+ -c, --cwd string Working directory for the command (default "$PWD")
481
+ -h, --help help for dirs-size
482
+ ```
483
+
484
+
485
+ ### rev-dep node-modules installed-duplicates
486
+
487
+ Find and optimize duplicate package installations
488
+
489
+ #### Synopsis
490
+
491
+ Identifies packages that are installed multiple times in node_modules.
492
+ Can optimize storage by creating symlinks between duplicate packages.
493
+
494
+ ```
495
+ rev-dep node-modules installed-duplicates [flags]
496
+ ```
497
+
498
+ #### Examples
499
+
500
+ ```
501
+ rev-dep node-modules installed-duplicates --optimize --size-stats
502
+ ```
503
+
504
+ #### Options
505
+
506
+ ```
507
+ -c, --cwd string Working directory for the command (default "$PWD")
508
+ -h, --help help for installed-duplicates
509
+ --isolate Create symlinks only within the same top-level node_module directories. By default optimize creates symlinks between top-level node_module directories (eg. when workspaces are used). Needs --optimize flag to take effect
510
+ --optimize Automatically create symlinks to deduplicate packages
511
+ --size-stats Print node modules dirs size before and after optimization. Might take longer than optimization itself
512
+ --verbose Show detailed information about each optimization
513
+ ```
514
+
515
+
516
+ ### rev-dep node-modules installed
517
+
518
+ List all installed npm packages in the project
519
+
520
+ #### Synopsis
521
+
522
+ Recursively scans node_modules directories to list all installed packages.
523
+ Helpful for auditing dependencies across monorepos.
524
+
525
+ ```
526
+ rev-dep node-modules installed [flags]
527
+ ```
528
+
529
+ #### Examples
530
+
531
+ ```
532
+ rev-dep node-modules installed --include-modules=@myorg/*
533
+ ```
534
+
535
+ #### Options
536
+
537
+ ```
538
+ -c, --cwd string Working directory for the command (default "$PWD")
539
+ -e, --exclude-modules strings list of modules to exclude from the output
540
+ -h, --help help for installed
541
+ -i, --include-modules strings list of modules to include in the output
542
+ ```
543
+
544
+
545
+ ### rev-dep node-modules missing
546
+
547
+ Find imported packages not listed in package.json
548
+
549
+ #### Synopsis
550
+
551
+ Identifies packages that are imported in your code but not declared
552
+ in your package.json dependencies.
553
+
554
+ ```
555
+ rev-dep node-modules missing [flags]
556
+ ```
557
+
558
+ #### Examples
559
+
560
+ ```
561
+ rev-dep node-modules missing --entry-points=src/main.ts
562
+ ```
563
+
564
+ #### Options
565
+
566
+ ```
567
+ -n, --count Only display the count of modules
568
+ -c, --cwd string Working directory for the command (default "$PWD")
569
+ -p, --entry-points strings Entry point file(s) to start analysis from (default: auto-detected)
570
+ -e, --exclude-modules strings list of modules to exclude from the output
571
+ -b, --files-with-binaries strings Additional files to search for binary usages. Use paths relative to cwd
572
+ -m, --files-with-node-modules strings Additional files to search for module imports. Use paths relative to cwd
573
+ --group-by-file Organize output by project file path
574
+ --group-by-module Organize output by npm package name
575
+ -h, --help help for missing
576
+ -t, --ignore-type-imports Exclude type imports from the analysis
577
+ -i, --include-modules strings list of modules to include in the output
578
+ --package-json string Path to package.json (default: ./package.json) (default "package.json")
579
+ --pkg-fields-with-binaries strings Additional package.json fields to check for binary usages
580
+ --tsconfig-json string Path to tsconfig.json (default: ./tsconfig.json) (default "tsconfig.json")
581
+ --zero-exit-code Use this flag to always return zero exit code
582
+ ```
583
+
584
+
585
+ ### rev-dep node-modules unused
586
+
587
+ Find installed packages that aren't imported in your code
588
+
589
+ #### Synopsis
590
+
591
+ Compares package.json dependencies with actual imports in your codebase
592
+ to identify potentially unused packages.
593
+
594
+ ```
595
+ rev-dep node-modules unused [flags]
596
+ ```
597
+
598
+ #### Examples
599
+
600
+ ```
601
+ rev-dep node-modules unused --exclude-modules=@types/*
602
+ ```
603
+
604
+ #### Options
605
+
606
+ ```
607
+ -n, --count Only display the count of modules
608
+ -c, --cwd string Working directory for the command (default "$PWD")
609
+ -p, --entry-points strings Entry point file(s) to start analysis from (default: auto-detected)
610
+ -e, --exclude-modules strings list of modules to exclude from the output
611
+ -b, --files-with-binaries strings Additional files to search for binary usages. Use paths relative to cwd
612
+ -m, --files-with-node-modules strings Additional files to search for module imports. Use paths relative to cwd
613
+ -h, --help help for unused
614
+ -t, --ignore-type-imports Exclude type imports from the analysis
615
+ -i, --include-modules strings list of modules to include in the output
616
+ --package-json string Path to package.json (default: ./package.json) (default "package.json")
617
+ --pkg-fields-with-binaries strings Additional package.json fields to check for binary usages
618
+ --tsconfig-json string Path to tsconfig.json (default: ./tsconfig.json) (default "tsconfig.json")
619
+ --zero-exit-code Use this flag to always return zero exit code
620
+ ```
621
+
622
+
623
+ ### rev-dep node-modules used
624
+
625
+ List all npm packages imported in your code
626
+
627
+ #### Synopsis
628
+
629
+ Analyzes your code to identify which npm packages are actually being used.
630
+ Helps keep track of your project's runtime dependencies.
631
+
632
+ ```
633
+ rev-dep node-modules used [flags]
634
+ ```
635
+
636
+ #### Examples
637
+
638
+ ```
639
+ rev-dep node-modules used -p src/index.ts --group-by-module
640
+ ```
641
+
642
+ #### Options
643
+
644
+ ```
645
+ -n, --count Only display the count of modules
646
+ -c, --cwd string Working directory for the command (default "$PWD")
647
+ -p, --entry-points strings Entry point file(s) to start analysis from (default: auto-detected)
648
+ -e, --exclude-modules strings list of modules to exclude from the output
649
+ -b, --files-with-binaries strings Additional files to search for binary usages. Use paths relative to cwd
650
+ -m, --files-with-node-modules strings Additional files to search for module imports. Use paths relative to cwd
651
+ --group-by-file Organize output by project file path
652
+ --group-by-module Organize output by npm package name
653
+ -h, --help help for used
654
+ -t, --ignore-type-imports Exclude type imports from the analysis
655
+ -i, --include-modules strings list of modules to include in the output
656
+ --package-json string Path to package.json (default: ./package.json) (default "package.json")
657
+ --pkg-fields-with-binaries strings Additional package.json fields to check for binary usages
658
+ --tsconfig-json string Path to tsconfig.json (default: ./tsconfig.json) (default "tsconfig.json")
659
+ ```
660
+
661
+
662
+ ### rev-dep resolve
663
+
664
+ Trace and display the dependency path between files in your project
665
+
666
+ #### Synopsis
667
+
668
+ Analyze and display the dependency chain between specified files.
669
+ Helps understand how different parts of your codebase are connected.
670
+
671
+ ```
672
+ rev-dep resolve [flags]
673
+ ```
674
+
675
+ #### Examples
676
+
677
+ ```
678
+ rev-dep resolve -p src/index.ts -f src/utils/helpers.ts
679
+ ```
680
+
681
+ #### Options
682
+
683
+ ```
684
+ -a, --all Show all possible resolution paths, not just the first one
685
+ --compact-summary Display a compact summary of found paths
686
+ -c, --cwd string Working directory for the command (default "$PWD")
687
+ -p, --entry-points strings Entry point file(s) to start analysis from (default: auto-detected)
688
+ -f, --file string Target file to check for dependencies
689
+ --graph-exclude strings Glob patterns to exclude files from dependency analysis
690
+ -h, --help help for resolve
691
+ -t, --ignore-type-imports Exclude type imports from the analysis
692
+ --package-json string Path to package.json (default: ./package.json) (default "package.json")
693
+ --tsconfig-json string Path to tsconfig.json (default: ./tsconfig.json) (default "tsconfig.json")
694
+ ```
695
+
696
+
697
+
698
+ <!-- cli-docs-end -->
699
+
700
+ ## Made in 🇵🇱 and 🇯🇵 with 🧠 by [@jayu](https://github.com/jayu)
701
+
702
+ I hope that this small piece of software will help you discover and understood complexity of your project hence make you more confident while refactoring. If this tool was useful, don't hesitate to give it a ⭐!
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rev-dep",
3
- "version": "2.0.0-alpha-8",
3
+ "version": "2.0.0",
4
4
  "description": "Dependency debugging tool for JavaScript and TypeScript projects",
5
5
  "bin": "bin.js",
6
6
  "files": [
@@ -17,8 +17,8 @@
17
17
  "node": ">=18"
18
18
  },
19
19
  "optionalDependencies": {
20
- "@rev-dep/darwin-arm64": "2.0.0-alpha-8",
21
- "@rev-dep/linux-x64": "2.0.0-alpha-8"
20
+ "@rev-dep/darwin-arm64": "2.0.0",
21
+ "@rev-dep/linux-x64": "2.0.0"
22
22
  },
23
23
  "keywords": [
24
24
  "dependencies",