@eeacms/volto-eea-map 0.1.1
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/.coverage.babel.config.js +9 -0
- package/.project.eslintrc.js +46 -0
- package/.release-it.json +17 -0
- package/CHANGELOG.md +40 -0
- package/DEVELOP.md +51 -0
- package/LICENSE.md +9 -0
- package/README.md +103 -0
- package/RELEASE.md +74 -0
- package/babel.config.js +17 -0
- package/bootstrap +41 -0
- package/cypress.json +17 -0
- package/jest-addon.config.js +36 -0
- package/locales/volto.pot +0 -0
- package/package.json +44 -0
- package/src/components/Blocks/EEAMap/Edit.jsx +37 -0
- package/src/components/Blocks/EEAMap/Schema.js +32 -0
- package/src/components/Blocks/EEAMap/View.jsx +20 -0
- package/src/components/Blocks/EEAMap/components/TextView.jsx +7 -0
- package/src/components/Blocks/EEAMap/components/Webmap.jsx +194 -0
- package/src/components/Blocks/EEAMap/components/widgets/ExtraViews.jsx +53 -0
- package/src/components/Blocks/EEAMap/components/widgets/LayerSelectWidget.jsx +113 -0
- package/src/components/Blocks/EEAMap/components/widgets/LayersPanel.jsx +56 -0
- package/src/components/Blocks/EEAMap/components/widgets/LegendWidget.jsx +63 -0
- package/src/components/Blocks/EEAMap/components/widgets/MapEditorWidget.jsx +81 -0
- package/src/components/Blocks/EEAMap/components/widgets/ObjectTypesWidget.jsx +53 -0
- package/src/components/Blocks/EEAMap/components/widgets/panelsSchema.js +190 -0
- package/src/components/Blocks/EEAMap/constants.js +29 -0
- package/src/components/Blocks/EEAMap/styles/map.css +22 -0
- package/src/components/Blocks/EEAMap/utils.js +17 -0
- package/src/components/index.js +4 -0
- package/src/index.js +41 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const defaultBabel = require('@plone/volto/babel');
|
|
2
|
+
|
|
3
|
+
function applyDefault(api) {
|
|
4
|
+
const voltoBabel = defaultBabel(api);
|
|
5
|
+
voltoBabel.plugins.push('@babel/plugin-transform-modules-commonjs', 'transform-class-properties', 'istanbul');
|
|
6
|
+
return voltoBabel;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
module.exports = applyDefault;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
const projectRootPath = fs.realpathSync('./project'); // __dirname
|
|
5
|
+
const packageJson = require(path.join(projectRootPath, 'package.json'));
|
|
6
|
+
const jsConfig = require(path.join(projectRootPath, 'jsconfig.json')).compilerOptions;
|
|
7
|
+
|
|
8
|
+
const pathsConfig = jsConfig.paths;
|
|
9
|
+
|
|
10
|
+
let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto');
|
|
11
|
+
|
|
12
|
+
Object.keys(pathsConfig).forEach(pkg => {
|
|
13
|
+
if (pkg === '@plone/volto') {
|
|
14
|
+
voltoPath = `./${jsConfig.baseUrl}/${pathsConfig[pkg][0]}`;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
const AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`);
|
|
18
|
+
const reg = new AddonConfigurationRegistry(projectRootPath);
|
|
19
|
+
|
|
20
|
+
// Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
|
|
21
|
+
const addonAliases = Object.keys(reg.packages).map(o => [
|
|
22
|
+
o,
|
|
23
|
+
reg.packages[o].modulePath,
|
|
24
|
+
]);
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
module.exports = {
|
|
28
|
+
extends: `${projectRootPath}/node_modules/@plone/volto/.eslintrc`,
|
|
29
|
+
settings: {
|
|
30
|
+
'import/resolver': {
|
|
31
|
+
alias: {
|
|
32
|
+
map: [
|
|
33
|
+
['@plone/volto', '@plone/volto/src'],
|
|
34
|
+
...addonAliases,
|
|
35
|
+
['@package', `${__dirname}/src`],
|
|
36
|
+
['~', `${__dirname}/src`],
|
|
37
|
+
],
|
|
38
|
+
extensions: ['.js', '.jsx', '.json'],
|
|
39
|
+
},
|
|
40
|
+
'babel-plugin-root-import': {
|
|
41
|
+
rootPathSuffix: 'src',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
package/.release-it.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"npm": {
|
|
3
|
+
"publish": false
|
|
4
|
+
},
|
|
5
|
+
"git": {
|
|
6
|
+
"changelog": "npx auto-changelog --stdout --commit-limit false -u --template https://raw.githubusercontent.com/release-it/release-it/master/templates/changelog-compact.hbs",
|
|
7
|
+
"tagName": "${version}"
|
|
8
|
+
},
|
|
9
|
+
"github": {
|
|
10
|
+
"release": true,
|
|
11
|
+
"releaseName": "${version}",
|
|
12
|
+
"releaseNotes": "npx auto-changelog --stdout --commit-limit false -u --template https://raw.githubusercontent.com/release-it/release-it/master/templates/changelog-compact.hbs"
|
|
13
|
+
},
|
|
14
|
+
"hooks": {
|
|
15
|
+
"after:bump": "npx auto-changelog --commit-limit false -p"
|
|
16
|
+
}
|
|
17
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
### Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
|
|
4
|
+
|
|
5
|
+
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
|
+
|
|
7
|
+
#### [0.1.1](https://github.com/eea/volto-eea-map/compare/0.1.0...0.1.1)
|
|
8
|
+
|
|
9
|
+
- Lint [`d31819d`](https://github.com/eea/volto-eea-map/commit/d31819d98338fbc013dfd4506466e7c20b04aad5)
|
|
10
|
+
- Remove object pick widget [`40c7bcd`](https://github.com/eea/volto-eea-map/commit/40c7bcd2305bbab1c21919a0ae82af3eb628b09d)
|
|
11
|
+
- Add group layer [`74fd1af`](https://github.com/eea/volto-eea-map/commit/74fd1af2bce6347ce4a80758947e05b7c4a6d516)
|
|
12
|
+
- Group extra views [`17b1a10`](https://github.com/eea/volto-eea-map/commit/17b1a10052326ce8db34ebe1250a167b82b9d11c)
|
|
13
|
+
- Move description in block edit [`edf277c`](https://github.com/eea/volto-eea-map/commit/edf277c1cf8a8a438dca08e44b17164c1fdd25a5)
|
|
14
|
+
- external legend fetch, map actions [`f2ddb8d`](https://github.com/eea/volto-eea-map/commit/f2ddb8df5bb3a6c8761086497d2795c6e0df126d)
|
|
15
|
+
- fix modal save/reset [`49b62db`](https://github.com/eea/volto-eea-map/commit/49b62db597ff7e41cbcc1ef52730aff84457ae9f)
|
|
16
|
+
- More schema edits [`91f18b9`](https://github.com/eea/volto-eea-map/commit/91f18b9c23842f45509f0e8844639402bad22f8e)
|
|
17
|
+
- Description, general tab, download, sources, open app [`7c7cf5a`](https://github.com/eea/volto-eea-map/commit/7c7cf5ac16ccff5c2c52a6721eda658496de272e)
|
|
18
|
+
- Zoom, center, level controls [`f51ecc8`](https://github.com/eea/volto-eea-map/commit/f51ecc8c8a97a0b7615d1762dd662646b41c7d7e)
|
|
19
|
+
- Legend, Print controls [`8e042aa`](https://github.com/eea/volto-eea-map/commit/8e042aa1aa532516e8b2355d082760d96adaac57)
|
|
20
|
+
- Legend, Print, default tab base [`7879456`](https://github.com/eea/volto-eea-map/commit/787945637257606e826bea8b4ded2d073d6d4a5b)
|
|
21
|
+
- Edit widget save/cancel logic [`d28764c`](https://github.com/eea/volto-eea-map/commit/d28764cb65b84426c2df45e9b37ac0a0062788f2)
|
|
22
|
+
- Edit menu update [`828daa4`](https://github.com/eea/volto-eea-map/commit/828daa488221e774c93094ef3aeaa8a3b6543159)
|
|
23
|
+
- Fixes & improvements [`35c3c4a`](https://github.com/eea/volto-eea-map/commit/35c3c4a0b080b53929f5aa70b9936c2128d8f6ac)
|
|
24
|
+
- Widgetization of the edit widget (WIP) [`e32edd1`](https://github.com/eea/volto-eea-map/commit/e32edd139bbbb607b0ba02febda2bf211ae1c176)
|
|
25
|
+
- Store base layer value [`0158549`](https://github.com/eea/volto-eea-map/commit/01585491f828de1e591fd70f292fda1e679896ca)
|
|
26
|
+
- base layer in editor panels [`75e4a05`](https://github.com/eea/volto-eea-map/commit/75e4a059adf938f95b2bf21f4b9b7f30837a233c)
|
|
27
|
+
- widgetization of MapEditor & extended variation [`30914a8`](https://github.com/eea/volto-eea-map/commit/30914a86ebbcb2575e3209d6b2af8621fae2718c)
|
|
28
|
+
- handle Error from api [`477970b`](https://github.com/eea/volto-eea-map/commit/477970bfc9dc86acc3cca96ad0931ada3316fcd6)
|
|
29
|
+
- Edit layers verify & fetch from serviceUrl [`672ade1`](https://github.com/eea/volto-eea-map/commit/672ade112faf10394b463c91a07323d1fe78eb26)
|
|
30
|
+
- Edit widget, layers tabs [`4cc34d4`](https://github.com/eea/volto-eea-map/commit/4cc34d41bb0e227785076f033a941aeaf7c42ed8)
|
|
31
|
+
- add map & configurations [`61cfd12`](https://github.com/eea/volto-eea-map/commit/61cfd125b1a230682e817f3728af5379f104c410)
|
|
32
|
+
- packs fix [`4eb213a`](https://github.com/eea/volto-eea-map/commit/4eb213a11d95c468e76a5c76db9ae2ced29db6b8)
|
|
33
|
+
- bootstrap [`2d16195`](https://github.com/eea/volto-eea-map/commit/2d161953a4e20db079162130cd6f1bf2116c874a)
|
|
34
|
+
- init eea map block [`1033ec3`](https://github.com/eea/volto-eea-map/commit/1033ec3af09cc07807f983898a9c2ec63cbc81c6)
|
|
35
|
+
|
|
36
|
+
#### 0.1.0
|
|
37
|
+
|
|
38
|
+
> 26 July 2022
|
|
39
|
+
|
|
40
|
+
- Initial commit [`39f2dfc`](https://github.com/eea/volto-eea-map/commit/39f2dfcc5f60451930621e0238a11f710e233371)
|
package/DEVELOP.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# volto-addon-template
|
|
2
|
+
|
|
3
|
+
## Develop
|
|
4
|
+
|
|
5
|
+
Before starting make sure your development environment is properly set. See [Volto Developer Documentation](https://docs.voltocms.com/getting-started/install/)
|
|
6
|
+
|
|
7
|
+
1. Make sure you have installed `yo`, `@plone/generator-volto` and `mrs-developer`
|
|
8
|
+
|
|
9
|
+
npm install -g yo @plone/generator-volto mrs-developer
|
|
10
|
+
|
|
11
|
+
1. Create new volto app
|
|
12
|
+
|
|
13
|
+
yo @plone/volto my-volto-project --addon @eeacms/volto-addon-template --skip-install
|
|
14
|
+
cd my-volto-project
|
|
15
|
+
|
|
16
|
+
1. Add the following to `mrs.developer.json`:
|
|
17
|
+
|
|
18
|
+
{
|
|
19
|
+
"volto-addon-template": {
|
|
20
|
+
"url": "https://github.com/eea/volto-addon-template.git",
|
|
21
|
+
"package": "@eeacms/volto-addon-template",
|
|
22
|
+
"branch": "develop",
|
|
23
|
+
"path": "src"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
1. Install
|
|
28
|
+
|
|
29
|
+
yarn develop
|
|
30
|
+
yarn
|
|
31
|
+
|
|
32
|
+
1. Start backend
|
|
33
|
+
|
|
34
|
+
docker pull plone
|
|
35
|
+
docker run -d --name plone -p 8080:8080 -e SITE=Plone -e PROFILES="profile-plone.restapi:blocks" plone
|
|
36
|
+
|
|
37
|
+
...wait for backend to setup and start - `Ready to handle requests`:
|
|
38
|
+
|
|
39
|
+
docker logs -f plone
|
|
40
|
+
|
|
41
|
+
...you can also check http://localhost:8080/Plone
|
|
42
|
+
|
|
43
|
+
1. Start frontend
|
|
44
|
+
|
|
45
|
+
yarn start
|
|
46
|
+
|
|
47
|
+
1. Go to http://localhost:3000
|
|
48
|
+
|
|
49
|
+
1. Happy hacking!
|
|
50
|
+
|
|
51
|
+
cd src/addons/volto-addon-template/
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 European Environment Agency
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# volto-addon-template
|
|
2
|
+
|
|
3
|
+
[](https://github.com/eea/volto-addon-template/releases)
|
|
4
|
+
|
|
5
|
+
[](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-addon-template/job/master/display/redirect)
|
|
6
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-addon-template-master)
|
|
7
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-addon-template-master)
|
|
8
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-addon-template-master)
|
|
9
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-addon-template-master)
|
|
10
|
+
|
|
11
|
+
[](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-addon-template/job/develop/display/redirect)
|
|
12
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-addon-template-develop)
|
|
13
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-addon-template-develop)
|
|
14
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-addon-template-develop)
|
|
15
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-addon-template-develop)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
[Volto](https://github.com/plone/volto) add-on
|
|
19
|
+
|
|
20
|
+
## Features
|
|
21
|
+
|
|
22
|
+
Demo GIF
|
|
23
|
+
|
|
24
|
+
## Getting started
|
|
25
|
+
|
|
26
|
+
### Try volto-addon-template with Docker
|
|
27
|
+
|
|
28
|
+
1. Get the latest Docker images
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
docker pull plone
|
|
32
|
+
docker pull plone/volto
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
1. Start Plone backend
|
|
36
|
+
```
|
|
37
|
+
docker run -d --name plone -p 8080:8080 -e SITE=Plone -e PROFILES="profile-plone.restapi:blocks" plone
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
1. Start Volto frontend
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
docker run -it --rm -p 3000:3000 --link plone -e ADDONS="@eeacms/volto-addon-template" plone/volto
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
1. Go to http://localhost:3000
|
|
47
|
+
|
|
48
|
+
### Add volto-addon-template to your Volto project
|
|
49
|
+
|
|
50
|
+
1. Make sure you have a [Plone backend](https://plone.org/download) up-and-running at http://localhost:8080/Plone
|
|
51
|
+
|
|
52
|
+
1. Start Volto frontend
|
|
53
|
+
|
|
54
|
+
* If you already have a volto project, just update `package.json`:
|
|
55
|
+
|
|
56
|
+
```JSON
|
|
57
|
+
"addons": [
|
|
58
|
+
"@eeacms/volto-addon-template"
|
|
59
|
+
],
|
|
60
|
+
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"@eeacms/volto-addon-template": "^1.0.0"
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
* If not, create one:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
npm install -g yo @plone/generator-volto
|
|
70
|
+
yo @plone/volto my-volto-project --addon @eeacms/volto-addon-template
|
|
71
|
+
cd my-volto-project
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
1. Install new add-ons and restart Volto:
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
yarn
|
|
78
|
+
yarn start
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
1. Go to http://localhost:3000
|
|
82
|
+
|
|
83
|
+
1. Happy editing!
|
|
84
|
+
|
|
85
|
+
## Release
|
|
86
|
+
|
|
87
|
+
See [RELEASE.md](https://github.com/eea/volto-addon-template/blob/master/RELEASE.md).
|
|
88
|
+
|
|
89
|
+
## How to contribute
|
|
90
|
+
|
|
91
|
+
See [DEVELOP.md](https://github.com/eea/volto-addon-template/blob/master/DEVELOP.md).
|
|
92
|
+
|
|
93
|
+
## Copyright and license
|
|
94
|
+
|
|
95
|
+
The Initial Owner of the Original Code is European Environment Agency (EEA).
|
|
96
|
+
All Rights Reserved.
|
|
97
|
+
|
|
98
|
+
See [LICENSE.md](https://github.com/eea/volto-addon-template/blob/master/LICENSE.md) for details.
|
|
99
|
+
|
|
100
|
+
## Funding
|
|
101
|
+
|
|
102
|
+
[European Environment Agency (EU)](http://eea.europa.eu)
|
|
103
|
+
|
package/RELEASE.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
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/babel.config.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module.exports = function (api) {
|
|
2
|
+
api.cache(true);
|
|
3
|
+
const presets = ['razzle/babel'];
|
|
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
|
+
};
|
package/bootstrap
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
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.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"baseUrl": "http://localhost:3000",
|
|
3
|
+
"viewportWidth": 1280,
|
|
4
|
+
"defaultCommandTimeout": 8888,
|
|
5
|
+
"chromeWebSecurity": false,
|
|
6
|
+
"reporter": "junit",
|
|
7
|
+
"video": true,
|
|
8
|
+
"retries": {
|
|
9
|
+
"runMode": 8,
|
|
10
|
+
"openMode": 0
|
|
11
|
+
},
|
|
12
|
+
"reporterOptions": {
|
|
13
|
+
"mochaFile": "cypress/reports/cypress-[hash].xml",
|
|
14
|
+
"jenkinsMode": true,
|
|
15
|
+
"toConsole": true
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
testMatch: ['**/src/addons/**/?(*.)+(spec|test).[jt]s?(x)'],
|
|
3
|
+
collectCoverageFrom: [
|
|
4
|
+
'src/addons/**/src/**/*.{js,jsx,ts,tsx}',
|
|
5
|
+
'!src/**/*.d.ts',
|
|
6
|
+
],
|
|
7
|
+
moduleNameMapper: {
|
|
8
|
+
'@plone/volto/cypress': '<rootDir>/node_modules/@plone/volto/cypress',
|
|
9
|
+
'@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
|
|
10
|
+
'@plone/volto/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
|
|
11
|
+
'@package/(.*)$': '<rootDir>/src/$1',
|
|
12
|
+
'@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
|
|
13
|
+
'@eeacms/(.*?)/(.*)$': '<rootDir>/src/addons/$1/src/$2',
|
|
14
|
+
'volto-slate/(.*)$': '<rootDir>/src/addons/volto-slate/src/$1',
|
|
15
|
+
'~/(.*)$': '<rootDir>/src/$1',
|
|
16
|
+
'load-volto-addons':
|
|
17
|
+
'<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
|
|
18
|
+
},
|
|
19
|
+
transform: {
|
|
20
|
+
'^.+\\.js(x)?$': 'babel-jest',
|
|
21
|
+
'^.+\\.css$': 'jest-css-modules',
|
|
22
|
+
'^.+\\.less$': 'jest-css-modules',
|
|
23
|
+
'^.+\\.scss$': 'jest-css-modules',
|
|
24
|
+
'^.+\\.(png)$': 'jest-file',
|
|
25
|
+
'^.+\\.(jpg)$': 'jest-file',
|
|
26
|
+
'^.+\\.(svg)$': './node_modules/@plone/volto/jest-svgsystem-transform.js',
|
|
27
|
+
},
|
|
28
|
+
coverageThreshold: {
|
|
29
|
+
global: {
|
|
30
|
+
branches: 5,
|
|
31
|
+
functions: 5,
|
|
32
|
+
lines: 5,
|
|
33
|
+
statements: 5,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
File without changes
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@eeacms/volto-eea-map",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "@eeacms/volto-eea-map: Volto add-on",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"author": "European Environment Agency: IDM2 A-Team",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"homepage": "https://github.com/eea/volto-eea-map",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"volto-addon",
|
|
11
|
+
"volto",
|
|
12
|
+
"plone",
|
|
13
|
+
"react"
|
|
14
|
+
],
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git@github.com:eea/volto-eea-map.git"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"esri-loader": "3.5.0",
|
|
21
|
+
"@plone/scripts": "*"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@cypress/code-coverage": "^3.9.5",
|
|
25
|
+
"babel-plugin-transform-class-properties": "^6.24.1"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"release": "release-it",
|
|
29
|
+
"bootstrap": "npm install -g ejs; npm link ejs; node bootstrap",
|
|
30
|
+
"test": "make test",
|
|
31
|
+
"test:fix": "make test-update",
|
|
32
|
+
"pre-commit": "yarn stylelint:fix && yarn prettier:fix && yarn lint:fix",
|
|
33
|
+
"stylelint": "if [ -d ./project ]; then ./project/node_modules/stylelint/bin/stylelint.js --allow-empty-input 'src/**/*.{css,less}'; else ../../../node_modules/stylelint/bin/stylelint.js --allow-empty-input 'src/**/*.{css,less}'; fi",
|
|
34
|
+
"stylelint:overrides": "if [ -d ./project ]; then ./project/node_modules/.bin/stylelint --syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides'; else ../../../node_modules/.bin/stylelint --syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides'; fi",
|
|
35
|
+
"stylelint:fix": "yarn stylelint --fix && yarn stylelint:overrides --fix",
|
|
36
|
+
"prettier": "if [ -d ./project ]; then ./project/node_modules/.bin/prettier --single-quote --check 'src/**/*.{js,jsx,json,css,less,md}'; else ../../../node_modules/.bin/prettier --single-quote --check 'src/**/*.{js,jsx,json,css,less,md}'; fi",
|
|
37
|
+
"prettier:fix": "if [ -d ./project ]; then ./project/node_modules/.bin/prettier --single-quote --write 'src/**/*.{js,jsx,json,css,less,md}'; else ../../../node_modules/.bin/prettier --single-quote --write 'src/**/*.{js,jsx,json,css,less,md}'; fi",
|
|
38
|
+
"lint": "if [ -d ./project ]; then ./project/node_modules/eslint/bin/eslint.js --max-warnings=0 'src/**/*.{js,jsx}'; else ../../../node_modules/eslint/bin/eslint.js --max-warnings=0 'src/**/*.{js,jsx}'; fi",
|
|
39
|
+
"lint:fix": "if [ -d ./project ]; then ./project/node_modules/eslint/bin/eslint.js --fix 'src/**/*.{js,jsx}'; else ../../../node_modules/eslint/bin/eslint.js --fix 'src/**/*.{js,jsx}'; fi",
|
|
40
|
+
"i18n": "rm -rf build/messages && NODE_ENV=production i18n --addon",
|
|
41
|
+
"cypress:run": "if [ -d ./project ]; then NODE_ENV=development ./project/node_modules/cypress/bin/cypress run; else NODE_ENV=development ../../../node_modules/cypress/bin/cypress run; fi",
|
|
42
|
+
"cypress:open": "if [ -d ./project ]; then NODE_ENV=development ./project/node_modules/cypress/bin/cypress open; else NODE_ENV=development ../../../node_modules/cypress/bin/cypress open; fi"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SidebarPortal } from '@plone/volto/components';
|
|
3
|
+
import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
|
|
4
|
+
import { Schema } from './Schema';
|
|
5
|
+
import Webmap from './components/Webmap';
|
|
6
|
+
import './styles/map.css';
|
|
7
|
+
import ExtraViews from './components/widgets/ExtraViews';
|
|
8
|
+
|
|
9
|
+
const Edit = (props) => {
|
|
10
|
+
const { block, data, onChangeBlock, selected } = props;
|
|
11
|
+
const schema = React.useMemo(() => Schema(props), [props]);
|
|
12
|
+
|
|
13
|
+
const { map_data = {}, height } = data;
|
|
14
|
+
if (__SERVER__) return '';
|
|
15
|
+
return (
|
|
16
|
+
<>
|
|
17
|
+
<Webmap data={map_data} height={height} />
|
|
18
|
+
<ExtraViews data={data} />
|
|
19
|
+
<SidebarPortal selected={selected}>
|
|
20
|
+
<BlockDataForm
|
|
21
|
+
block={block}
|
|
22
|
+
title={schema.title}
|
|
23
|
+
schema={schema}
|
|
24
|
+
onChangeField={(id, value) => {
|
|
25
|
+
onChangeBlock(block, {
|
|
26
|
+
...data,
|
|
27
|
+
[id]: value,
|
|
28
|
+
});
|
|
29
|
+
}}
|
|
30
|
+
formData={data}
|
|
31
|
+
/>
|
|
32
|
+
</SidebarPortal>
|
|
33
|
+
</>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default Edit;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export const Schema = () => {
|
|
2
|
+
return {
|
|
3
|
+
title: 'EEA Map Block',
|
|
4
|
+
fieldsets: [
|
|
5
|
+
{
|
|
6
|
+
id: 'default',
|
|
7
|
+
title: 'Default',
|
|
8
|
+
fields: ['show_description', 'description', 'height', 'map_data'],
|
|
9
|
+
},
|
|
10
|
+
],
|
|
11
|
+
properties: {
|
|
12
|
+
height: {
|
|
13
|
+
title: 'Height',
|
|
14
|
+
type: 'number',
|
|
15
|
+
},
|
|
16
|
+
show_description: {
|
|
17
|
+
title: 'Show description',
|
|
18
|
+
type: 'boolean',
|
|
19
|
+
},
|
|
20
|
+
description: {
|
|
21
|
+
title: 'Description',
|
|
22
|
+
type: 'text',
|
|
23
|
+
},
|
|
24
|
+
map_data: {
|
|
25
|
+
title: 'Edit map',
|
|
26
|
+
description: 'Open the map customization interface',
|
|
27
|
+
widget: 'map_edit_widget',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
required: [],
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Webmap from './components/Webmap';
|
|
3
|
+
import ExtraViews from './components/widgets/ExtraViews';
|
|
4
|
+
|
|
5
|
+
const View = (props) => {
|
|
6
|
+
const { data } = props || {};
|
|
7
|
+
|
|
8
|
+
const { map_data = {} } = data;
|
|
9
|
+
|
|
10
|
+
if (__SERVER__) return '';
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<Webmap data={map_data} />
|
|
15
|
+
<ExtraViews data={data} />
|
|
16
|
+
</>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default View;
|