A fast unused and duplicate dependency checker

Related tags

Utilities depp
Overview

Depp - A fast unused and duplicate package checker

Installation

npm install -g depp-installer (will try to get npm install -g depp later)

Usage

Just run depp in your project folder and it will do the rest. Keep in mind it will likely fail without setting some externals

Note if you want it to work with JS please use -j or --js by default it will do only .ts|.tsx files

All options

โžœ depp --help
NAME:
   depp - Find un used packages fast

USAGE:
   depp [global options] command [command options] [arguments...]

COMMANDS:
   clean    Cleans all output files
   show     Shows previous report
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --dev, -d                             Enable dev dependencies (default: false)
   --js, -j                              Enable js source files (default: false)
   --path value, -p value                Overwrite root directory
   --log, -l                             Will write logs to .depcheck.log (default: false)
   --source value, -s value              Overwrite default sources
   --report, -r                          Generate report file (default: false)
   --show-versions, -v                   Show conflicting versions (default: false)
   --write-output-files, -w              This will write the esbuild output files. (default: false)
   --externals value, -e value           Pass custom externals using this flag
   --ignore-namespace value, --in value  Pass namespace (@monorepo) to be ignored
   --help, -h                            show help (default: false)

Example Advanced usage

This is an example of advanced usage of the script with externals and ignore-namespace

depp -v -j -e mobx -e magic-sdk -e domain -e @daybrush/utils -e yjs -e constants -e ws  -e perf_hooks -in @editor -in @server   --report

Why use this

  1. It is using esbuild and go so it is quite a bit faster than most other tools
  2. Most tools that I could find at least, didn't not support monorepos. This does and is built for monorepos

Caveats

This is not been extensively tested and might have some short comings, it may not identify every unused package but will definitely do a decent first pass

Acknowledgement

This is built upon the excellent work down by @evanw on esbuild and uses esbuild under the hood

Comments
  • Installation is not supported for this architecture: arm64

    Installation is not supported for this architecture: arm64

    Trying to install depp but get this error.

    โžœ  ๐Ÿ“ฆ v2.0.0 npm install -g depp-installer
    npm ERR! code 1
    npm ERR! path /usr/local/lib/node_modules/depp-installer
    npm ERR! command failed
    npm ERR! command sh -c node dist/postinstall.js install
    npm ERR! /usr/local/lib/node_modules/depp-installer/dist/postinstall.js:107
    npm ERR!     throw new Error("Installation is not supported for this architecture: " + process.arch);
    npm ERR!           ^
    npm ERR!
    npm ERR! Error: Installation is not supported for this architecture: arm64
    npm ERR!     at parsePackageJson (/usr/local/lib/node_modules/depp-installer/dist/postinstall.js:107:11)
    npm ERR!     at Object.<anonymous> (/usr/local/lib/node_modules/depp-installer/dist/postinstall.js:161:16)
    npm ERR!     at Generator.next (<anonymous>)
    npm ERR!     at /usr/local/lib/node_modules/depp-installer/dist/postinstall.js:36:61
    npm ERR!     at new Promise (<anonymous>)
    npm ERR!     at __async (/usr/local/lib/node_modules/depp-installer/dist/postinstall.js:20:10)
    npm ERR!     at Object.install (/usr/local/lib/node_modules/depp-installer/dist/postinstall.js:160:10)
    npm ERR!     at Object.<anonymous> (/usr/local/lib/node_modules/depp-installer/dist/postinstall.js:212:15)
    npm ERR!     at Module._compile (node:internal/modules/cjs/loader:1101:14)
    npm ERR!     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    
    bug need-more-info 
    opened by Lxxyx 8
  • Not using my config file

    Not using my config file

    I have an extensive list of externals, so I generated a config.json so I wouldn't have to set the config with every command.

    {
      "js":true,
      "path":"",
      "log":false,
      "report":true,
      "show-versions":true,
      "dev":true,
      "externals":[
        "prop-types",
        "invariant",
        "lodash/sortBy",
        "lodash/findIndex",
        "date-arithmetic",
        "memoize-one",
        "react",
        "dom-helpers/listen",
        "dom-helpers/contains",
        "dom-helpers/closest",
        "rollup-plugin-terser",
        "rollup-plugin-size-snapshot",
        "rollup-plugin-replace",
        "rollup-plugin-node-resolve",
        "rollup-plugin-commonjs",
        "webpack-atoms",
        "webpack-dev-server",
        "webpack",
        "react-tackle-box/Slot",
        "@storybook/theming",
        "@storybook/react",
        "@storybook/addon-actions/register",
        "moment"
        ],
        "ignore-namespaces":null,
        "browser-platform":false
      }
    

    But when I run depp -v -j, my output continues to show that it 'Could not resolve "x" (mark it as external to exclude it from the bundle)'. I also get a lot of output like '{ Unexpected "<" 0xc001c1e9c0 [] }'. Am I missing something?

    bug 
    opened by cutterbl 4
  • Error created by not using targeting platform node correctly

    Error created by not using targeting platform node correctly

    nodejs - 17.0.1 macOS - 12.0.1

    Errors [{ Could not resolve "vm" (use "Platform: api.PlatformNode" when building for node) 0xc006a4baa0 [] <nil>} { Could not resolve "perf_hooks" (use "Platform: api.PlatformNode" when building for node) 0xc006a4bb00 [] <nil>}]
    

    PS: I have two MacBooks with the same configuration & environment. On MacBook 13 everything okay, but on MacBook 16 I got that issue.

    bug good first issue 
    opened by nosferatu500 2
  • Fix JSX bug and reading config file bugs

    Fix JSX bug and reading config file bugs

    Resolves #9

    There were a few bugs here, the three main bugs were

    • Bad error printing, the error is much easier to understand when printed out properly
    • The default loader for .js files was not set to jsx so could not understand JSX. That is where the < comes from
    • The global config being overwrite by the default false from the flags
    opened by CryogenicPlanet 1
  • Config and ci

    Config and ci

    Resolves #3 Resolves #7

    An example of depp working in CI is https://github.com/CryogenicPlanet/invited/pull/2 but as shown in that PR for some reason the actual dependency checking doesn't seem to work inside the GitHub actions runner

    opened by CryogenicPlanet 1
  • Configuration Files

    Configuration Files

    I know config files kinda suck but I think it could be good for this in a few ways:

    1. For more complex codebases you might have to external a bunch of packages
    2. We could add version control support and use this tool within CI systems

    We could mitigate yaml or json config hell by allow all the config to be done from the cli with commands kinda like dokku

    enhancement 
    opened by CryogenicPlanet 1
  • Doesn't install on Windows

    Doesn't install on Windows

    I get the following error when I run npm i -g depp-installer on Windows 10:

    > [email protected] preuninstall C:\Program Files\nodejs\node_modules\depp-installer
    > node dist/postinstall.js uninstall
    
    Uninstalled cli successfully
    
    > [email protected] postinstall C:\Program Files\nodejs\node_modules\depp-installer
    > node dist/postinstall.js install
    
    Copying the relevant binary for your platform win32
    Downloading binary from https://github.com/CryogenicPlanet/depp/releases/download/v0.0.1-e/depp.exe_0.0.1-e_windows_x86_64.tar.gz
    (node:7564) UnhandledPromiseRejectionWarning: Error: Request failed with status code 404
        at createError (C:\Users\mgg\AppData\Roaming\nvm\v14.15.0\node_modules\depp-installer\node_modules\axios\lib\core\createError.js:16:15)
        at settle (C:\Users\mgg\AppData\Roaming\nvm\v14.15.0\node_modules\depp-installer\node_modules\axios\lib\core\settle.js:17:12)
        at RedirectableRequest.handleResponse (C:\Users\mgg\AppData\Roaming\nvm\v14.15.0\node_modules\depp-installer\node_modules\axios\lib\adapters\http.js:262:9)
        at RedirectableRequest.emit (events.js:315:20)
        at RedirectableRequest._processResponse (C:\Users\mgg\AppData\Roaming\nvm\v14.15.0\node_modules\depp-installer\node_modules\follow-redirects\index.js:425:10)
        at ClientRequest.RedirectableRequest._onNativeResponse (C:\Users\mgg\AppData\Roaming\nvm\v14.15.0\node_modules\depp-installer\node_modules\follow-redirects\index.js:57:10)
        at Object.onceWrapper (events.js:422:26)
        at ClientRequest.emit (events.js:315:20)
        at HTTPParser.parserOnIncomingClient (_http_client.js:641:27)
        at HTTPParser.parserOnHeadersComplete (_http_common.js:126:17)
    (Use `node --trace-warnings ...` to show where the warning was created)
    (node:7564) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
    (node:7564) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
    + [email protected]
    updated 1 package in 4.43s
    
    bug good first issue 
    opened by fristys 1
  • Use in CI Systems

    Use in CI Systems

    As this is likely not a one-time problem, it would be good to be able to integrate this as a part of your CI pipeline.

    Thoughts:

    • The tool can wrongly target a package as being unused, this might be because we don't actually see the package in the code. Think apollo or graphql or the tool is making a mistake.

    • We can partially mitigate the above, by allowing users to configure accepted packages or ignored packages in #3 so we can check against those

    • This likely should be used as a fail condition on CI systems but rather something like codecov or something, it can generate the report and add it as a PR comment

    bug enhancement 
    opened by CryogenicPlanet 1
Releases(v0.0.12)
Owner
Rahul Tarak
20 | @modfy
Rahul Tarak
Clean up unused AWS resources

vacuum Vacuum your AWS account of unused resources to save you ?? ?? !! To run: vacuum all โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’

Kevin Holditch 12 Aug 10, 2022
This is a small utility that finds unused exported Go symbols (functions, methods ...) in Go

This is a small utility that finds unused exported Go symbols (functions, methods ...) in Go. For all other similar use cases

Bjรธrn Erik Pedersen 18 Sep 15, 2022
A small & fast dependency-free library for parsing micro expressions.

MicroExpr A small & fast dependency-free library for parsing micro expressions. This library was originally built for use in templating languages (e.g

Daniel G. Taylor 8 Aug 27, 2022
checkspaces is a checker for spaces between // and directives.

checkspaces checks if there is a space between // and directives.

masibw 2 Dec 10, 2021
Helm plugin to reference value files packaged in dependency charts

Helm Octopus Plugin This Helm plugin allows to reference packaged value files (other than the default values.yaml). Install helm plugin install https:

Softonic 3 Sep 23, 2021
MNA - stands for mobile number assignment - a small zero external dependency golang library that is used to identify mobile number assignment in tanzania

MNA - stands for mobile number assignment - a small zero external dependency golang library that is used to identify mobile number assignment in tanzania

TECHCRAFT TECHNOLOGIES LIMITED 8 Nov 29, 2021
Golang flags parser with zero dependency

flags Golang flags parser with zero dependency. Usage See simple.go for basic usage. Concept flags gives a simple way to get flag's value from argumen

Vincent Boutour 0 Jan 16, 2022
Di - A (very) WIP Go 1.18+ generic dependency injection package based on type reflection

di A (very) WIP Go 1.18+ generic dependency injection package based on type refl

Ringo Hoffmann 5 Apr 26, 2022
Fast and scalable pseudorandom generator for Go

fastrand Fast pseudorandom number generator. Features Optimized for speed. Performance scales on multiple CPUs. How does it work? It abuses sync.Pool

Aliaksandr Valialkin 174 Sep 21, 2022
MCsniperGO, a fast, efficient, and feature-packed minecraft name sniper.

MCsniperGO This project was made possible by my donators Usage This sniper is in it's beta stage, meaning bugs should be expected. Easy installation d

Kqzz 128 Sep 19, 2022
Fast, lightweight and NOT reliable tool for downloading tons of images.

image-download-tool Fast, lightweight and NOT reliable tool for downloading tons of images. How to use Run .exe with --help flag Create json file with

Denis 3 May 12, 2022
Envoy utility to process envoy config for fast development and debugging.

envoyconf-tools Envoy is a proxy, really awesome and we are devs who often use it, face errors and struggle to debug it, when envoy config's source is

VOrishirne 3 Oct 31, 2021
๐ŸฎBlazing fast URL shortener made with simplicity in mind

klein Blazing fast URL shortener made with simplicity in mind Structures The project is what people would call a "monolith".

sach1 19 Feb 16, 2022
๐Ÿฎ โ€• Blazing fast URL shortener made with simplicity in mind

klein Blazing fast URL shortener made with simplicity in mind Run As easy as filling out config/config.yaml and running make. Of course, you need to h

Pink Cigarette 19 Feb 16, 2022
Fast, scalable pseudo random number generator based on xxh3

XXH3-Based Pseudorandom Number Generator This package contains an experimental implementation of a noise based pseudorandom number generator that scal

Roman Atachiants 9 Aug 3, 2022
Fast integer map for uint32-to-uint32

Uint32-to-Uint32 Map This repository contains an implementation of uint32-to-uint32 map which is ~20-50% faster than Go standard map for the same type

Roman Atachiants 20 Jul 25, 2022
A full-featured license tool to check and fix license headers and resolve dependencies' licenses.

SkyWalking Eyes A full-featured license tool to check and fix license headers and resolve dependencies' licenses. Usage You can use License-Eye in Git

The Apache Software Foundation 160 Sep 23, 2022
A Go (golang) library for parsing and verifying versions and version constraints.

go-version is a library for parsing versions and version constraints, and verifying versions against a set of constraints. go-version can sort a collection of versions properly, handles prerelease/beta versions, can increment versions, etc.

HashiCorp 1.3k Sep 23, 2022
๐Ÿค–๐ŸคA tool to test and analyze storage and retrieval deal capability on the Filecoin network.

Dealbot A tool to test and analyze storage and retrieval deal capability on the Filecoin network. Getting Started Clone the repo and build: git clone

Filecoin 29 Sep 10, 2022