@eeacms/volto-datahub 4.0.0 → 5.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 +14 -19
- package/README.md +33 -38
- package/babel.config.js +1 -17
- package/package.json +36 -19
- package/src/components/ItemView/Datasets/DatasetEsri.jsx +6 -1
- package/src/components/ItemView/Datasets/DatasetEsri.test.jsx +3 -1
- package/src/components/ItemView/Datasets/DatasetHttpLinks.jsx +6 -1
- package/src/components/ItemView/Datasets/DatasetHttpLinks.test.jsx +7 -5
- package/src/components/ItemView/Datasets/DatasetItemDownloadList.test.jsx +6 -6
- package/src/components/ItemView/Datasets/DatasetLinks.test.jsx +5 -3
- package/src/components/ItemView/Datasets/DatasetUrls.test.jsx +5 -3
- package/src/components/ItemView/MetadataSection.jsx +2 -2
- package/src/components/ItemView/MoreLikeThis.test.jsx +3 -3
- package/src/components/ItemView/utils.test.js +1 -1
- package/tsconfig.json +43 -0
- package/vitest.config.mjs +283 -0
- package/{jest.setup.js → vitest.setup.jsx} +20 -11
- package/.coverage.babel.config.js +0 -9
- package/.eslintrc.js +0 -66
- package/.husky/pre-commit +0 -2
- package/DEVELOP.md +0 -108
- package/RELEASE.md +0 -74
- package/bootstrap +0 -41
- package/cypress.config.js +0 -26
- package/docker-compose.yml +0 -32
- package/jest-addon.config.js +0 -57
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,20 @@ 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
|
-
### [
|
|
7
|
+
### [5.0.0](https://github.com/eea/volto-datahub/compare/4.0.0...5.0.0) - 20 November 2026
|
|
8
|
+
|
|
9
|
+
#### :rocket: New Features
|
|
10
|
+
|
|
11
|
+
- feat: Volto 19 support - refs #297832 [Alin Voinea - [`7a8b3fb`](https://github.com/eea/volto-datahub/commit/7a8b3fb163612eee1d4976e9a81df11b176806af)]
|
|
12
|
+
|
|
13
|
+
#### :bug: Bug Fixes
|
|
14
|
+
|
|
15
|
+
- fix: Add betterleaks github action - refs #304517 [dobri1408 - [`42203bb`](https://github.com/eea/volto-datahub/commit/42203bb48f0c723a54568bfc30d7d1e7dc9753ab)]
|
|
16
|
+
|
|
17
|
+
#### :hammer_and_wrench: Others
|
|
18
|
+
|
|
19
|
+
- test: pin Chromium version 149 to work with Cypress [valentinab25 - [`da88cab`](https://github.com/eea/volto-datahub/commit/da88cab9875654680c9ad49fa0ca7ca0aa2084da)]
|
|
20
|
+
## [4.0.0](https://github.com/eea/volto-datahub/compare/3.0.2...4.0.0) - 24 June 2026
|
|
8
21
|
|
|
9
22
|
#### :nail_care: Enhancements
|
|
10
23
|
|
|
@@ -24,9 +37,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
24
37
|
|
|
25
38
|
- feat: Volto 18 support - refs #287700 [Alin Voinea - [`ac2b36c`](https://github.com/eea/volto-datahub/commit/ac2b36c35bcd12d7558e1b40c56c6553199feffa)]
|
|
26
39
|
|
|
27
|
-
#### :house: Internal changes
|
|
28
|
-
|
|
29
|
-
|
|
30
40
|
#### :hammer_and_wrench: Others
|
|
31
41
|
|
|
32
42
|
- tests: Fix Sonar Qube tags - refs #297339 [Alin Voinea - [`54937c6`](https://github.com/eea/volto-datahub/commit/54937c65d18a64477dcaf886f6e31a66675e2b1e)]
|
|
@@ -61,7 +71,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
61
71
|
#### :hammer_and_wrench: Others
|
|
62
72
|
|
|
63
73
|
- add volto-eea-design-system as dependency [Teodor - [`fa4fa9e`](https://github.com/eea/volto-datahub/commit/fa4fa9e2b763b1b9399d728185e6de5a59046d1d)]
|
|
64
|
-
- update Jenkinsfile to skip Volto 16 tests [Teodor - [`426b48f`](https://github.com/eea/volto-datahub/commit/426b48fb0b81f820d051234777ae22d9cff1d397)]
|
|
65
74
|
- Update label [Teodor - [`9bd7ef6`](https://github.com/eea/volto-datahub/commit/9bd7ef6ee7aa9c1af13334f354ac17203599b8f2)]
|
|
66
75
|
### [2.0.1](https://github.com/eea/volto-datahub/compare/2.0.0...2.0.1) - 7 August 2024
|
|
67
76
|
|
|
@@ -153,14 +162,12 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
153
162
|
|
|
154
163
|
- Update tests [kreafox - [`b452535`](https://github.com/eea/volto-datahub/commit/b452535adabf75488d6c82725152d497c6758cd4)]
|
|
155
164
|
- Add tests [kreafox - [`3ef3c6f`](https://github.com/eea/volto-datahub/commit/3ef3c6f3ea11eff95d091fb5112f3e5c4a981e0d)]
|
|
156
|
-
- Update Jenkinsfile [kreafox - [`2202f7f`](https://github.com/eea/volto-datahub/commit/2202f7f4de801a209753b0abe159c974fc0da754)]
|
|
157
165
|
- Add test [kreafox - [`fcec0ba`](https://github.com/eea/volto-datahub/commit/fcec0ba7c8054d7973421428dd36d59c3a7fb2ba)]
|
|
158
166
|
- Add test [kreafox - [`5061ab7`](https://github.com/eea/volto-datahub/commit/5061ab71928e4e352635c49ba7b53bf204a5b797)]
|
|
159
167
|
- Code cleanup [kreafox - [`a0031be`](https://github.com/eea/volto-datahub/commit/a0031be9884b18fbbf247b0a2276b12df28bb6f1)]
|
|
160
168
|
- Update dependencies [kreafox - [`955fec2`](https://github.com/eea/volto-datahub/commit/955fec2f7b7acd84dd40b195fd5dc098a8e9a11c)]
|
|
161
169
|
- Fix icon size on firefox [kreafox - [`b49744d`](https://github.com/eea/volto-datahub/commit/b49744d1667988a93a5f3c43535136c3ca7f833a)]
|
|
162
170
|
- Fixes on datahub view [kreafox - [`32e91a0`](https://github.com/eea/volto-datahub/commit/32e91a0f92fb1c1297a9ff3d7aa36f993d2d547b)]
|
|
163
|
-
- test: Update Makefile and docker-compose to align it with Jenkinsfile [valentinab25 - [`9a9cfca`](https://github.com/eea/volto-datahub/commit/9a9cfca01faf04b5545a33e4657003dcdc3b72f6)]
|
|
164
171
|
- Add datasets filtering option [kreafox - [`3064341`](https://github.com/eea/volto-datahub/commit/30643419cab961809926c5e9221dfdb59ddf59ea)]
|
|
165
172
|
- Improve accordion on datahub view [kreafox - [`dd7716a`](https://github.com/eea/volto-datahub/commit/dd7716a4913a820e3031925e6af5d6f9add0d3c5)]
|
|
166
173
|
### [1.0.25](https://github.com/eea/volto-datahub/compare/1.0.24...1.0.25) - 16 August 2023
|
|
@@ -171,7 +178,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
171
178
|
|
|
172
179
|
#### :hammer_and_wrench: Others
|
|
173
180
|
|
|
174
|
-
- Update Jenkinsfile [kreafox - [`4a950b1`](https://github.com/eea/volto-datahub/commit/4a950b19149a6ecc1d04e974b94c242d563731e1)]
|
|
175
181
|
- Fix sonarqube issues to improve code quality [kreafox - [`8bd8364`](https://github.com/eea/volto-datahub/commit/8bd83646fb39611d5fb93a342d562dfa255f264c)]
|
|
176
182
|
- Configure externals [Tiberiu Ichim - [`72eef0f`](https://github.com/eea/volto-datahub/commit/72eef0fcaf30440b9a0eb2523975a2a0d6e011a6)]
|
|
177
183
|
- Add rss middleware [Tiberiu Ichim - [`61b215b`](https://github.com/eea/volto-datahub/commit/61b215b64bf6908421ce5c411f0a834bff11929e)]
|
|
@@ -183,9 +189,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
183
189
|
- Add redirect middleware [Tiberiu Ichim - [`7f739bd`](https://github.com/eea/volto-datahub/commit/7f739bd9aab070b4eb8dc196efb238985f930784)]
|
|
184
190
|
### [1.0.23](https://github.com/eea/volto-datahub/compare/1.0.22...1.0.23) - 12 June 2023
|
|
185
191
|
|
|
186
|
-
#### :house: Internal changes
|
|
187
|
-
|
|
188
|
-
|
|
189
192
|
#### :hammer_and_wrench: Others
|
|
190
193
|
|
|
191
194
|
- test: jest should look for addons in node_modules Refs #253277 [valentinab25 - [`864b75b`](https://github.com/eea/volto-datahub/commit/864b75b7f9a51d50b0aee7c0df8cccc098985f39)]
|
|
@@ -229,7 +232,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
229
232
|
|
|
230
233
|
#### :hammer_and_wrench: Others
|
|
231
234
|
|
|
232
|
-
- test(Jenkinsfile): Use latest stable volto for testing [Zoltan Szabo - [`7aed7a1`](https://github.com/eea/volto-datahub/commit/7aed7a124289f3b39b479fda1bbedd72de88d95b)]
|
|
233
235
|
- Move labels inside <a> [kreafox - [`4273ece`](https://github.com/eea/volto-datahub/commit/4273ece5870b6661b1a66da91f6678923649a3cb)]
|
|
234
236
|
- updates on archived items [Zoltan Szabo - [`627225d`](https://github.com/eea/volto-datahub/commit/627225d726ef48cfbcebddbf574abbe46c2c844d)]
|
|
235
237
|
### [1.0.16](https://github.com/eea/volto-datahub/compare/1.0.15...1.0.16) - 6 March 2023
|
|
@@ -277,9 +279,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
277
279
|
- Remove unused import [Tiberiu Ichim - [`49bbbc8`](https://github.com/eea/volto-datahub/commit/49bbbc87a5f6235aa2f258a1712db4a8c93dfb80)]
|
|
278
280
|
### [1.0.9](https://github.com/eea/volto-datahub/compare/1.0.8...1.0.9) - 17 January 2023
|
|
279
281
|
|
|
280
|
-
#### :hammer_and_wrench: Others
|
|
281
|
-
|
|
282
|
-
- updated Jenkinsfile [Zoltan Szabo - [`b2efcf6`](https://github.com/eea/volto-datahub/commit/b2efcf636c03321d53cf9d1a3cc511132a4dcf1c)]
|
|
283
282
|
### [1.0.8](https://github.com/eea/volto-datahub/compare/1.0.7...1.0.8) - 16 January 2023
|
|
284
283
|
|
|
285
284
|
#### :hammer_and_wrench: Others
|
|
@@ -291,9 +290,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
291
290
|
|
|
292
291
|
### [1.0.6](https://github.com/eea/volto-datahub/compare/1.0.5...1.0.6) - 6 January 2023
|
|
293
292
|
|
|
294
|
-
#### :hammer_and_wrench: Others
|
|
295
|
-
|
|
296
|
-
- test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`9e5dee2`](https://github.com/eea/volto-datahub/commit/9e5dee2052462d8ee06da0195bcb34b0e26d34d2)]
|
|
297
293
|
### [1.0.5](https://github.com/eea/volto-datahub/compare/1.0.4...1.0.5) - 2 December 2022
|
|
298
294
|
|
|
299
295
|
#### :hammer_and_wrench: Others
|
|
@@ -469,7 +465,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
469
465
|
|
|
470
466
|
- Use Callout instead of Quote [kreafox - [`52158a3`](https://github.com/eea/volto-datahub/commit/52158a3fdb14f8228c83fbc8d32dbbb1e9c296e0)]
|
|
471
467
|
- Update BlockQuote [kreafox - [`a66cc90`](https://github.com/eea/volto-datahub/commit/a66cc900a2ba7452c7a0dfa54b678b45fbbb5c44)]
|
|
472
|
-
- Fix Jenkinsfile [kreafox - [`def0c67`](https://github.com/eea/volto-datahub/commit/def0c6786711b1f8a1448f4093b89b5da7e86c30)]
|
|
473
468
|
- Prettier [kreafox - [`50b2a67`](https://github.com/eea/volto-datahub/commit/50b2a679229c994d256d99818c318c999d1980b6)]
|
|
474
469
|
- WIP Datahub item view [kreafox - [`5c42f6f`](https://github.com/eea/volto-datahub/commit/5c42f6fac74dd6895a281397977a0879c4471519)]
|
|
475
470
|
- Remove the index if not enableNLP [Tiberiu Ichim - [`3a3f399`](https://github.com/eea/volto-datahub/commit/3a3f399b4b7c117465358c9ca42ff6f0d3626d6d)]
|
package/README.md
CHANGED
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
# volto-datahub
|
|
1
|
+
# @eeacms/volto-datahub
|
|
2
2
|
|
|
3
3
|
[](https://github.com/eea/volto-datahub/releases)
|
|
4
|
-
|
|
5
4
|
[](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-datahub/job/master/display/redirect)
|
|
6
|
-
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-datahub)
|
|
7
5
|
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-datahub)
|
|
8
|
-
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-datahub)
|
|
9
|
-
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-datahub)
|
|
10
|
-
|
|
11
|
-
[](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-datahub/job/develop/display/redirect)
|
|
12
|
-
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-datahub&branch=develop)
|
|
13
|
-
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-datahub&branch=develop)
|
|
14
|
-
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-datahub&branch=develop)
|
|
15
|
-
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-datahub&branch=develop)
|
|
16
|
-
|
|
17
6
|
|
|
18
7
|
EEA DataHub search [Volto](https://github.com/plone/volto) add-on
|
|
19
8
|
|
|
@@ -37,23 +26,42 @@ The `RAZZLE_` prefix has been removed from the Elasticsearch middleware environm
|
|
|
37
26
|
|
|
38
27
|
- https://demo-www.eea.europa.eu/en/datahub
|
|
39
28
|
|
|
40
|
-
##
|
|
29
|
+
## Upgrade
|
|
30
|
+
|
|
31
|
+
### Upgrading to 5.x
|
|
32
|
+
|
|
33
|
+
> This version requires `Volto 18` or `Volto 19` and Node.js 22.
|
|
34
|
+
|
|
35
|
+
No API change: the block ids, the schema fields, the API path and the stored block data are the same
|
|
36
|
+
as 4.x, so an upgrade renders the same items. The release adds Volto 19 support and moves the
|
|
37
|
+
repository to the Volto 19 layout, where the published package lives in
|
|
38
|
+
`packages/volto-datahub`.
|
|
39
|
+
|
|
40
|
+
#### Fix
|
|
41
|
+
|
|
42
|
+
- External dataset links in the item view open with `rel="noopener noreferrer"` instead of
|
|
43
|
+
`rel="noopener"`, so the target page cannot reach back through `window.opener`.
|
|
41
44
|
|
|
42
|
-
|
|
45
|
+
#### Breaking changes
|
|
43
46
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
- **Node.js 22 or newer is required** (`engines.node >= 22`), 4.x declared no engine.
|
|
48
|
+
- **React 18 is required.** The package declares `react` and `react-dom` as `^18.2.0` peers, 4.x
|
|
49
|
+
declared no peers.
|
|
50
|
+
- **The package no longer ships the repository tooling.** The Cypress specs and the Jest setup are
|
|
51
|
+
gone and the unit tests moved to Vitest next to the add-on, so nothing a site imports was removed.
|
|
48
52
|
|
|
49
|
-
|
|
53
|
+
## Requirements
|
|
50
54
|
|
|
51
|
-
|
|
55
|
+
### Backend
|
|
52
56
|
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
- [Plone](https://plone.org/download)
|
|
58
|
+
- [plone.restapi](https://pypi.org/project/plone.restapi/)
|
|
55
59
|
|
|
56
|
-
###
|
|
60
|
+
### Frontend
|
|
61
|
+
|
|
62
|
+
- Node.js: `>=22.0.0`
|
|
63
|
+
|
|
64
|
+
## Installation
|
|
57
65
|
|
|
58
66
|
1. Make sure you have a [Plone backend](https://plone.org/download) up-and-running at http://localhost:8080/Plone
|
|
59
67
|
|
|
@@ -97,26 +105,13 @@ Go to http://localhost:3000
|
|
|
97
105
|
make frontend-start
|
|
98
106
|
```
|
|
99
107
|
|
|
100
|
-
For a legacy Volto 17 project, install the package with `yarn` and restart the frontend as usual.
|
|
101
|
-
|
|
102
108
|
1. Go to http://localhost:3000
|
|
103
109
|
|
|
104
110
|
1. Happy editing!
|
|
105
111
|
|
|
106
|
-
##
|
|
107
|
-
|
|
108
|
-
See [RELEASE.md](https://github.com/eea/volto-datahub/blob/master/RELEASE.md).
|
|
109
|
-
|
|
110
|
-
## How to contribute
|
|
111
|
-
|
|
112
|
-
See [DEVELOP.md](https://github.com/eea/volto-datahub/blob/master/DEVELOP.md).
|
|
113
|
-
|
|
114
|
-
## Copyright and license
|
|
115
|
-
|
|
116
|
-
The Initial Owner of the Original Code is European Environment Agency (EEA).
|
|
117
|
-
All Rights Reserved.
|
|
112
|
+
## License
|
|
118
113
|
|
|
119
|
-
See [LICENSE.md](
|
|
114
|
+
See [LICENSE.md](LICENSE.md) for details.
|
|
120
115
|
|
|
121
116
|
## Funding
|
|
122
117
|
|
package/babel.config.js
CHANGED
|
@@ -1,17 +1 @@
|
|
|
1
|
-
module.exports =
|
|
2
|
-
api.cache(true);
|
|
3
|
-
const presets = ['razzle'];
|
|
4
|
-
const plugins = [
|
|
5
|
-
[
|
|
6
|
-
'react-intl', // React Intl extractor, required for the whole i18n infrastructure to work
|
|
7
|
-
{
|
|
8
|
-
messagesDir: './build/messages/',
|
|
9
|
-
},
|
|
10
|
-
],
|
|
11
|
-
];
|
|
12
|
-
|
|
13
|
-
return {
|
|
14
|
-
plugins,
|
|
15
|
-
presets,
|
|
16
|
-
};
|
|
17
|
-
};
|
|
1
|
+
module.exports = require('@plone/volto/babel');
|
package/package.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eeacms/volto-datahub",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "@eeacms/volto-datahub: Volto add-on",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "European Environment Agency: IDM2 A-Team",
|
|
7
7
|
"license": "MIT",
|
|
8
|
+
"packageManager": "pnpm@10.20.0",
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=22.0.0"
|
|
11
|
+
},
|
|
8
12
|
"homepage": "https://github.com/eea/volto-datahub",
|
|
9
13
|
"keywords": [
|
|
10
14
|
"volto-addon",
|
|
@@ -21,17 +25,31 @@
|
|
|
21
25
|
"@eeacms/volto-eea-design-system": "*",
|
|
22
26
|
"@eeacms/volto-globalsearch": "*",
|
|
23
27
|
"@eeacms/volto-listing-block": "*",
|
|
24
|
-
"feed": "4.2.2"
|
|
28
|
+
"feed": "4.2.2",
|
|
29
|
+
"react-portal": "^4.3.0",
|
|
30
|
+
"remixicon": "4.6.0"
|
|
25
31
|
},
|
|
26
32
|
"devDependencies": {
|
|
27
33
|
"@cypress/code-coverage": "^3.10.0",
|
|
28
|
-
"@
|
|
34
|
+
"@testing-library/jest-dom": "6.9.1",
|
|
35
|
+
"@testing-library/react": "^16.3.2",
|
|
36
|
+
"@vitejs/plugin-react": "4.7.0",
|
|
37
|
+
"@vitest/coverage-istanbul": "3.2.7",
|
|
29
38
|
"babel-plugin-transform-class-properties": "^6.24.1",
|
|
30
39
|
"cypress": "13.1.0",
|
|
31
40
|
"dotenv": "^16.3.2",
|
|
32
41
|
"husky": "^8.0.3",
|
|
42
|
+
"jsdom": "23.0.0",
|
|
33
43
|
"lint-staged": "^14.0.1",
|
|
34
|
-
"md5": "^2.3.0"
|
|
44
|
+
"md5": "^2.3.0",
|
|
45
|
+
"vite": "6.4.3",
|
|
46
|
+
"vitest": "3.2.7",
|
|
47
|
+
"@types/react": "^18.3.1",
|
|
48
|
+
"@types/react-dom": "^18.3.1",
|
|
49
|
+
"redux-mock-store": "1.5.4",
|
|
50
|
+
"redux-thunk": "^2.4.2",
|
|
51
|
+
"release-it": "^19.0.5",
|
|
52
|
+
"typescript": "^5.7.3"
|
|
35
53
|
},
|
|
36
54
|
"addons": [
|
|
37
55
|
"@eeacms/volto-globalsearch",
|
|
@@ -64,20 +82,19 @@
|
|
|
64
82
|
"release": "release-it",
|
|
65
83
|
"release-major-beta": "release-it major --preRelease=beta",
|
|
66
84
|
"release-beta": "release-it --preRelease=beta",
|
|
67
|
-
"
|
|
68
|
-
"test": "
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"prepare": "husky install"
|
|
85
|
+
"test": "vitest --config ./vitest.config.mjs run --passWithNoTests",
|
|
86
|
+
"test:fix": "vitest --config ./vitest.config.mjs run --passWithNoTests --update",
|
|
87
|
+
"i18n": "rm -rf build/messages && NODE_ENV=production i18n --addon",
|
|
88
|
+
"prepare": "cd ../.. && husky install || true",
|
|
89
|
+
"dry-release": "release-it --dry-run",
|
|
90
|
+
"release-major-alpha": "release-it major --preRelease=alpha",
|
|
91
|
+
"release-alpha": "release-it --preRelease=alpha"
|
|
92
|
+
},
|
|
93
|
+
"publishConfig": {
|
|
94
|
+
"access": "public"
|
|
95
|
+
},
|
|
96
|
+
"peerDependencies": {
|
|
97
|
+
"react": "^18.2.0",
|
|
98
|
+
"react-dom": "^18.2.0"
|
|
82
99
|
}
|
|
83
100
|
}
|
|
@@ -10,7 +10,12 @@ const ItemLink = ({ item }) => (
|
|
|
10
10
|
<List.Content>
|
|
11
11
|
<div className="dataset-item">
|
|
12
12
|
<SVGIcon name={servicesSVG} size="20px" />
|
|
13
|
-
<a
|
|
13
|
+
<a
|
|
14
|
+
className="item-link"
|
|
15
|
+
href={item.url}
|
|
16
|
+
target="_blank"
|
|
17
|
+
rel="noopener noreferrer"
|
|
18
|
+
>
|
|
14
19
|
{item.protocol} {item.name || item.description}
|
|
15
20
|
</a>
|
|
16
21
|
{isInternalURL(item.url) ? (
|
|
@@ -4,7 +4,9 @@ import '@testing-library/jest-dom';
|
|
|
4
4
|
|
|
5
5
|
import DatasetEsri from './DatasetEsri';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
vi.mock('remixicon/icons/System/lock-line.svg', () => ({
|
|
8
|
+
default: 'MockLockIcon',
|
|
9
|
+
}));
|
|
8
10
|
|
|
9
11
|
describe('DatasetEsri', () => {
|
|
10
12
|
const dataset = {
|
|
@@ -9,7 +9,12 @@ const renderListItem = (item, index, iconClass) => (
|
|
|
9
9
|
<List.Content>
|
|
10
10
|
<div className="dataset-item">
|
|
11
11
|
<Icon className={iconClass} />
|
|
12
|
-
<a
|
|
12
|
+
<a
|
|
13
|
+
href={item.url}
|
|
14
|
+
className="item-link"
|
|
15
|
+
target="_blank"
|
|
16
|
+
rel="noopener noreferrer"
|
|
17
|
+
>
|
|
13
18
|
<span>{item.name || item.url}</span>
|
|
14
19
|
</a>
|
|
15
20
|
{isInternalURL(item.url) ? (
|
|
@@ -5,15 +5,17 @@ import { isInternalURL } from '@eeacms/volto-datahub/utils';
|
|
|
5
5
|
|
|
6
6
|
import DatasetHttpLinks from './DatasetHttpLinks';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
runRequest:
|
|
8
|
+
vi.mock('@eeacms/search', () => ({
|
|
9
|
+
runRequest: vi.fn(),
|
|
10
10
|
}));
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
isInternalURL:
|
|
12
|
+
vi.mock('@eeacms/volto-datahub/utils', () => ({
|
|
13
|
+
isInternalURL: vi.fn(),
|
|
14
14
|
}));
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
vi.mock('remixicon/icons/System/lock-line.svg', () => ({
|
|
17
|
+
default: 'MockLockIcon',
|
|
18
|
+
}));
|
|
17
19
|
|
|
18
20
|
describe('DatasetHttpLinks', () => {
|
|
19
21
|
const dataset = {
|
|
@@ -9,13 +9,13 @@ import '@testing-library/jest-dom';
|
|
|
9
9
|
|
|
10
10
|
import DatasetItemDownloadList from './DatasetItemDownloadList';
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
runRequest:
|
|
12
|
+
vi.mock('@eeacms/search', () => ({
|
|
13
|
+
runRequest: vi.fn(),
|
|
14
14
|
}));
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
vi.mock('./DatasetUrls', () => ({ default: vi.fn(() => null) }));
|
|
16
|
+
vi.mock('./DatasetLinks', () => ({ default: vi.fn(() => null) }));
|
|
17
|
+
vi.mock('./DatasetEsri', () => ({ default: vi.fn(() => null) }));
|
|
18
|
+
vi.mock('./DatasetHttpLinks', () => ({ default: vi.fn(() => null) }));
|
|
19
19
|
|
|
20
20
|
describe('DatasetItemDownloadList', () => {
|
|
21
21
|
const link = [
|
|
@@ -5,9 +5,11 @@ import '@testing-library/jest-dom';
|
|
|
5
5
|
|
|
6
6
|
import DatasetLinks from './DatasetLinks';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
vi.mock('remixicon/icons/System/lock-line.svg', () => ({
|
|
9
|
+
default: 'MockLockIcon',
|
|
10
|
+
}));
|
|
11
|
+
vi.mock('@eeacms/volto-datahub/utils', () => ({
|
|
12
|
+
isInternalURL: vi.fn(),
|
|
11
13
|
}));
|
|
12
14
|
|
|
13
15
|
describe('DatasetLinks', () => {
|
|
@@ -5,9 +5,11 @@ import '@testing-library/jest-dom';
|
|
|
5
5
|
|
|
6
6
|
import DatasetUrls from './DatasetUrls';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
vi.mock('remixicon/icons/System/lock-line.svg', () => ({
|
|
9
|
+
default: 'MockLockIcon',
|
|
10
|
+
}));
|
|
11
|
+
vi.mock('@eeacms/volto-datahub/utils', () => ({
|
|
12
|
+
isInternalURL: vi.fn(),
|
|
11
13
|
}));
|
|
12
14
|
|
|
13
15
|
describe('DatasetUrls', () => {
|
|
@@ -84,7 +84,7 @@ const MetadataSection = (props) => {
|
|
|
84
84
|
`${appConfig.indexBaseUrl}/catalogue/datahub/api/records/` +
|
|
85
85
|
`${docid}/formatters/xsl-view?output=pdf&language=eng&approved=true`
|
|
86
86
|
}
|
|
87
|
-
rel="noopener"
|
|
87
|
+
rel="noopener noreferrer"
|
|
88
88
|
>
|
|
89
89
|
Metadata Factsheet
|
|
90
90
|
</a>
|
|
@@ -95,7 +95,7 @@ const MetadataSection = (props) => {
|
|
|
95
95
|
<a
|
|
96
96
|
target="_blank"
|
|
97
97
|
href={`${appConfig.indexBaseUrl}/catalogue/srv/eng/catalog.search#/metadata/${docid}`}
|
|
98
|
-
rel="noopener"
|
|
98
|
+
rel="noopener noreferrer"
|
|
99
99
|
>
|
|
100
100
|
Metadata catalogue
|
|
101
101
|
</a>
|
|
@@ -5,10 +5,10 @@ import '@testing-library/jest-dom';
|
|
|
5
5
|
|
|
6
6
|
import MoreLikeThis from './MoreLikeThis';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
vi.mock('@eeacms/search', () => {
|
|
9
9
|
return {
|
|
10
|
-
runRequest:
|
|
11
|
-
firstWords:
|
|
10
|
+
runRequest: vi.fn(),
|
|
11
|
+
firstWords: vi.fn((word, length) =>
|
|
12
12
|
word.split(' ').slice(0, length).join(' '),
|
|
13
13
|
),
|
|
14
14
|
};
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"esModuleInterop": true,
|
|
4
|
+
"skipLibCheck": true,
|
|
5
|
+
"target": "es2022",
|
|
6
|
+
"allowJs": true,
|
|
7
|
+
"resolveJsonModule": true,
|
|
8
|
+
"moduleDetection": "force",
|
|
9
|
+
"isolatedModules": true,
|
|
10
|
+
"verbatimModuleSyntax": true,
|
|
11
|
+
"module": "preserve",
|
|
12
|
+
"noEmit": true,
|
|
13
|
+
"lib": [
|
|
14
|
+
"es2022",
|
|
15
|
+
"dom",
|
|
16
|
+
"dom.iterable"
|
|
17
|
+
],
|
|
18
|
+
"jsx": "react-jsx",
|
|
19
|
+
"paths": {
|
|
20
|
+
"@plone/volto/*": [
|
|
21
|
+
"../../core/packages/volto/src/*"
|
|
22
|
+
],
|
|
23
|
+
"@eeacms/volto-datahub/*": [
|
|
24
|
+
"./src/*"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"include": [
|
|
29
|
+
"**/*.ts",
|
|
30
|
+
"**/*.tsx",
|
|
31
|
+
"**/*.js",
|
|
32
|
+
"**/*.jsx"
|
|
33
|
+
],
|
|
34
|
+
"exclude": [
|
|
35
|
+
"node_modules",
|
|
36
|
+
"build",
|
|
37
|
+
"public",
|
|
38
|
+
"coverage",
|
|
39
|
+
"**/*.test.{js,jsx,ts,tsx}",
|
|
40
|
+
"**/*.spec.{js,jsx,ts,tsx}",
|
|
41
|
+
"**/*.stories.{js,jsx,ts,tsx}"
|
|
42
|
+
]
|
|
43
|
+
}
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
5
|
+
import { defineConfig } from 'vitest/config';
|
|
6
|
+
import { transformWithEsbuild } from 'vite';
|
|
7
|
+
|
|
8
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
process.env.TZ = 'UTC';
|
|
10
|
+
// The nearest folder with a Volto checkout in `core/`: the add-on repository
|
|
11
|
+
// when developed standalone, or the frontend project when it is checked out
|
|
12
|
+
// in its `packages/` folder.
|
|
13
|
+
const findProjectRoot = (dir) => {
|
|
14
|
+
if (fs.existsSync(path.join(dir, 'core/packages/volto'))) return dir;
|
|
15
|
+
const parent = path.dirname(dir);
|
|
16
|
+
return parent === dir ? __dirname : findProjectRoot(parent);
|
|
17
|
+
};
|
|
18
|
+
const projectRoot = findProjectRoot(__dirname);
|
|
19
|
+
const voltoRoot = fs.existsSync(path.join(projectRoot, 'core/packages/volto'))
|
|
20
|
+
? path.join(projectRoot, 'core/packages/volto')
|
|
21
|
+
: path.dirname(
|
|
22
|
+
fileURLToPath(
|
|
23
|
+
import.meta.resolve('@plone/volto/package.json'),
|
|
24
|
+
),
|
|
25
|
+
);
|
|
26
|
+
const requireFromVolto = createRequire(path.join(voltoRoot, 'package.json'));
|
|
27
|
+
// The other core packages are dependencies of Volto, not of the add-on.
|
|
28
|
+
const resolveCorePackage = (name, folder) =>
|
|
29
|
+
fs.existsSync(path.join(projectRoot, 'core/packages', folder))
|
|
30
|
+
? path.join(projectRoot, 'core/packages', folder)
|
|
31
|
+
: path.dirname(requireFromVolto.resolve(`${name}/package.json`));
|
|
32
|
+
const voltoSlateRoot = resolveCorePackage('@plone/volto-slate', 'volto-slate');
|
|
33
|
+
const componentsRoot = resolveCorePackage('@plone/components', 'components');
|
|
34
|
+
const registryRoot = resolveCorePackage('@plone/registry', 'registry');
|
|
35
|
+
|
|
36
|
+
const requireFromAddon = createRequire(path.join(__dirname, 'package.json'));
|
|
37
|
+
const voltoPackage = JSON.parse(
|
|
38
|
+
fs.readFileSync(path.join(voltoRoot, 'package.json'), 'utf8'),
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const baseConfig = (
|
|
42
|
+
await import(pathToFileURL(path.join(voltoRoot, 'vitest.config.mjs')).href)
|
|
43
|
+
).default;
|
|
44
|
+
const setupGlobals = fs.existsSync(
|
|
45
|
+
path.join(voltoRoot, 'test-setup-globals-vitest.js'),
|
|
46
|
+
)
|
|
47
|
+
? path.join(voltoRoot, 'test-setup-globals-vitest.js')
|
|
48
|
+
: path.join(voltoRoot, 'test-setup-globals.js');
|
|
49
|
+
const addonsLoader = fs.existsSync(
|
|
50
|
+
path.join(voltoRoot, 'test-addons-loader.js'),
|
|
51
|
+
)
|
|
52
|
+
? path.join(voltoRoot, 'test-addons-loader.js')
|
|
53
|
+
: path.join(voltoRoot, 'jest-addons-loader.js');
|
|
54
|
+
const setupFiles = [
|
|
55
|
+
setupGlobals,
|
|
56
|
+
path.join(voltoRoot, 'test-setup-config.jsx'),
|
|
57
|
+
];
|
|
58
|
+
const setupAfterEnv = path.join(voltoRoot, 'jest-setup-afterenv.js');
|
|
59
|
+
if (fs.existsSync(setupAfterEnv)) setupFiles.push(setupAfterEnv);
|
|
60
|
+
setupFiles.push(addonsLoader);
|
|
61
|
+
|
|
62
|
+
const globalsFile = path.join(__dirname, 'vitest.globals.js');
|
|
63
|
+
if (fs.existsSync(globalsFile)) setupFiles.push(globalsFile);
|
|
64
|
+
const envFile = path.join(__dirname, '.env');
|
|
65
|
+
const useAddonSetup =
|
|
66
|
+
!fs.existsSync(envFile) ||
|
|
67
|
+
/^VITEST_USE_SETUP=ON(?:\s|$)/m.test(fs.readFileSync(envFile, 'utf8'));
|
|
68
|
+
const addonSetup = path.join(__dirname, 'vitest.setup.jsx');
|
|
69
|
+
if (useAddonSetup && fs.existsSync(addonSetup)) setupFiles.push(addonSetup);
|
|
70
|
+
|
|
71
|
+
function resolvePackageRoot(packageName) {
|
|
72
|
+
for (const packageRequire of [requireFromAddon, requireFromVolto]) {
|
|
73
|
+
try {
|
|
74
|
+
return path.dirname(packageRequire.resolve(`${packageName}/package.json`));
|
|
75
|
+
} catch {
|
|
76
|
+
try {
|
|
77
|
+
let current = path.dirname(packageRequire.resolve(packageName));
|
|
78
|
+
while (current !== path.dirname(current)) {
|
|
79
|
+
const manifest = path.join(current, 'package.json');
|
|
80
|
+
if (fs.existsSync(manifest)) {
|
|
81
|
+
const candidate = JSON.parse(fs.readFileSync(manifest, 'utf8'));
|
|
82
|
+
if (candidate.name === packageName) return current;
|
|
83
|
+
}
|
|
84
|
+
current = path.dirname(current);
|
|
85
|
+
}
|
|
86
|
+
} catch {
|
|
87
|
+
// Try the next package resolution context.
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const addonPackage = JSON.parse(
|
|
95
|
+
fs.readFileSync(path.join(__dirname, 'package.json'), 'utf8'),
|
|
96
|
+
);
|
|
97
|
+
const aliases = {
|
|
98
|
+
...(baseConfig.resolve?.alias ?? {}),
|
|
99
|
+
'@plone/volto': path.join(voltoRoot, 'src'),
|
|
100
|
+
'@plone/volto-slate': path.join(voltoSlateRoot, 'src'),
|
|
101
|
+
'@plone/components': path.join(componentsRoot, 'src'),
|
|
102
|
+
'@plone/registry': path.join(registryRoot, 'src'),
|
|
103
|
+
'@root': path.join(voltoRoot, 'src'),
|
|
104
|
+
'@package': path.join(__dirname, 'src'),
|
|
105
|
+
'~': path.join(voltoRoot, 'src'),
|
|
106
|
+
'load-volto-addons': addonsLoader,
|
|
107
|
+
[addonPackage.name]: path.join(__dirname, 'src'),
|
|
108
|
+
};
|
|
109
|
+
function addSourceAlias(packageRoot) {
|
|
110
|
+
const manifestPath = path.join(packageRoot, 'package.json');
|
|
111
|
+
const sourceRoot = path.join(packageRoot, 'src');
|
|
112
|
+
if (!fs.existsSync(manifestPath) || !fs.existsSync(sourceRoot)) return;
|
|
113
|
+
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
|
|
114
|
+
if (manifest.name) aliases[manifest.name] = sourceRoot;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const workspacePackages = path.join(projectRoot, 'packages');
|
|
118
|
+
if (fs.existsSync(workspacePackages)) {
|
|
119
|
+
for (const packageDirectory of fs.readdirSync(workspacePackages)) {
|
|
120
|
+
const packageRoot = path.join(workspacePackages, packageDirectory);
|
|
121
|
+
addSourceAlias(packageRoot);
|
|
122
|
+
// In a frontend project each add-on repository keeps its add-on in its
|
|
123
|
+
// own `packages/` folder.
|
|
124
|
+
const nestedPackages = path.join(packageRoot, 'packages');
|
|
125
|
+
if (fs.existsSync(nestedPackages)) {
|
|
126
|
+
for (const nestedDirectory of fs.readdirSync(nestedPackages)) {
|
|
127
|
+
addSourceAlias(path.join(nestedPackages, nestedDirectory));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
const pnpmStore = path.join(projectRoot, 'node_modules/.pnpm');
|
|
133
|
+
if (fs.existsSync(pnpmStore)) {
|
|
134
|
+
for (const storeDirectory of fs.readdirSync(pnpmStore)) {
|
|
135
|
+
for (const scope of ['@eeacms', '@plone-collective']) {
|
|
136
|
+
const scopeRoot = path.join(
|
|
137
|
+
pnpmStore,
|
|
138
|
+
storeDirectory,
|
|
139
|
+
'node_modules',
|
|
140
|
+
scope,
|
|
141
|
+
);
|
|
142
|
+
if (!fs.existsSync(scopeRoot)) continue;
|
|
143
|
+
for (const packageDirectory of fs.readdirSync(scopeRoot)) {
|
|
144
|
+
addSourceAlias(path.join(scopeRoot, packageDirectory));
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const excludedVoltoAliases = [
|
|
151
|
+
'vitest',
|
|
152
|
+
'vite',
|
|
153
|
+
'jsdom',
|
|
154
|
+
'@vitejs/plugin-react',
|
|
155
|
+
];
|
|
156
|
+
for (const dependency of Object.keys({
|
|
157
|
+
...(voltoPackage.dependencies ?? {}),
|
|
158
|
+
...(voltoPackage.devDependencies ?? {}),
|
|
159
|
+
})) {
|
|
160
|
+
if (
|
|
161
|
+
dependency in aliases ||
|
|
162
|
+
excludedVoltoAliases.includes(dependency) ||
|
|
163
|
+
dependency.startsWith('@vitest/') ||
|
|
164
|
+
dependency.startsWith('@testing-library/')
|
|
165
|
+
) {
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
const dependencyRoot = resolvePackageRoot(dependency);
|
|
169
|
+
if (dependencyRoot) aliases[dependency] = dependencyRoot;
|
|
170
|
+
}
|
|
171
|
+
const workspaceSearchlib = [
|
|
172
|
+
'packages/volto-searchlib/searchlib',
|
|
173
|
+
'packages/volto-searchlib/packages/volto-searchlib/searchlib',
|
|
174
|
+
]
|
|
175
|
+
.map((searchlibFolder) => path.join(projectRoot, searchlibFolder))
|
|
176
|
+
.find((searchlibFolder) => fs.existsSync(searchlibFolder));
|
|
177
|
+
const installedSearchlib = resolvePackageRoot('@eeacms/volto-searchlib');
|
|
178
|
+
const searchlibPath = fs.existsSync(workspaceSearchlib)
|
|
179
|
+
? workspaceSearchlib
|
|
180
|
+
: fs.existsSync(path.join(__dirname, 'searchlib'))
|
|
181
|
+
? path.join(__dirname, 'searchlib')
|
|
182
|
+
: installedSearchlib
|
|
183
|
+
? path.join(installedSearchlib, 'searchlib')
|
|
184
|
+
: '';
|
|
185
|
+
if (fs.existsSync(searchlibPath)) aliases['@eeacms/search'] = searchlibPath;
|
|
186
|
+
const subsitesMock = path.join(
|
|
187
|
+
__dirname,
|
|
188
|
+
'src/__mocks__/volto-subsites-utils.js',
|
|
189
|
+
);
|
|
190
|
+
if (fs.existsSync(subsitesMock)) aliases['volto-subsites/utils'] = subsitesMock;
|
|
191
|
+
const localStorageMock = path.join(
|
|
192
|
+
__dirname,
|
|
193
|
+
'src/__mocks__/redux-localstorage-simple-original.js',
|
|
194
|
+
);
|
|
195
|
+
if (fs.existsSync(localStorageMock)) {
|
|
196
|
+
aliases['redux-localstorage-simple-original'] = localStorageMock;
|
|
197
|
+
}
|
|
198
|
+
const uuidMock = path.join(__dirname, 'vitest.uuid.mock.js');
|
|
199
|
+
if (fs.existsSync(uuidMock)) aliases.uuid = uuidMock;
|
|
200
|
+
const jsxSourceRoots = Object.values(aliases).filter(
|
|
201
|
+
(aliasPath) => typeof aliasPath === 'string',
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
const jsxInJsPlugin = {
|
|
205
|
+
name: 'eea-addon-jsx-in-js',
|
|
206
|
+
enforce: 'pre',
|
|
207
|
+
transform(code, id) {
|
|
208
|
+
const filePath = id.split('?')[0];
|
|
209
|
+
if (
|
|
210
|
+
!filePath.endsWith('.js') ||
|
|
211
|
+
!jsxSourceRoots.some(
|
|
212
|
+
(sourceRoot) =>
|
|
213
|
+
filePath === sourceRoot ||
|
|
214
|
+
filePath.startsWith(`${sourceRoot}${path.sep}`),
|
|
215
|
+
)
|
|
216
|
+
) {
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
return transformWithEsbuild(code, filePath, {
|
|
220
|
+
loader: 'jsx',
|
|
221
|
+
jsx: 'automatic',
|
|
222
|
+
});
|
|
223
|
+
},
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
export default defineConfig({
|
|
227
|
+
plugins: [jsxInJsPlugin, ...(baseConfig.plugins ?? [])],
|
|
228
|
+
define: {
|
|
229
|
+
__CLIENT__: true,
|
|
230
|
+
__DEVELOPMENT__: false,
|
|
231
|
+
__SERVER__: false,
|
|
232
|
+
__TEST__: true,
|
|
233
|
+
},
|
|
234
|
+
resolve: { alias: aliases },
|
|
235
|
+
server: {
|
|
236
|
+
fs: {
|
|
237
|
+
allow: [projectRoot, __dirname],
|
|
238
|
+
},
|
|
239
|
+
deps: {
|
|
240
|
+
inline: [/@eeacms/, /@plone/, /query-string/],
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
test: {
|
|
244
|
+
root: __dirname,
|
|
245
|
+
isolate: true,
|
|
246
|
+
globals: true,
|
|
247
|
+
environment: 'jsdom',
|
|
248
|
+
css: false,
|
|
249
|
+
setupFiles,
|
|
250
|
+
include: [
|
|
251
|
+
'src/**/*.{test,spec}.{js,jsx,ts,tsx}',
|
|
252
|
+
'searchlib/**/*.{test,spec}.{js,jsx,ts,tsx}',
|
|
253
|
+
],
|
|
254
|
+
passWithNoTests: true,
|
|
255
|
+
snapshotFormat: baseConfig.test?.snapshotFormat ?? {
|
|
256
|
+
printBasicPrototype: false,
|
|
257
|
+
},
|
|
258
|
+
coverage: {
|
|
259
|
+
provider: 'istanbul',
|
|
260
|
+
reporter: ['text', 'lcov', 'html', 'cobertura'],
|
|
261
|
+
reportsDirectory: process.env.COVERAGE_DIR ?? 'coverage',
|
|
262
|
+
include: [
|
|
263
|
+
'src/**/*.{js,jsx,ts,tsx}',
|
|
264
|
+
'searchlib/**/*.{js,jsx,ts,tsx}',
|
|
265
|
+
],
|
|
266
|
+
exclude: [
|
|
267
|
+
'src/**/*.{test,spec}.{js,jsx,ts,tsx}',
|
|
268
|
+
'src/**/__tests__/**',
|
|
269
|
+
'src/**/__mocks__/**',
|
|
270
|
+
'src/**/*.d.ts',
|
|
271
|
+
'src/**/index.{js,jsx,ts,tsx}',
|
|
272
|
+
'src/**/*config.{js,jsx,ts,tsx}',
|
|
273
|
+
'src/**/*schema.{js,jsx,ts,tsx}',
|
|
274
|
+
],
|
|
275
|
+
thresholds: {
|
|
276
|
+
branches: 5,
|
|
277
|
+
functions: 5,
|
|
278
|
+
lines: 5,
|
|
279
|
+
statements: 5,
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
});
|
|
@@ -1,19 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { vi } from 'vitest';
|
|
2
2
|
import configureStore from 'redux-mock-store';
|
|
3
3
|
import thunk from 'redux-thunk';
|
|
4
4
|
import { blocksConfig } from '@plone/volto/config/Blocks';
|
|
5
5
|
import installSlate from '@plone/volto-slate/index';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
global.jest = vi;
|
|
8
|
+
|
|
9
|
+
global.jest = {
|
|
10
|
+
...global.jest,
|
|
11
|
+
advanceTimersByTime: vi.advanceTimersByTime.bind(vi),
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
var mockSemanticComponents = await vi.importActual('semantic-ui-react');
|
|
15
|
+
var mockComponents = await vi.importActual('@plone/volto/components');
|
|
16
|
+
var mockRegistry = await vi.importActual('@plone/volto/registry');
|
|
17
|
+
var config = mockRegistry.default;
|
|
10
18
|
|
|
11
19
|
config.blocks.blocksConfig = {
|
|
12
20
|
...blocksConfig,
|
|
13
21
|
...config.blocks.blocksConfig,
|
|
14
22
|
};
|
|
15
23
|
|
|
16
|
-
|
|
24
|
+
vi.doMock('semantic-ui-react', () => ({
|
|
17
25
|
__esModule: true,
|
|
18
26
|
...mockSemanticComponents,
|
|
19
27
|
Popup: ({ content, trigger }) => {
|
|
@@ -26,7 +34,7 @@ jest.doMock('semantic-ui-react', () => ({
|
|
|
26
34
|
},
|
|
27
35
|
}));
|
|
28
36
|
|
|
29
|
-
|
|
37
|
+
vi.doMock('@plone/volto/components', () => {
|
|
30
38
|
return {
|
|
31
39
|
__esModule: true,
|
|
32
40
|
...mockComponents,
|
|
@@ -34,13 +42,14 @@ jest.doMock('@plone/volto/components', () => {
|
|
|
34
42
|
};
|
|
35
43
|
});
|
|
36
44
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
)
|
|
45
|
+
vi.doMock('@plone/volto/registry', () => ({
|
|
46
|
+
...mockRegistry,
|
|
47
|
+
default: [installSlate].reduce((acc, apply) => apply(acc), config),
|
|
48
|
+
}));
|
|
40
49
|
|
|
41
50
|
const mockStore = configureStore([thunk]);
|
|
42
51
|
|
|
43
|
-
global.fetch =
|
|
52
|
+
global.fetch = vi.fn(() =>
|
|
44
53
|
Promise.resolve({
|
|
45
54
|
json: () => Promise.resolve({}),
|
|
46
55
|
}),
|
|
@@ -50,7 +59,7 @@ global.store = mockStore({
|
|
|
50
59
|
intl: {
|
|
51
60
|
locale: 'en',
|
|
52
61
|
messages: {},
|
|
53
|
-
formatMessage:
|
|
62
|
+
formatMessage: vi.fn(),
|
|
54
63
|
},
|
|
55
64
|
content: {
|
|
56
65
|
create: {},
|
package/.eslintrc.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const projectRootPath = fs.realpathSync(__dirname + '/../../../');
|
|
4
|
-
|
|
5
|
-
let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto');
|
|
6
|
-
let configFile;
|
|
7
|
-
if (fs.existsSync(`${projectRootPath}/tsconfig.json`))
|
|
8
|
-
configFile = `${projectRootPath}/tsconfig.json`;
|
|
9
|
-
else if (fs.existsSync(`${projectRootPath}/jsconfig.json`))
|
|
10
|
-
configFile = `${projectRootPath}/jsconfig.json`;
|
|
11
|
-
|
|
12
|
-
if (configFile) {
|
|
13
|
-
const jsConfig = require(configFile).compilerOptions;
|
|
14
|
-
const pathsConfig = jsConfig.paths;
|
|
15
|
-
if (pathsConfig['@plone/volto'])
|
|
16
|
-
voltoPath = `./${jsConfig.baseUrl}/${pathsConfig['@plone/volto'][0]}`;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const { AddonRegistry } = require('@plone/registry/addon-registry');
|
|
20
|
-
const { registry } = AddonRegistry.init(projectRootPath);
|
|
21
|
-
|
|
22
|
-
// Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
|
|
23
|
-
const addonAliases = Object.keys(registry.packages).map((o) => [
|
|
24
|
-
o,
|
|
25
|
-
registry.packages[o].modulePath,
|
|
26
|
-
]);
|
|
27
|
-
|
|
28
|
-
const addonExtenders = registry.getEslintExtenders().map((m) => require(m));
|
|
29
|
-
|
|
30
|
-
const defaultConfig = {
|
|
31
|
-
extends: `${voltoPath}/.eslintrc`,
|
|
32
|
-
settings: {
|
|
33
|
-
'import/resolver': {
|
|
34
|
-
alias: {
|
|
35
|
-
map: [
|
|
36
|
-
['@plone/volto', '@plone/volto/src'],
|
|
37
|
-
['@plone/volto-slate', '@plone/volto-slate/src'],
|
|
38
|
-
...addonAliases,
|
|
39
|
-
['@package', `${__dirname}/src`],
|
|
40
|
-
['@root', `${__dirname}/src`],
|
|
41
|
-
['~', `${__dirname}/src`],
|
|
42
|
-
],
|
|
43
|
-
extensions: ['.js', '.jsx', '.json'],
|
|
44
|
-
},
|
|
45
|
-
'babel-plugin-root-import': {
|
|
46
|
-
rootPathSuffix: 'src',
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
rules: {
|
|
51
|
-
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
|
|
52
|
-
'react/jsx-no-target-blank': [
|
|
53
|
-
'error',
|
|
54
|
-
{
|
|
55
|
-
allowReferrer: true,
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const config = addonExtenders.reduce(
|
|
62
|
-
(acc, extender) => extender.modify(acc),
|
|
63
|
-
defaultConfig,
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
module.exports = config;
|
package/.husky/pre-commit
DELETED
package/DEVELOP.md
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
# volto-datahub
|
|
2
|
-
|
|
3
|
-
## Develop
|
|
4
|
-
|
|
5
|
-
1. Make sure you have `docker` and `docker compose` installed and running on your machine:
|
|
6
|
-
|
|
7
|
-
```Bash
|
|
8
|
-
git clone https://github.com/eea/volto-datahub.git
|
|
9
|
-
cd volto-datahub
|
|
10
|
-
git checkout -b bugfix-123456 develop
|
|
11
|
-
make
|
|
12
|
-
make start
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
1. Wait for `Volto started at 0.0.0.0:3000` meesage
|
|
16
|
-
|
|
17
|
-
1. Go to http://localhost:3000
|
|
18
|
-
|
|
19
|
-
1. Initialize git hooks
|
|
20
|
-
|
|
21
|
-
```Bash
|
|
22
|
-
yarn prepare
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
1. Happy hacking!
|
|
26
|
-
|
|
27
|
-
### Or add @eeacms/volto-datahub to your Volto project
|
|
28
|
-
|
|
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
|
-
|
|
31
|
-
For new Volto 18+ projects, use Cookieplone. It includes `mrs-developer` by default.
|
|
32
|
-
|
|
33
|
-
1. Create a new Volto project with Cookieplone
|
|
34
|
-
|
|
35
|
-
uvx cookieplone project
|
|
36
|
-
cd project-title
|
|
37
|
-
|
|
38
|
-
1. Add the following to `mrs.developer.json`:
|
|
39
|
-
|
|
40
|
-
{
|
|
41
|
-
"volto-datahub": {
|
|
42
|
-
"output": "packages",
|
|
43
|
-
"url": "https://github.com/eea/volto-datahub.git",
|
|
44
|
-
"package": "@eeacms/volto-datahub",
|
|
45
|
-
"branch": "develop",
|
|
46
|
-
"path": "src"
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
1. Add `@eeacms/volto-datahub` to the `addons` key in your project `volto.config.js`
|
|
51
|
-
|
|
52
|
-
1. Install or refresh the project setup
|
|
53
|
-
|
|
54
|
-
make install
|
|
55
|
-
|
|
56
|
-
1. Start backend in one terminal
|
|
57
|
-
|
|
58
|
-
make backend-start
|
|
59
|
-
|
|
60
|
-
...wait for backend to setup and start, ending with `Ready to handle requests`
|
|
61
|
-
|
|
62
|
-
...you can also check http://localhost:8080/Plone
|
|
63
|
-
|
|
64
|
-
1. Start frontend in a second terminal
|
|
65
|
-
|
|
66
|
-
make frontend-start
|
|
67
|
-
|
|
68
|
-
1. Go to http://localhost:3000
|
|
69
|
-
|
|
70
|
-
1. Happy hacking!
|
|
71
|
-
|
|
72
|
-
cd packages/volto-datahub
|
|
73
|
-
|
|
74
|
-
For legacy Volto 17 projects, keep using the yarn-based workflow from the Volto 17 documentation.
|
|
75
|
-
|
|
76
|
-
## Cypress
|
|
77
|
-
|
|
78
|
-
To run cypress locally, first make sure you don't have any Volto/Plone running on ports `8080` and `3000`.
|
|
79
|
-
|
|
80
|
-
You don't have to be in a `clean-volto-project`, you can be in any Volto Frontend
|
|
81
|
-
project where you added `volto-datahub` to `mrs.developer.json`
|
|
82
|
-
|
|
83
|
-
Go to:
|
|
84
|
-
|
|
85
|
-
```BASH
|
|
86
|
-
cd packages/volto-datahub/
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
Start:
|
|
90
|
-
|
|
91
|
-
```Bash
|
|
92
|
-
make
|
|
93
|
-
make start
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
This will build and start with Docker a clean `Plone backend` and `Volto Frontend` with `volto-datahub` block installed.
|
|
97
|
-
|
|
98
|
-
Open Cypress Interface:
|
|
99
|
-
|
|
100
|
-
```Bash
|
|
101
|
-
make cypress-open
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
Or run it:
|
|
105
|
-
|
|
106
|
-
```Bash
|
|
107
|
-
make cypress-run
|
|
108
|
-
```
|
package/RELEASE.md
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
## Release
|
|
2
|
-
|
|
3
|
-
### Automatic release using Jenkins
|
|
4
|
-
|
|
5
|
-
* The automatic release is started by creating a [Pull Request](../../compare/master...develop) from `develop` to `master`. The pull request status checks correlated to the branch and PR Jenkins jobs need to be processed successfully. 1 review from a github user with rights is mandatory.
|
|
6
|
-
* It runs on every commit on `master` branch, which is protected from direct commits, only allowing pull request merge commits.
|
|
7
|
-
* The automatic release is done by [Jenkins](https://ci.eionet.europa.eu). The status of the release job can be seen both in the Readme.md badges and the green check/red cross/yellow circle near the last commit information. If you click on the icon, you will have the list of checks that were run. The `continuous-integration/jenkins/branch` link goes to the Jenkins job execution webpage.
|
|
8
|
-
* Automated release scripts are located in the `eeacms/gitflow` docker image, specifically [js-release.sh](https://github.com/eea/eea.docker.gitflow/blob/master/src/js-release.sh) script. It uses the `release-it` tool.
|
|
9
|
-
* As long as a PR request is open from develop to master, the PR Jenkins job will automatically re-create the CHANGELOG.md and package.json files to be production-ready.
|
|
10
|
-
* The version format must be MAJOR.MINOR.PATCH. By default, next release is set to next minor version (with patch 0).
|
|
11
|
-
* You can manually change the version in `package.json`. The new version must not be already present in the tags/releases of the repository, otherwise it will be automatically increased by the script. Any changes to the version will trigger a `CHANGELOG.md` re-generation.
|
|
12
|
-
* Automated commits and commits with [JENKINS] or [YARN] in the commit log are excluded from `CHANGELOG.md` file.
|
|
13
|
-
|
|
14
|
-
### Manual release from the develop branch ( beta release )
|
|
15
|
-
|
|
16
|
-
#### Installation and configuration of release-it
|
|
17
|
-
|
|
18
|
-
You need to first install the [release-it](https://github.com/release-it/release-it) client.
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
npm install -g release-it
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
Release-it uses the configuration written in the [`.release-it.json`](./.release-it.json) file located in the root of the repository.
|
|
25
|
-
|
|
26
|
-
Release-it is a tool that automates 4 important steps in the release process:
|
|
27
|
-
|
|
28
|
-
1. Version increase in `package.json` ( increased from the current version in `package.json`)
|
|
29
|
-
2. `CHANGELOG.md` automatic generation from commit messages ( grouped by releases )
|
|
30
|
-
3. GitHub release on the commit with the changelog and package.json modification on the develop branch
|
|
31
|
-
4. NPM release ( by default it's disabled, but can be enabled in the configuration file )
|
|
32
|
-
|
|
33
|
-
To configure the authentification, you need to export GITHUB_TOKEN for [GitHub](https://github.com/settings/tokens)
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
export GITHUB_TOKEN=XXX-XXXXXXXXXXXXXXXXXXXXXX
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
To configure npm, you can use the `npm login` command or use a configuration file with a TOKEN :
|
|
40
|
-
|
|
41
|
-
```
|
|
42
|
-
echo "//registry.npmjs.org/:_authToken=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY" > .npmrc
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
#### Using release-it tool
|
|
46
|
-
|
|
47
|
-
There are 3 yarn scripts that can be run to do the release
|
|
48
|
-
|
|
49
|
-
##### yarn release-beta
|
|
50
|
-
|
|
51
|
-
Automatically calculates and presents 3 beta versions - patch, minor and major for you to choose ( or Other for manual input).
|
|
52
|
-
|
|
53
|
-
```
|
|
54
|
-
? Select increment (next version):
|
|
55
|
-
❯ prepatch (0.1.1-beta.0)
|
|
56
|
-
preminor (0.2.0-beta.0)
|
|
57
|
-
premajor (1.0.0-beta.0)
|
|
58
|
-
Other, please specify...
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
##### yarn release-major-beta
|
|
62
|
-
|
|
63
|
-
Same as `yarn release-beta`, but with premajor version pre-selected.
|
|
64
|
-
|
|
65
|
-
##### yarn release
|
|
66
|
-
|
|
67
|
-
Generic command, does not automatically add the `beta` to version, but you can still manually write it if you choose Other.
|
|
68
|
-
|
|
69
|
-
#### Important notes
|
|
70
|
-
|
|
71
|
-
> Do not use release-it tool on master branch, the commit on CHANGELOG.md file and the version increase in the package.json file can't be done without a PULL REQUEST.
|
|
72
|
-
|
|
73
|
-
> Do not keep Pull Requests from develop to master branches open when you are doing beta releases from the develop branch. As long as a PR to master is open, an automatic script will run on every commit and will update both the version and the changelog to a production-ready state - ( MAJOR.MINOR.PATCH mandatory format for version).
|
|
74
|
-
|
package/bootstrap
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const ejs = require('ejs');
|
|
4
|
-
|
|
5
|
-
const currentDir = path.basename(process.cwd());
|
|
6
|
-
|
|
7
|
-
const bootstrap = function (ofile) {
|
|
8
|
-
fs.readFile(ofile, 'utf8', function (err, data) {
|
|
9
|
-
if (err) {
|
|
10
|
-
return console.log(err);
|
|
11
|
-
}
|
|
12
|
-
const result = ejs.render(data, {
|
|
13
|
-
addonName: `@eeacms/${currentDir}`,
|
|
14
|
-
name: currentDir
|
|
15
|
-
});
|
|
16
|
-
const output = ofile.replace('.tpl', '');
|
|
17
|
-
fs.writeFile(output, result, 'utf8', function (err) {
|
|
18
|
-
if (err) {
|
|
19
|
-
return console.log(err);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
if (ofile.includes('.tpl')) {
|
|
23
|
-
fs.unlink(ofile, (err) => {
|
|
24
|
-
if (err) {
|
|
25
|
-
return console.error(err);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
fs.readdir(".", { withFileTypes: true }, (err, dirents) => {
|
|
33
|
-
const files = dirents
|
|
34
|
-
.filter(dirent => dirent.isFile())
|
|
35
|
-
.map(dirent => dirent.name);
|
|
36
|
-
files.forEach(function (file) {
|
|
37
|
-
if (file != 'bootstrap') {
|
|
38
|
-
bootstrap(file);
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
});
|
package/cypress.config.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
const { defineConfig } = require('cypress');
|
|
2
|
-
|
|
3
|
-
module.exports = defineConfig({
|
|
4
|
-
viewportWidth: 1280,
|
|
5
|
-
defaultCommandTimeout: 8888,
|
|
6
|
-
chromeWebSecurity: false,
|
|
7
|
-
reporter: 'junit',
|
|
8
|
-
video: false,
|
|
9
|
-
retries: {
|
|
10
|
-
runMode: 2,
|
|
11
|
-
openMode: 0,
|
|
12
|
-
},
|
|
13
|
-
reporterOptions: {
|
|
14
|
-
mochaFile: 'cypress/reports/cypress-[hash].xml',
|
|
15
|
-
jenkinsMode: true,
|
|
16
|
-
toConsole: true,
|
|
17
|
-
},
|
|
18
|
-
e2e: {
|
|
19
|
-
setupNodeEvents(on, config) {
|
|
20
|
-
// e2e testing node events setup code
|
|
21
|
-
require('@cypress/code-coverage/task')(on, config);
|
|
22
|
-
return config;
|
|
23
|
-
},
|
|
24
|
-
baseUrl: 'http://localhost:3000',
|
|
25
|
-
},
|
|
26
|
-
});
|
package/docker-compose.yml
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
version: "3"
|
|
2
|
-
services:
|
|
3
|
-
backend:
|
|
4
|
-
image: eeacms/plone-backend
|
|
5
|
-
ports:
|
|
6
|
-
- "8080:8080"
|
|
7
|
-
environment:
|
|
8
|
-
SITE: "Plone"
|
|
9
|
-
PROFILES: "eea.kitkat:testing"
|
|
10
|
-
|
|
11
|
-
frontend:
|
|
12
|
-
build:
|
|
13
|
-
context: ./
|
|
14
|
-
dockerfile: ./Dockerfile
|
|
15
|
-
args:
|
|
16
|
-
ADDON_NAME: "${ADDON_NAME}"
|
|
17
|
-
ADDON_PATH: "${ADDON_PATH}"
|
|
18
|
-
VOLTO_VERSION: ${VOLTO_VERSION:-18-yarn}
|
|
19
|
-
ports:
|
|
20
|
-
- "3000:3000"
|
|
21
|
-
- "3001:3001"
|
|
22
|
-
depends_on:
|
|
23
|
-
- backend
|
|
24
|
-
volumes:
|
|
25
|
-
- ./:/app/src/addons/${ADDON_PATH}
|
|
26
|
-
environment:
|
|
27
|
-
CI: "true"
|
|
28
|
-
NODE_ENV: "development"
|
|
29
|
-
RAZZLE_JEST_CONFIG: "src/addons/${ADDON_PATH}/jest-addon.config.js"
|
|
30
|
-
RAZZLE_INTERNAL_API_PATH: "http://backend:8080/Plone"
|
|
31
|
-
RAZZLE_DEV_PROXY_API_PATH: "http://backend:8080/Plone"
|
|
32
|
-
HOST: "0.0.0.0"
|
package/jest-addon.config.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
require('dotenv').config({ path: __dirname + '/.env' });
|
|
2
|
-
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
|
|
6
|
-
const voltoSlatePath = fs.existsSync(
|
|
7
|
-
path.join(__dirname, '../../../node_modules/@plone/volto-slate/src'),
|
|
8
|
-
)
|
|
9
|
-
? '<rootDir>/node_modules/@plone/volto-slate/src'
|
|
10
|
-
: '<rootDir>/node_modules/@plone/volto/packages/volto-slate/src';
|
|
11
|
-
|
|
12
|
-
module.exports = {
|
|
13
|
-
testMatch: ['**/src/addons/**/?(*.)+(spec|test).[jt]s?(x)'],
|
|
14
|
-
collectCoverageFrom: [
|
|
15
|
-
'src/addons/**/src/**/*.{js,jsx,ts,tsx}',
|
|
16
|
-
'!src/**/*.d.ts',
|
|
17
|
-
],
|
|
18
|
-
moduleNameMapper: {
|
|
19
|
-
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
|
|
20
|
-
'@plone/volto/cypress': '<rootDir>/node_modules/@plone/volto/cypress',
|
|
21
|
-
'@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
|
|
22
|
-
'@plone/volto/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
|
|
23
|
-
'@package/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
|
|
24
|
-
'@root/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
|
|
25
|
-
'@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
|
|
26
|
-
'@eeacms/search': '<rootDir>/node_modules/@eeacms/volto-searchlib/src',
|
|
27
|
-
'@eeacms/(.*?)/(.*)$': '<rootDir>/node_modules/@eeacms/$1/src/$2',
|
|
28
|
-
'@plone/volto-slate$': voltoSlatePath,
|
|
29
|
-
'@plone/volto-slate/(.*)$': `${voltoSlatePath}/$1`,
|
|
30
|
-
'~/(.*)$': '<rootDir>/src/$1',
|
|
31
|
-
'load-volto-addons':
|
|
32
|
-
'<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
|
|
33
|
-
},
|
|
34
|
-
transformIgnorePatterns: [
|
|
35
|
-
'/node_modules/(?!(@plone|@root|@package|@eeacms)/).*/',
|
|
36
|
-
],
|
|
37
|
-
transform: {
|
|
38
|
-
'^.+\\.js(x)?$': 'babel-jest',
|
|
39
|
-
'^.+\\.ts(x)?$': 'babel-jest',
|
|
40
|
-
'^.+\\.(png)$': 'jest-file',
|
|
41
|
-
'^.+\\.(jpg)$': 'jest-file',
|
|
42
|
-
'^.+\\.(svg)$': './node_modules/@plone/volto/jest-svgsystem-transform.js',
|
|
43
|
-
},
|
|
44
|
-
coverageThreshold: {
|
|
45
|
-
global: {
|
|
46
|
-
branches: 5,
|
|
47
|
-
functions: 5,
|
|
48
|
-
lines: 5,
|
|
49
|
-
statements: 5,
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
...(process.env.JEST_USE_SETUP === 'ON' && {
|
|
53
|
-
setupFilesAfterEnv: [
|
|
54
|
-
'<rootDir>/node_modules/@eeacms/volto-datahub/jest.setup.js',
|
|
55
|
-
],
|
|
56
|
-
}),
|
|
57
|
-
};
|