Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rush/node-modules-cache
Skip "npm install" if currently existing node_modules has been built from the same package.json/package-lock.json
https://github.com/rush/node-modules-cache
Last synced: 18 days ago
JSON representation
Skip "npm install" if currently existing node_modules has been built from the same package.json/package-lock.json
- Host: GitHub
- URL: https://github.com/rush/node-modules-cache
- Owner: Rush
- License: mit
- Created: 2017-09-22T00:30:32.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-23T17:07:35.000Z (over 6 years ago)
- Last Synced: 2024-10-15T04:06:42.789Z (22 days ago)
- Language: JavaScript
- Size: 21.5 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# node-modules-cache
This tool is useful for entirely skipping `npm install` if currently existing `node_modules` has been built from the same `package.json` and optionally `package-lock.json`.This if often the case on CI such as Codeship, Gitlab CI or Drone.IO where caching whole `node_modules` is a common pattern.
## Installation
Minimum Node 6 is required.
```
npm install -g node-modules-cache
```or
```
wget https://rush.sh/I7cG88_dKzPzn0v+Z5hQK6DxDa4/node-modules-cache -O /usr/local/bin/node-modules-cache
```## Usage
The below will run `npm install` automatically if our cached package.json/package-lock.json have changed.
```
node-modules-cache install # you can pass any extra parameters you would pass to npm install
```It is equivalent to more manual usage:
```
node-modules-cache check || (npm install && node-modules-cache set)
```If you want to reinstall all modules when the cache is invalid then use:
```
node-modules-cache reinstall
```which is equivalent to:
```
node-modules-cache check || (rm -rf node_modules && npm install && node-modules-cache set)
```## License
MIT