Skip to content

Instantly share code, notes, and snippets.

@molszanski
Last active November 19, 2021 16:46
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save molszanski/56de03b54f66885ef415af84e06cda7f to your computer and use it in GitHub Desktop.
Save molszanski/56de03b54f66885ef415af84e06cda7f to your computer and use it in GitHub Desktop.
Makefile example for frontend dev
bin = ./node_modules/.bin
# (spec, dot, progress, tap, landing, nyan, min (mocha --reporters))
REPORTER = spec
build-prod: ## Build a clean prod versions
@ NODE_ENV=develop \
$(bin)/webpack --config ./build/config-webpack-dist.coffee
@ cp ./assets/favicon.ico ./dist/favicon.ico
.PHONY: test
test: ## Run tests in node
@ NODE_ENV=test \
$(bin)/mocha-webpack \
--webpack-config ./build/config-webpack-test.coffee \
--reporter $(REPORTER) \
"test/**/*.{js,ts,coffee}"
lint: ## Run a typescript linter
@ NODE_ENV=develop \
$(bin)/tslint \
-c ./build/tslint.json \
--project ./build/tsconfig.json
validate: lint test ## Lint and test before release
# -----------------------------------------------------------
# ----- EVERYTHING BELOW THIS LINE IS NOT IMPORTANT --------
# ----- (Makefile helpers and decoration) --------
# -----------------------------------------------------------
#
# Decorative Scripts - Do not edit below this line unless you know what it is
.PHONY: help
.DEFAULT_GOAL := help
NO_COLOR = \033[0m
INDENT = -30s
BIGINDENT = -50s
GREEN = \033[36m
BLUE = \033[34m
DIM = \033[2m
YELLOW = \033[33m
# @printf '$(DIM)Variables$(NO_COLOR):\n'
# @printf "$(DIM)$(BLUE) % $(BIGINDENT)$(NO_COLOR) %s \n" "Secrets folder name:" ./$(secretsFolderName)
help:
@printf '$(DIM)Commands:$(NO_COLOR)\n'
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "$(GREEN) % $(BIGINDENT)$(NO_COLOR) - %s\n", $$1, $$2}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment