Skip to content

Instantly share code, notes, and snippets.

@copyrighthero
Created June 4, 2021 21:38
Show Gist options
  • Save copyrighthero/3ff8eaca62eb684730828fbe91118c5d to your computer and use it in GitHub Desktop.
Save copyrighthero/3ff8eaca62eb684730828fbe91118c5d to your computer and use it in GitHub Desktop.
Generic makefile for running npm commands
ARGS = build clean pack start test
MAKECMDGOALS ?= clean
$(ARGS):
npm run $(MAKECMDGOALS)
.PHONY: $(ARGS)
@copyrighthero
Copy link
Author

This Makefile will allow you to run any npm commands that you have specified in the ARGS variable.

i.e. make by default will run npm run clean, which is specified to be the default for MAKECMDGOALS

i.e. make start will run npm run start, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment