In the company, most of us work together to develop and maintain a project for a long time, but sometimes we find that there are many obsolete NPM packages in package.json, and we want to delete them, but we can’t delete them blindly. So depcheck it’s coming.

How to use it

The first step

Global installation:

npm install depcheck -g
Copy the code

The second step

Depcheck is executed in the root directory of the project (here we take our own project to do the test), after the execution, according to their own results to delete

Step 3 (Install and uninstall dependencies)

— Save in the dependencies section of package.json

— Save-dev < devDependencies > in package.json

Dependencies are installed in package.json in three ways

npm i element-ui

npm i element-ui -S

npm i element-ui –save

Depend on the devDependencies installed in package.json in two ways

npm install jquery –save-dev

npm install jquery –D

1. Install the jquery

npm install jquery --save
Copy the code

Uninstall the jquery

npm uninstall jquery --save
Copy the code