Skip to content

Commit

Permalink
Rename Makefile targets following cookiecutter-volto#14
Browse files Browse the repository at this point in the history
  • Loading branch information
sneridagh committed May 14, 2024
1 parent 8ec6a44 commit b313723
Showing 1 changed file with 36 additions and 20 deletions.
56 changes: 36 additions & 20 deletions frontend_addon/{{ cookiecutter.__folder_name }}/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,24 @@ DOCKER_IMAGE_ACCEPTANCE=plone/server-acceptance:${PLONE_VERSION}
ADDON_NAME='{{ cookiecutter.npm_package_name }}'

.PHONY: help
help: ## Show this 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
install: ## Installs the add-on in a development environment
pnpm dlx mrs-developer missdev --no-config --fetch-https
pnpm i

.PHONY: start
start: ## Starts Volto, allowing reloading of the add-on during development
pnpm start

.PHONY: build
build: ## Build a production bundle for distribution of the project with the add-on
pnpm build

.PHONY: i18n
i18n: ## Sync i18n
pnpm --filter $(ADDON_NAME) i18n
Expand All @@ -47,57 +55,65 @@ format: ## Format codebase
pnpm stylelint:fix

.PHONY: lint
lint: ## Lint Codebase
lint: ## Lint, or catch and remove problems, in code base
pnpm lint
pnpm prettier
pnpm stylelint

.PHONY: release
release: ## Release the add-on on npmjs.org
pnpm release

.PHONY: release-dry-run
release-dry-run: ## Dry-run the release of the add-on on npmjs.org
pnpm release

.PHONY: test
test: ## Run unit tests
pnpm test

.PHONY: test-ci
test-ci: ## Run unit tests in CI
ci-test: ## 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
.PHONY: backend-docker-start
backend-docker-start: ## Starts a Docker-based backend for development
@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
storybook-start: ## Start Storybook server on port 6006
@echo "$(GREEN)==> Start Storybook$(RESET)"
pnpm run storybook

.PHONY: storybook-build
storybook-build: ## Storybook: Build
storybook-build: ## Build Storybook
@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
.PHONY: acceptance-frontend-dev-start
acceptance-frontend-dev-start: ## Start acceptance frontend in development mode
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
.PHONY: acceptance-frontend-prod-start
acceptance-frontend-prod-start: ## Start acceptance frontend in production mode
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
.PHONY: acceptance-backend-start
acceptance-backend-start: ## Start backend 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)
.PHONY: ci-acceptance-backend-start
ci-acceptance-backend-start: ## Start acceptance server in CI (no terminal attached)
docker run -i --rm -p 55001:55001 $(DOCKER_IMAGE_ACCEPTANCE)

.PHONY: test-acceptance
test-acceptance: ## Start Cypress in interactive mode
.PHONY: acceptance-test
acceptance-test: ## 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
.PHONY: acceptance-headless-test
acceptance-headless-test: ## 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}'

0 comments on commit b313723

Please sign in to comment.