mirror of
https://github.com/kvz/bash3boilerplate.git
synced 2024-12-18 14:26:22 +00:00
Upgrade fakefile
This commit is contained in:
parent
879422d09f
commit
55cd329ebd
25
Makefile
25
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)
|
||||
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user