@eeacms/volto-citation 0.1.5 → 1.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/.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;
package/CHANGELOG.md CHANGED
@@ -4,21 +4,30 @@ 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
+ ### [1.0.0](https://github.com/eea/volto-citation/compare/0.1.5...1.0.0) - 22 April 2024
8
+
9
+ #### :rocket: New Features
10
+
11
+ - feat: Release 1.0.0 - Volto 17 support [alin - [`4b6a67d`](https://github.com/eea/volto-citation/commit/4b6a67dc1400034ab30c1d6c2054df2d025bd429)]
12
+ - feat: Volto 17 support - refs #264527 [EEA Jenkins - [`16d48de`](https://github.com/eea/volto-citation/commit/16d48de6f0acc5e61839479156d0bf2f553e314c)]
13
+
14
+ #### :house: Internal changes
15
+
16
+ - chore: package.json [Alin Voinea - [`2e1c298`](https://github.com/eea/volto-citation/commit/2e1c2986373e801a5bd8a7bea62fc8913a10f436)]
17
+
18
+ #### :hammer_and_wrench: Others
19
+
20
+ - test: Update jest,Jenkinsfile,lint to volto-addons-template PR30 [valentinab25 - [`5a3d55d`](https://github.com/eea/volto-citation/commit/5a3d55d78d0b27d3162d442030808c88c8a2f333)]
21
+ - test: Update jest,Jenkinsfile,lint to volto-addons-template PR30 [valentinab25 - [`3a3ba3e`](https://github.com/eea/volto-citation/commit/3a3ba3e55d9c089f44c8aac34dafaee100d5bd9e)]
7
22
  ### [0.1.5](https://github.com/eea/volto-citation/compare/0.1.4...0.1.5) - 17 January 2024
8
23
 
9
24
  #### :house: Internal changes
10
25
 
11
- - chore: [JENKINS] Refactor automated testing [valentinab25 - [`6571949`](https://github.com/eea/volto-citation/commit/6571949941593affae952a5e2539182c8937a89d)]
12
26
  - chore: husky, lint-staged use fixed versions [valentinab25 - [`fe169f6`](https://github.com/eea/volto-citation/commit/fe169f675d540495272d60469024082aa5077095)]
13
27
  - chore:volto 16 in tests, update docs, fix stylelint overrides [valentinab25 - [`79683d8`](https://github.com/eea/volto-citation/commit/79683d85b71803b96ef31b754bede458f7001c50)]
14
28
 
15
29
  #### :hammer_and_wrench: Others
16
30
 
17
- - test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`e5725a1`](https://github.com/eea/volto-citation/commit/e5725a1c8b9d7a5d0574a40fe785015db99ef33a)]
18
- - test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`2196015`](https://github.com/eea/volto-citation/commit/2196015f5752129aebc5e35e0df465e070b9a09f)]
19
- - test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`e0b9cf2`](https://github.com/eea/volto-citation/commit/e0b9cf2f1a8a20f4ab32ee357f6a1bab2637c9b1)]
20
- - test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`dca3755`](https://github.com/eea/volto-citation/commit/dca375521c18d1d6fb64ece80ddb9a1db7f166f5)]
21
- - test: [JENKINS] Improve cypress time [valentinab25 - [`7100915`](https://github.com/eea/volto-citation/commit/7100915a460506b44ead3295a220c0ec9caa6279)]
22
31
  ### [0.1.4](https://github.com/eea/volto-citation/compare/0.1.3...0.1.4) - 29 September 2023
23
32
 
24
33
  #### :house: Internal changes
@@ -33,12 +42,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
33
42
  #### :hammer_and_wrench: Others
34
43
 
35
44
  - test: EN locales, pre-commit fix, feature PRs checks Refs #257193 [valentinab25 - [`adbc1b5`](https://github.com/eea/volto-citation/commit/adbc1b5359b70e16510b764eb42c1c52778536ab)]
36
- - test: Fix eslint and yarn i18n [Alin Voinea - [`d8f5cd1`](https://github.com/eea/volto-citation/commit/d8f5cd1fab04c42e354af4ecd640e2f9d1202e38)]
37
45
  - i18n: Add en [Alin Voinea - [`9100e04`](https://github.com/eea/volto-citation/commit/9100e04e4de63f607a3867eaf45161b90d0985be)]
38
46
  - test: Update Makefile and docker-compose to align it with Jenkinsfile [valentinab25 - [`766a456`](https://github.com/eea/volto-citation/commit/766a456f3ab988aa916feaae5fab9f2f894390fe)]
39
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`44b2af5`](https://github.com/eea/volto-citation/commit/44b2af58fe025442100ef0c52c45154b2d74e267)]
40
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`8f0a7e2`](https://github.com/eea/volto-citation/commit/8f0a7e2713a1a2a7ecf34bd3f7dc23e61b815283)]
41
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`c2597b9`](https://github.com/eea/volto-citation/commit/c2597b9778a2515e0b015b39a983add268f5c29a)]
42
47
  ### [0.1.3](https://github.com/eea/volto-citation/compare/0.1.2...0.1.3) - 3 August 2023
43
48
 
44
49
  #### :house: Documentation changes
@@ -1,3 +1,5 @@
1
+ require('dotenv').config({ path: __dirname + '/.env' })
2
+
1
3
  module.exports = {
2
4
  testMatch: ['**/src/addons/**/?(*.)+(spec|test).[jt]s?(x)'],
3
5
  collectCoverageFrom: [
@@ -9,18 +11,26 @@ module.exports = {
9
11
  '@plone/volto/cypress': '<rootDir>/node_modules/@plone/volto/cypress',
10
12
  '@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
11
13
  '@plone/volto/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
12
- '@package/(.*)$': '<rootDir>/src/$1',
13
- '@root/(.*)$': '<rootDir>/src/$1',
14
+ '@package/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
15
+ '@root/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
14
16
  '@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
17
+ '@eeacms/search/(.*)$': '<rootDir>/src/addons/volto-searchlib/searchlib/$1',
18
+ '@eeacms/search': '<rootDir>/src/addons/volto-searchlib/searchlib',
15
19
  '@eeacms/(.*?)/(.*)$': '<rootDir>/node_modules/@eeacms/$1/src/$2',
16
- '@plone/volto-slate':
20
+ '@plone/volto-slate$':
17
21
  '<rootDir>/node_modules/@plone/volto/packages/volto-slate/src',
22
+ '@plone/volto-slate/(.*)$':
23
+ '<rootDir>/node_modules/@plone/volto/packages/volto-slate/src/$1',
18
24
  '~/(.*)$': '<rootDir>/src/$1',
19
25
  'load-volto-addons':
20
26
  '<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
21
27
  },
28
+ transformIgnorePatterns: [
29
+ '/node_modules/(?!(@plone|@root|@package|@eeacms)/).*/',
30
+ ],
22
31
  transform: {
23
32
  '^.+\\.js(x)?$': 'babel-jest',
33
+ '^.+\\.ts(x)?$': 'babel-jest',
24
34
  '^.+\\.(png)$': 'jest-file',
25
35
  '^.+\\.(jpg)$': 'jest-file',
26
36
  '^.+\\.(svg)$': './node_modules/@plone/volto/jest-svgsystem-transform.js',
@@ -33,4 +43,9 @@ module.exports = {
33
43
  statements: 5,
34
44
  },
35
45
  },
36
- };
46
+ ...(process.env.JEST_USE_SETUP === 'ON' && {
47
+ setupFilesAfterEnv: [
48
+ '<rootDir>/node_modules/@eeacms/volto-citation/jest.setup.js',
49
+ ],
50
+ }),
51
+ }
package/jest.setup.js ADDED
@@ -0,0 +1,65 @@
1
+ import { jest } from '@jest/globals';
2
+ import configureStore from 'redux-mock-store';
3
+ import thunk from 'redux-thunk';
4
+ import { blocksConfig } from '@plone/volto/config/Blocks';
5
+ import installSlate from '@plone/volto-slate/index';
6
+
7
+ var mockSemanticComponents = jest.requireActual('semantic-ui-react');
8
+ var mockComponents = jest.requireActual('@plone/volto/components');
9
+ var config = jest.requireActual('@plone/volto/registry').default;
10
+
11
+ config.blocks.blocksConfig = {
12
+ ...blocksConfig,
13
+ ...config.blocks.blocksConfig,
14
+ };
15
+
16
+ jest.doMock('semantic-ui-react', () => ({
17
+ __esModule: true,
18
+ ...mockSemanticComponents,
19
+ Popup: ({ content, trigger }) => {
20
+ return (
21
+ <div className="popup">
22
+ <div className="trigger">{trigger}</div>
23
+ <div className="content">{content}</div>
24
+ </div>
25
+ );
26
+ },
27
+ }));
28
+
29
+ jest.doMock('@plone/volto/components', () => {
30
+ return {
31
+ __esModule: true,
32
+ ...mockComponents,
33
+ SidebarPortal: ({ children }) => <div id="sidebar">{children}</div>,
34
+ };
35
+ });
36
+
37
+ jest.doMock('@plone/volto/registry', () =>
38
+ [installSlate].reduce((acc, apply) => apply(acc), config),
39
+ );
40
+
41
+ const mockStore = configureStore([thunk]);
42
+
43
+ global.fetch = jest.fn(() =>
44
+ Promise.resolve({
45
+ json: () => Promise.resolve({}),
46
+ }),
47
+ );
48
+
49
+ global.store = mockStore({
50
+ intl: {
51
+ locale: 'en',
52
+ messages: {},
53
+ formatMessage: jest.fn(),
54
+ },
55
+ content: {
56
+ create: {},
57
+ subrequests: [],
58
+ },
59
+ connected_data_parameters: {},
60
+ screen: {
61
+ page: {
62
+ width: 768,
63
+ },
64
+ },
65
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-citation",
3
- "version": "0.1.5",
3
+ "version": "1.0.0",
4
4
  "description": "@eeacms/volto-citation: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -25,6 +25,7 @@
25
25
  "@plone/scripts": "*",
26
26
  "babel-plugin-transform-class-properties": "^6.24.1",
27
27
  "cypress-fail-fast": "^5.0.1",
28
+ "dotenv": "^16.3.2",
28
29
  "husky": "^8.0.3",
29
30
  "lint-staged": "^14.0.1",
30
31
  "md5": "^2.3.0"
@@ -39,9 +39,9 @@
39
39
  overflow: auto;
40
40
  padding: 9.5px;
41
41
  border: 1px solid #ccc;
42
+ border-radius: 4px;
42
43
  margin: 0 0 10px;
43
44
  background-color: #f5f5f5;
44
- border-radius: 4px;
45
45
  line-height: 1.428571429;
46
46
  word-break: break-all;
47
47
  word-wrap: break-word;
@@ -1,48 +0,0 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
-
4
- const projectRootPath = fs.existsSync('./project')
5
- ? fs.realpathSync('./project')
6
- : fs.realpathSync('./../../../');
7
- const packageJson = require(path.join(projectRootPath, 'package.json'));
8
- const jsConfig = require(path.join(projectRootPath, 'jsconfig.json')).compilerOptions;
9
-
10
- const pathsConfig = jsConfig.paths;
11
-
12
- let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto');
13
-
14
- Object.keys(pathsConfig).forEach(pkg => {
15
- if (pkg === '@plone/volto') {
16
- voltoPath = `./${jsConfig.baseUrl}/${pathsConfig[pkg][0]}`;
17
- }
18
- });
19
- const AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`);
20
- const reg = new AddonConfigurationRegistry(projectRootPath);
21
-
22
- // Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
23
- const addonAliases = Object.keys(reg.packages).map(o => [
24
- o,
25
- reg.packages[o].modulePath,
26
- ]);
27
-
28
-
29
- module.exports = {
30
- extends: `${projectRootPath}/node_modules/@plone/volto/.eslintrc`,
31
- settings: {
32
- 'import/resolver': {
33
- alias: {
34
- map: [
35
- ['@plone/volto', '@plone/volto/src'],
36
- ...addonAliases,
37
- ['@package', `${__dirname}/src`],
38
- ['~', `${__dirname}/src`],
39
- ],
40
- extensions: ['.js', '.jsx', '.json'],
41
- },
42
- 'babel-plugin-root-import': {
43
- rootPathSuffix: 'src',
44
- },
45
- },
46
- },
47
- };
48
-