From c4f5f7300671ee13331c803593b0741f53d21c22 Mon Sep 17 00:00:00 2001 From: valentinab25 Date: Mon, 31 Jul 2023 07:37:04 +0300 Subject: [PATCH 01/10] docs: Cleanup Makefile, update DEVELOP documentation, i18n - refs #254894 --- .i18n.babel.config.js | 1 - DEVELOP.md | 56 ++++++++++++ Dockerfile | 14 +++ Jenkinsfile | 25 +++++ Makefile | 157 ++++++++++++++++++++++++-------- README.md | 13 +++ docker-compose.yml | 28 ++++++ locales/de/LC_MESSAGES/volto.po | 14 +++ locales/it/LC_MESSAGES/volto.po | 14 +++ locales/ro/LC_MESSAGES/volto.po | 14 +++ locales/volto.pot | 16 ++++ 11 files changed, 311 insertions(+), 41 deletions(-) delete mode 100644 .i18n.babel.config.js create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 locales/de/LC_MESSAGES/volto.po create mode 100644 locales/it/LC_MESSAGES/volto.po create mode 100644 locales/ro/LC_MESSAGES/volto.po diff --git a/.i18n.babel.config.js b/.i18n.babel.config.js deleted file mode 100644 index a900a75..0000000 --- a/.i18n.babel.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('@plone/volto/babel'); diff --git a/DEVELOP.md b/DEVELOP.md index 7343f4f..864b312 100644 --- a/DEVELOP.md +++ b/DEVELOP.md @@ -2,6 +2,28 @@ ## Develop +1. Make sure you have `docker` and `docker compose` installed and running on your machine: + + ```Bash + git clone https://github.com/eea/volto-slate-label.git + cd volto-slate-label + git checkout -b bugfix-123456 develop + make + make start + ``` + +1. Wait for `Volto started at 0.0.0.0:3000` meesage + +1. Go to http://localhost:3000 + +1. Happy hacking! + + ```Bash + cd src/addons/volto-slate-label/ + ``` + +### Or add @eeacms/volto-slate-label to your Volto project + Before starting make sure your development environment is properly set. See [Volto Developer Documentation](https://docs.voltocms.com/getting-started/install/) 1. Make sure you have installed `yo`, `@plone/generator-volto` and `mrs-developer` @@ -50,3 +72,37 @@ Before starting make sure your development environment is properly set. See [Vol cd src/addons/volto-slate-label/ o-addon-template/ + +## Cypress + +To run cypress locally, first make sure you don't have any Volto/Plone running on ports `8080` and `3000`. + +You don't have to be in a `clean-volto-project`, you can be in any Volto Frontend +project where you added `volto-slate-label` to `mrs.developer.json` + +Go to: + + ```BASH + cd src/addons/volto-slate-label/ + ``` + +Start: + + ```Bash + make + make start + ``` + +This will build and start with Docker a clean `Plone backend` and `Volto Frontend` with `volto-slate-label` block installed. + +Open Cypress Interface: + + ```Bash + make cypress-open + ``` + +Or run it: + + ```Bash + make cypress-run + ``` diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bd8e10d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +# syntax=docker/dockerfile:1 +ARG VOLTO_VERSION +FROM plone/frontend-builder:${VOLTO_VERSION} + +ARG ADDON_NAME +ARG ADDON_PATH + +COPY --chown=node:node ./ /app/src/addons/${ADDON_PATH}/ + +RUN /setupAddon +RUN yarn install + +ENTRYPOINT ["yarn"] +CMD ["start"] diff --git a/Jenkinsfile b/Jenkinsfile index 52d2c16..5bd3b50 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -197,6 +197,31 @@ pipeline { } } + stage('SonarQube compare to master') { + when { + allOf { + environment name: 'CHANGE_ID', value: '' + branch 'develop' + not { changelog '.*^Automated release [0-9\\.]+$' } + } + } + steps { + node(label: 'docker') { + script { + sh '''docker pull eeacms/gitflow''' + sh '''echo "Error" > checkresult.txt''' + catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { + sh '''set -o pipefail; docker run -i --rm --name="$BUILD_TAG-gitflow-sn" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_NAME="$GIT_NAME" eeacms/gitflow /checkSonarqubemaster.sh | grep -v "Found script" | tee checkresult.txt''' + } + + publishChecks name: 'SonarQube', title: 'Sonarqube Code Quality Check', summary: "Quality check on the SonarQube metrics from branch develop, comparing it with the ones from master branch. No bugs are allowed", + text: readFile(file: 'checkresult.txt'), conclusion: "${currentBuild.currentResult}", + detailsURL: "${env.BUILD_URL}display/redirect" + } + } + } + } + stage('Pull Request') { when { not { diff --git a/Makefile b/Makefile index 576a7c8..13481d3 100644 --- a/Makefile +++ b/Makefile @@ -1,49 +1,126 @@ -SHELL=/bin/bash +############################################################################## +# Run: +# make +# make start +# +# Go to: +# +# http://localhost:3000 +# +# Cypress: +# +# make cypress-open +# +############################################################################## +# SETUP MAKE +# +## Defensive settings for make: https://tech.davis-hansson.com/p/make/ +SHELL:=bash +.ONESHELL: +# for Makefile debugging purposes add -x to the .SHELLFLAGS +.SHELLFLAGS:=-eu -o pipefail -O inherit_errexit -c +.SILENT: +.DELETE_ON_ERROR: +MAKEFLAGS+=--warn-undefined-variables +MAKEFLAGS+=--no-builtin-rules +# Colors +# OK=Green, warn=yellow, error=red +ifeq ($(TERM),) +# no colors if not in terminal + MARK_COLOR= + OK_COLOR= + WARN_COLOR= + ERROR_COLOR= + NO_COLOR= +else + MARK_COLOR=`tput setaf 6` + OK_COLOR=`tput setaf 2` + WARN_COLOR=`tput setaf 3` + ERROR_COLOR=`tput setaf 1` + NO_COLOR=`tput sgr0` +endif + +############################################################################## +# SETTINGS AND VARIABLE DIR=$(shell basename $$(pwd)) -ADDON ?= "@eeacms/volto-slate-label" - -# 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` - -project: - npm install -g yo - npm install -g @plone/generator-volto - npm install -g mrs-developer - yo @plone/volto project --addon ${ADDON} --workspace "src/addons/${DIR}" --no-interactive - ln -sf $$(pwd) project/src/addons/ - cp .project.eslintrc.js .eslintrc.js - cd project && yarn - @echo "-------------------" - @echo "$(GREEN)Volto project is ready!$(RESET)" - @echo "$(RED)Now run: cd project && yarn start$(RESET)" - -all: project - -.PHONY: start-test-backend -start-test-backend: ## Start Test Plone Backend - @echo "$(GREEN)==> Start Test Plone Backend$(RESET)" - docker run -i --rm -e ZSERVER_HOST=0.0.0.0 -e ZSERVER_PORT=55001 -p 55001:55001 -e SITE=plone -e APPLY_PROFILES=plone.app.contenttypes:plone-content,plone.restapi:default,kitconcept.volto:default-homepage -e CONFIGURE_PACKAGES=plone.app.contenttypes,plone.restapi,kitconcept.volto,kitconcept.volto.cors -e ADDONS='plone.app.robotframework plone.app.contenttypes plone.restapi kitconcept.volto' plone ./bin/robot-server plone.app.robotframework.testing.PLONE_ROBOT_TESTING - -.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=plone -p 8080:8080 -e SITE=Plone -e ADDONS="kitconcept.volto" -e ZCML="kitconcept.volto.cors" plone +NODE_MODULES?="../../../node_modules" +PLONE_VERSION?=6 +VOLTO_VERSION?=16 +ADDON_PATH="${DIR}" +ADDON_NAME="@eeacms/${ADDON_PATH}" +DOCKER_COMPOSE=PLONE_VERSION=${PLONE_VERSION} VOLTO_VERSION=${VOLTO_VERSION} ADDON_NAME=${ADDON_NAME} ADDON_PATH=${ADDON_PATH} docker compose + +# Top-level targets +.PHONY: all +all: clean install + +.PHONY: clean +clean: ## Cleanup development environment + ${DOCKER_COMPOSE} down --volumes --remove-orphans + +.PHONY: install +install: ## Build and install development environment + echo "Running: ${DOCKER_COMPOSE} build" + ${DOCKER_COMPOSE} pull + ${DOCKER_COMPOSE} build + +.PHONY: start +start: ## Start development environment + echo "Running: ${DOCKER_COMPOSE} up" + ${DOCKER_COMPOSE} up + +.PHONY: cypress-open +cypress-open: ## Open cypress integration tests + NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress open + +.PHONY: cypress-run +cypress-run: ## Run cypress integration tests + NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run .PHONY: test -test: - docker pull plone/volto-addon-ci:alpha - docker run -it --rm -e NAMESPACE="@eeacms" -e GIT_NAME="${DIR}" -e RAZZLE_JEST_CONFIG=jest-addon.config.js -v "$$(pwd):/opt/frontend/my-volto-project/src/addons/${DIR}" -e CI="true" plone/volto-addon-ci:alpha +test: ## Run jest tests + ${DOCKER_COMPOSE} run -e CI=1 frontend test .PHONY: test-update -test-update: - docker pull plone/volto-addon-ci:alpha - docker run -it --rm -e NAMESPACE="@eeacms" -e GIT_NAME="${DIR}" -e RAZZLE_JEST_CONFIG=jest-addon.config.js -v "$$(pwd):/opt/frontend/my-volto-project/src/addons/${DIR}" -e CI="true" plone/volto-addon-ci:alpha yarn test src/addons/${DIR}/src --watchAll=false -u +test-update: ## Update jest tests snapshots + ${DOCKER_COMPOSE} run -e CI=1 frontend test -u + +.PHONY: stylelint +stylelint: ## Stylelint + $(NODE_MODULES)/stylelint/bin/stylelint.js --allow-empty-input 'src/**/*.{css,less}' + +.PHONY: stylelint-overrides +stylelint-overrides: + $(NODE_MODULES)/.bin/stylelint --syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides' + +.PHONY: stylelint-fix +stylelint-fix: ## Fix stylelint + $(NODE_MODULES)/stylelint/bin/stylelint.js --allow-empty-input 'src/**/*.{css,less}' --fix + $(NODE_MODULES)/.bin/stylelint --syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides' --fix + +.PHONY: prettier +prettier: ## Prettier + $(NODE_MODULES)/.bin/prettier --single-quote --check 'src/**/*.{js,jsx,json,css,less,md}' + +.PHONY: prettier-fix +prettier-fix: ## Fix prettier + $(NODE_MODULES)/.bin/prettier --single-quote --write 'src/**/*.{js,jsx,json,css,less,md}' + +.PHONY: lint +lint: ## ES Lint + $(NODE_MODULES)/eslint/bin/eslint.js --max-warnings=0 'src/**/*.{js,jsx}' + +.PHONY: lint-fix +lint-fix: ## Fix ES Lint + $(NODE_MODULES)/eslint/bin/eslint.js --fix 'src/**/*.{js,jsx}' + +.PHONY: i18n +i18n: ## i18n + rm -rf build/messages + NODE_ENV=development $(NODE_MODULES)/.bin/i18n --addon .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 :)" + head -n 14 Makefile diff --git a/README.md b/README.md index b2ede42..c1ae824 100644 --- a/README.md +++ b/README.md @@ -29,10 +29,23 @@ This version requires: `@plone/volto >= 16.0.0.alpha.15` (`volto-slate` part of ## Getting started +### Try volto-slate-label with Docker + + git clone https://github.com/eea/volto-slate-label.git + cd volto-slate-label + make + make start + +Go to http://localhost:3000 + ### Add volto-slate-label to your Volto project 1. Make sure you have a [Plone backend](https://plone.org/download) up-and-running at http://localhost:8080/Plone + ```Bash + docker compose up backend + ``` + 1. Start Volto frontend * If you already have a volto project, just update `package.json`: diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c6f4862 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,28 @@ +version: "3" +services: + backend: + image: plone/plone-backend:${PLONE_VERSION:-6} + ports: + - "8080:8080" + environment: + SITE: "Plone" + + frontend: + build: + context: ./ + dockerfile: ./Dockerfile + args: + ADDON_NAME: "${ADDON_NAME}" + ADDON_PATH: "${ADDON_PATH}" + VOLTO_VERSION: ${VOLTO_VERSION:-16} + ports: + - "3000:3000" + - "3001:3001" + depends_on: + - backend + volumes: + - ./:/app/src/addons/${ADDON_PATH} + environment: + RAZZLE_INTERNAL_API_PATH: "http://backend:8080/Plone" + RAZZLE_DEV_PROXY_API_PATH: "http://backend:8080/Plone" + HOST: "0.0.0.0" diff --git a/locales/de/LC_MESSAGES/volto.po b/locales/de/LC_MESSAGES/volto.po new file mode 100644 index 0000000..12b9a47 --- /dev/null +++ b/locales/de/LC_MESSAGES/volto.po @@ -0,0 +1,14 @@ +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: \n" +"PO-Revision-Date: \n" +"Last-Translator: \n" +"Language: \n" +"Language-Team: \n" +"Content-Type: \n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + + diff --git a/locales/it/LC_MESSAGES/volto.po b/locales/it/LC_MESSAGES/volto.po new file mode 100644 index 0000000..12b9a47 --- /dev/null +++ b/locales/it/LC_MESSAGES/volto.po @@ -0,0 +1,14 @@ +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: \n" +"PO-Revision-Date: \n" +"Last-Translator: \n" +"Language: \n" +"Language-Team: \n" +"Content-Type: \n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + + diff --git a/locales/ro/LC_MESSAGES/volto.po b/locales/ro/LC_MESSAGES/volto.po new file mode 100644 index 0000000..12b9a47 --- /dev/null +++ b/locales/ro/LC_MESSAGES/volto.po @@ -0,0 +1,14 @@ +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: \n" +"PO-Revision-Date: \n" +"Last-Translator: \n" +"Language: \n" +"Language-Team: \n" +"Content-Type: \n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + + diff --git a/locales/volto.pot b/locales/volto.pot index e69de29..93c2825 100644 --- a/locales/volto.pot +++ b/locales/volto.pot @@ -0,0 +1,16 @@ +msgid "" +msgstr "" +"Project-Id-Version: Plone\n" +"POT-Creation-Date: 2023-06-28T10:48:22.678Z\n" +"Last-Translator: Plone i18n \n" +"Language-Team: Plone i18n \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"Language-Code: en\n" +"Language-Name: English\n" +"Preferred-Encodings: utf-8\n" +"Domain: volto\n" + + From c85d929a5637eb15bca13b4761b5ac08d8d29d79 Mon Sep 17 00:00:00 2001 From: EEA Jenkins Date: Thu, 17 Aug 2023 17:00:54 +0300 Subject: [PATCH 02/10] Add Sonarqube tag using freshwater-frontend addons list --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5bd3b50..3726ddb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,7 +4,7 @@ pipeline { environment { GIT_NAME = "volto-slate-label" NAMESPACE = "@eeacms" - SONARQUBE_TAGS = "volto.eea.europa.eu,demo-www.eea.europa.eu,forest.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,water.europa.eu-marine,biodiversity.europa.eu,climate-adapt.eea.europa.eu,climate-energy.eea.europa.eu,climate-advisory-board.devel4cph.eea.europa.eu,climate-advisory-board.europa.eu,www.eea.europa.eu-ims,www.eea.europa.eu-en,industry.eea.europa.eu" + SONARQUBE_TAGS = "volto.eea.europa.eu,demo-www.eea.europa.eu,forest.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,water.europa.eu-marine,biodiversity.europa.eu,climate-adapt.eea.europa.eu,climate-energy.eea.europa.eu,climate-advisory-board.devel4cph.eea.europa.eu,climate-advisory-board.europa.eu,www.eea.europa.eu-ims,www.eea.europa.eu-en,industry.eea.europa.eu,water.europa.eu-freshwater" DEPENDENCIES = "" VOLTO = "" } From e9b984b42d3428ab737c02ffd480d2f6de393652 Mon Sep 17 00:00:00 2001 From: valentinab25 Date: Wed, 23 Aug 2023 00:14:41 +0300 Subject: [PATCH 03/10] test: Update Makefile and docker-compose to align it with Jenkinsfile --- Makefile | 5 +++++ docker-compose.yml | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 13481d3..4a5cbed 100644 --- a/Makefile +++ b/Makefile @@ -70,6 +70,11 @@ start: ## Start development environment echo "Running: ${DOCKER_COMPOSE} up" ${DOCKER_COMPOSE} up +.PHONY: shell +shell: ## Start a shell in the frontend container + echo "Running: ${DOCKER_COMPOSE} run frontend bash" + ${DOCKER_COMPOSE} run --entrypoint=bash frontend + .PHONY: cypress-open cypress-open: ## Open cypress integration tests NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress open diff --git a/docker-compose.yml b/docker-compose.yml index c6f4862..5d79f5c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,11 +1,12 @@ version: "3" services: backend: - image: plone/plone-backend:${PLONE_VERSION:-6} + image: eeacms/plone-backend ports: - "8080:8080" environment: SITE: "Plone" + PROFILES: "eea.kitkat:testing" frontend: build: @@ -23,6 +24,9 @@ services: volumes: - ./:/app/src/addons/${ADDON_PATH} environment: + CI: "true" + NODE_ENV: "development" + RAZZLE_JEST_CONFIG: "src/addons/${ADDON_PATH}/jest-addon.config.js" RAZZLE_INTERNAL_API_PATH: "http://backend:8080/Plone" RAZZLE_DEV_PROXY_API_PATH: "http://backend:8080/Plone" HOST: "0.0.0.0" From 12ef506c27d8810836968f137d9e6a1711fdf64e Mon Sep 17 00:00:00 2001 From: Alin Voinea Date: Tue, 29 Aug 2023 20:14:51 +0300 Subject: [PATCH 04/10] i18n: Add en --- locales/de/LC_MESSAGES/volto.po | 8 ++++++++ locales/en/LC_MESSAGES/volto.po | 22 ++++++++++++++++++++++ locales/it/LC_MESSAGES/volto.po | 8 ++++++++ locales/ro/LC_MESSAGES/volto.po | 8 ++++++++ locales/volto.pot | 10 +++++++++- 5 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 locales/en/LC_MESSAGES/volto.po diff --git a/locales/de/LC_MESSAGES/volto.po b/locales/de/LC_MESSAGES/volto.po index 12b9a47..1d653e9 100644 --- a/locales/de/LC_MESSAGES/volto.po +++ b/locales/de/LC_MESSAGES/volto.po @@ -11,4 +11,12 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#: editor/index +# defaultMessage: Edit label +msgid "Edit label" +msgstr "" +#: editor/index +# defaultMessage: Remove label +msgid "Remove label" +msgstr "" diff --git a/locales/en/LC_MESSAGES/volto.po b/locales/en/LC_MESSAGES/volto.po new file mode 100644 index 0000000..1d653e9 --- /dev/null +++ b/locales/en/LC_MESSAGES/volto.po @@ -0,0 +1,22 @@ +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: \n" +"PO-Revision-Date: \n" +"Last-Translator: \n" +"Language: \n" +"Language-Team: \n" +"Content-Type: \n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#: editor/index +# defaultMessage: Edit label +msgid "Edit label" +msgstr "" + +#: editor/index +# defaultMessage: Remove label +msgid "Remove label" +msgstr "" diff --git a/locales/it/LC_MESSAGES/volto.po b/locales/it/LC_MESSAGES/volto.po index 12b9a47..1d653e9 100644 --- a/locales/it/LC_MESSAGES/volto.po +++ b/locales/it/LC_MESSAGES/volto.po @@ -11,4 +11,12 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#: editor/index +# defaultMessage: Edit label +msgid "Edit label" +msgstr "" +#: editor/index +# defaultMessage: Remove label +msgid "Remove label" +msgstr "" diff --git a/locales/ro/LC_MESSAGES/volto.po b/locales/ro/LC_MESSAGES/volto.po index 12b9a47..1d653e9 100644 --- a/locales/ro/LC_MESSAGES/volto.po +++ b/locales/ro/LC_MESSAGES/volto.po @@ -11,4 +11,12 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#: editor/index +# defaultMessage: Edit label +msgid "Edit label" +msgstr "" +#: editor/index +# defaultMessage: Remove label +msgid "Remove label" +msgstr "" diff --git a/locales/volto.pot b/locales/volto.pot index 93c2825..de5fe22 100644 --- a/locales/volto.pot +++ b/locales/volto.pot @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: Plone\n" -"POT-Creation-Date: 2023-06-28T10:48:22.678Z\n" +"POT-Creation-Date: 2023-08-29T17:14:51.219Z\n" "Last-Translator: Plone i18n \n" "Language-Team: Plone i18n \n" "MIME-Version: 1.0\n" @@ -13,4 +13,12 @@ msgstr "" "Preferred-Encodings: utf-8\n" "Domain: volto\n" +#: editor/index +# defaultMessage: Edit label +msgid "Edit label" +msgstr "" +#: editor/index +# defaultMessage: Remove label +msgid "Remove label" +msgstr "" From 872eaf9e16be65890e1ba942935c0a7a47ac2aca Mon Sep 17 00:00:00 2001 From: Alin Voinea Date: Tue, 29 Aug 2023 21:15:40 +0300 Subject: [PATCH 05/10] test: Fix package.json scripts to use makefile --- package.json | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 786b290..cbea861 100644 --- a/package.json +++ b/package.json @@ -25,19 +25,21 @@ }, "scripts": { "release": "release-it", + "release-major-beta": "release-it major --preRelease=beta", + "release-beta": "release-it --preRelease=beta", "bootstrap": "npm install -g ejs; npm link ejs; node bootstrap", "test": "make test", "test:fix": "make test-update", "pre-commit": "yarn stylelint:fix && yarn prettier:fix && yarn lint:fix", - "stylelint": "../../../node_modules/stylelint/bin/stylelint.js --allow-empty-input 'src/**/*.{css,less}'", - "stylelint:overrides": "../../../node_modules/.bin/stylelint --syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides'", - "stylelint:fix": "yarn stylelint --fix && yarn stylelint:overrides --fix", - "prettier": "../../../node_modules/.bin/prettier --single-quote --check 'src/**/*.{js,jsx,json,css,less,md}'", - "prettier:fix": "../../../node_modules/.bin/prettier --single-quote --write 'src/**/*.{js,jsx,json,css,less,md}'", - "lint": "../../../node_modules/eslint/bin/eslint.js --max-warnings=0 'src/**/*.{js,jsx}'", - "lint:fix": "../../../node_modules/eslint/bin/eslint.js --fix 'src/**/*.{js,jsx}'", - "i18n": "rm -rf build/messages && NODE_ENV=production i18n --addon", - "cypress:run": "NODE_ENV=development ../../../node_modules/cypress/bin/cypress run", - "cypress:open": "NODE_ENV=development ../../../node_modules/cypress/bin/cypress open" + "stylelint": "make stylelint", + "stylelint:overrides": "make stylelint-overrides", + "stylelint:fix": "make stylelint-fix", + "prettier": "make prettier", + "prettier:fix": "make prettier-fix", + "lint": "make lint", + "lint:fix": "make lint-fix", + "i18n": "make i18n", + "cypress:run": "make cypress-run", + "cypress:open": "make cypress-open" } } From 778f07dc3b0713a094a89fc04e4a943cad9de4f8 Mon Sep 17 00:00:00 2001 From: valentinab25 Date: Wed, 6 Sep 2023 01:14:13 +0300 Subject: [PATCH 06/10] test: EN locales, pre-commit fix, feature PRs checks Refs #257193 --- .husky/pre-commit | 2 ++ Jenkinsfile | 66 ++++++++++++++++++++++++++++++++--------------- cypress.config.js | 4 +-- package.json | 28 ++++++++++++++++++-- 4 files changed, 75 insertions(+), 25 deletions(-) create mode 100755 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..9183f9d --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,2 @@ +[ -n "$CI" ] && exit 0 +yarn lint-staged diff --git a/Jenkinsfile b/Jenkinsfile index 3726ddb..38a6039 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -62,11 +62,17 @@ pipeline { stage('Tests') { when { - allOf { - environment name: 'CHANGE_ID', value: '' - anyOf { - not { changelog '.*^Automated release [0-9\\.]+$' } - branch 'master' + anyOf { + allOf { + not { environment name: 'CHANGE_ID', value: '' } + environment name: 'CHANGE_TARGET', value: 'develop' + } + allOf { + environment name: 'CHANGE_ID', value: '' + anyOf { + not { changelog '.*^Automated release [0-9\\.]+$' } + branch 'master' + } } } } @@ -110,11 +116,17 @@ pipeline { stage('Integration tests') { when { - allOf { - environment name: 'CHANGE_ID', value: '' - anyOf { - not { changelog '.*^Automated release [0-9\\.]+$' } - branch 'master' + anyOf { + allOf { + not { environment name: 'CHANGE_ID', value: '' } + environment name: 'CHANGE_TARGET', value: 'develop' + } + allOf { + environment name: 'CHANGE_ID', value: '' + anyOf { + not { changelog '.*^Automated release [0-9\\.]+$' } + branch 'master' + } } } } @@ -167,13 +179,19 @@ pipeline { stage('Report to SonarQube') { when { - allOf { - environment name: 'CHANGE_ID', value: '' - anyOf { - branch 'master' - allOf { - branch 'develop' - not { changelog '.*^Automated release [0-9\\.]+$' } + anyOf { + allOf { + not { environment name: 'CHANGE_ID', value: '' } + environment name: 'CHANGE_TARGET', value: 'develop' + } + allOf { + environment name: 'CHANGE_ID', value: '' + anyOf { + allOf { + branch 'develop' + not { changelog '.*^Automated release [0-9\\.]+$' } + } + branch 'master' } } } @@ -199,10 +217,16 @@ pipeline { stage('SonarQube compare to master') { when { - allOf { - environment name: 'CHANGE_ID', value: '' - branch 'develop' - not { changelog '.*^Automated release [0-9\\.]+$' } + anyOf { + allOf { + not { environment name: 'CHANGE_ID', value: '' } + environment name: 'CHANGE_TARGET', value: 'develop' + } + allOf { + environment name: 'CHANGE_ID', value: '' + branch 'develop' + not { changelog '.*^Automated release [0-9\\.]+$' } + } } } steps { diff --git a/cypress.config.js b/cypress.config.js index 30be8ac..4846ce9 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -2,12 +2,12 @@ const { defineConfig } = require('cypress'); module.exports = defineConfig({ viewportWidth: 1280, - defaultCommandTimeout: 8888, + defaultCommandTimeout: 5000, chromeWebSecurity: false, reporter: 'junit', video: true, retries: { - runMode: 8, + runMode: 1, openMode: 0, }, reporterOptions: { diff --git a/package.json b/package.json index cbea861..e2ff816 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,30 @@ "@cypress/code-coverage": "^3.10.0", "@plone/scripts": "*", "babel-plugin-transform-class-properties": "^6.24.1", - "md5": "^2.3.0" + "md5": "^2.3.0", + "husky": "*", + "lint-staged": "*" + }, + "lint-staged": { + "src/**/*.{js,jsx,ts,tsx,json}": [ + "make lint-fix", + "make prettier-fix" + ], + "src/**/*.{jsx}": [ + "make i18n" + ], + "theme/**/*.{css,less}": [ + "make stylelint-fix" + ], + "src/**/*.{css,less}": [ + "make stylelint-fix" + ], + "theme/**/*.overrides": [ + "make stylelint-fix" + ], + "src/**/*.overrides": [ + "make stylelint-fix" + ] }, "scripts": { "release": "release-it", @@ -40,6 +63,7 @@ "lint:fix": "make lint-fix", "i18n": "make i18n", "cypress:run": "make cypress-run", - "cypress:open": "make cypress-open" + "cypress:open": "make cypress-open", + "prepare": "husky install" } } From 1801ba849d085eb63dcc1faedc849e716e6661d0 Mon Sep 17 00:00:00 2001 From: Alin Voinea Date: Thu, 14 Sep 2023 14:38:41 +0300 Subject: [PATCH 07/10] style: lint-staged reorder in package.json --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e2ff816..d576116 100644 --- a/package.json +++ b/package.json @@ -21,9 +21,9 @@ "@cypress/code-coverage": "^3.10.0", "@plone/scripts": "*", "babel-plugin-transform-class-properties": "^6.24.1", - "md5": "^2.3.0", "husky": "*", - "lint-staged": "*" + "lint-staged": "*", + "md5": "^2.3.0" }, "lint-staged": { "src/**/*.{js,jsx,ts,tsx,json}": [ From d9496e0f30fc3091d30ac8c916761287d51555c6 Mon Sep 17 00:00:00 2001 From: GhitaB Date: Thu, 14 Sep 2023 16:36:36 +0300 Subject: [PATCH 08/10] Refs #257521 - Improve texts for label and tooltip. --- src/editor/schema.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/editor/schema.js b/src/editor/schema.js index ef6a129..68748db 100644 --- a/src/editor/schema.js +++ b/src/editor/schema.js @@ -19,7 +19,7 @@ export const LabelEditorSchema = { ], properties: { label_type: { - title: 'Type', + title: 'Type of label', type: 'string', factory: 'Choice', choices: [ @@ -27,9 +27,10 @@ export const LabelEditorSchema = { ['high', 'High importance'], ['highlight', 'Highlight'], ], + description: 'Choose a type or leave the default value (No value).', }, label_pointing: { - title: 'Pointing', + title: 'Label pointing', type: 'string', factory: 'Choice', choices: [ @@ -38,13 +39,16 @@ export const LabelEditorSchema = { ['left pointing', 'Left'], ['pointing below', 'Down'], ], + description: + 'Choose an orientation or leave the default value (No value).', }, tooltip_content: { - title: 'Content', + title: 'Tooltip content', widget: 'slate', + description: 'Enter the text you want to display in the tooltip.', }, tooltip_pointing: { - title: 'Position', + title: 'Tooltip position', type: 'string', factory: 'Choice', choices: [ @@ -59,7 +63,7 @@ export const LabelEditorSchema = { ], }, tooltip_type: { - title: 'Type', + title: 'Tooltip type', type: 'string', factory: 'Choice', choices: [ @@ -70,8 +74,8 @@ export const LabelEditorSchema = { default: '', }, always_show: { - title: 'Always show', - description: 'Always show the content label tooltip', + title: 'Always show tooltip', + description: 'Always show the content label tooltip.', type: 'boolean', }, }, From ba2e66eafdb7a3a77185c5c0b90b05e9afb9ede1 Mon Sep 17 00:00:00 2001 From: GhitaB Date: Thu, 14 Sep 2023 17:15:55 +0300 Subject: [PATCH 09/10] Refs #257521 - Add Simple style as default for labels. --- src/editor/schema.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/editor/schema.js b/src/editor/schema.js index 68748db..e9c61b2 100644 --- a/src/editor/schema.js +++ b/src/editor/schema.js @@ -23,11 +23,15 @@ export const LabelEditorSchema = { type: 'string', factory: 'Choice', choices: [ + ['simple', 'Simple'], ['medium', 'Medium importance'], ['high', 'High importance'], ['highlight', 'Highlight'], ], - description: 'Choose a type or leave the default value (No value).', + default: 'simple', + description: 'Choose a type or leave the default value (Simple).', + required: true, + noValueOption: false, }, label_pointing: { title: 'Label pointing', From f8a8e4003fb2dd769df52e963cbce5deab712fce Mon Sep 17 00:00:00 2001 From: EEA Jenkins <@users.noreply.github.com> Date: Fri, 15 Sep 2023 06:09:12 +0000 Subject: [PATCH 10/10] Automated release 0.5.3 --- CHANGELOG.md | 19 +++++++++++++++++++ package.json | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 67163e7..052fddb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,25 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +### [0.5.3](https://github.com/eea/volto-slate-label/compare/0.5.2...0.5.3) - 15 September 2023 + +#### :house: Internal changes + +- style: lint-staged reorder in package.json [Alin Voinea - [`1801ba8`](https://github.com/eea/volto-slate-label/commit/1801ba849d085eb63dcc1faedc849e716e6661d0)] + +#### :house: Documentation changes + +- docs: Cleanup Makefile, update DEVELOP documentation, i18n - refs #254894 [valentinab25 - [`c4f5f73`](https://github.com/eea/volto-slate-label/commit/c4f5f7300671ee13331c803593b0741f53d21c22)] + +#### :hammer_and_wrench: Others + +- Refs #257521 - Add Simple style as default for labels. [GhitaB - [`ba2e66e`](https://github.com/eea/volto-slate-label/commit/ba2e66eafdb7a3a77185c5c0b90b05e9afb9ede1)] +- Refs #257521 - Improve texts for label and tooltip. [GhitaB - [`d9496e0`](https://github.com/eea/volto-slate-label/commit/d9496e0f30fc3091d30ac8c916761287d51555c6)] +- test: EN locales, pre-commit fix, feature PRs checks Refs #257193 [valentinab25 - [`778f07d`](https://github.com/eea/volto-slate-label/commit/778f07dc3b0713a094a89fc04e4a943cad9de4f8)] +- test: Fix package.json scripts to use makefile [Alin Voinea - [`872eaf9`](https://github.com/eea/volto-slate-label/commit/872eaf9e16be65890e1ba942935c0a7a47ac2aca)] +- i18n: Add en [Alin Voinea - [`12ef506`](https://github.com/eea/volto-slate-label/commit/12ef506c27d8810836968f137d9e6a1711fdf64e)] +- test: Update Makefile and docker-compose to align it with Jenkinsfile [valentinab25 - [`e9b984b`](https://github.com/eea/volto-slate-label/commit/e9b984b42d3428ab737c02ffd480d2f6de393652)] +- Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`c85d929`](https://github.com/eea/volto-slate-label/commit/c85d929a5637eb15bca13b4761b5ac08d8d29d79)] ### [0.5.2](https://github.com/eea/volto-slate-label/compare/0.5.1...0.5.2) - 14 June 2023 ### [0.5.1](https://github.com/eea/volto-slate-label/compare/0.5.0...0.5.1) - 12 June 2023 diff --git a/package.json b/package.json index d576116..ca0b33f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@eeacms/volto-slate-label", - "version": "0.5.2", + "version": "0.5.3", "description": "@eeacms/volto-slate-label: Volto add-on", "main": "src/index.js", "author": "European Environment Agency: IDM2 A-Team",