@eeacms/volto-timeline-block 1.1.5 → 2.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,7 +4,19 @@ 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.1.5](https://github.com/eea/volto-timeline-block/compare/1.1.4...1.1.5) - 19 October 2023
7
+ ### [2.0.0](https://github.com/eea/volto-timeline-block/compare/1.1.5...2.0.0) - 22 April 2024
8
+
9
+ #### :rocket: New Features
10
+
11
+ - feat: Release 2.0.0 - Volto 17 support [alin - [`00f65bb`](https://github.com/eea/volto-timeline-block/commit/00f65bba9d2fa20bf0095a8942933e73c8e8f300)]
12
+ - feat: Volto 17 support - refs #264527 [EEA Jenkins - [`a32dec9`](https://github.com/eea/volto-timeline-block/commit/a32dec9354dcdaaa907b96fee85b67c0c5fe433a)]
13
+
14
+ #### :house: Internal changes
15
+
16
+
17
+ #### :hammer_and_wrench: Others
18
+
19
+ ### [1.1.5](https://github.com/eea/volto-timeline-block/compare/1.1.4...1.1.5) - 22 October 2023
8
20
 
9
21
  #### :house: Internal changes
10
22
 
@@ -39,7 +51,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
39
51
  - test: Add cypress test for timeline in DX Layout - refs #254894 [Crețu Mihaela - [`f144abd`](https://github.com/eea/volto-timeline-block/commit/f144abd41e77557cac5308b248d825b24c95893f)]
40
52
  - i18n: Add en [Alin Voinea - [`eb85ad0`](https://github.com/eea/volto-timeline-block/commit/eb85ad074e8dfe027c4751ed4e7b99bf727ddc70)]
41
53
  - test: Update Makefile and docker-compose to align it with Jenkinsfile [valentinab25 - [`2c84c80`](https://github.com/eea/volto-timeline-block/commit/2c84c80259b0d1aeaa397b80a563c4d863d6755f)]
42
- - Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`31e6132`](https://github.com/eea/volto-timeline-block/commit/31e613228a5a4ad1253914671bfb37b162b5c3a9)]
43
54
  ### [1.1.2](https://github.com/eea/volto-timeline-block/compare/1.1.1...1.1.2) - 24 July 2023
44
55
 
45
56
  ### [1.1.1](https://github.com/eea/volto-timeline-block/compare/1.1.0...1.1.1) - 12 June 2023
@@ -49,31 +60,16 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
49
60
  - test: jest should look for addons in node_modules Refs #253277 [valentinab25 - [`9e46798`](https://github.com/eea/volto-timeline-block/commit/9e46798e251fba50d9ef8756f3f72de4684f6c44)]
50
61
  - test: Add cypress test for basic functionality and demo gif to README - refs #253277 [ana-oprea - [`5afd16a`](https://github.com/eea/volto-timeline-block/commit/5afd16ab58e0a4f6b4d303f61c54ea3ed3a7baf7)]
51
62
  - test: Fix test config, coverage Refs #253277 [valentinab25 - [`66e4928`](https://github.com/eea/volto-timeline-block/commit/66e4928bc2d940a81ad73ce27107ad0d1d471135)]
52
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`c0c83df`](https://github.com/eea/volto-timeline-block/commit/c0c83dff921bf4e4c4d81f60754c9f928aa5ce79)]
53
- - Add Sonarqube tag using industry-frontend addons list [EEA Jenkins - [`90db0d4`](https://github.com/eea/volto-timeline-block/commit/90db0d4c8df4925a23fae6a55443ced5c256c645)]
54
63
  ### [1.1.0](https://github.com/eea/volto-timeline-block/compare/1.0.1...1.1.0) - 27 March 2023
55
64
 
56
65
  #### :hammer_and_wrench: Others
57
66
 
58
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`33e1837`](https://github.com/eea/volto-timeline-block/commit/33e183750b62be6c1fcfbdb8dad10db469169266)]
59
- - Add Sonarqube tag using ims-frontend addons list [EEA Jenkins - [`41833c2`](https://github.com/eea/volto-timeline-block/commit/41833c236ec95bd60a693d5394c8c128e30f4ecf)]
60
- - Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`5c12df2`](https://github.com/eea/volto-timeline-block/commit/5c12df222354499cbffe93e34c3c6a31f9f52124)]
61
- - Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`abc6930`](https://github.com/eea/volto-timeline-block/commit/abc693081a2ed229adf27dbe0315c44a6735c28e)]
62
- - Add Sonarqube tag using climate-energy-frontend addons list [EEA Jenkins - [`ed6e2b0`](https://github.com/eea/volto-timeline-block/commit/ed6e2b0b15a2437f456a227fdefe2336aeda98b2)]
63
67
  - test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`ff4d170`](https://github.com/eea/volto-timeline-block/commit/ff4d1705b90bbffcc54f7182e6799a8fac303104)]
64
- - Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`4ed90fb`](https://github.com/eea/volto-timeline-block/commit/4ed90fb54c0aec76c8f2287a83a14c8acc8c1ca8)]
65
- - Add Sonarqube tag using bise-frontend addons list [EEA Jenkins - [`01e1ac8`](https://github.com/eea/volto-timeline-block/commit/01e1ac8bf4cc04713c643ef30f5dfa8d628b6e2b)]
66
- - yarn 3 [Alin Voinea - [`a234a4c`](https://github.com/eea/volto-timeline-block/commit/a234a4c8d1717cf9039195e7246a07265a6b8b49)]
67
- - Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`4a25463`](https://github.com/eea/volto-timeline-block/commit/4a25463070164b31656e20c5ace164da225fd3fb)]
68
- - Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`5b687d5`](https://github.com/eea/volto-timeline-block/commit/5b687d5a91c4cc566e4428084c9d1d78df2de676)]
69
- - Add Sonarqube tag using demo-kitkat-frontend addons list [EEA Jenkins - [`c9e0a49`](https://github.com/eea/volto-timeline-block/commit/c9e0a49e8a3c291833bb6c002441907b74df0875)]
70
- - Add Sonarqube tag using forests-frontend addons list [EEA Jenkins - [`25df72a`](https://github.com/eea/volto-timeline-block/commit/25df72a779fd975ab4e42c39cfdc6968f7f04945)]
71
68
  ### [1.0.1](https://github.com/eea/volto-timeline-block/compare/1.0.0...1.0.1) - 16 November 2022
72
69
 
73
70
  #### :hammer_and_wrench: Others
74
71
 
75
72
  - test(estlint): Fix .project.eslintrc.js [Alin Voinea - [`742fb19`](https://github.com/eea/volto-timeline-block/commit/742fb1986b76ed5b775a7895aa91df452bf601e6)]
76
- - Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`c4e6e36`](https://github.com/eea/volto-timeline-block/commit/c4e6e36aaabb02bea84695411cfb2d3ca586b210)]
77
73
  ## [1.0.0](https://github.com/eea/volto-timeline-block/compare/0.2.3...1.0.0) - 28 October 2022
78
74
 
79
75
  #### :nail_care: Enhancements
@@ -86,7 +82,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
86
82
  - test(cypress): Cypress 10 / Razzle 4 [Alin Voinea - [`ca50ec9`](https://github.com/eea/volto-timeline-block/commit/ca50ec9a9ab4db0faf0b33fa250814d788741478)]
87
83
  - Cleanup [Alin Voinea - [`28c2444`](https://github.com/eea/volto-timeline-block/commit/28c244491045ca3ba6a3c182818364f73951f765)]
88
84
  - Update dependencies [Alin Voinea - [`ab59000`](https://github.com/eea/volto-timeline-block/commit/ab590002fdef3c95d4580893b6e407b51746a290)]
89
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`bfa44a6`](https://github.com/eea/volto-timeline-block/commit/bfa44a64c026b2a5f9f22fbfcb3119f60c78d461)]
90
85
  ### [0.2.3](https://github.com/eea/volto-timeline-block/compare/0.2.2...0.2.3) - 30 June 2022
91
86
 
92
87
  ### [0.2.2](https://github.com/eea/volto-timeline-block/compare/0.2.1...0.2.2) - 8 June 2022
@@ -102,7 +97,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
102
97
 
103
98
  #### :hammer_and_wrench: Others
104
99
 
105
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`21fea4e`](https://github.com/eea/volto-timeline-block/commit/21fea4edb8da738f81c12ca1f70696b63581159b)]
106
100
  ### [0.2.0](https://github.com/eea/volto-timeline-block/compare/0.1.0...0.2.0) - 29 March 2022
107
101
 
108
102
  #### :hammer_and_wrench: Others
package/cypress.config.js CHANGED
@@ -2,12 +2,12 @@ const { defineConfig } = require('cypress');
2
2
 
3
3
  module.exports = defineConfig({
4
4
  viewportWidth: 1280,
5
- defaultCommandTimeout: 5000,
5
+ defaultCommandTimeout: 8888,
6
6
  chromeWebSecurity: false,
7
7
  reporter: 'junit',
8
- video: true,
8
+ video: false,
9
9
  retries: {
10
- runMode: 1,
10
+ runMode: 2,
11
11
  openMode: 0,
12
12
  },
13
13
  reporterOptions: {
@@ -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-timeline-block/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-timeline-block",
3
- "version": "1.1.5",
3
+ "version": "2.0.0",
4
4
  "description": "@eeacms/volto-timeline-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -20,6 +20,7 @@
20
20
  "@cypress/code-coverage": "^3.10.0",
21
21
  "@plone/scripts": "*",
22
22
  "babel-plugin-transform-class-properties": "^6.24.1",
23
+ "dotenv": "^16.3.2",
23
24
  "husky": "^8.0.3",
24
25
  "lint-staged": "^14.0.1",
25
26
  "md5": "^2.3.0"
@@ -2,7 +2,7 @@ import iconSVG from '@plone/volto/icons/calendar.svg';
2
2
  import TimelineBlockEdit from './Edit';
3
3
  import TimelineBlockView from './View';
4
4
 
5
- export default (config) => {
5
+ const applyConfig = (config) => {
6
6
  config.blocks.blocksConfig.timeline_block = {
7
7
  id: 'timeline_block',
8
8
  title: 'Timeline',
@@ -20,3 +20,5 @@ export default (config) => {
20
20
  };
21
21
  return config;
22
22
  };
23
+
24
+ export default applyConfig;
@@ -50,7 +50,7 @@ const timelineSchema = {
50
50
  required: [],
51
51
  };
52
52
 
53
- export default {
53
+ const schema = {
54
54
  title: 'Timeline block',
55
55
 
56
56
  fieldsets: [
@@ -79,3 +79,5 @@ export default {
79
79
 
80
80
  required: [],
81
81
  };
82
+
83
+ export default schema;
@@ -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
-