Skip to content

Commit

Permalink
2371 improve make commands for npm
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-nick17 committed Jan 28, 2025
1 parent 07dde0f commit 4fc17f2
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
PORT=23600

NVM_SOURCE_PATH ?= $(HOME)/.nvm/nvm.sh

ifneq ("$(wildcard $(NVM_SOURCE_PATH))","")
NVM_EXEC = source $(NVM_SOURCE_PATH) && nvm exec --
endif
NPM = $(NVM_EXEC) npm

.PHONY: all
all: audit build watch

.PHONY: audit
audit:
go list -json -m all | nancy sleuth
npm audit --audit-level=high
$(NPM) audit --audit-level=high

.PHONY: build
build: deps-javascript
go run main.go

.PHONY: deps-javascript
deps-javascript:
npm install --unsafe-perm
$(NPM) install --unsafe-perm

.PHONY: install-prereqs
install-prereqs:
Expand All @@ -23,7 +30,7 @@ install-prereqs:

.PHONY: test
test: deps-javascript
npm test
$(NPM) test

.PHONY: watch
watch:
Expand All @@ -38,8 +45,8 @@ watch-templates:

.PHONY: watch-assets
watch-assets:
npm run build
npm run watch
$(NPM) run build
$(NPM) run watch

.PHONY: watch-serve
watch-serve:
Expand Down

0 comments on commit 4fc17f2

Please sign in to comment.