diff options
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | Makefile | 54 | ||||
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | webpack.config.js | 3 |
4 files changed, 62 insertions, 2 deletions
@@ -6,8 +6,9 @@ database/* fonts/* media/* render/ +dist/ vendor/* -node_modules/* +node_modules/ config.json error_log !README.md diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..bef37ef --- /dev/null +++ b/Makefile @@ -0,0 +1,54 @@ +PATH := vendor/bin:node_modules/.bin:$(PATH) +GIT_VERSION := $(shell git --no-pager describe --always --tags) + +js_sources := $(wildcard src/*.js) +js_bundles := $(js_sources:src/%.js=assets/js/%.bundle.js) +zip_release := $(GIT_VERSION:%=dist/w_cms_%.zip) + +all: php_dependencies $(js_bundles) + +dist: distclean $(zip_release) + +dist/w_cms_%.zip: all + @echo "Building Zip release..." + mkdir -p $(dir $@) + git archive --format=zip HEAD -o $@ + zip -d $@ \ + "src*" \ + .gitignore \ + composer.lock \ + Makefile \ + "package*" \ + webpack.config.js + zip -r $@ \ + assets/js \ + vendor \ + -x "*test*" \ + -x "*docs*" + +assets/js/%.bundle.js: src/%.js js_dependencies + @echo "Building JS Bundles..." + mkdir -p $(dir $@) + webpack --env prod + +php_dependencies: + @echo "Installing PHP dependencies..." + composer install --no-dev --prefer-dist + +php_clean: + @echo "Cleaning PHP..." + rm -rf vendor + +js_dependencies: + @echo "Installing JS dependencies..." + npm install + +js_clean: + @echo "Cleaning JS..." + rm -rf node_modules + rm -rf $(js_bundles) + +clean: php_clean js_clean + +distclean: + rm -rf dist @@ -77,6 +77,10 @@ While developing the JS sources it is useful to run webpack in watch mode so tha npm run watch +## Release zip + +To build the release zip, make sure you are on `master` and executed `git pull` then run `make dist`. This will create a zip file in `dist/`. + To Do ===== diff --git a/webpack.config.js b/webpack.config.js index e18b201..734b3cd 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -5,6 +5,7 @@ module.exports = (env) => { // Environment dependent mode: env == 'dev' ? 'development' : 'production', devtool: env == 'dev' ? 'inline-source-map' : 'none', + stats: env == 'dev' ? {} : { warnings: false }, // Constant entry: { @@ -27,4 +28,4 @@ module.exports = (env) => { ], }, } -};
\ No newline at end of file +}; |