generated from eea/volto-frontend-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
113 lines (88 loc) · 4.34 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
### Defensive settings for make:
# https://tech.davis-hansson.com/p/make/
SHELL:=bash
.ONESHELL:
.SHELLFLAGS:=-eu -o pipefail -c
.SILENT:
.DELETE_ON_ERROR:
MAKEFLAGS+=--warn-undefined-variables
MAKEFLAGS+=--no-builtin-rules
# Update the versions depending on your project requirements | Last Updated 2023-03-02
DOCKER_IMAGE=plone/server-dev:6.0.2
DOCKER_IMAGE_ACCEPTANCE=plone/server-acceptance:6.0.2
KGS=
TESTING_ADDONS=plone.app.robotframework==2.0.0 plone.app.testing==7.0.0
NODEBIN = ./node_modules/.bin
# Plone 5 legacy
DOCKER_IMAGE5=plone/plone-backend:5.2.9
KGS5=plone.restapi==8.32.6 plone.volto==4.0.0 plone.rest==2.0.0
# Project settings
DIR=$(shell basename $$(pwd))
# Recipe snippets for reuse
# We like colors
# From: https://coderwall.com/p/izxssa/colored-makefile-for-golang-projects
RED=`tput setaf 1`
GREEN=`tput setaf 2`
RESET=`tput sgr0`
YELLOW=`tput setaf 3`
# Top-level targets
.PHONY: all
all: project
.PHONY: help
help: ## Show this help.
@echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)"
.PHONY: start-backend-docker
start-backend-docker: ## Starts a Docker-based backend
@echo "$(GREEN)==> Start Docker-based Plone Backend$(RESET)"
docker run -it --rm --name=backend -p 8080:8080 -e SITE=Plone -e ADDONS='$(KGS)' $(DOCKER_IMAGE)
.PHONY: install
install: ## Install the frontend
@echo "Install frontend"
$(MAKE) omelette
$(MAKE) preinstall
yarn install
.PHONY: build
build: ## Build frontend
NODE_OPTIONS="--max-old-space-size=8192" yarn build
.PHONY: preinstall
preinstall: ## Preinstall task, checks if missdev (mrs-developer) is present and runs it
if [ -f $$(pwd)/mrs.developer.json ]; then make develop; fi
.PHONY: develop
develop: ## Runs missdev in the local project (mrs.developer.json should be present)
npx -p mrs-developer missdev --config=jsconfig.json --output=addons --fetch-https
.PHONY: bundlewatch
bundlewatch:
yarn bundlewatch --config .bundlewatch.config.json
.PHONY: omelette
omelette: ## Creates the omelette folder that contains a link to the installed version of Volto (a softlink pointing to node_modules/@plone/volto)
if [ ! -d omelette ]; then ln -sf node_modules/@plone/volto omelette; fi
.PHONY: patches
patches:
/bin/bash patches/patchit.sh > /dev/null 2>&1 ||true
.PHONY: start-test-acceptance-server start-test-backend
start-test-acceptance-server start-test-backend : ## Start Test Plone Backend
@echo "$(GREEN)==> Start Test Plone Backend$(RESET)"
docker run -i --rm -p 55001:55001 $(DOCKER_IMAGE_ACCEPTANCE)
## KGS in case you need a Plone 5.2 series (comment/remove above line):
# docker run -i --rm -e ZSERVER_HOST=0.0.0.0 -e ZSERVER_PORT=55001 -p 55001:55001 -e ADDONS='$(KGS5) $(TESTING_ADDONS)' -e APPLY_PROFILES=plone.app.contenttypes:plone-content,plone.restapi:default,plone.volto:default-homepage -e CONFIGURE_PACKAGES=plone.app.contenttypes,plone.restapi,plone.volto,plone.volto.cors $(DOCKER_IMAGE5) ./bin/robot-server plone.app.robotframework.testing.VOLTO_ROBOT_TESTING
.PHONY: start-test-acceptance-frontend
start-test-acceptance-frontend: ## Start the Acceptance Frontend Fixture
RAZZLE_API_PATH=http://localhost:55001/plone yarn build && yarn start:prod
.PHONY: test-acceptance
test-acceptance: ## Start Core Cypress Acceptance Tests
$(NODEBIN)/cypress open
.PHONY: test-acceptance-headless
test-acceptance-headless: ## Start Core Cypress Acceptance Tests in headless mode
$(NODEBIN)/cypress run
.PHONY: full-test-acceptance
full-test-acceptance: ## Runs Core Full Acceptance Testing in headless mode
$(NODEBIN)/start-test "make start-test-acceptance-server" http-get://localhost:55001/plone "make start-test-acceptance-frontend" http://localhost:3000 "make test-acceptance-headless"
.PHONY: test-acceptance
test-acceptance-addon: ## Start Core Cypress Acceptance Tests for an addon
$(NODEBIN)/cypress open -P $(ADDONPATH)
.PHONY: test-acceptance-headless
test-acceptance-addon-headless: ## Start Core Cypress Acceptance Tests for an addon in headless mode
$(NODEBIN)/cypress run -P $(ADDONPATH)
.PHONY: full-test-acceptance-addon
full-test-acceptance-addon: ## Runs Core Full Acceptance Testing for an addon in headless mode
$(NODEBIN)/start-test "make start-test-acceptance-server" http-get://localhost:55001/plone "make start-test-acceptance-frontend" http://localhost:3000 "make test-acceptance-addon-headless"