Created
May 28, 2021 13:37
-
-
Save gs0510/2e73e4f76a7e5d1812ea88f9e0a8f974 to your computer and use it in GitHub Desktop.
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
SHELL=/bin/bash | |
NVM=. ~/.nvm/nvm.sh | |
ifeq ($(VERCEL), 1) | |
# The yarn version is picked from .engines in package.json | |
YARN=yarn | |
# Put .esy in node_modules for caching in Vercel | |
ESY=export ESY__PREFIX=$$PWD/node_modules/.esy && npx esy | |
BSB=npx bsb | |
else | |
# Yarn version specified here because it can't bootstrap itself as a devDependency with npx. | |
YARN=$(NVM) use && npx yarn@1.22 | |
ESY=$(NVM) use && npx esy | |
BSB=$(NVM) use && npx bsb | |
endif | |
.PHONY: dev | |
dev: install-deps watch-and-serve | |
.PHONY: install-deps | |
install-deps: | |
ifeq ($(VERCEL), 1) | |
npm config set user root | |
yum install perl-Digest-SHA | |
else | |
echo "Hello" | |
# $(NVM) install | |
endif | |
$(YARN) install | |
make vendor/ood && $(YARN) link ood | |
$(ESY) install | |
vendor/ood: | |
mkdir -p vendor && cd vendor && \ | |
git clone https://github.com/ocaml/ood.git && cd ood && \ | |
$(YARN) link | |
.PHONY: watch | |
watch: | |
$(YARN) watch | |
.PHONY: watch-and-serve | |
watch-and-serve: | |
$(YARN) watch-and-serve | |
.PHONY: build | |
build: | |
$(ESY) build | |
$(YARN) build | |
.PHONY: serve | |
serve: build | |
$(YARN) start-test-server | |
.PHONY: clean | |
clean: | |
-$(BSB) -clean | |
-$(ESY) dune clean | |
-rm -f .merlin | |
-rm -rf .next | |
-rm -rf out | |
.PHONY: distclean | |
distclean: clean | |
-($(YARN) unlink ood && cd vendor/ood && $(YARN) unlink) | |
-rm -rf vendor | |
-rm -rf node_modules | |
-rm -rf _esy | |
-rm -f yarn-error.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment