@eeacms/volto-slate-metadata-mentions 8.2.0 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,29 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ ### [9.0.0](https://github.com/eea/volto-slate-metadata-mentions/compare/8.3.0...9.0.0) - 30 March 2026
8
+
9
+ #### :rocket: New Features
10
+
11
+ - feat: Volto 18 support - refs #287700 [Alin Voinea - [`abb36e4`](https://github.com/eea/volto-slate-metadata-mentions/commit/abb36e4aff038c49bf9b567badc20446f1154921)]
12
+
13
+ #### :house: Internal changes
14
+
15
+
16
+ #### :hammer_and_wrench: Others
17
+
18
+ - test: Fix make test [Alin V. (Claudiu) - [`abc4402`](https://github.com/eea/volto-slate-metadata-mentions/commit/abc4402128767dbe0dc55c04f45f16a7e9ab6b96)]
19
+ - tests: Fix Sonar Qube tags - refs #297339 [Alin Voinea - [`6718de5`](https://github.com/eea/volto-slate-metadata-mentions/commit/6718de5f13f61ca8c8ca65d404b75034e9a07f8f)]
20
+ ### [8.3.0](https://github.com/eea/volto-slate-metadata-mentions/compare/8.2.0...8.3.0) - 1 May 2025
21
+
22
+ #### :bug: Bug Fixes
23
+
24
+ - fix: subjects widget - refs #284007 [Alin Voinea - [`8b46168`](https://github.com/eea/volto-slate-metadata-mentions/commit/8b46168a36454ac529ddbee7c83a60bc3a34faca)]
25
+ - fix: creators and contributors display full name - refs #284007 [Teodor Voicu - [`5a89152`](https://github.com/eea/volto-slate-metadata-mentions/commit/5a89152ac52db83a1d2597c6a3acdc92996dfbec)]
26
+
27
+ #### :hammer_and_wrench: Others
28
+
29
+ - test: Fix unit tests [Alin Voinea - [`3e01041`](https://github.com/eea/volto-slate-metadata-mentions/commit/3e010415b1d10da4f2b29f4e3508a657cd2a8c23)]
7
30
  ### [8.2.0](https://github.com/eea/volto-slate-metadata-mentions/compare/8.1.1...8.2.0) - 13 September 2024
8
31
 
9
32
  #### :rocket: New Features
package/DEVELOP.md CHANGED
@@ -26,21 +26,20 @@
26
26
 
27
27
  ### Or add @eeacms/volto-slate-metadata-mentions to your Volto project
28
28
 
29
- Before starting make sure your development environment is properly set. See [Volto Developer Documentation](https://docs.voltocms.com/getting-started/install/)
29
+ Before starting make sure your development environment is properly set. See the official Plone documentation for [creating a project with Cookieplone](https://6.docs.plone.org/install/create-project-cookieplone.html) and [installing an add-on in development mode in Volto 18 and 19](https://6.docs.plone.org/volto/development/add-ons/install-an-add-on-dev-18.html).
30
30
 
31
- 1. Make sure you have installed `yo`, `@plone/generator-volto` and `mrs-developer`
31
+ For new Volto 18+ projects, use Cookieplone. It includes `mrs-developer` by default.
32
32
 
33
- npm install -g yo @plone/generator-volto mrs-developer
33
+ 1. Create a new Volto project with Cookieplone
34
34
 
35
- 1. Create new volto app
36
-
37
- yo @plone/volto my-volto-project --addon @eeacms/volto-slate-metadata-mentions --skip-install
38
- cd my-volto-project
35
+ uvx cookieplone project
36
+ cd project-title
39
37
 
40
38
  1. Add the following to `mrs.developer.json`:
41
39
 
42
40
  {
43
41
  "volto-slate-metadata-mentions": {
42
+ "output": "packages",
44
43
  "url": "https://github.com/eea/volto-slate-metadata-mentions.git",
45
44
  "package": "@eeacms/volto-slate-metadata-mentions",
46
45
  "branch": "develop",
@@ -48,28 +47,31 @@ Before starting make sure your development environment is properly set. See [Vol
48
47
  }
49
48
  }
50
49
 
51
- 1. Install
50
+ 1. Add `@eeacms/volto-slate-metadata-mentions` to the `addons` key in your project `volto.config.js`
51
+
52
+ 1. Install or refresh the project setup
52
53
 
53
- make develop
54
- yarn
54
+ make install
55
55
 
56
- 1. Start backend
56
+ 1. Start backend in one terminal
57
57
 
58
- docker run --pull always -it --rm --name plone -p 8080:8080 -e SITE=Plone plone/plone-backend
58
+ make backend-start
59
59
 
60
- ...wait for backend to setup and start - `Ready to handle requests`:
60
+ ...wait for backend to setup and start, ending with `Ready to handle requests`
61
61
 
62
62
  ...you can also check http://localhost:8080/Plone
63
63
 
64
- 1. Start frontend
64
+ 1. Start frontend in a second terminal
65
65
 
66
- yarn start
66
+ make frontend-start
67
67
 
68
68
  1. Go to http://localhost:3000
69
69
 
70
70
  1. Happy hacking!
71
71
 
72
- cd src/addons/volto-slate-metadata-mentions/
72
+ cd packages/volto-slate-metadata-mentions
73
+
74
+ For legacy Volto 17 projects, keep using the yarn-based workflow from the Volto 17 documentation.
73
75
 
74
76
  ## Cypress
75
77
 
@@ -81,7 +83,7 @@ project where you added `volto-slate-metadata-mentions` to `mrs.developer.json`
81
83
  Go to:
82
84
 
83
85
  ```BASH
84
- cd src/addons/volto-slate-metadata-mentions/
86
+ cd packages/volto-slate-metadata-mentions/
85
87
  ```
86
88
 
87
89
  Start:
package/Dockerfile CHANGED
@@ -1,13 +1,22 @@
1
1
  # syntax=docker/dockerfile:1
2
2
  ARG VOLTO_VERSION
3
- FROM eeacms/frontend-builder:${VOLTO_VERSION}
3
+ FROM plone/frontend-builder:${VOLTO_VERSION}
4
4
 
5
5
  ARG ADDON_NAME
6
6
  ARG ADDON_PATH
7
+ ENV HOST="0.0.0.0"
8
+
9
+ USER root
10
+ RUN apt-get update -q \
11
+ && apt-get install -qy --no-install-recommends \
12
+ chromium libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb \
13
+ && rm -rf /var/lib/apt/lists/*
14
+ USER node
7
15
 
8
16
  COPY --chown=node:node ./ /app/src/addons/${ADDON_PATH}/
9
17
 
10
18
  RUN /setupAddon
19
+ RUN yarn add jest-junit
11
20
  RUN yarn install
12
21
 
13
22
  ENTRYPOINT ["yarn"]
package/Jenkinsfile CHANGED
@@ -1,7 +1,4 @@
1
1
  pipeline {
2
- tools {
3
- jdk 'Java17'
4
- }
5
2
  agent {
6
3
  node { label 'docker-host' }
7
4
  }
@@ -9,12 +6,12 @@ pipeline {
9
6
  environment {
10
7
  GIT_NAME = "volto-slate-metadata-mentions"
11
8
  NAMESPACE = "@eeacms"
12
- SONARQUBE_TAGS = "volto.eea.europa.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,climate-energy.eea.europa.eu,forest.eea.europa.eu,clms.land.copernicus.eu,industry.eea.europa.eu,water.europa.eu-freshwater,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,water.europa.eu-marine,climate-adapt.eea.europa.eu,climate-advisory-board.devel4cph.eea.europa.eu,climate-advisory-board.europa.eu,www.eea.europa.eu-en,insitu-frontend.eionet.europa.eu,insitu.copernicus.eu"
9
+ SONARQUBE_TAGS = "volto.eea.europa.eu,biodiversity.europa.eu,climate-energy.eea.europa.eu,forest.eea.europa.eu,industry.eea.europa.eu,water.europa.eu-freshwater,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,water.europa.eu-marine,climate-adapt.eea.europa.eu,climate-advisory-board.devel4cph.eea.europa.eu,climate-advisory-board.europa.eu,www.eea.europa.eu-en,www.eea.europa.eu,insitu.copernicus.eu,ask.copernicus.eu,land.copernicus.eu"
13
10
  DEPENDENCIES = ""
14
11
  BACKEND_PROFILES = "eea.kitkat:testing"
15
12
  BACKEND_ADDONS = ""
16
13
  VOLTO = "17"
17
- VOLTO16_BREAKING_CHANGES = "no"
14
+ VOLTO18_BREAKING_CHANGES = "no"
18
15
  IMAGE_NAME = BUILD_TAG.toLowerCase()
19
16
  }
20
17
 
@@ -166,8 +163,7 @@ pipeline {
166
163
  script {
167
164
  try {
168
165
  sh '''docker run --pull always --rm -d --name="$IMAGE_NAME-plone" -e SITE="Plone" -e PROFILES="$BACKEND_PROFILES" -e ADDONS="$BACKEND_ADDONS" eeacms/plone-backend'''
169
- sh '''docker run -d --shm-size=6g --link $IMAGE_NAME-plone:plone --name="$IMAGE_NAME-cypress" -e "RAZZLE_INTERNAL_API_PATH=http://plone:8080/Plone" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend start-ci'''
170
- sleep 30
166
+ sh '''docker run -d --shm-size=4g --link $IMAGE_NAME-plone:plone --name="$IMAGE_NAME-cypress" -e "RAZZLE_INTERNAL_API_PATH=http://plone:8080/Plone" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend start-ci'''
171
167
  frontend = sh script:'''docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress make check-ci''', returnStatus: true
172
168
  if ( frontend != 0 ) {
173
169
  sh '''docker logs $IMAGE_NAME-cypress; exit 1'''
@@ -243,11 +239,17 @@ pipeline {
243
239
  script {
244
240
  def scannerHome = tool 'SonarQubeScanner'
245
241
  def nodeJS = tool 'NodeJS'
242
+ if (env.CHANGE_ID) {
243
+ env.sonarParams = " -Dsonar.pullrequest.base=${env.CHANGE_TARGET} -Dsonar.pullrequest.branch=${env.CHANGE_BRANCH} -Dsonar.pullrequest.key=${env.CHANGE_ID} "
244
+ }
245
+ else {
246
+ env.sonarParams = " -Dsonar.branch.name=${env.BRANCH_NAME}"
247
+ }
246
248
  withSonarQubeEnv('Sonarqube') {
247
249
  sh '''sed -i "s#/app/src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
248
250
  sh '''sed -i "s#src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
249
- sh "export PATH=${scannerHome}/bin:${nodeJS}/bin:$PATH; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info,./cypress-coverage/coverage/lcov.info -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER"
250
- sh '''try=5; while [ \$try -gt 0 ]; do curl -s -XPOST -u "${SONAR_AUTH_TOKEN}:" "${SONAR_HOST_URL}api/project_tags/set?project=${GIT_NAME}-${BRANCH_NAME}&tags=${SONARQUBE_TAGS},${BRANCH_NAME}" > set_tags_result; if [ \$(grep -ic error set_tags_result ) -eq 0 ]; then try=0; else cat set_tags_result; echo "... Will retry"; sleep 15; try=\$(( \$try - 1 )); fi; done'''
251
+ sh "export PATH=${scannerHome}/bin:${nodeJS}/bin:$PATH; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info,./cypress-coverage/coverage/lcov.info -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME -Dsonar.projectName=$GIT_NAME -Dsonar.projectVersion=\$(jq -r '.version' package.json) ${env.sonarParams}"
252
+ sh '''try=5; while [ \$try -gt 0 ]; do curl -s -XPOST -u "${SONAR_AUTH_TOKEN}:" "${SONAR_HOST_URL}api/project_tags/set?project=${GIT_NAME}&tags=${SONARQUBE_TAGS}" > set_tags_result; if [ \$(grep -ic error set_tags_result ) -eq 0 ]; then try=0; else cat set_tags_result; echo "... Will retry"; sleep 15; try=\$(( \$try - 1 )); fi; done'''
251
253
  }
252
254
  }
253
255
  }
@@ -257,75 +259,75 @@ pipeline {
257
259
  }
258
260
  }
259
261
 
260
- stage('Volto 16') {
262
+ stage('Volto 18') {
261
263
  agent { node { label 'integration'} }
262
264
  when {
263
265
  environment name: 'SKIP_TESTS', value: ''
264
- not { environment name: 'VOLTO16_BREAKING_CHANGES', value: 'yes' }
266
+ not { environment name: 'VOLTO18_BREAKING_CHANGES', value: 'yes' }
265
267
  }
266
268
  stages {
267
269
  stage('Build test image') {
268
270
  steps {
269
- sh '''docker build --pull --build-arg="VOLTO_VERSION=16" --build-arg="ADDON_NAME=$NAMESPACE/$GIT_NAME" --build-arg="ADDON_PATH=$GIT_NAME" . -t $IMAGE_NAME-frontend16'''
271
+ sh '''docker build --pull --build-arg="VOLTO_VERSION=18-yarn" --build-arg="ADDON_NAME=$NAMESPACE/$GIT_NAME" --build-arg="ADDON_PATH=$GIT_NAME" . -t $IMAGE_NAME-frontend18'''
270
272
  }
271
273
  }
272
274
 
273
- stage('Unit tests Volto 16') {
275
+ stage('Unit tests Volto 18') {
274
276
  steps {
275
277
  script {
276
278
  try {
277
- sh '''docker run --name="$IMAGE_NAME-volto16" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend16 test-ci'''
278
- sh '''rm -rf xunit-reports16'''
279
- sh '''mkdir -p xunit-reports16'''
280
- sh '''docker cp $IMAGE_NAME-volto16:/app/junit.xml xunit-reports16/'''
279
+ sh '''docker run --name="$IMAGE_NAME-volto18" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend18 test-ci'''
280
+ sh '''rm -rf xunit-reports18'''
281
+ sh '''mkdir -p xunit-reports18'''
282
+ sh '''docker cp $IMAGE_NAME-volto18:/app/junit.xml xunit-reports18/'''
281
283
  } finally {
282
284
  catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
283
- junit testResults: 'xunit-reports16/junit.xml', allowEmptyResults: true
285
+ junit testResults: 'xunit-reports18/junit.xml', allowEmptyResults: true
284
286
  }
285
- sh script: '''docker rm -v $IMAGE_NAME-volto16''', returnStatus: true
287
+ sh script: '''docker rm -v $IMAGE_NAME-volto18''', returnStatus: true
286
288
  }
287
289
  }
288
290
  }
289
291
  }
290
292
 
291
- stage('Integration tests Volto 16') {
293
+ stage('Integration tests Volto 18') {
292
294
  steps {
293
295
  script {
294
296
  try {
295
- sh '''docker run --pull always --rm -d --name="$IMAGE_NAME-plone16" -e SITE="Plone" -e PROFILES="$BACKEND_PROFILES" -e ADDONS="$BACKEND_ADDONS" eeacms/plone-backend'''
296
- sh '''docker run -d --shm-size=4g --link $IMAGE_NAME-plone16:plone --name="$IMAGE_NAME-cypress16" -e "RAZZLE_INTERNAL_API_PATH=http://plone:8080/Plone" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend16 start-ci'''
297
- frontend = sh script:'''docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress16 make check-ci''', returnStatus: true
297
+ sh '''docker run --pull always --rm -d --name="$IMAGE_NAME-plone18" -e SITE="Plone" -e PROFILES="$BACKEND_PROFILES" -e ADDONS="$BACKEND_ADDONS" eeacms/plone-backend'''
298
+ sh '''docker run -d --shm-size=4g --link $IMAGE_NAME-plone18:plone --name="$IMAGE_NAME-cypress18" -e "RAZZLE_INTERNAL_API_PATH=http://plone:8080/Plone" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend18 start-ci'''
299
+ frontend = sh script:'''docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress18 make check-ci''', returnStatus: true
298
300
  if ( frontend != 0 ) {
299
- sh '''docker logs $IMAGE_NAME-cypress16; exit 1'''
301
+ sh '''docker logs $IMAGE_NAME-cypress18; exit 1'''
300
302
  }
301
- sh '''timeout -s 9 1800 docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress16 make cypress-ci'''
303
+ sh '''timeout -s 9 1800 docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress18 make cypress-ci'''
302
304
  } finally {
303
305
  try {
304
306
  if ( frontend == 0 ) {
305
- sh '''rm -rf cypress-videos16 cypress-results16 cypress-coverage16 cypress-screenshots16'''
306
- sh '''mkdir -p cypress-videos16 cypress-results16 cypress-coverage16 cypress-screenshots16'''
307
- videos = sh script: '''docker cp $IMAGE_NAME-cypress16:/app/src/addons/$GIT_NAME/cypress/videos cypress-videos16/''', returnStatus: true
308
- sh '''docker cp $IMAGE_NAME-cypress16:/app/src/addons/$GIT_NAME/cypress/reports cypress-results16/'''
309
- screenshots = sh script: '''docker cp $IMAGE_NAME-cypress16:/app/src/addons/$GIT_NAME/cypress/screenshots cypress-screenshots16''', returnStatus: true
307
+ sh '''rm -rf cypress-videos18 cypress-results18 cypress-coverage18 cypress-screenshots18'''
308
+ sh '''mkdir -p cypress-videos18 cypress-results18 cypress-coverage18 cypress-screenshots18'''
309
+ videos = sh script: '''docker cp $IMAGE_NAME-cypress18:/app/src/addons/$GIT_NAME/cypress/videos cypress-videos18/''', returnStatus: true
310
+ sh '''docker cp $IMAGE_NAME-cypress18:/app/src/addons/$GIT_NAME/cypress/reports cypress-results18/'''
311
+ screenshots = sh script: '''docker cp $IMAGE_NAME-cypress18:/app/src/addons/$GIT_NAME/cypress/screenshots cypress-screenshots18''', returnStatus: true
310
312
 
311
- archiveArtifacts artifacts: 'cypress-screenshots16/**', fingerprint: true, allowEmptyArchive: true
313
+ archiveArtifacts artifacts: 'cypress-screenshots18/**', fingerprint: true, allowEmptyArchive: true
312
314
 
313
315
  if ( videos == 0 ) {
314
- sh '''for file in $(find cypress-results16 -name *.xml); do if [ $(grep -E 'failures="[1-9].*"' $file | wc -l) -eq 0 ]; then testname=$(grep -E 'file=.*failures="0"' $file | sed 's#.* file=".*\\/\\(.*\\.[jsxt]\\+\\)" time.*#\\1#' ); rm -f cypress-videos16/videos/$testname.mp4; fi; done'''
315
- archiveArtifacts artifacts: 'cypress-videos16/**/*.mp4', fingerprint: true, allowEmptyArchive: true
316
+ sh '''for file in $(find cypress-results18 -name *.xml); do if [ $(grep -E 'failures="[1-9].*"' $file | wc -l) -eq 0 ]; then testname=$(grep -E 'file=.*failures="0"' $file | sed 's#.* file=".*\\/\\(.*\\.[jsxt]\\+\\)" time.*#\\1#' ); rm -f cypress-videos18/videos/$testname.mp4; fi; done'''
317
+ archiveArtifacts artifacts: 'cypress-videos18/**/*.mp4', fingerprint: true, allowEmptyArchive: true
316
318
  }
317
319
  }
318
320
  } finally {
319
321
  catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
320
- junit testResults: 'cypress-results16/**/*.xml', allowEmptyResults: true
322
+ junit testResults: 'cypress-results18/**/*.xml', allowEmptyResults: true
321
323
  }
322
324
  catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
323
- sh '''docker logs $IMAGE_NAME-cypress16'''
325
+ sh '''docker logs $IMAGE_NAME-cypress18'''
324
326
  }
325
- sh script: "docker stop $IMAGE_NAME-cypress16", returnStatus: true
326
- sh script: "docker stop $IMAGE_NAME-plone16", returnStatus: true
327
- sh script: "docker rm -v $IMAGE_NAME-plone16", returnStatus: true
328
- sh script: "docker rm -v $IMAGE_NAME-cypress16", returnStatus: true
327
+ sh script: "docker stop $IMAGE_NAME-cypress18", returnStatus: true
328
+ sh script: "docker stop $IMAGE_NAME-plone18", returnStatus: true
329
+ sh script: "docker rm -v $IMAGE_NAME-plone18", returnStatus: true
330
+ sh script: "docker rm -v $IMAGE_NAME-cypress18", returnStatus: true
329
331
  }
330
332
  }
331
333
  }
@@ -338,7 +340,7 @@ pipeline {
338
340
  post {
339
341
  always {
340
342
  sh script: "docker rmi $IMAGE_NAME-frontend", returnStatus: true
341
- sh script: "docker rmi $IMAGE_NAME-frontend16", returnStatus: true
343
+ sh script: "docker rmi $IMAGE_NAME-frontend18", returnStatus: true
342
344
  }
343
345
  }
344
346
  }
@@ -364,7 +366,7 @@ pipeline {
364
366
  script {
365
367
  sh '''echo "Error" > checkresult.txt'''
366
368
  catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
367
- sh '''set -o pipefail; docker run -i --rm --pull always --name="$IMAGE_NAME-gitflow-sn" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_NAME="$GIT_NAME" eeacms/gitflow /checkSonarqubemaster.sh | grep -v "Found script" | tee checkresult.txt'''
369
+ sh '''set -o pipefail; docker run -i --rm --pull always --name="$IMAGE_NAME-gitflow-sn" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_NAME="$GIT_NAME" eeacms/gitflow /checkSonarqubemasterV2.sh | grep -v "Found script" | tee checkresult.txt'''
368
370
  }
369
371
 
370
372
  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',
@@ -414,4 +416,3 @@ pipeline {
414
416
  }
415
417
  }
416
418
  }
417
-
package/Makefile CHANGED
@@ -23,10 +23,12 @@ SHELL:=bash
23
23
  .DELETE_ON_ERROR:
24
24
  MAKEFLAGS+=--warn-undefined-variables
25
25
  MAKEFLAGS+=--no-builtin-rules
26
+ TERM?=dumb
27
+ export TERM
26
28
 
27
29
  # Colors
28
30
  # OK=Green, warn=yellow, error=red
29
- ifeq ($(TERM),)
31
+ ifneq ($(shell test -n "$$TERM" && command -v tput >/dev/null 2>&1 && echo yes),yes)
30
32
  # no colors if not in terminal
31
33
  MARK_COLOR=
32
34
  OK_COLOR=
@@ -34,11 +36,11 @@ ifeq ($(TERM),)
34
36
  ERROR_COLOR=
35
37
  NO_COLOR=
36
38
  else
37
- MARK_COLOR=`tput setaf 6`
38
- OK_COLOR=`tput setaf 2`
39
- WARN_COLOR=`tput setaf 3`
40
- ERROR_COLOR=`tput setaf 1`
41
- NO_COLOR=`tput sgr0`
39
+ MARK_COLOR:=$(shell tput setaf 6 2>/dev/null || true)
40
+ OK_COLOR:=$(shell tput setaf 2 2>/dev/null || true)
41
+ WARN_COLOR:=$(shell tput setaf 3 2>/dev/null || true)
42
+ ERROR_COLOR:=$(shell tput setaf 1 2>/dev/null || true)
43
+ NO_COLOR:=$(shell tput sgr0 2>/dev/null || true)
42
44
  endif
43
45
 
44
46
  ##############################################################################
@@ -46,7 +48,7 @@ endif
46
48
  DIR=$(shell basename $$(pwd))
47
49
  NODE_MODULES?="../../../node_modules"
48
50
  PLONE_VERSION?=6
49
- VOLTO_VERSION?=17
51
+ VOLTO_VERSION?=18-yarn
50
52
  ADDON_PATH="${DIR}"
51
53
  ADDON_NAME="@eeacms/${ADDON_PATH}"
52
54
  DOCKER_COMPOSE=PLONE_VERSION=${PLONE_VERSION} VOLTO_VERSION=${VOLTO_VERSION} ADDON_NAME=${ADDON_NAME} ADDON_PATH=${ADDON_PATH} docker compose
@@ -82,19 +84,19 @@ shell: ## Start a shell in the frontend container
82
84
 
83
85
  .PHONY: cypress-open
84
86
  cypress-open: ## Open cypress integration tests
85
- CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress open
87
+ TERM="$${TERM:-dumb}" CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress open
86
88
 
87
89
  .PHONY: cypress-run
88
90
  cypress-run: ## Run cypress integration tests
89
- CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run
91
+ TERM="$${TERM:-dumb}" CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run
90
92
 
91
93
  .PHONY: test
92
94
  test: ## Run jest tests
