-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
103 lines (81 loc) · 3.3 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
### 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
CURRENT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
# 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`
PLONE_VERSION=6
DOCKER_IMAGE=plone/server-dev:${PLONE_VERSION}
DOCKER_IMAGE_ACCEPTANCE=plone/server-acceptance:${PLONE_VERSION}
ADDON_NAME='@plonegovbr/volto-vlibras'
.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 :)"
# Dev Helpers
.PHONY: install
install: ## Install task, checks if missdev (mrs-developer) is present and runs it
pnpm dlx mrs-developer missdev --no-config --fetch-https
pnpm i
.PHONY: i18n
i18n: ## Sync i18n
pnpm --filter $(ADDON_NAME) i18n
.PHONY: format
format: ## Format codebase
pnpm lint:fix
pnpm prettier:fix
pnpm stylelint:fix
.PHONY: lint
lint: ## Lint Codebase
pnpm lint
pnpm prettier
pnpm stylelint
.PHONY: test
test: ## Run unit tests
pnpm test
.PHONY: test-ci
test-ci: ## Run unit tests in CI
CI=1 RAZZLE_JEST_CONFIG=$(CURRENT_DIR)/jest-addon.config.js pnpm --filter @plone/volto test -- --passWithNoTests
.PHONY: start-backend-docker
start-backend-docker: ## Starts a Docker-based backend for developing
@echo "$(GREEN)==> Start Docker-based Plone Backend$(RESET)"
docker run -it --rm --name=backend -p 8080:8080 -e SITE=Plone $(DOCKER_IMAGE)
## Storybook
.PHONY: storybook-start
storybook-start: ## Storybook: Start server on port 6006
@echo "$(GREEN)==> Start Storybook$(RESET)"
pnpm run storybook
.PHONY: storybook-build
storybook-build: ## Storybook: Build
@echo "$(GREEN)==> Build Storybook$(RESET)"
mkdir -p $(CURRENT_DIR)/.storybook-build
pnpm run build-storybook -o $(CURRENT_DIR)/.storybook-build
## Acceptance
.PHONY: start-test-acceptance-frontend-dev
start-test-acceptance-frontend-dev: ## Start acceptance frontend in dev mode
CI=true RAZZLE_API_PATH=http://127.0.0.1:55001/plone pnpm start
.PHONY: start-test-acceptance-frontend
start-test-acceptance-frontend: ## Start acceptance frontend in prod mode
CI=true RAZZLE_API_PATH=http://127.0.0.1:55001/plone pnpm build && pnpm start:prod
.PHONY: start-test-acceptance-server
start-test-acceptance-server: ## Start acceptance server
docker run -it --rm -p 55001:55001 $(DOCKER_IMAGE_ACCEPTANCE)
.PHONY: start-test-acceptance-server-ci
start-test-acceptance-server-ci: ## Start acceptance server in CI mode (no terminal attached)
docker run -i --rm -p 55001:55001 $(DOCKER_IMAGE_ACCEPTANCE)
.PHONY: test-acceptance
test-acceptance: ## Start Cypress in interactive mode
pnpm --filter @plone/volto exec cypress open --config-file $(CURRENT_DIR)/cypress.config.js --config specPattern=$(CURRENT_DIR)'/cypress/tests/**/*.{js,jsx,ts,tsx}'
.PHONY: test-acceptance-headless
test-acceptance-headless: ## Run cypress tests in headless mode for CI
pnpm --filter @plone/volto exec cypress run --config-file $(CURRENT_DIR)/cypress.config.js --config specPattern=$(CURRENT_DIR)'/cypress/tests/**/*.{js,jsx,ts,tsx}'