diff --git a/Makefile b/Makefile index 29a7c10..7a2a446 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,9 @@ # # https://www.npmjs.com/package/fakefile # +# Please do not edit this file directly, but propose changed upstream instead: +# https://github.com/kvz/fakefile/blob/main/Makefile +# # This Makefile offers convience shortcuts into any Node.js project that utilizes npm scripts. # It functions as a wrapper around the actual listed in `package.json` # So instead of typing: @@ -25,10 +28,26 @@ # OSX users will have to install bash-completion # (http://davidalger.com/development/bash-completion-on-os-x-with-brew/) +ifeq ($(shell test -e ./yarn.lock && echo -n yes),yes) + RUNNER=yarn + INSTALLER=yarn install +else + RUNNER=npm run + INSTALLER=npm install +endif + define npm_script_targets -TARGETS := $(shell node -e 'for (var k in require("./package.json").scripts) {console.log(k.replace(/:/g, "-"));}') +TARGETS := $(shell \ + node -e 'for (var k in require("./package.json").scripts) {console.log(k.replace(/:/g, "-"));}' + | grep -v -E "^install$$" +) $$(TARGETS): - npm run $(subst -,:,$(MAKECMDGOALS)) + $(RUNNER) $(shell \ + node -e 'for (var k in require("./package.json").scripts) {console.log(k.replace(/:/g, "-"), k);}' + | grep -E "^$(MAKECMDGOALS)\s" + | head -n1 + | awk '{print $$2}' + ) .PHONY: $$(TARGETS) endef @@ -37,4 +56,4 @@ $(eval $(call npm_script_targets)) # These npm run scripts are available, without needing to be mentioned in `package.json` install: - npm run install + $(INSTALLER) diff --git a/package.json b/package.json index 3d08f14..5177b3f 100644 --- a/package.json +++ b/package.json @@ -26,10 +26,8 @@ "fsevents": "*" }, "devDependencies": { - "cross-env": "3.1.3", "fakefile": "0.0.8", "next-update": "1.5.1", - "npm-run-all": "3.1.2", "replace": "0.3.0" } }