aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorn-peugnet <n.peugnet@free.fr>2019-11-07 14:05:57 +0100
committern-peugnet <n.peugnet@free.fr>2019-11-07 15:40:45 +0100
commit14ff62ace7a8fdc21a8d2f84bd0cbd32edca24af (patch)
treeda45467a9823f8cec3ed01b184daafcbc31e1c06 /Makefile
parentf43d03393babc939756c9f5581343913b02c7298 (diff)
downloadwcms-14ff62ace7a8fdc21a8d2f84bd0cbd32edca24af.tar.gz
wcms-14ff62ace7a8fdc21a8d2f84bd0cbd32edca24af.zip
build: gen VERSION from make instead of release-it
- remove @release-it/bumper module - gen VERSION from make - remove VERSION from git
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile17
1 files changed, 15 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 0753357..70722f4 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,8 @@ include .env
export
PATH := vendor/bin:node_modules/.bin:$(PATH)
-GIT_VERSION := $(shell git --no-pager describe --always --tags)
+override GIT_VERSION := $(shell git --no-pager describe --always --tags)
+override CUR_VERSION := $(strip $(shell cat VERSION))
js_sources := $(wildcard src/*.js)
js_bundles := $(js_sources:src/%.js=assets/js/%.bundle.js)
@@ -12,7 +13,7 @@ zip_release := dist/w_cms_$(GIT_VERSION).zip
all: vendor build
-build: $(js_bundles)
+build: VERSION $(js_bundles)
watch: node_modules
webpack --env dev --watch
@@ -38,6 +39,7 @@ dist/w_cms_%.zip: all
"package*" \
webpack.config.js
zip -r $@ \
+ VERSION \
assets/js \
vendor \
-x "*test*" \
@@ -51,6 +53,14 @@ assets/js/%.bundle.js assets/js/%.bundle.map: src/%.js node_modules
.env:
cp .default.env .env
+# use a force (fake) target to always rebuild this file but have Make
+# consider this updated if it was actually rewritten (a .PHONY target
+# is always considered new)
+VERSION: FORCE
+ifneq ($(CUR_VERSION),$(GIT_VERSION))
+ @echo $(GIT_VERSION) > VERSION
+endif
+
vendor: composer.json composer.lock
@echo "Installing PHP dependencies..."
composer install $(if $(filter $(ENV),prod),--no-dev --prefer-dist,)
@@ -70,7 +80,10 @@ distclean: buildclean
buildclean:
@echo "Cleaning build artifacts..."
+ rm -rf VERSION
rm -rf $(js_bundles)
rm -rf $(js_srcmaps)
+FORCE: ;
+
.PHONY: all build watch release dist clean distclean buildclean