@eeacms/volto-slate-metadata-mentions 7.0.3 → 8.1.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/.env +3 -0
- package/CHANGELOG.md +22 -29
- package/Jenkinsfile +145 -46
- package/Makefile +11 -8
- package/cypress/support/commands.js +1 -6
- package/cypress/support/e2e.js +0 -4
- package/jest-addon.config.js +19 -4
- package/jest.setup.js +65 -0
- package/package.json +3 -1
- package/src/plugins/Mentions/MentionEditor.jsx +27 -10
- package/src/plugins/Mentions/index.js +5 -4
- package/src/plugins/Mentions/render.jsx +29 -6
- package/src/plugins/Mentions/schema.js +73 -23
- package/.project.eslintrc.js +0 -48
package/.env
ADDED
package/CHANGELOG.md
CHANGED
|
@@ -4,11 +4,32 @@ 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
|
+
### [8.1.0](https://github.com/eea/volto-slate-metadata-mentions/compare/8.0.0...8.1.0) - 16 May 2024
|
|
8
|
+
|
|
9
|
+
#### :rocket: New Features
|
|
10
|
+
|
|
11
|
+
- feat(slate): metadata can now wrap image in download link - refs #264785 [ichim-david - [`96cd99d`](https://github.com/eea/volto-slate-metadata-mentions/commit/96cd99dcac782bfb2ab28cbb01fa73a442c1bb65)]
|
|
12
|
+
|
|
13
|
+
#### :hammer_and_wrench: Others
|
|
14
|
+
|
|
15
|
+
- Release 8.1.0 [alin - [`6e688d1`](https://github.com/eea/volto-slate-metadata-mentions/commit/6e688d1c0bda84703a895c5a7519e0ecd451a673)]
|
|
16
|
+
## [8.0.0](https://github.com/eea/volto-slate-metadata-mentions/compare/7.0.3...8.0.0) - 22 April 2024
|
|
17
|
+
|
|
18
|
+
#### :rocket: New Features
|
|
19
|
+
|
|
20
|
+
- feat: Release 8.0.0 - Volto 17 support [alin - [`83565c7`](https://github.com/eea/volto-slate-metadata-mentions/commit/83565c76d4893d5f8130bc3af9d96f2ba855a349)]
|
|
21
|
+
- feat: Volto 17 support - refs #264527 [EEA Jenkins - [`ca86e11`](https://github.com/eea/volto-slate-metadata-mentions/commit/ca86e11fdd4806588d59a0bba8b35e9cbf9fb33a)]
|
|
22
|
+
|
|
23
|
+
#### :bug: Bug Fixes
|
|
24
|
+
|
|
25
|
+
- fix(tests): removed waitForResourcesToLoad no longer needed in volto 17 [David Ichim - [`8bc76d1`](https://github.com/eea/volto-slate-metadata-mentions/commit/8bc76d1e4df78d5bd7152791672a4cc5c32563f0)]
|
|
26
|
+
|
|
27
|
+
#### :hammer_and_wrench: Others
|
|
28
|
+
|
|
7
29
|
### [7.0.3](https://github.com/eea/volto-slate-metadata-mentions/compare/7.0.2...7.0.3) - 18 January 2024
|
|
8
30
|
|
|
9
31
|
#### :house: Internal changes
|
|
10
32
|
|
|
11
|
-
- chore: [JENKINS] Refactor automated testing [valentinab25 - [`11e092e`](https://github.com/eea/volto-slate-metadata-mentions/commit/11e092e7b951b1c676e16bc3b08dd868621b6345)]
|
|
12
33
|
|
|
13
34
|
#### :house: Documentation changes
|
|
14
35
|
|
|
@@ -17,11 +38,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
17
38
|
#### :hammer_and_wrench: Others
|
|
18
39
|
|
|
19
40
|
- test: modify cypress test - refs #254313 [ana-oprea - [`df1cff1`](https://github.com/eea/volto-slate-metadata-mentions/commit/df1cff18cc90b327d9cd480af79d62911603e743)]
|
|
20
|
-
- test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`a5aaf33`](https://github.com/eea/volto-slate-metadata-mentions/commit/a5aaf339483b0d9631596610dea1f7e0e7cba9d1)]
|
|
21
|
-
- test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`394a7bd`](https://github.com/eea/volto-slate-metadata-mentions/commit/394a7bd75d6be8cfa89be4927aa056482dddf080)]
|
|
22
|
-
- test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`d739b27`](https://github.com/eea/volto-slate-metadata-mentions/commit/d739b2778eef1854d7c076f2d790c48d42619930)]
|
|
23
|
-
- test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`1435b99`](https://github.com/eea/volto-slate-metadata-mentions/commit/1435b99fd535888698dd0cbb09407b5e4fa02fed)]
|
|
24
|
-
- test: [JENKINS] Improve cypress time [valentinab25 - [`977fc5b`](https://github.com/eea/volto-slate-metadata-mentions/commit/977fc5b9ee9030dd72d4236f9712082505564bfc)]
|
|
25
41
|
### [7.0.2](https://github.com/eea/volto-slate-metadata-mentions/compare/7.0.1...7.0.2) - 22 October 2023
|
|
26
42
|
|
|
27
43
|
#### :house: Internal changes
|
|
@@ -47,7 +63,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
47
63
|
#### :hammer_and_wrench: Others
|
|
48
64
|
|
|
49
65
|
- test: EN locales, pre-commit fix, feature PRs checks Refs #257193 [valentinab25 - [`e13b9b6`](https://github.com/eea/volto-slate-metadata-mentions/commit/e13b9b6c36e4d61905807179459929aabf44f56c)]
|
|
50
|
-
- test: Fix eslint and yarn i18n [Alin Voinea - [`e085c11`](https://github.com/eea/volto-slate-metadata-mentions/commit/e085c1189c0aa92b984440b51b4534261560c175)]
|
|
51
66
|
- i18n: Add en [Alin Voinea - [`9e7360d`](https://github.com/eea/volto-slate-metadata-mentions/commit/9e7360da54440957842726bae19e093bb1937a49)]
|
|
52
67
|
- test: Update Makefile and docker-compose to align it with Jenkinsfile [valentinab25 - [`b873d00`](https://github.com/eea/volto-slate-metadata-mentions/commit/b873d00ba45dbe569512b54740ab54fa9dd296ce)]
|
|
53
68
|
## [7.0.0](https://github.com/eea/volto-slate-metadata-mentions/compare/6.1.2...7.0.0) - 25 July 2023
|
|
@@ -69,24 +84,16 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
69
84
|
|
|
70
85
|
#### :house: Internal changes
|
|
71
86
|
|
|
72
|
-
- chore: [JENKINS] Deprecate circularity website [valentinab25 - [`bea37a4`](https://github.com/eea/volto-slate-metadata-mentions/commit/bea37a4cd51c087a67dbb23f8ac778e201f06596)]
|
|
73
87
|
|
|
74
88
|
#### :hammer_and_wrench: Others
|
|
75
89
|
|
|
76
90
|
- test: jest should look for addons in node_modules Refs #253277 [valentinab25 - [`98fa009`](https://github.com/eea/volto-slate-metadata-mentions/commit/98fa00918b613bdbf079300e4683f300ba77c575)]
|
|
77
91
|
- test: Fix test config, coverage Refs #253277 [valentinab25 - [`e87dda2`](https://github.com/eea/volto-slate-metadata-mentions/commit/e87dda2b7ec6f8d39383ee4024265628e562be8f)]
|
|
78
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`d941f6b`](https://github.com/eea/volto-slate-metadata-mentions/commit/d941f6bcdf7154c8fac1a6e8c9436f2a0af1dfef)]
|
|
79
92
|
### [6.1.0](https://github.com/eea/volto-slate-metadata-mentions/compare/6.0.1...6.1.0) - 27 March 2023
|
|
80
93
|
|
|
81
94
|
#### :hammer_and_wrench: Others
|
|
82
95
|
|
|
83
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`eb5cef6`](https://github.com/eea/volto-slate-metadata-mentions/commit/eb5cef62bf50f5f100e4348f5642166168f7db3b)]
|
|
84
|
-
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`11d00a7`](https://github.com/eea/volto-slate-metadata-mentions/commit/11d00a7994b7ad7efaeb1d23582052be43abac1b)]
|
|
85
|
-
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`5293413`](https://github.com/eea/volto-slate-metadata-mentions/commit/5293413f9bbf28d304c3a26c5df9c6bca935ca04)]
|
|
86
96
|
- test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`fc0a308`](https://github.com/eea/volto-slate-metadata-mentions/commit/fc0a30840ee5cc4c3d00683800c510080b13cb09)]
|
|
87
|
-
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`abb75cd`](https://github.com/eea/volto-slate-metadata-mentions/commit/abb75cd923d258edd89cee3b5ef52e6232cf0a03)]
|
|
88
|
-
- yarn 3 [Alin Voinea - [`ae13d7b`](https://github.com/eea/volto-slate-metadata-mentions/commit/ae13d7b7e029da5765c8e85aede5f08c01131152)]
|
|
89
|
-
- Add Sonarqube tag using demo-kitkat-frontend addons list [EEA Jenkins - [`561f504`](https://github.com/eea/volto-slate-metadata-mentions/commit/561f5043e35499b2208d81358f3289a9199ce8dd)]
|
|
90
97
|
### [6.0.1](https://github.com/eea/volto-slate-metadata-mentions/compare/6.0.0...6.0.1) - 16 November 2022
|
|
91
98
|
|
|
92
99
|
#### :hammer_and_wrench: Others
|
|
@@ -101,47 +108,35 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
101
108
|
|
|
102
109
|
#### :hammer_and_wrench: Others
|
|
103
110
|
|
|
104
|
-
- Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`a684cac`](https://github.com/eea/volto-slate-metadata-mentions/commit/a684cac03f47b8d89bbf4b14ede23143e4b774a5)]
|
|
105
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`a30ae17`](https://github.com/eea/volto-slate-metadata-mentions/commit/a30ae17a70d891d20f6b73ea4a5c6576316894a2)]
|
|
106
111
|
### [5.0.1](https://github.com/eea/volto-slate-metadata-mentions/compare/5.0.0...5.0.1) - 30 June 2022
|
|
107
112
|
|
|
108
113
|
#### :hammer_and_wrench: Others
|
|
109
114
|
|
|
110
|
-
- Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`6d5c31f`](https://github.com/eea/volto-slate-metadata-mentions/commit/6d5c31f8217c9f5a52fc2447c5d89fafa717932d)]
|
|
111
115
|
## [5.0.0](https://github.com/eea/volto-slate-metadata-mentions/compare/4.0.3...5.0.0) - 6 April 2022
|
|
112
116
|
|
|
113
117
|
#### :hammer_and_wrench: Others
|
|
114
118
|
|
|
115
119
|
- Breaking 5.0.0 [Alin Voinea - [`9daf888`](https://github.com/eea/volto-slate-metadata-mentions/commit/9daf88800e0f375b9e7927540827c64c8f03c00e)]
|
|
116
|
-
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`c77d975`](https://github.com/eea/volto-slate-metadata-mentions/commit/c77d975b57d3982b360b8d0bc2d3aa4d64a41254)]
|
|
117
120
|
### [4.0.3](https://github.com/eea/volto-slate-metadata-mentions/compare/4.0.2...4.0.3) - 16 March 2022
|
|
118
121
|
|
|
119
122
|
#### :hammer_and_wrench: Others
|
|
120
123
|
|
|
121
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`80d1b4e`](https://github.com/eea/volto-slate-metadata-mentions/commit/80d1b4eafce60c03c5fb3698ef2375ee903c05d6)]
|
|
122
124
|
### [4.0.2](https://github.com/eea/volto-slate-metadata-mentions/compare/4.0.1...4.0.2) - 3 January 2022
|
|
123
125
|
|
|
124
126
|
### [4.0.1](https://github.com/eea/volto-slate-metadata-mentions/compare/4.0.0...4.0.1) - 18 December 2021
|
|
125
127
|
|
|
126
128
|
#### :hammer_and_wrench: Others
|
|
127
129
|
|
|
128
|
-
- Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`2de3bf6`](https://github.com/eea/volto-slate-metadata-mentions/commit/2de3bf624ff35504add94f5daf37484a8f459df7)]
|
|
129
130
|
- Refs #142010 - Optimize Volto-addons gitflow pipelines [valentinab25 - [`3a6a696`](https://github.com/eea/volto-slate-metadata-mentions/commit/3a6a69612652cd947d54f77c430bdca21b82a0df)]
|
|
130
|
-
- Add Sonarqube tag using industry-frontend addons list [EEA Jenkins - [`6e8fb49`](https://github.com/eea/volto-slate-metadata-mentions/commit/6e8fb492411d12c570ae75f00ee710818e5027f8)]
|
|
131
|
-
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`fc8fcc3`](https://github.com/eea/volto-slate-metadata-mentions/commit/fc8fcc35bf20e4a1c3b3bbc099e67045e3feea15)]
|
|
132
|
-
- Add Sonarqube tag using forests-frontend addons list [EEA Jenkins - [`9e0c360`](https://github.com/eea/volto-slate-metadata-mentions/commit/9e0c360b5e842d30f4cc09efe3e3f8f7d3bd351c)]
|
|
133
|
-
- Add Sonarqube tag using sustainability-frontend addons list [EEA Jenkins - [`e7404b9`](https://github.com/eea/volto-slate-metadata-mentions/commit/e7404b9f21415e894c149e5c8275bf74d0540c2c)]
|
|
134
131
|
## [4.0.0](https://github.com/eea/volto-slate-metadata-mentions/compare/3.0.2...4.0.0) - 24 September 2021
|
|
135
132
|
|
|
136
133
|
#### :hammer_and_wrench: Others
|
|
137
134
|
|
|
138
135
|
- Allow also dict fields: temporal, geolocation [Alin Voinea - [`49be384`](https://github.com/eea/volto-slate-metadata-mentions/commit/49be3845a5fed9957139ebe88d24adc44b2521d5)]
|
|
139
|
-
- Add Sonarqube tag using climate-energy-frontend addons list [EEA Jenkins - [`53de974`](https://github.com/eea/volto-slate-metadata-mentions/commit/53de9745893b04f14f4688c81e52a857a5fbe7b9)]
|
|
140
136
|
### [3.0.2](https://github.com/eea/volto-slate-metadata-mentions/compare/3.0.1...3.0.2) - 10 September 2021
|
|
141
137
|
|
|
142
138
|
#### :hammer_and_wrench: Others
|
|
143
139
|
|
|
144
|
-
- Add Sonarqube tag using ims-frontend addons list [EEA Jenkins - [`cc67fec`](https://github.com/eea/volto-slate-metadata-mentions/commit/cc67fec41698b99c1382b8be4a9aec4d14806d15)]
|
|
145
140
|
### [3.0.1](https://github.com/eea/volto-slate-metadata-mentions/compare/3.0.0...3.0.1) - 9 September 2021
|
|
146
141
|
|
|
147
142
|
## [3.0.0](https://github.com/eea/volto-slate-metadata-mentions/compare/2.4.0...3.0.0) - 3 September 2021
|
|
@@ -151,7 +146,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
151
146
|
- Update package metadata [Alin Voinea - [`af8c5b3`](https://github.com/eea/volto-slate-metadata-mentions/commit/af8c5b3bf2ce6d9520b3d9378c648a37d8d519d3)]
|
|
152
147
|
- Add ErrorBoundary to Widgets [Alin Voinea - [`f9c7e0d`](https://github.com/eea/volto-slate-metadata-mentions/commit/f9c7e0de20c13305e9dfe09a968753f44e3224ce)]
|
|
153
148
|
- Make sure it doesn't crash if used with SlateJSONField [Alin Voinea - [`60dbd38`](https://github.com/eea/volto-slate-metadata-mentions/commit/60dbd389f217b7341eb0c369abd044424357ab05)]
|
|
154
|
-
- Add Sonarqube tag using frontend addons list [EEA Jenkins - [`7c7f219`](https://github.com/eea/volto-slate-metadata-mentions/commit/7c7f2196bafde9bbb3ecead19d65ff109080e1f1)]
|
|
155
149
|
### [2.4.0](https://github.com/eea/volto-slate-metadata-mentions/compare/2.3.1...2.4.0) - 1 July 2021
|
|
156
150
|
|
|
157
151
|
### [2.3.1](https://github.com/eea/volto-slate-metadata-mentions/compare/2.3.0...2.3.1) - 1 July 2021
|
|
@@ -271,7 +265,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
271
265
|
- Cleanup [Alin Voinea - [`4edb16c`](https://github.com/eea/volto-slate-metadata-mentions/commit/4edb16c39bd1632a285aae1dc4b23bc3121b30af)]
|
|
272
266
|
- Remove unused uid normalizer [Alin Voinea - [`6006d90`](https://github.com/eea/volto-slate-metadata-mentions/commit/6006d9070ca8418c508f002032eca087c851b489)]
|
|
273
267
|
- Cosmetics [Alin Voinea - [`15424a4`](https://github.com/eea/volto-slate-metadata-mentions/commit/15424a48b14117a19c00167966a8fa15bcff8504)]
|
|
274
|
-
- yarn lint [Alin Voinea - [`45403b3`](https://github.com/eea/volto-slate-metadata-mentions/commit/45403b3962c2c995e22c8c40535098948f6f8d2b)]
|
|
275
268
|
- lint [Alin Voinea - [`9eedfe6`](https://github.com/eea/volto-slate-metadata-mentions/commit/9eedfe614e9202a2fd3d97c5d8cf53a52a43a3a4)]
|
|
276
269
|
- Update widgets to use children; lint [Alin Voinea - [`17b5eec`](https://github.com/eea/volto-slate-metadata-mentions/commit/17b5eecc0ce445c123fd57abbc14e045f4920370)]
|
|
277
270
|
- Style token widget [Alin Voinea - [`4fa52f5`](https://github.com/eea/volto-slate-metadata-mentions/commit/4fa52f5cc7cfde140e482048792c6f1782b4ee4e)]
|
package/Jenkinsfile
CHANGED
|
@@ -9,11 +9,12 @@ pipeline {
|
|
|
9
9
|
environment {
|
|
10
10
|
GIT_NAME = "volto-slate-metadata-mentions"
|
|
11
11
|
NAMESPACE = "@eeacms"
|
|
12
|
-
SONARQUBE_TAGS = "volto.eea.europa.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,climate-energy.eea.europa.eu,
|
|
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"
|
|
13
13
|
DEPENDENCIES = ""
|
|
14
14
|
BACKEND_PROFILES = "eea.kitkat:testing"
|
|
15
15
|
BACKEND_ADDONS = ""
|
|
16
|
-
VOLTO = "
|
|
16
|
+
VOLTO = "17"
|
|
17
|
+
VOLTO16_BREAKING_CHANGES = "no"
|
|
17
18
|
IMAGE_NAME = BUILD_TAG.toLowerCase()
|
|
18
19
|
}
|
|
19
20
|
|
|
@@ -44,6 +45,7 @@ pipeline {
|
|
|
44
45
|
}
|
|
45
46
|
steps {
|
|
46
47
|
script {
|
|
48
|
+
checkout scm
|
|
47
49
|
withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN')]) {
|
|
48
50
|
check_result = sh script: '''docker run --pull always -i --rm --name="$IMAGE_NAME-gitflow-check" -e GIT_TOKEN="$GITHUB_TOKEN" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_ORG="$GIT_ORG" -e GIT_NAME="$GIT_NAME" eeacms/gitflow /check_if_testing_needed.sh''', returnStatus: true
|
|
49
51
|
|
|
@@ -61,7 +63,6 @@ pipeline {
|
|
|
61
63
|
allOf {
|
|
62
64
|
not { environment name: 'CHANGE_ID', value: '' }
|
|
63
65
|
environment name: 'CHANGE_TARGET', value: 'develop'
|
|
64
|
-
environment name: 'SKIP_TESTS', value: ''
|
|
65
66
|
}
|
|
66
67
|
allOf {
|
|
67
68
|
environment name: 'CHANGE_ID', value: ''
|
|
@@ -69,25 +70,27 @@ pipeline {
|
|
|
69
70
|
not { changelog '.*^Automated release [0-9\\.]+$' }
|
|
70
71
|
branch 'master'
|
|
71
72
|
}
|
|
72
|
-
environment name: 'SKIP_TESTS', value: ''
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
parallel {
|
|
77
|
+
|
|
78
|
+
stage('Volto 17') {
|
|
79
|
+
agent { node { label 'docker-1.13'} }
|
|
80
|
+
stages {
|
|
81
|
+
stage('Build test image') {
|
|
82
|
+
steps {
|
|
83
|
+
sh '''docker build --pull --build-arg="VOLTO_VERSION=$VOLTO" --build-arg="ADDON_NAME=$NAMESPACE/$GIT_NAME" --build-arg="ADDON_PATH=$GIT_NAME" . -t $IMAGE_NAME-frontend'''
|
|
84
|
+
}
|
|
81
85
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
when {
|
|
86
|
+
|
|
87
|
+
stage('Fix code') {
|
|
88
|
+
when {
|
|
86
89
|
environment name: 'CHANGE_ID', value: ''
|
|
87
90
|
not { branch 'master' }
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
+
}
|
|
92
|
+
steps {
|
|
93
|
+
script {
|
|
91
94
|
fix_result = sh(script: '''docker run --name="$IMAGE_NAME-fix" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend ci-fix''', returnStatus: true)
|
|
92
95
|
sh '''docker cp $IMAGE_NAME-fix:/app/src/addons/$GIT_NAME/src .'''
|
|
93
96
|
sh '''docker rm -v $IMAGE_NAME-fix'''
|
|
@@ -105,31 +108,31 @@ pipeline {
|
|
|
105
108
|
sh '''exit 1'''
|
|
106
109
|
}
|
|
107
110
|
}
|
|
111
|
+
}
|
|
108
112
|
}
|
|
109
|
-
}
|
|
110
113
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
+
stage('ES lint') {
|
|
115
|
+
when { environment name: 'SKIP_TESTS', value: '' }
|
|
116
|
+
steps {
|
|
117
|
+
sh '''docker run --rm --name="$IMAGE_NAME-eslint" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend lint'''
|
|
118
|
+
}
|
|
114
119
|
}
|
|
115
|
-
}
|
|
116
120
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
121
|
+
stage('Style lint') {
|
|
122
|
+
when { environment name: 'SKIP_TESTS', value: '' }
|
|
123
|
+
steps {
|
|
124
|
+
sh '''docker run --rm --name="$IMAGE_NAME-stylelint" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend stylelint'''
|
|
125
|
+
}
|
|
120
126
|
}
|
|
121
|
-
}
|
|
122
127
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
128
|
+
stage('Prettier') {
|
|
129
|
+
when { environment name: 'SKIP_TESTS', value: '' }
|
|
130
|
+
steps {
|
|
131
|
+
sh '''docker run --rm --name="$IMAGE_NAME-prettier" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend prettier'''
|
|
132
|
+
}
|
|
126
133
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
stage('Coverage Tests') {
|
|
130
|
-
parallel {
|
|
131
|
-
|
|
132
|
-
stage('Unit tests') {
|
|
134
|
+
stage('Unit tests') {
|
|
135
|
+
when { environment name: 'SKIP_TESTS', value: '' }
|
|
133
136
|
steps {
|
|
134
137
|
script {
|
|
135
138
|
try {
|
|
@@ -155,17 +158,25 @@ pipeline {
|
|
|
155
158
|
}
|
|
156
159
|
}
|
|
157
160
|
}
|
|
158
|
-
|
|
161
|
+
}
|
|
159
162
|
|
|
160
|
-
|
|
163
|
+
stage('Integration tests') {
|
|
164
|
+
when { environment name: 'SKIP_TESTS', value: '' }
|
|
161
165
|
steps {
|
|
162
166
|
script {
|
|
163
167
|
try {
|
|
164
168
|
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'''
|
|
165
|
-
sh '''docker run -d --shm-size=
|
|
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
|
|
171
|
+
frontend = sh script:'''docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress make check-ci''', returnStatus: true
|
|
172
|
+
if ( frontend != 0 ) {
|
|
173
|
+
sh '''docker logs $IMAGE_NAME-cypress; exit 1'''
|
|
174
|
+
}
|
|
175
|
+
|
|
166
176
|
sh '''timeout -s 9 1800 docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress make cypress-ci'''
|
|
167
177
|
} finally {
|
|
168
178
|
try {
|
|
179
|
+
if ( frontend == 0 ) {
|
|
169
180
|
sh '''rm -rf cypress-videos cypress-results cypress-coverage cypress-screenshots'''
|
|
170
181
|
sh '''mkdir -p cypress-videos cypress-results cypress-coverage cypress-screenshots'''
|
|
171
182
|
videos = sh script: '''docker cp $IMAGE_NAME-cypress:/app/src/addons/$GIT_NAME/cypress/videos cypress-videos/''', returnStatus: true
|
|
@@ -189,6 +200,7 @@ pipeline {
|
|
|
189
200
|
sh '''for file in $(find cypress-results -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-videos/videos/$testname.mp4; fi; done'''
|
|
190
201
|
archiveArtifacts artifacts: 'cypress-videos/**/*.mp4', fingerprint: true, allowEmptyArchive: true
|
|
191
202
|
}
|
|
203
|
+
}
|
|
192
204
|
} finally {
|
|
193
205
|
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
|
|
194
206
|
junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true
|
|
@@ -204,16 +216,7 @@ pipeline {
|
|
|
204
216
|
}
|
|
205
217
|
}
|
|
206
218
|
}
|
|
207
|
-
}
|
|
208
219
|
}
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
post {
|
|
212
|
-
always {
|
|
213
|
-
sh script: "docker rmi $IMAGE_NAME-frontend", returnStatus: true
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
220
|
|
|
218
221
|
stage('Report to SonarQube') {
|
|
219
222
|
when {
|
|
@@ -221,9 +224,11 @@ pipeline {
|
|
|
221
224
|
allOf {
|
|
222
225
|
not { environment name: 'CHANGE_ID', value: '' }
|
|
223
226
|
environment name: 'CHANGE_TARGET', value: 'develop'
|
|
227
|
+
environment name: 'SKIP_TESTS', value: ''
|
|
224
228
|
}
|
|
225
229
|
allOf {
|
|
226
230
|
environment name: 'CHANGE_ID', value: ''
|
|
231
|
+
environment name: 'SKIP_TESTS', value: ''
|
|
227
232
|
anyOf {
|
|
228
233
|
allOf {
|
|
229
234
|
branch 'develop'
|
|
@@ -248,14 +253,107 @@ pipeline {
|
|
|
248
253
|
}
|
|
249
254
|
}
|
|
250
255
|
|
|
256
|
+
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
stage('Volto 16') {
|
|
261
|
+
agent { node { label 'integration'} }
|
|
262
|
+
when {
|
|
263
|
+
environment name: 'SKIP_TESTS', value: ''
|
|
264
|
+
not { environment name: 'VOLTO16_BREAKING_CHANGES', value: 'yes' }
|
|
265
|
+
}
|
|
266
|
+
stages {
|
|
267
|
+
stage('Build test image') {
|
|
268
|
+
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'''
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
stage('Unit tests Volto 16') {
|
|
274
|
+
steps {
|
|
275
|
+
script {
|
|
276
|
+
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/'''
|
|
281
|
+
} finally {
|
|
282
|
+
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
|
|
283
|
+
junit testResults: 'xunit-reports16/junit.xml', allowEmptyResults: true
|
|
284
|
+
}
|
|
285
|
+
sh script: '''docker rm -v $IMAGE_NAME-volto16''', returnStatus: true
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
stage('Integration tests Volto 16') {
|
|
292
|
+
steps {
|
|
293
|
+
script {
|
|
294
|
+
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
|
|
298
|
+
if ( frontend != 0 ) {
|
|
299
|
+
sh '''docker logs $IMAGE_NAME-cypress16; exit 1'''
|
|
300
|
+
}
|
|
301
|
+
sh '''timeout -s 9 1800 docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress16 make cypress-ci'''
|
|
302
|
+
} finally {
|
|
303
|
+
try {
|
|
304
|
+
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
|
|
310
|
+
|
|
311
|
+
archiveArtifacts artifacts: 'cypress-screenshots16/**', fingerprint: true, allowEmptyArchive: true
|
|
312
|
+
|
|
313
|
+
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
|
+
}
|
|
317
|
+
}
|
|
318
|
+
} finally {
|
|
319
|
+
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
|
|
320
|
+
junit testResults: 'cypress-results16/**/*.xml', allowEmptyResults: true
|
|
321
|
+
}
|
|
322
|
+
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
|
|
323
|
+
sh '''docker logs $IMAGE_NAME-cypress16'''
|
|
324
|
+
}
|
|
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
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
post {
|
|
339
|
+
always {
|
|
340
|
+
sh script: "docker rmi $IMAGE_NAME-frontend", returnStatus: true
|
|
341
|
+
sh script: "docker rmi $IMAGE_NAME-frontend16", returnStatus: true
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
|
|
251
347
|
stage('SonarQube compare to master') {
|
|
252
348
|
when {
|
|
253
349
|
anyOf {
|
|
254
350
|
allOf {
|
|
255
351
|
not { environment name: 'CHANGE_ID', value: '' }
|
|
256
352
|
environment name: 'CHANGE_TARGET', value: 'develop'
|
|
353
|
+
environment name: 'SKIP_TESTS', value: ''
|
|
257
354
|
}
|
|
258
355
|
allOf {
|
|
356
|
+
environment name: 'SKIP_TESTS', value: ''
|
|
259
357
|
environment name: 'CHANGE_ID', value: ''
|
|
260
358
|
branch 'develop'
|
|
261
359
|
not { changelog '.*^Automated release [0-9\\.]+$' }
|
|
@@ -316,3 +414,4 @@ pipeline {
|
|
|
316
414
|
}
|
|
317
415
|
}
|
|
318
416
|
}
|
|
417
|
+
|
package/Makefile
CHANGED
|
@@ -46,7 +46,7 @@ endif
|
|
|
46
46
|
DIR=$(shell basename $$(pwd))
|
|
47
47
|
NODE_MODULES?="../../../node_modules"
|
|
48
48
|
PLONE_VERSION?=6
|
|
49
|
-
VOLTO_VERSION?=
|
|
49
|
+
VOLTO_VERSION?=17
|
|
50
50
|
ADDON_PATH="${DIR}"
|
|
51
51
|
ADDON_NAME="@eeacms/${ADDON_PATH}"
|
|
52
52
|
DOCKER_COMPOSE=PLONE_VERSION=${PLONE_VERSION} VOLTO_VERSION=${VOLTO_VERSION} ADDON_NAME=${ADDON_NAME} ADDON_PATH=${ADDON_PATH} docker compose
|
|
@@ -86,7 +86,7 @@ cypress-open: ## Open cypress integration tests
|
|
|
86
86
|
|
|
87
87
|
.PHONY: cypress-run
|
|
88
88
|
cypress-run: ## Run cypress integration tests
|
|
89
|
-
CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run
|
|
89
|
+
CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run
|
|
90
90
|
|
|
91
91
|
.PHONY: test
|
|
92
92
|
test: ## Run jest tests
|
|
@@ -98,7 +98,7 @@ test-update: ## Update jest tests snapshots
|
|
|
98
98
|
|
|
99
99
|
.PHONY: stylelint
|
|
100
100
|
stylelint: ## Stylelint
|
|
101
|
-
$(NODE_MODULES)
|
|
101
|
+
$(NODE_MODULES)/.bin/stylelint --allow-empty-input 'src/**/*.{css,less}'
|
|
102
102
|
|
|
103
103
|
.PHONY: stylelint-overrides
|
|
104
104
|
stylelint-overrides:
|
|
@@ -106,7 +106,7 @@ stylelint-overrides:
|
|
|
106
106
|
|
|
107
107
|
.PHONY: stylelint-fix
|
|
108
108
|
stylelint-fix: ## Fix stylelint
|
|
109
|
-
$(NODE_MODULES)
|
|
109
|
+
$(NODE_MODULES)/.bin/stylelint --allow-empty-input 'src/**/*.{css,less}' --fix
|
|
110
110
|
$(NODE_MODULES)/.bin/stylelint --custom-syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides' --fix
|
|
111
111
|
|
|
112
112
|
.PHONY: prettier
|
|
@@ -119,11 +119,11 @@ prettier-fix: ## Fix prettier
|
|
|
119
119
|
|
|
120
120
|
.PHONY: lint
|
|
121
121
|
lint: ## ES Lint
|
|
122
|
-
$(NODE_MODULES)
|
|
122
|
+
$(NODE_MODULES)/.bin/eslint --max-warnings=0 'src/**/*.{js,jsx}'
|
|
123
123
|
|
|
124
124
|
.PHONY: lint-fix
|
|
125
125
|
lint-fix: ## Fix ES Lint
|
|
126
|
-
$(NODE_MODULES)
|
|
126
|
+
$(NODE_MODULES)/.bin/eslint --fix 'src/**/*.{js,jsx}'
|
|
127
127
|
|
|
128
128
|
.PHONY: i18n
|
|
129
129
|
i18n: ## i18n
|
|
@@ -155,8 +155,11 @@ start-ci:
|
|
|
155
155
|
cd ../..
|
|
156
156
|
yarn start
|
|
157
157
|
|
|
158
|
+
.PHONY: check-ci
|
|
159
|
+
check-ci:
|
|
160
|
+
$(NODE_MODULES)/.bin/wait-on -t 240000 http://localhost:3000
|
|
161
|
+
|
|
158
162
|
.PHONY: cypress-ci
|
|
159
163
|
cypress-ci:
|
|
160
164
|
$(NODE_MODULES)/.bin/wait-on -t 240000 http://localhost:3000
|
|
161
|
-
NODE_ENV=development
|
|
162
|
-
|
|
165
|
+
CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run --browser chromium
|
|
@@ -68,8 +68,7 @@ Cypress.Commands.add(
|
|
|
68
68
|
id: contentId,
|
|
69
69
|
title: contentTitle,
|
|
70
70
|
image: {
|
|
71
|
-
data:
|
|
72
|
-
'iVBORw0KGgoAAAANSUhEUgAAANcAAAA4CAMAAABZsZ3QAAAAM1BMVEX29fK42OU+oMvn7u9drtIPisHI4OhstdWZyt4fkcXX5+sAg74umMhNp86p0eJ7vNiKw9v/UV4wAAAAAXRSTlMAQObYZgAABBxJREFUeF7tmuty4yAMhZG4X2zn/Z92J5tsBJwWXG/i3XR6frW2Y/SBLIRAfaQUDNt8E5tLUt9BycfcKfq3R6Mlfyimtx4rzp+K3dtibXkor99zsEqLYZltblTecciogoh+TXfY1Ve4dn07rCDGG9dHSEEOg/GmXl0U1XDxTKxNK5De7BxsyyBr6gGm2/vPxKJ8F6f7BXKfRMp1xIWK9A+5ks25alSb353dWnDJN1k35EL5f8dVGifTf/4tjUuuFq7u4srmXC60yAmldLXIWbg65RKU87lcGxJCFqUPv0IacW0PmSivOZFLE908inPToMmii/roG+MRV/O8FU88i8tFsxV3a06MFUw0Qu7RmAtdV5/HVVaOVMTWNOWSwMljLhzhcB6XIS7OK5V6AvRDNN7t5VJWQs1J40UmalbK56usBG/CuCHSYuc+rkUGeMCViNRARPrzW52N3oQLe6WifNliSuuGaH3czbVNudI9s7ZLUCLHVwWlyES522o1t14uvmbblmVTKqFjaZYJFSTPP4dLL1kU1z7p0lzdbRulmEWLxoQX+z9ce7A8GqEEucllLxePuZwdJl1Lezu0hoswvTPt61DrFcRuujV/2cmlxaGBC7Aw6cpovGANwRiSdOAWJ5AGy4gLL64dl0QhUEAuEUNws+XxV+OKGPdw/hESGYF9XEGaFC7sNLMSXWJjHsnanYi87VK428N2uxpOjOFANcagLM5l+7mSycM8KknZpKLcGi6jmzWGr/vLurZ/0g4u9AZuAoeb5r1ceQhyiTPY1E4wUR6u/F3H2ojSpXMMriBPT9cezTto8Cx+MsglHL4fv1Rxrb1LVw9yvyQpJ3AhFnLZfuRLH2QsOG3FGGD20X/th/u5bFAt16Bt308KjF+MNOXgl/SquIEySX3GhaZvc67KZbDxcCDORz2N8yCWPaY5lyQZO7lQ29fnZbt3Xu6qoge4+DjXl/MocySPOp9rlvdyznahRyHEYd77v3LhugOXDv4J65QXfl803BDAdaWBEDhfVx7nKofjoVCgxnUAqw/UAUDPn788BDvQuG4TDtdtUPvzjSlXAB8DvaDOhhrmhwbywylXAm8CvaouikJTL93gs3y7Yy4VYbIxOHrcMizPqWOjqO9l3Uz52kibQy4xxOgqhJvD+w5rvokOcAlGvNCfeqCv1ste1stzLm0f71Iq3ZfTrPfuE5nhPtF+LvQE2lffQC7pYtQy3tdzdrKvd5TLVVzDetScS3nEKmmwDyt1Cev1kX3YfbvzNK4fzrlw+cB6vm+uiUgf2zdXI62241LawCb7Pi5FXFPF8KpzDoF/Sw2lg+GrHNbno1mhPu+VCF/vfMnw06PnUl6j48dVHD3jHNHPua+fc3o/5yp/zsGi0vYtzi3Pz5mHd4T6BWMIlewacd63AAAAAElFTkSuQmCC',
|
|
71
|
+
data: 'iVBORw0KGgoAAAANSUhEUgAAANcAAAA4CAMAAABZsZ3QAAAAM1BMVEX29fK42OU+oMvn7u9drtIPisHI4OhstdWZyt4fkcXX5+sAg74umMhNp86p0eJ7vNiKw9v/UV4wAAAAAXRSTlMAQObYZgAABBxJREFUeF7tmuty4yAMhZG4X2zn/Z92J5tsBJwWXG/i3XR6frW2Y/SBLIRAfaQUDNt8E5tLUt9BycfcKfq3R6Mlfyimtx4rzp+K3dtibXkor99zsEqLYZltblTecciogoh+TXfY1Ve4dn07rCDGG9dHSEEOg/GmXl0U1XDxTKxNK5De7BxsyyBr6gGm2/vPxKJ8F6f7BXKfRMp1xIWK9A+5ks25alSb353dWnDJN1k35EL5f8dVGifTf/4tjUuuFq7u4srmXC60yAmldLXIWbg65RKU87lcGxJCFqUPv0IacW0PmSivOZFLE908inPToMmii/roG+MRV/O8FU88i8tFsxV3a06MFUw0Qu7RmAtdV5/HVVaOVMTWNOWSwMljLhzhcB6XIS7OK5V6AvRDNN7t5VJWQs1J40UmalbK56usBG/CuCHSYuc+rkUGeMCViNRARPrzW52N3oQLe6WifNliSuuGaH3czbVNudI9s7ZLUCLHVwWlyES522o1t14uvmbblmVTKqFjaZYJFSTPP4dLL1kU1z7p0lzdbRulmEWLxoQX+z9ce7A8GqEEucllLxePuZwdJl1Lezu0hoswvTPt61DrFcRuujV/2cmlxaGBC7Aw6cpovGANwRiSdOAWJ5AGy4gLL64dl0QhUEAuEUNws+XxV+OKGPdw/hESGYF9XEGaFC7sNLMSXWJjHsnanYi87VK428N2uxpOjOFANcagLM5l+7mSycM8KknZpKLcGi6jmzWGr/vLurZ/0g4u9AZuAoeb5r1ceQhyiTPY1E4wUR6u/F3H2ojSpXMMriBPT9cezTto8Cx+MsglHL4fv1Rxrb1LVw9yvyQpJ3AhFnLZfuRLH2QsOG3FGGD20X/th/u5bFAt16Bt308KjF+MNOXgl/SquIEySX3GhaZvc67KZbDxcCDORz2N8yCWPaY5lyQZO7lQ29fnZbt3Xu6qoge4+DjXl/MocySPOp9rlvdyznahRyHEYd77v3LhugOXDv4J65QXfl803BDAdaWBEDhfVx7nKofjoVCgxnUAqw/UAUDPn788BDvQuG4TDtdtUPvzjSlXAB8DvaDOhhrmhwbywylXAm8CvaouikJTL93gs3y7Yy4VYbIxOHrcMizPqWOjqO9l3Uz52kibQy4xxOgqhJvD+w5rvokOcAlGvNCfeqCv1ste1stzLm0f71Iq3ZfTrPfuE5nhPtF+LvQE2lffQC7pYtQy3tdzdrKvd5TLVVzDetScS3nEKmmwDyt1Cev1kX3YfbvzNK4fzrlw+cB6vm+uiUgf2zdXI62241LawCb7Pi5FXFPF8KpzDoF/Sw2lg+GrHNbno1mhPu+VCF/vfMnw06PnUl6j48dVHD3jHNHPua+fc3o/5yp/zsGi0vYtzi3Pz5mHd4T6BWMIlewacd63AAAAAElFTkSuQmCC',
|
|
73
72
|
encoding: 'base64',
|
|
74
73
|
filename: 'image.png',
|
|
75
74
|
'content-type': 'image/png',
|
|
@@ -409,10 +408,6 @@ Cypress.Commands.add('toolbarSave', () => {
|
|
|
409
408
|
|
|
410
409
|
// Save
|
|
411
410
|
cy.get('#toolbar-save').click();
|
|
412
|
-
cy.waitForResourceToLoad('@navigation');
|
|
413
|
-
cy.waitForResourceToLoad('@breadcrumbs');
|
|
414
|
-
cy.waitForResourceToLoad('@actions');
|
|
415
|
-
cy.waitForResourceToLoad('@types');
|
|
416
411
|
cy.waitForResourceToLoad('my-page');
|
|
417
412
|
cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page');
|
|
418
413
|
});
|
package/cypress/support/e2e.js
CHANGED
|
@@ -35,10 +35,6 @@ export const slateBeforeEach = (contentType = 'Document') => {
|
|
|
35
35
|
path: 'cypress',
|
|
36
36
|
});
|
|
37
37
|
cy.visit('/cypress/my-page');
|
|
38
|
-
cy.waitForResourceToLoad('@navigation');
|
|
39
|
-
cy.waitForResourceToLoad('@breadcrumbs');
|
|
40
|
-
cy.waitForResourceToLoad('@actions');
|
|
41
|
-
cy.waitForResourceToLoad('@types');
|
|
42
38
|
cy.waitForResourceToLoad('my-page');
|
|
43
39
|
cy.navigate('/cypress/my-page/edit');
|
|
44
40
|
};
|
package/jest-addon.config.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require('dotenv').config({ path: __dirname + '/.env' })
|
|
2
|
+
|
|
1
3
|
module.exports = {
|
|
2
4
|
testMatch: ['**/src/addons/**/?(*.)+(spec|test).[jt]s?(x)'],
|
|
3
5
|
collectCoverageFrom: [
|
|
@@ -9,18 +11,26 @@ module.exports = {
|
|
|
9
11
|
'@plone/volto/cypress': '<rootDir>/node_modules/@plone/volto/cypress',
|
|
10
12
|
'@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
|
|
11
13
|
'@plone/volto/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
|
|
12
|
-
'@package/(.*)$': '<rootDir>/src/$1',
|
|
13
|
-
'@root/(.*)$': '<rootDir>/src/$1',
|
|
14
|
+
'@package/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
|
|
15
|
+
'@root/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
|
|
14
16
|
'@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
|
|
17
|
+
'@eeacms/search/(.*)$': '<rootDir>/src/addons/volto-searchlib/searchlib/$1',
|
|
18
|
+
'@eeacms/search': '<rootDir>/src/addons/volto-searchlib/searchlib',
|
|
15
19
|
'@eeacms/(.*?)/(.*)$': '<rootDir>/node_modules/@eeacms/$1/src/$2',
|
|
16
|
-
'@plone/volto-slate':
|
|
20
|
+
'@plone/volto-slate$':
|
|
17
21
|
'<rootDir>/node_modules/@plone/volto/packages/volto-slate/src',
|
|
22
|
+
'@plone/volto-slate/(.*)$':
|
|
23
|
+
'<rootDir>/node_modules/@plone/volto/packages/volto-slate/src/$1',
|
|
18
24
|
'~/(.*)$': '<rootDir>/src/$1',
|
|
19
25
|
'load-volto-addons':
|
|
20
26
|
'<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
|
|
21
27
|
},
|
|
28
|
+
transformIgnorePatterns: [
|
|
29
|
+
'/node_modules/(?!(@plone|@root|@package|@eeacms)/).*/',
|
|
30
|
+
],
|
|
22
31
|
transform: {
|
|
23
32
|
'^.+\\.js(x)?$': 'babel-jest',
|
|
33
|
+
'^.+\\.ts(x)?$': 'babel-jest',
|
|
24
34
|
'^.+\\.(png)$': 'jest-file',
|
|
25
35
|
'^.+\\.(jpg)$': 'jest-file',
|
|
26
36
|
'^.+\\.(svg)$': './node_modules/@plone/volto/jest-svgsystem-transform.js',
|
|
@@ -33,4 +43,9 @@ module.exports = {
|
|
|
33
43
|
statements: 5,
|
|
34
44
|
},
|
|
35
45
|
},
|
|
36
|
-
|
|
46
|
+
...(process.env.JEST_USE_SETUP === 'ON' && {
|
|
47
|
+
setupFilesAfterEnv: [
|
|
48
|
+
'<rootDir>/node_modules/@eeacms/volto-slate-metadata-mentions/jest.setup.js',
|
|
49
|
+
],
|
|
50
|
+
}),
|
|
51
|
+
}
|
package/jest.setup.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
import configureStore from 'redux-mock-store';
|
|
3
|
+
import thunk from 'redux-thunk';
|
|
4
|
+
import { blocksConfig } from '@plone/volto/config/Blocks';
|
|
5
|
+
import installSlate from '@plone/volto-slate/index';
|
|
6
|
+
|
|
7
|
+
var mockSemanticComponents = jest.requireActual('semantic-ui-react');
|
|
8
|
+
var mockComponents = jest.requireActual('@plone/volto/components');
|
|
9
|
+
var config = jest.requireActual('@plone/volto/registry').default;
|
|
10
|
+
|
|
11
|
+
config.blocks.blocksConfig = {
|
|
12
|
+
...blocksConfig,
|
|
13
|
+
...config.blocks.blocksConfig,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
jest.doMock('semantic-ui-react', () => ({
|
|
17
|
+
__esModule: true,
|
|
18
|
+
...mockSemanticComponents,
|
|
19
|
+
Popup: ({ content, trigger }) => {
|
|
20
|
+
return (
|
|
21
|
+
<div className="popup">
|
|
22
|
+
<div className="trigger">{trigger}</div>
|
|
23
|
+
<div className="content">{content}</div>
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
},
|
|
27
|
+
}));
|
|
28
|
+
|
|
29
|
+
jest.doMock('@plone/volto/components', () => {
|
|
30
|
+
return {
|
|
31
|
+
__esModule: true,
|
|
32
|
+
...mockComponents,
|
|
33
|
+
SidebarPortal: ({ children }) => <div id="sidebar">{children}</div>,
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
jest.doMock('@plone/volto/registry', () =>
|
|
38
|
+
[installSlate].reduce((acc, apply) => apply(acc), config),
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const mockStore = configureStore([thunk]);
|
|
42
|
+
|
|
43
|
+
global.fetch = jest.fn(() =>
|
|
44
|
+
Promise.resolve({
|
|
45
|
+
json: () => Promise.resolve({}),
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
global.store = mockStore({
|
|
50
|
+
intl: {
|
|
51
|
+
locale: 'en',
|
|
52
|
+
messages: {},
|
|
53
|
+
formatMessage: jest.fn(),
|
|
54
|
+
},
|
|
55
|
+
content: {
|
|
56
|
+
create: {},
|
|
57
|
+
subrequests: [],
|
|
58
|
+
},
|
|
59
|
+
connected_data_parameters: {},
|
|
60
|
+
screen: {
|
|
61
|
+
page: {
|
|
62
|
+
width: 768,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eeacms/volto-slate-metadata-mentions",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.1.0",
|
|
4
4
|
"description": "Volto Slate Metadata Mentions Plugin",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "European Environment Agency: IDM2 A-Team",
|
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
"@cypress/code-coverage": "^3.10.0",
|
|
23
23
|
"@plone/scripts": "*",
|
|
24
24
|
"babel-plugin-transform-class-properties": "^6.24.1",
|
|
25
|
+
"cypress": "13.1.0",
|
|
26
|
+
"dotenv": "^16.3.2",
|
|
25
27
|
"husky": "^8.0.3",
|
|
26
28
|
"lint-staged": "^14.0.1",
|
|
27
29
|
"md5": "^2.3.0"
|
|
@@ -10,7 +10,16 @@ import { setPluginOptions } from '@plone/volto-slate/actions';
|
|
|
10
10
|
import { MentionSchema } from './schema';
|
|
11
11
|
import { getMentionWidget } from './utils';
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
import { defineMessages, useIntl } from 'react-intl';
|
|
14
|
+
|
|
15
|
+
const messages = defineMessages({
|
|
16
|
+
metadataValue: {
|
|
17
|
+
id: 'Metadata value',
|
|
18
|
+
defaultMessage: 'Metadata value',
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const MentionEditor = (props) => {
|
|
14
23
|
const {
|
|
15
24
|
editor,
|
|
16
25
|
pluginId,
|
|
@@ -26,6 +35,8 @@ export default (props) => {
|
|
|
26
35
|
(state) => state?.schema?.schema?.properties || {},
|
|
27
36
|
);
|
|
28
37
|
|
|
38
|
+
const intl = useIntl();
|
|
39
|
+
|
|
29
40
|
const pid = `${editor.uid}-${pluginId}`;
|
|
30
41
|
|
|
31
42
|
// Get formData
|
|
@@ -38,12 +49,14 @@ export default (props) => {
|
|
|
38
49
|
|
|
39
50
|
const dispatch = useDispatch();
|
|
40
51
|
const [formData, setFormData] = React.useState({});
|
|
41
|
-
const [editSchema, setEditSchema] = React.useState(MentionSchema);
|
|
42
52
|
|
|
43
53
|
const active = getActiveElement(editor);
|
|
44
54
|
const [elementNode] = active;
|
|
45
55
|
const isElement = isActiveElement(editor);
|
|
46
56
|
const id = elementNode?.data?.metadata || elementNode?.data?.id;
|
|
57
|
+
const [editSchema, setEditSchema] = React.useState(
|
|
58
|
+
MentionSchema({ metadata: id, intl }),
|
|
59
|
+
);
|
|
47
60
|
|
|
48
61
|
// Update the form data based on the current footnote
|
|
49
62
|
const elRef = React.useRef(null);
|
|
@@ -71,6 +84,7 @@ export default (props) => {
|
|
|
71
84
|
insertElement(editor, {
|
|
72
85
|
metadata: formData?.metadata,
|
|
73
86
|
widget: formData?.widget,
|
|
87
|
+
...formData,
|
|
74
88
|
});
|
|
75
89
|
|
|
76
90
|
// Update document metadata
|
|
@@ -96,20 +110,22 @@ export default (props) => {
|
|
|
96
110
|
const extendedFields = metaId ? [metaId] : [];
|
|
97
111
|
const extendedProperties = metaId ? { [metaId]: properties[metaId] } : {};
|
|
98
112
|
|
|
113
|
+
const baseSchema = MentionSchema({ metadata: metaId, intl });
|
|
114
|
+
|
|
99
115
|
setEditSchema({
|
|
100
|
-
...
|
|
116
|
+
...baseSchema,
|
|
101
117
|
fieldsets: [
|
|
102
|
-
...
|
|
118
|
+
...baseSchema.fieldsets,
|
|
103
119
|
{
|
|
104
120
|
id: 'metadata',
|
|
105
|
-
title:
|
|
121
|
+
title: intl.formatMessage(messages.metadataValue),
|
|
106
122
|
fields: extendedFields,
|
|
107
123
|
},
|
|
108
124
|
],
|
|
109
125
|
properties: {
|
|
110
|
-
...
|
|
126
|
+
...baseSchema.properties,
|
|
111
127
|
metadata: {
|
|
112
|
-
...
|
|
128
|
+
...baseSchema.properties.metadata,
|
|
113
129
|
choices: Object.keys(properties)
|
|
114
130
|
.map((key) => {
|
|
115
131
|
const val = properties[key];
|
|
@@ -121,12 +137,11 @@ export default (props) => {
|
|
|
121
137
|
},
|
|
122
138
|
});
|
|
123
139
|
},
|
|
124
|
-
[properties],
|
|
140
|
+
[properties, intl],
|
|
125
141
|
);
|
|
126
142
|
|
|
127
143
|
React.useEffect(() => {
|
|
128
|
-
|
|
129
|
-
updateSchema(metaId);
|
|
144
|
+
updateSchema(id);
|
|
130
145
|
}, [updateSchema, id]);
|
|
131
146
|
|
|
132
147
|
const onChangeValues = React.useCallback(
|
|
@@ -193,3 +208,5 @@ export default (props) => {
|
|
|
193
208
|
/>
|
|
194
209
|
);
|
|
195
210
|
};
|
|
211
|
+
|
|
212
|
+
export default MentionEditor;
|
|
@@ -40,7 +40,7 @@ const btnFactory = (options) => (props) => (
|
|
|
40
40
|
<ToolbarButton {...props} {...options} title="Metadata" />
|
|
41
41
|
);
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
const applyConfig = (config) => {
|
|
44
44
|
const opts = {
|
|
45
45
|
title: 'Metadata',
|
|
46
46
|
pluginId: MENTION,
|
|
@@ -54,9 +54,8 @@ export default (config) => {
|
|
|
54
54
|
toolbarButtonIcon: mentionsSVG,
|
|
55
55
|
messages,
|
|
56
56
|
};
|
|
57
|
-
const [installMentionsEditor, , , pluginOptions] =
|
|
58
|
-
opts
|
|
59
|
-
);
|
|
57
|
+
const [installMentionsEditor, , , pluginOptions] =
|
|
58
|
+
makeInlineElementPlugin(opts);
|
|
60
59
|
config = installMentionsEditor(config);
|
|
61
60
|
|
|
62
61
|
const { slate } = config.settings;
|
|
@@ -71,3 +70,5 @@ export default (config) => {
|
|
|
71
70
|
|
|
72
71
|
return config;
|
|
73
72
|
};
|
|
73
|
+
|
|
74
|
+
export default applyConfig;
|
|
@@ -6,6 +6,18 @@ import { Popup, PopupContent } from 'semantic-ui-react';
|
|
|
6
6
|
import { useEditorContext } from '@plone/volto-slate/hooks';
|
|
7
7
|
import ErrorBoundary from './ErrorBoundary';
|
|
8
8
|
|
|
9
|
+
import { ConditionalLink } from '@plone/volto/components';
|
|
10
|
+
|
|
11
|
+
import { flattenToAppURL } from '@plone/volto/helpers';
|
|
12
|
+
import { defineMessages, useIntl } from 'react-intl';
|
|
13
|
+
|
|
14
|
+
const messages = defineMessages({
|
|
15
|
+
downloadImage: {
|
|
16
|
+
id: 'Download image {title}',
|
|
17
|
+
defaultMessage: 'Download image {title}',
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
9
21
|
export const MentionElement = ({
|
|
10
22
|
attributes,
|
|
11
23
|
children,
|
|
@@ -19,7 +31,9 @@ export const MentionElement = ({
|
|
|
19
31
|
let metadata = { ...(extras?.metadata || initialFormData) };
|
|
20
32
|
const id = data?.metadata || data?.id;
|
|
21
33
|
|
|
22
|
-
|
|
34
|
+
const intl = useIntl();
|
|
35
|
+
|
|
36
|
+
// Get data from the editor, if it exists. The editor has up-to-date block
|
|
23
37
|
// props
|
|
24
38
|
const editor = useEditorContext();
|
|
25
39
|
|
|
@@ -27,12 +41,11 @@ export const MentionElement = ({
|
|
|
27
41
|
const blockProps = editor.getBlockProps();
|
|
28
42
|
metadata = blockProps.metadata || blockProps.properties || {};
|
|
29
43
|
}
|
|
30
|
-
|
|
31
44
|
let output = metadata[id];
|
|
32
45
|
let Widget = views.getWidget(data);
|
|
33
46
|
let className = 'metadata mention ' + id;
|
|
34
47
|
|
|
35
|
-
// If edit mode and output is empty render
|
|
48
|
+
// If edit mode and output is empty render its id
|
|
36
49
|
if (editor && !output) {
|
|
37
50
|
className += ' empty';
|
|
38
51
|
output = id;
|
|
@@ -43,9 +56,19 @@ export const MentionElement = ({
|
|
|
43
56
|
<>
|
|
44
57
|
{mode === 'view' ? (
|
|
45
58
|
<ErrorBoundary name={id}>
|
|
46
|
-
<
|
|
47
|
-
{(
|
|
48
|
-
|
|
59
|
+
<ConditionalLink
|
|
60
|
+
aria-label={intl.formatMessage(messages.downloadImage, {
|
|
61
|
+
title: metadata.title,
|
|
62
|
+
})}
|
|
63
|
+
to={`${flattenToAppURL(metadata['@id'])}/@@download/image/${
|
|
64
|
+
metadata.id
|
|
65
|
+
}`}
|
|
66
|
+
condition={data.addLinkToDownload !== false}
|
|
67
|
+
>
|
|
68
|
+
<Widget value={output} className={className}>
|
|
69
|
+
{(child) => wrapInlineMarkupText(children, (_c) => child)}
|
|
70
|
+
</Widget>
|
|
71
|
+
</ConditionalLink>
|
|
49
72
|
</ErrorBoundary>
|
|
50
73
|
) : (
|
|
51
74
|
<Popup
|
|
@@ -1,25 +1,75 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
['title', 'Title'],
|
|
16
|
-
['description', 'Description'],
|
|
17
|
-
],
|
|
18
|
-
},
|
|
19
|
-
widget: {
|
|
20
|
-
title: 'Display',
|
|
21
|
-
type: 'string',
|
|
22
|
-
},
|
|
1
|
+
import { defineMessages } from 'react-intl';
|
|
2
|
+
|
|
3
|
+
const messages = defineMessages({
|
|
4
|
+
default: {
|
|
5
|
+
id: 'Default',
|
|
6
|
+
defaultMessage: 'Default',
|
|
7
|
+
},
|
|
8
|
+
title: {
|
|
9
|
+
id: 'Metadata entry',
|
|
10
|
+
defaultMessage: 'Metadata entry',
|
|
11
|
+
},
|
|
12
|
+
metadata: {
|
|
13
|
+
id: 'Metadata',
|
|
14
|
+
defaultMessage: 'Metadata',
|
|
23
15
|
},
|
|
24
|
-
|
|
16
|
+
metadataDescription: {
|
|
17
|
+
id: 'Select metadata to be used',
|
|
18
|
+
defaultMessage: 'Select metadata to be used',
|
|
19
|
+
},
|
|
20
|
+
display: {
|
|
21
|
+
id: 'Display',
|
|
22
|
+
defaultMessage: 'Display',
|
|
23
|
+
},
|
|
24
|
+
addLinkToDownload: {
|
|
25
|
+
id: 'Add link to download',
|
|
26
|
+
defaultMessage: 'Add link to download',
|
|
27
|
+
},
|
|
28
|
+
addLinkToDownloadDescription: {
|
|
29
|
+
id: 'Wrap image in a link to download the original image',
|
|
30
|
+
defaultMessage: 'Wrap image in a link to download the original image',
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export const MentionSchema = function ({ metadata, intl }) {
|
|
35
|
+
return {
|
|
36
|
+
title: intl.formatMessage(messages.title),
|
|
37
|
+
fieldsets: [
|
|
38
|
+
{
|
|
39
|
+
id: 'default',
|
|
40
|
+
title: intl.formatMessage(messages.default),
|
|
41
|
+
fields: [
|
|
42
|
+
'metadata',
|
|
43
|
+
'widget',
|
|
44
|
+
...(metadata === 'image' ? ['addLinkToDownload'] : []),
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
properties: {
|
|
49
|
+
metadata: {
|
|
50
|
+
title: intl.formatMessage(messages.metadata),
|
|
51
|
+
description: intl.formatMessage(messages.metadataDescription),
|
|
52
|
+
choices: [
|
|
53
|
+
['title', 'Title'],
|
|
54
|
+
['description', 'Description'],
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
widget: {
|
|
58
|
+
title: intl.formatMessage(messages.display),
|
|
59
|
+
type: 'string',
|
|
60
|
+
},
|
|
61
|
+
...(metadata === 'image'
|
|
62
|
+
? {
|
|
63
|
+
addLinkToDownload: {
|
|
64
|
+
title: intl.formatMessage(messages.addLinkToDownload),
|
|
65
|
+
description: intl.formatMessage(
|
|
66
|
+
messages.addLinkToDownloadDescription,
|
|
67
|
+
),
|
|
68
|
+
type: 'boolean',
|
|
69
|
+
},
|
|
70
|
+
}
|
|
71
|
+
: {}),
|
|
72
|
+
},
|
|
73
|
+
required: ['metadata'],
|
|
74
|
+
};
|
|
25
75
|
};
|
package/.project.eslintrc.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
const projectRootPath = fs.existsSync('./project')
|
|
5
|
-
? fs.realpathSync('./project')
|
|
6
|
-
: fs.realpathSync('./../../../');
|
|
7
|
-
const packageJson = require(path.join(projectRootPath, 'package.json'));
|
|
8
|
-
const jsConfig = require(path.join(projectRootPath, 'jsconfig.json')).compilerOptions;
|
|
9
|
-
|
|
10
|
-
const pathsConfig = jsConfig.paths;
|
|
11
|
-
|
|
12
|
-
let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto');
|
|
13
|
-
|
|
14
|
-
Object.keys(pathsConfig).forEach(pkg => {
|
|
15
|
-
if (pkg === '@plone/volto') {
|
|
16
|
-
voltoPath = `./${jsConfig.baseUrl}/${pathsConfig[pkg][0]}`;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
const AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`);
|
|
20
|
-
const reg = new AddonConfigurationRegistry(projectRootPath);
|
|
21
|
-
|
|
22
|
-
// Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
|
|
23
|
-
const addonAliases = Object.keys(reg.packages).map(o => [
|
|
24
|
-
o,
|
|
25
|
-
reg.packages[o].modulePath,
|
|
26
|
-
]);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
module.exports = {
|
|
30
|
-
extends: `${projectRootPath}/node_modules/@plone/volto/.eslintrc`,
|
|
31
|
-
settings: {
|
|
32
|
-
'import/resolver': {
|
|
33
|
-
alias: {
|
|
34
|
-
map: [
|
|
35
|
-
['@plone/volto', '@plone/volto/src'],
|
|
36
|
-
...addonAliases,
|
|
37
|
-
['@package', `${__dirname}/src`],
|
|
38
|
-
['~', `${__dirname}/src`],
|
|
39
|
-
],
|
|
40
|
-
extensions: ['.js', '.jsx', '.json'],
|
|
41
|
-
},
|
|
42
|
-
'babel-plugin-root-import': {
|
|
43
|
-
rootPathSuffix: 'src',
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
|