@eeacms/volto-flourish 0.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.
@@ -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('istanbul');
6
+ return voltoBabel;
7
+ }
8
+
9
+ module.exports = applyDefault;
package/.eslintrc.js ADDED
@@ -0,0 +1,65 @@
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 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
+ const addonExtenders = reg.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/packages/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-no-target-blank': [
52
+ 'error',
53
+ {
54
+ allowReferrer: true,
55
+ },
56
+ ],
57
+ }
58
+ };
59
+
60
+ const config = addonExtenders.reduce(
61
+ (acc, extender) => extender.modify(acc),
62
+ defaultConfig,
63
+ );
64
+
65
+ module.exports = config;
@@ -0,0 +1,2 @@
1
+ [ -n "$CI" ] && exit 0
2
+ yarn lint-staged
@@ -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,5 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0
4
+
5
+ - Initial release
package/DEVELOP.md ADDED
@@ -0,0 +1,114 @@
1
+ # volto-flourish
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-flourish.git
9
+ cd volto-flourish
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-flourish to your Volto project
28
+
29
+ Before starting make sure your development environment is properly set. See [Volto Developer Documentation](https://docs.voltocms.com/getting-started/install/)
30
+
31
+ 1. Make sure you have installed `yo`, `@plone/generator-volto` and `mrs-developer`
32
+
33
+ npm install -g yo @plone/generator-volto mrs-developer
34
+
35
+ 1. Create new volto app
36
+
37
+ yo @plone/volto my-volto-project --addon @eeacms/volto-flourish --skip-install
38
+ cd my-volto-project
39
+
40
+ 1. Add the following to `mrs.developer.json`:
41
+
42
+ {
43
+ "volto-flourish": {
44
+ "url": "https://github.com/eea/volto-flourish.git",
45
+ "package": "@eeacms/volto-flourish",
46
+ "branch": "develop",
47
+ "path": "src"
48
+ }
49
+ }
50
+
51
+ 1. Install
52
+
53
+ make develop
54
+ yarn
55
+
56
+ 1. Start backend
57
+
58
+ docker run --pull always -it --rm --name plone -p 8080:8080 -e SITE=Plone plone/plone-backend
59
+
60
+ ...wait for backend to setup and start - `Ready to handle requests`:
61
+
62
+ ...you can also check http://localhost:8080/Plone
63
+
64
+ 1. Start frontend
65
+
66
+ yarn start
67
+
68
+ 1. Go to http://localhost:3000
69
+
70
+ 1. Happy hacking!
71
+
72
+ cd src/addons/volto-flourish/
73
+
74
+ ## Cypress
75
+
76
+ To run cypress locally, first make sure you don't have any Volto/Plone running on ports `8080` and `3000`.
77
+
78
+ You don't have to be in a `clean-volto-project`, you can be in any Volto Frontend
79
+ project where you added `volto-flourish` to `mrs.developer.json`
80
+
81
+ Go to:
82
+
83
+ ```BASH
84
+ cd src/addons/volto-flourish/
85
+ ```
86
+
87
+ Start:
88
+
89
+ ```Bash
90
+ make
91
+ make start
92
+ ```
93
+
94
+ This will build and start with Docker a clean `Plone backend` and `Volto Frontend` with `volto-flourish` block installed.
95
+
96
+ Open Cypress Interface:
97
+
98
+ ```Bash
99
+ make cypress-open
100
+ ```
101
+
102
+ Or run it:
103
+
104
+ ```Bash
105
+ make cypress-run
106
+ ```
107
+ make cypress-open
108
+ ```
109
+
110
+ Or run it:
111
+
112
+ ```Bash
113
+ make cypress-run
114
+ ```
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,101 @@
1
+ # volto-flourish
2
+
3
+ [![Releases](https://img.shields.io/github/v/release/eea/volto-flourish)](https://github.com/eea/volto-flourish/releases)
4
+
5
+ [![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto-addons%2Fvolto-flourish%2Fmaster&subject=master)](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-flourish/job/master/display/redirect)
6
+ [![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-flourish-master&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-flourish-master)
7
+ [![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-flourish-master&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-flourish-master)
8
+ [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-flourish-master&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-flourish-master)
9
+ [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-flourish-master&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-flourish-master)
10
+
11
+ [![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto-addons%2Fvolto-flourish%2Fdevelop&subject=develop)](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-flourish/job/develop/display/redirect)
12
+ [![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-flourish-develop&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-flourish-develop)
13
+ [![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-flourish-develop&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-flourish-develop)
14
+ [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-flourish-develop&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-flourish-develop)
15
+ [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-flourish-develop&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-flourish-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-flourish with Docker
27
+
28
+ git clone https://github.com/eea/volto-flourish.git
29
+ cd volto-flourish
30
+ make
31
+ make start
32
+
33
+ Go to http://localhost:3000
34
+
35
+ ### Add volto-flourish to your Volto project
36
+
37
+ 1. Make sure you have a [Plone backend](https://plone.org/download) up-and-running at http://localhost:8080/Plone
38
+
39
+ ```Bash
40
+ docker compose up backend
41
+ ```
42
+
43
+ 1. Start Volto frontend
44
+
45
+ * If you already have a volto project, just update `package.json`:
46
+
47
+ ```JSON
48
+ "addons": [
49
+ "@eeacms/volto-flourish"
50
+ ],
51
+
52
+ "dependencies": {
53
+ "@eeacms/volto-flourish": "*"
54
+ }
55
+ ```
56
+
57
+ * If not, create one:
58
+
59
+ ```
60
+ npm install -g yo @plone/generator-volto
61
+ yo @plone/volto my-volto-project --canary --addon @eeacms/volto-flourish
62
+ cd my-volto-project
63
+ ```
64
+
65
+ 1. Install new add-ons and restart Volto:
66
+
67
+ ```
68
+ yarn
69
+ yarn start
70
+ ```
71
+
72
+ 1. Go to http://localhost:3000
73
+
74
+ 1. Happy editing!
75
+
76
+ ## Release
77
+
78
+ See [RELEASE.md](https://github.com/eea/volto-flourish/blob/master/RELEASE.md).
79
+
80
+ ## How to contribute
81
+
82
+ See [DEVELOP.md](https://github.com/eea/volto-flourish/blob/master/DEVELOP.md).
83
+
84
+ ## Copyright and license
85
+
86
+ The Initial Owner of the Original Code is European Environment Agency (EEA).
87
+ All Rights Reserved.
88
+
89
+ See [LICENSE.md](https://github.com/eea/volto-flourish/blob/master/LICENSE.md) for details.
90
+
91
+ ## Funding
92
+
93
+ [European Environment Agency (EU)](http://eea.europa.eu)
94
+ (EEA).
95
+ All Rights Reserved.
96
+
97
+ See [LICENSE.md](https://github.com/eea/volto-addon-template/blob/master/LICENSE.md) for details.
98
+
99
+ ## Funding
100
+
101
+ [European Environment Agency (EU)](http://eea.europa.eu)
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
+
@@ -0,0 +1,17 @@
1
+ module.exports = function (api) {
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
+ };
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
+ });
@@ -0,0 +1,27 @@
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
+ require('cypress-fail-fast/plugin')(on, config);
23
+ return config;
24
+ },
25
+ baseUrl: 'http://localhost:3000',
26
+ },
27
+ });
@@ -0,0 +1,32 @@
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:-16}
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"
@@ -0,0 +1,51 @@
1
+ require('dotenv').config({ path: __dirname + '/.env' })
2
+
3
+ module.exports = {
4
+ testMatch: ['**/src/addons/**/?(*.)+(spec|test).[jt]s?(x)'],
5
+ collectCoverageFrom: [
6
+ 'src/addons/**/src/**/*.{js,jsx,ts,tsx}',
7
+ '!src/**/*.d.ts',
8
+ ],
9
+ moduleNameMapper: {
10
+ '\\.(css|less|scss|sass)$': 'identity-obj-proxy',
11
+ '@plone/volto/cypress': '<rootDir>/node_modules/@plone/volto/cypress',
12
+ '@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
13
+ '@plone/volto/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
14
+ '@package/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
15
+ '@root/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
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',
19
+ '@eeacms/(.*?)/(.*)$': '<rootDir>/node_modules/@eeacms/$1/src/$2',
20
+ '@plone/volto-slate$':
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',
24
+ '~/(.*)$': '<rootDir>/src/$1',
25
+ 'load-volto-addons':
26
+ '<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
27
+ },
28
+ transformIgnorePatterns: [
29
+ '/node_modules/(?!(@plone|@root|@package|@eeacms)/).*/',
30
+ ],
31
+ transform: {
32
+ '^.+\\.js(x)?$': 'babel-jest',
33
+ '^.+\\.ts(x)?$': 'babel-jest',
34
+ '^.+\\.(png)$': 'jest-file',
35
+ '^.+\\.(jpg)$': 'jest-file',
36
+ '^.+\\.(svg)$': './node_modules/@plone/volto/jest-svgsystem-transform.js',
37
+ },
38
+ coverageThreshold: {
39
+ global: {
40
+ branches: 5,
41
+ functions: 5,
42
+ lines: 5,
43
+ statements: 5,
44
+ },
45
+ },
46
+ ...(process.env.JEST_USE_SETUP === 'ON' && {
47
+ setupFilesAfterEnv: [
48
+ '<rootDir>/node_modules/@eeacms/volto-flourish/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
+ });
@@ -0,0 +1,14 @@
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: \n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: \n"
6
+ "PO-Revision-Date: \n"
7
+ "Last-Translator: \n"
8
+ "Language: \n"
9
+ "Language-Team: \n"
10
+ "Content-Type: \n"
11
+ "Content-Transfer-Encoding: \n"
12
+ "Plural-Forms: \n"
13
+
14
+
@@ -0,0 +1,14 @@
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: \n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: \n"
6
+ "PO-Revision-Date: \n"
7
+ "Last-Translator: \n"
8
+ "Language: \n"
9
+ "Language-Team: \n"
10
+ "Content-Type: \n"
11
+ "Content-Transfer-Encoding: \n"
12
+ "Plural-Forms: \n"
13
+
14
+
@@ -0,0 +1,14 @@
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: \n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: \n"
6
+ "PO-Revision-Date: \n"
7
+ "Last-Translator: \n"
8
+ "Language: \n"
9
+ "Language-Team: \n"
10
+ "Content-Type: \n"
11
+ "Content-Transfer-Encoding: \n"
12
+ "Plural-Forms: \n"
13
+
14
+
@@ -0,0 +1,14 @@
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: \n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: \n"
6
+ "PO-Revision-Date: \n"
7
+ "Last-Translator: \n"
8
+ "Language: \n"
9
+ "Language-Team: \n"
10
+ "Content-Type: \n"
11
+ "Content-Transfer-Encoding: \n"
12
+ "Plural-Forms: \n"
13
+
14
+
@@ -0,0 +1,16 @@
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Plone\n"
4
+ "POT-Creation-Date: 2023-06-28T10:48:22.678Z\n"
5
+ "Last-Translator: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
6
+ "Language-Team: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
7
+ "MIME-Version: 1.0\n"
8
+ "Content-Type: text/plain; charset=utf-8\n"
9
+ "Content-Transfer-Encoding: 8bit\n"
10
+ "Plural-Forms: nplurals=1; plural=0;\n"
11
+ "Language-Code: en\n"
12
+ "Language-Name: English\n"
13
+ "Preferred-Encodings: utf-8\n"
14
+ "Domain: volto\n"
15
+
16
+
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@eeacms/volto-flourish",
3
+ "version": "0.1.0",
4
+ "description": "@eeacms/volto-flourish: 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-flourish",
9
+ "keywords": [
10
+ "volto-addon",
11
+ "volto",
12
+ "plone",
13
+ "react"
14
+ ],
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git@github.com:eea/volto-flourish.git"
18
+ },
19
+ "dependencies": {},
20
+ "devDependencies": {
21
+ "@plone/scripts": "*",
22
+ "@cypress/code-coverage": "^3.10.0",
23
+ "cypress-fail-fast": "^5.0.1",
24
+ "babel-plugin-transform-class-properties": "^6.24.1",
25
+ "husky": "^8.0.3",
26
+ "lint-staged": "^14.0.1",
27
+ "md5": "^2.3.0"
28
+ },
29
+ "lint-staged": {
30
+ "src/**/*.{js,jsx,ts,tsx,json}": [
31
+ "make lint-fix",
32
+ "make prettier-fix"
33
+ ],
34
+ "src/**/*.{jsx}": [
35
+ "make i18n"
36
+ ],
37
+ "theme/**/*.{css,less}": [
38
+ "make stylelint-fix"
39
+ ],
40
+ "src/**/*.{css,less}": [
41
+ "make stylelint-fix"
42
+ ],
43
+ "theme/**/*.overrides": [
44
+ "make stylelint-fix"
45
+ ],
46
+ "src/**/*.overrides": [
47
+ "make stylelint-fix"
48
+ ]
49
+ },
50
+ "scripts": {
51
+ "prepare": "husky install",
52
+ "release": "release-it",
53
+ "release-major-beta": "release-it major --preRelease=beta",
54
+ "release-beta": "release-it --preRelease=beta",
55
+ "bootstrap": "npm install -g ejs; npm link ejs; node bootstrap",
56
+ "test": "make test",
57
+ "test:fix": "make test-update",
58
+ "pre-commit": "yarn stylelint:fix && yarn prettier:fix && yarn lint:fix",
59
+ "stylelint": "make stylelint",
60
+ "stylelint:overrides": "make stylelint-overrides",
61
+ "stylelint:fix": "make stylelint-fix",
62
+ "prettier": "make prettier",
63
+ "prettier:fix": "make prettier-fix",
64
+ "lint": "make lint",
65
+ "lint:fix": "make lint-fix",
66
+ "i18n": "make i18n",
67
+ "cypress:run": "make cypress-run",
68
+ "cypress:open": "make cypress-open"
69
+ }
70
+ }
package/src/index.js ADDED
@@ -0,0 +1,5 @@
1
+ const applyConfig = (config) => {
2
+ return config;
3
+ };
4
+
5
+ export default applyConfig;