Created
July 31, 2021 12:41
-
-
Save d3vAdv3ntur3s/a7d9ec0ce7608754e0a763128d6a2dfc to your computer and use it in GitHub Desktop.
Example Makefile
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
SHELL:=/usr/bin/env bash #default shell used | |
MAKEFLAGS += --silent --jobs 10 #don't echo commands and parallelise | |
# Default task executed when running with make command only no args | |
default: help | |
#src: https://victoria.dev/blog/how-to-create-a-self-documenting-makefile/ | |
help: ## Show this help | |
@egrep -h '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' | |
################### | |
# Development # | |
################### | |
run-backend: ## Run backend Node JS App locally | |
NODE_ENV=dev npm --prefix backend start | |
run-frontend: ## Run frontend React app in Dev mode locally | |
NODE_ENV=dev npm --prefix frontend start | |
run-frontend-storybook: ## Run frontend story book for demonstrating components | |
npm --prefix frontend storybook | |
################### | |
# Testing # | |
################### | |
test-all: test-backend test-frontend test-e2e ## Test frontend, backend, e2e tests | |
test-backend: ## Run tests of the backend via npm | |
NODE_ENV=test npm --prefix backend test; | |
test-frontend: ## Run tests of the frontend via npm | |
NODE_ENV=test npm --prefix frontend run test-ci; | |
test-e2e: ## Run headless browser tests of the locally running frontend via Cypress | |
CYPRESS_BASE_URL=http://localhost:8080/ npm --prefix e2e run cy:run | |
# targets don't produce any output | |
.PHONY: run-backend run-frontend run-frontend-storybook | |
.PHONY: test-all test-backend test-frontend test-e2e | |
# https://makefiletutorial.com for useful tips and help with make files |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment