From 25ac9aa7dbe6c5c6464b2d67a188dca96305ff96 Mon Sep 17 00:00:00 2001 From: korelstar Date: Wed, 3 Feb 2021 21:28:15 +0100 Subject: [PATCH] refactor Makefile --- Makefile | 99 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 54 insertions(+), 45 deletions(-) diff --git a/Makefile b/Makefile index c8a8ccfb..d8092cae 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,48 @@ - -### build and sign release - app_name=notes project_dir=$(CURDIR)/../$(app_name) build_dir=$(CURDIR)/build/artifacts -sign_dir=$(build_dir)/sign -appstore_dir=$(build_dir)/appstore -package_name=$(app_name) cert_dir=$(HOME)/.nextcloud/certificates -appstore: clean lint build-js-production - mkdir -p $(sign_dir) + +all: dev-setup build + + +##### Environment #### + +dev-setup: clean clean-dev init + +init: composer-init npm-init + +composer-init: + composer install + +npm-init: + npm install + +npm-upgrade: + npm-upgrade + npm install + +npm-update: + npm update + + + +##### Building ##### + +appstore: lint build + @echo "Signing…" + php ../server/occ integrity:sign-app \ + --privateKey=$(cert_dir)/$(app_name).key\ + --certificate=$(cert_dir)/$(app_name).crt\ + --path=$(build_dir)/$(app_name) + tar -czf $(build_dir)/$(app_name).tar.gz \ + -C $(build_dir) $(app_name) + openssl dgst -sha512 -sign $(cert_dir)/$(app_name).key $(build_dir)/$(app_name).tar.gz | openssl base64 + + +build: clean build-js-production + mkdir -p $(build_dir) rsync -a \ --exclude=.babelrc.js \ --exclude=build \ @@ -35,40 +67,8 @@ appstore: clean lint build-js-production --exclude=.tx \ --exclude=vendor \ --exclude=webpack*.js \ - $(project_dir) $(sign_dir) - @echo "Signing…" - php ../server/occ integrity:sign-app \ - --privateKey=$(cert_dir)/$(app_name).key\ - --certificate=$(cert_dir)/$(app_name).crt\ - --path=$(sign_dir)/$(app_name) - tar -czf $(build_dir)/$(app_name).tar.gz \ - -C $(sign_dir) $(app_name) - openssl dgst -sha512 -sign $(cert_dir)/$(app_name).key $(build_dir)/$(app_name).tar.gz | openssl base64 + $(project_dir) $(build_dir) - -### from vueexample - -all: dev-setup build-js-production - -# Dev env management -dev-setup: clean clean-dev init - -init: composer-init npm-init - -composer-init: - composer install - -npm-init: - npm install - -npm-upgrade: - npm-upgrade - npm install - -npm-update: - npm update - -# Building build-js: npm run dev @@ -78,14 +78,18 @@ build-js-production: watch-js: npm run watch -# Testing + +##### Testing ##### + test: test-api test-api: phpunit --bootstrap vendor/autoload.php --testdox tests/api/ -# Linting + +##### Linting ##### + lint: lint-php lint-js lint-css lint-xml @@ -125,7 +129,9 @@ lint-xml: xmllint appinfo/info.xml --schema appinfo/info.xsd --noout -# Fix lint + +##### Fix lint ##### + lint-fix: lint-php-fix lint-js-fix lint-css-fix lint-php-fix: @@ -138,7 +144,10 @@ lint-js-fix: lint-css-fix: npm run stylelint:fix -# Cleaning + + +##### Cleaning ##### + clean: rm -rf js/ rm -rf $(build_dir)