fix(build): move project-specific targets into their own file
This commit is contained in:
parent
80b7f698ef
commit
0fd8ea9d5c
23
Makefile
23
Makefile
|
@ -1,24 +1 @@
|
||||||
include $(shell find $(ROOT_PATH) -name '*.mk' | grep -v node_modules)
|
include $(shell find $(ROOT_PATH) -name '*.mk' | grep -v node_modules)
|
||||||
|
|
||||||
# Tool options
|
|
||||||
.PHONY: all ci clean clean-deps clean-target configure help release release-dry todo
|
|
||||||
.PHONY: image image-build image-run
|
|
||||||
.PHONY: push git-stats git-push
|
|
||||||
.PHONY: node_modules out build cover deps docs lint test test-watch yarn-global yarn-update
|
|
||||||
|
|
||||||
bundle-shebang: node_modules
|
|
||||||
sed -i '1s;^;#! /usr/bin/env node\n\n;' $(TARGET_PATH)/bundle/index.cjs
|
|
||||||
chmod ug+x $(TARGET_PATH)/bundle/index.cjs
|
|
||||||
|
|
||||||
test-cover: ## run mocha unit tests with coverage reports
|
|
||||||
test-cover: test-check
|
|
||||||
sed -i $(TARGET_PATH)/coverage/lcov.info \
|
|
||||||
-e '/external ".*"$$/,/end_of_record/d' \
|
|
||||||
-e '/ sync$$/,/end_of_record/d' \
|
|
||||||
-e '/test sync/,/end_of_record/d' \
|
|
||||||
-e '/node_modules/,/end_of_record/d' \
|
|
||||||
-e '/bootstrap$$/,/end_of_record/d' \
|
|
||||||
-e '/universalModuleDefinition/,/end_of_record/d'
|
|
||||||
sed -n '/^SF/,$$p' -i $(TARGET_PATH)/coverage/lcov.info
|
|
||||||
sed '1s;^;TN:\n;' -i $(TARGET_PATH)/coverage/lcov.info
|
|
||||||
|
|
||||||
|
|
|
@ -32,18 +32,13 @@ export CI_RUNNER_DESCRIPTION ?= $(shell hostname)
|
||||||
export CI_RUNNER_ID ?= $(shell hostname)
|
export CI_RUNNER_ID ?= $(shell hostname)
|
||||||
export CI_RUNNER_VERSION ?= 0.0.0
|
export CI_RUNNER_VERSION ?= 0.0.0
|
||||||
|
|
||||||
# Debug
|
.PHONY: all ci clean clean-target configure help release release-dry todo
|
||||||
export DEBUG_BIND ?= 127.0.0.1
|
|
||||||
export DEBUG_PORT ?= 9229
|
|
||||||
|
|
||||||
# Versions
|
# Targets that must be provided by other files: bundle, build, cover, docs, clean-deps
|
||||||
export RUNNER_VERSION := $(CI_RUNNER_VERSION)
|
|
||||||
|
|
||||||
all: lint build cover docs ## builds, bundles, and tests the application
|
all: lint build cover docs ## builds, bundles, and tests the application
|
||||||
@echo Success!
|
@echo Success!
|
||||||
|
|
||||||
ci: clean-target lint build bundle cover docs
|
|
||||||
|
|
||||||
clean: ## clean up everything added by the default target
|
clean: ## clean up everything added by the default target
|
||||||
clean: clean-deps clean-target
|
clean: clean-deps clean-target
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
.PHONY: push git-stats git-push
|
||||||
|
|
||||||
push: git-push
|
push: git-push
|
||||||
|
|
||||||
# from https://gist.github.com/amitchhajer/4461043#gistcomment-2349917
|
# from https://gist.github.com/amitchhajer/4461043#gistcomment-2349917
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
.PHONY: image image-build image-run
|
||||||
|
|
||||||
image: ## build the docker image
|
image: ## build the docker image
|
||||||
docker build $(DOCKER_ARGS) -f Dockerfile -t $(DOCKER_IMAGE) .
|
docker build $(DOCKER_ARGS) -f Dockerfile -t $(DOCKER_IMAGE) .
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,17 @@
|
||||||
# node options
|
export NODE_VERSION := $(shell node -v 2>/dev/null || echo "none")
|
||||||
|
export PACKAGE_NAME := $(shell jq -r '.name' package.json || echo "unknown")
|
||||||
|
export PACKAGE_VERSION := $(shell jq -r '.version' package.json || echo "unknown")
|
||||||
|
export RUNNER_VERSION := $(CI_RUNNER_VERSION)
|
||||||
|
|
||||||
|
# Debug
|
||||||
|
export DEBUG_BIND ?= 127.0.0.1
|
||||||
|
export DEBUG_PORT ?= 9229
|
||||||
|
|
||||||
|
# Node options
|
||||||
NODE_CMD ?= $(shell env node)
|
NODE_CMD ?= $(shell env node)
|
||||||
NODE_DEBUG ?= --inspect-brk=$(DEBUG_BIND):$(DEBUG_PORT) --nolazy
|
NODE_DEBUG ?= --inspect-brk=$(DEBUG_BIND):$(DEBUG_PORT) --nolazy
|
||||||
|
|
||||||
export NODE_VERSION := $(shell node -v 2>/dev/null || echo "none")
|
.PHONY: build bundle ci clean-deps cover deps docs lint test yarn-global yarn-upgrade
|
||||||
export PACKAGE_NAME := $(shell jq -r '.name' package.json)
|
|
||||||
export PACKAGE_VERSION := $(shell jq -r '.version' package.json)
|
|
||||||
|
|
||||||
# directory targets
|
# directory targets
|
||||||
node_modules: deps
|
node_modules: deps
|
||||||
|
@ -21,6 +28,8 @@ build: node_modules
|
||||||
bundle: build
|
bundle: build
|
||||||
node config/esbuild.mjs
|
node config/esbuild.mjs
|
||||||
|
|
||||||
|
ci: clean-target lint build bundle cover docs
|
||||||
|
|
||||||
clean-deps: ## clean up the node_modules directory
|
clean-deps: ## clean up the node_modules directory
|
||||||
rm -rf node_modules/
|
rm -rf node_modules/
|
||||||
|
|
||||||
|
@ -68,5 +77,5 @@ test: node_modules out
|
||||||
yarn-global: ## install bundle as a global tool
|
yarn-global: ## install bundle as a global tool
|
||||||
yarn global add file:$(ROOT_PATH)
|
yarn global add file:$(ROOT_PATH)
|
||||||
|
|
||||||
yarn-update: ## check yarn for outdated packages
|
yarn-upgrade: ## check yarn for potential upgrades
|
||||||
yarn upgrade-interactive --latest
|
yarn upgrade-interactive --latest
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
.PHONY: bundle-shebang cover-fixup
|
||||||
|
|
||||||
|
bundle-shebang: bundle
|
||||||
|
sed -i '1s;^;#! /usr/bin/env node\n\n;' $(TARGET_PATH)/bundle/index.cjs
|
||||||
|
chmod ug+x $(TARGET_PATH)/bundle/index.cjs
|
||||||
|
|
||||||
|
cover-fixup: ## run mocha unit tests with coverage reports
|
||||||
|
cover-fixup: cover
|
||||||
|
sed -i $(TARGET_PATH)/coverage/lcov.info \
|
||||||
|
-e '/external ".*"$$/,/end_of_record/d' \
|
||||||
|
-e '/ sync$$/,/end_of_record/d' \
|
||||||
|
-e '/test sync/,/end_of_record/d' \
|
||||||
|
-e '/node_modules/,/end_of_record/d' \
|
||||||
|
-e '/bootstrap$$/,/end_of_record/d' \
|
||||||
|
-e '/universalModuleDefinition/,/end_of_record/d'
|
||||||
|
sed -n '/^SF/,$$p' -i $(TARGET_PATH)/coverage/lcov.info
|
||||||
|
sed '1s;^;TN:\n;' -i $(TARGET_PATH)/coverage/lcov.info
|
||||||
|
|
Loading…
Reference in New Issue