npm-clean-cli

Clean NPM Dependencies

Usage no npm install needed!

<script type="module">
  import npmCleanCli from 'https://cdn.skypack.dev/npm-clean-cli';
</script>

README

Build Status codecov npm npm Greenkeeper badge

npm-clean-cli

Introduction

There are times when you're working in an npm project and you'd like to start "fresh", from a dependency point of view i.e.1

  • Blow away your node_modules directory
  • Clean your npm cache
    • Even if

    it should never be necessary to clear the cache for any reason other than reclaiming disk space

  • And reinstall your npm dependencies

Installation

npm install npm-clean-cli -g

Usage

  • Go to a directory that you'd like to "clean"
  • Execute npmclean
    • Your directory must have a package.json file or else the additional commands won't run
    • If you do have a package.json file, the output should look something like alt-text

Footnotes

1 And yeah, I know that doing something like

rm -rf node_modules; npm clean cache --force; npm install

is not that verbose, and even if it is, you could assign it to a bash alias. But hey, I guess I like to overengineer things.