93
- ${DOCKER_COMPOSE} run -e CI=1 frontend test
95
+ ${DOCKER_COMPOSE} run --no-deps -e CI=1 frontend test
94
96
 
95
97
  .PHONY: test-update
96
98
  test-update: ## Update jest tests snapshots
97
- ${DOCKER_COMPOSE} run -e CI=1 frontend test -u
99
+ ${DOCKER_COMPOSE} run --no-deps -e CI=1 frontend test -u
98
100
 
99
101
  .PHONY: stylelint
100
102
  stylelint: ## Stylelint
@@ -162,4 +164,4 @@ check-ci:
162
164
  .PHONY: cypress-ci
163
165
  cypress-ci:
164
166
  $(NODE_MODULES)/.bin/wait-on -t 240000 http://localhost:3000
165
- CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run --browser chromium
167
+ TERM="$${TERM:-dumb}" CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run --browser chromium
package/README.md CHANGED
@@ -3,16 +3,16 @@
3
3
  [![Releases](https://img.shields.io/github/v/release/eea/volto-slate-metadata-mentions)](https://github.com/eea/volto-slate-metadata-mentions/releases)
4
4
 
5
5
  [![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto-addons%2Fvolto-slate-metadata-mentions%2Fmaster&subject=master)](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-slate-metadata-mentions/job/master/display/redirect)
6
- [![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-metadata-mentions-master&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-metadata-mentions-master)
7
- [![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-metadata-mentions-master&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-metadata-mentions-master)
8
- [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-metadata-mentions-master&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-metadata-mentions-master)
9
- [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-metadata-mentions-master&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-metadata-mentions-master)
6
+ [![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-metadata-mentions&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-metadata-mentions)
7
+ [![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-metadata-mentions&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-metadata-mentions)
8
+ [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-metadata-mentions&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-metadata-mentions)
9
+ [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-metadata-mentions&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-metadata-mentions)
10
10
 
11
11
  [![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto-addons%2Fvolto-slate-metadata-mentions%2Fdevelop&subject=develop)](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-slate-metadata-mentions/job/develop/display/redirect)
12
- [![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-metadata-mentions-develop&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-metadata-mentions-develop)
13
- [![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-metadata-mentions-develop&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-metadata-mentions-develop)
14
- [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-metadata-mentions-develop&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-metadata-mentions-develop)
15
- [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-metadata-mentions-develop&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-metadata-mentions-develop)
12
+ [![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-metadata-mentions&branch=develop&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-metadata-mentions&branch=develop)
13
+ [![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-metadata-mentions&branch=develop&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-metadata-mentions&branch=develop)
14
+ [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-metadata-mentions&branch=develop&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-metadata-mentions&branch=develop)
15
+ [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-metadata-mentions&branch=develop&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-metadata-mentions&branch=develop)
16
16
 
17
17
 
18
18
  [Volto Slate](https://6.dev-docs.plone.org/volto/configuration/volto-slate/) Metadata Mentions
@@ -61,6 +61,11 @@ This version requires: `@plone/volto >= 16.0.0.alpha.15` (`volto-slate` part of
61
61
 
62
62
  Go to http://localhost:3000
63
63
 
64
+ `make start` now defaults to Volto 18. To run the same setup against Volto 17, use:
65
+
66
+ VOLTO_VERSION=17 make
67
+ VOLTO_VERSION=17 make start
68
+
64
69
  ### Add volto-slate-metadata-mentions to your Volto project
65
70
 
66
71
  1. Make sure you have a [Plone backend](https://plone.org/download) up-and-running at http://localhost:8080/Plone
@@ -74,30 +79,39 @@ Go to http://localhost:3000
74
79
  * If you already have a volto project, just update `package.json`:
75
80
 
76
81
  ```JSON
77
- "addons": [
78
- "@eeacms/volto-slate-metadata-mentions"
79
- ],
80
-
81
82
  "dependencies": {
82
83
  "@eeacms/volto-slate-metadata-mentions": "*"
83
84
  }
84
85
  ```
85
86
 
86
- * If not, create one:
87
+ and `volto.config.js`:
88
+
89
+ ```JavaScript
90
+ const addons = ['@eeacms/volto-slate-metadata-mentions'];
91
+ ```
92
+
93
+ * If not, create one with Cookieplone, as recommended by the official Plone documentation for Volto 18+:
87
94
 
88
95
  ```
89
- npm install -g yo @plone/generator-volto
90
- yo @plone/volto my-volto-project --canary --addon @eeacms/volto-slate-metadata-mentions
91
- cd my-volto-project
96
+ uvx cookieplone project
97
+ cd project-title
92
98
  ```
93
99
 
94
- 1. Install new add-ons and restart Volto:
100
+ 1. Install or update dependencies, then start the project:
95
101
 
96
102
  ```
97
- yarn
98
- yarn start
103
+ make install
99
104
  ```
100
105
 
106
+ For a Cookieplone project, start the backend and frontend in separate terminals:
107
+
108
+ ```
109
+ make backend-start
110
+ make frontend-start
111
+ ```
112
+
113
+ For a legacy Volto 17 project, install the package with `yarn` and restart the frontend as usual.
114
+
101
115
  1. Go to http://localhost:3000
102
116
 
103
117
  1. Happy editing!
@@ -0,0 +1,44 @@
1
+ import { slateBeforeEach, slateAfterEach } from '../support/e2e';
2
+ import {
3
+ addMetadataMention,
4
+ setDescriptionMetadataValue,
5
+ } from '../support/metadata';
6
+
7
+ describe('Block Tests: Metadata lifecycle', () => {
8
+ beforeEach(slateBeforeEach);
9
+ afterEach(slateAfterEach);
10
+
11
+ it('allows adding, removing, and re-adding metadata mentions in the editor', () => {
12
+ cy.getSlateEditorAndType('Colorless green ideas sleep furiously.')
13
+ .type('{selectAll}')
14
+ .dblclick();
15
+
16
+ addMetadataMention({
17
+ cursorText: 'Colorless',
18
+ selectionStart: 'Colorless',
19
+ selectionEnd: 'green',
20
+ metadataLabel: 'Publishing Date',
21
+ });
22
+
23
+ // Click on the mention to select it and show context toolbar
24
+ cy.get('.slate-editor .metadata.mention.edit').first().click();
25
+ cy.wait(500);
26
+ cy.get('.slate-editor .metadata.mention.edit').first().dblclick();
27
+ cy.clickSlateButton('Remove metadata');
28
+
29
+ // Re-focus the editor after removing mention
30
+ cy.get('.slate-editor.selected [contenteditable=true]').focus().click();
31
+ cy.wait(500);
32
+
33
+ addMetadataMention({
34
+ cursorText: 'Colorless',
35
+ selectionStart: 'green',
36
+ selectionEnd: 'sleep',
37
+ metadataLabel: 'Summary',
38
+ setValue: () => setDescriptionMetadataValue('blue cats sleep'),
39
+ });
40
+
41
+ cy.toolbarSave();
42
+ cy.contains('Colorless blue cats sleep furiously.');
43
+ });
44
+ });
@@ -0,0 +1,42 @@
1
+ import { slateBeforeEach, slateAfterEach } from '../support/e2e';
2
+ import {
3
+ addMetadataMention,
4
+ getMentionNodes,
5
+ setDescriptionMetadataValue,
6
+ } from '../support/metadata';
7
+
8
+ const createSummaryMention = (value = 'Mentioned summary') => {
9
+ cy.getSlateEditorAndType('Alpha beta gamma delta.');
10
+ addMetadataMention({
11
+ cursorText: 'Alpha',
12
+ selectionStart: 'gamma',
13
+ metadataLabel: 'Summary',
14
+ setValue: () => setDescriptionMetadataValue(value),
15
+ });
16
+ };
17
+
18
+ describe('Block Tests: Metadata summary', () => {
19
+ beforeEach(slateBeforeEach);
20
+ afterEach(slateAfterEach);
21
+
22
+ it('renders summary metadata mentions after save', () => {
23
+ createSummaryMention();
24
+
25
+ cy.toolbarSave();
26
+ cy.get('#page-document').should('contain.text', 'Mentioned summary');
27
+ });
28
+
29
+ it('stores summary metadata mention data in the slate JSON', () => {
30
+ createSummaryMention();
31
+
32
+ cy.toolbarSave();
33
+ getMentionNodes().then((mentions) => {
34
+ expect(mentions).to.have.length(1);
35
+ expect(mentions[0].data).to.deep.equal({
36
+ description: 'Mentioned summary',
37
+ metadata: 'description',
38
+ widget: 'description',
39
+ });
40
+ });
41
+ });
42
+ });
@@ -0,0 +1,42 @@
1
+ import { slateBeforeEach, slateAfterEach } from '../support/e2e';
2
+ import {
3
+ addMetadataMention,
4
+ getMentionNodes,
5
+ setContributorsMetadataValue,
6
+ } from '../support/metadata';
7
+
8
+ const createContributorsMention = (value = 'John Doe') => {
9
+ cy.getSlateEditorAndType('Alpha beta gamma delta.');
10
+ addMetadataMention({
11
+ cursorText: 'Alpha',
12
+ selectionStart: 'beta',
13
+ metadataLabel: 'Contributors',
14
+ setValue: () => setContributorsMetadataValue(value),
15
+ });
16
+ };
17
+
18
+ describe('Block Tests: Metadata contributors', () => {
19
+ beforeEach(slateBeforeEach);
20
+ afterEach(slateAfterEach);
21
+
22
+ it('renders contributors metadata mentions after save', () => {
23
+ createContributorsMention();
24
+
25
+ cy.toolbarSave();
26
+ cy.get('#page-document').should('contain.text', 'John Doe');
27
+ });
28
+
29
+ it('stores contributors metadata mention data in the slate JSON', () => {
30
+ createContributorsMention();
31
+
32
+ cy.toolbarSave();
33
+ getMentionNodes().then((mentions) => {
34
+ expect(mentions).to.have.length(1);
35
+ expect(mentions[0].data).to.deep.equal({
36
+ contributors: ['John Doe'],
37
+ metadata: 'contributors',
38
+ widget: 'array',
39
+ });
40
+ });
41
+ });
42
+ });