Created
March 7, 2019 14:55
-
-
Save sndrs/f9d6284aca6262da16413d0d7b9faa06 to your computer and use it in GitHub Desktop.
Check for – and use – NVM from a makefile
This file contains 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
export PATH := node_modules/.bin:$(PATH) | |
export SHELL := /usr/bin/env bash | |
.PHONY: dev | |
dev: check-nvm install # run `yarn dev` in .nvmrc-mandated node | |
@bash -l -c 'nvm exec --silent yarn -s dev' | |
.PHONY: install | |
install: # install deps using yarn in .nvmrc-mandated node | |
@bash -l -c 'nvm exec --silent yarn -s' | |
.PHONY: check-nvm | |
check-nvm: # will error with link to install NVM if it's not installed | |
@bash -l -c 'type -t nvm > /dev/null || { echo -e "\x1b[31mYou need to install NVM:\x1b[0m https://github.com/creationix/nvm#installation-and-update"; exit 1; }' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment