Created
May 19, 2019 02:53
-
-
Save martineno/92dc94d0a6b18d1624fa5cbd5ec8b24f to your computer and use it in GitHub Desktop.
Only run `npm install` when needed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# An example of how to only run `npm install` only when package.json or package-lock.json | |
# have changed. This might be helpful for situation where you run `npm install` every time | |
# and app or service lauches (e.g. for local development), but the install takes a long time. | |
# | |
# This approach creates a tracking file called `make_installed`. Whenever `npm install` is | |
# invoked, this file is touched. If the file is newer then the modification date on either | |
# package.json or package-lock.json then no installation is done. If it is older, | |
# then installation is done. | |
# | |
# This also works with git. When you checkout a previous commit the modification date for | |
# the checked out files will be the current date, not the date it was commited. | |
# | |
node_modules/make_installed: package.json package-lock.json | |
npm install | |
touch node_modules/make_installed | |
install: node_modules/make_installed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment