@eeacms/volto-timeline-block 1.1.1 → 1.1.3

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,2 @@
1
+ [ -n "$CI" ] && exit 0
2
+ yarn lint-staged
package/CHANGELOG.md CHANGED
@@ -4,6 +4,26 @@ 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.3](https://github.com/eea/volto-timeline-block/compare/1.1.2...1.1.3) - 29 September 2023
8
+
9
+ #### :house: Internal changes
10
+
11
+ - style: lint-staged reorder in package.json [Alin Voinea - [`6689916`](https://github.com/eea/volto-timeline-block/commit/6689916e882299e8a18d4aa2d1a98e46e140cf54)]
12
+
13
+ #### :house: Documentation changes
14
+
15
+ - docs: Update README and DEVELOP [Alin Voinea - [`21e9ea6`](https://github.com/eea/volto-timeline-block/commit/21e9ea6989981a45395d3f8870fa2258187456ad)]
16
+ - docs: Cleanup Makefile, update DEVELOP documentation, i18n - refs #254894 [valentinab25 - [`8e0caf1`](https://github.com/eea/volto-timeline-block/commit/8e0caf1d0159eba30a65c9cff2b9499808264b1b)]
17
+
18
+ #### :hammer_and_wrench: Others
19
+
20
+ - test: EN locales, pre-commit fix, feature PRs checks Refs #257193 [valentinab25 - [`5779269`](https://github.com/eea/volto-timeline-block/commit/57792695b924b453f6069f4e700865ab9dc42623)]
21
+ - test: Add cypress test for timeline in DX Layout - refs #254894 [Crețu Mihaela - [`f144abd`](https://github.com/eea/volto-timeline-block/commit/f144abd41e77557cac5308b248d825b24c95893f)]
22
+ - i18n: Add en [Alin Voinea - [`eb85ad0`](https://github.com/eea/volto-timeline-block/commit/eb85ad074e8dfe027c4751ed4e7b99bf727ddc70)]
23
+ - test: Update Makefile and docker-compose to align it with Jenkinsfile [valentinab25 - [`2c84c80`](https://github.com/eea/volto-timeline-block/commit/2c84c80259b0d1aeaa397b80a563c4d863d6755f)]
24
+ - Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`31e6132`](https://github.com/eea/volto-timeline-block/commit/31e613228a5a4ad1253914671bfb37b162b5c3a9)]
25
+ ### [1.1.2](https://github.com/eea/volto-timeline-block/compare/1.1.1...1.1.2) - 24 July 2023
26
+
7
27
  ### [1.1.1](https://github.com/eea/volto-timeline-block/compare/1.1.0...1.1.1) - 12 June 2023
8
28
 
9
29
  #### :hammer_and_wrench: Others
package/DEVELOP.md CHANGED
@@ -2,6 +2,30 @@
2
2
 
3
3
  ## Develop
4
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-timeline-block.git
9
+ cd volto-timeline-block
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-timeline-block to your Volto project
28
+
5
29
  Before starting make sure your development environment is properly set. See [Volto Developer Documentation](https://docs.voltocms.com/getting-started/install/)
6
30
 
7
31
  1. Make sure you have installed `yo`, `@plone/generator-volto` and `mrs-developer`
@@ -26,18 +50,15 @@ Before starting make sure your development environment is properly set. See [Vol
26
50
 
27
51
  1. Install
28
52
 
29
- yarn develop
53
+ make develop
30
54
  yarn
31
55
 
32
56
  1. Start backend
33
57
 
34
- docker pull plone
35
- docker run -d --name plone -p 8080:8080 -e SITE=Plone -e PROFILES="profile-plone.restapi:blocks" plone
58
+ docker run --pull always -it --rm --name plone -p 8080:8080 -e SITE=Plone plone/plone-backend
36
59
 
37
60
  ...wait for backend to setup and start - `Ready to handle requests`:
38
61
 
39
- docker logs -f plone
40
-
41
62
  ...you can also check http://localhost:8080/Plone
42
63
 
43
64
  1. Start frontend
@@ -49,3 +70,37 @@ Before starting make sure your development environment is properly set. See [Vol
49
70
  1. Happy hacking!
50
71
 
51
72
  cd src/addons/volto-timeline-block/
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-timeline-block` to `mrs.developer.json`
80
+
81
+ Go to:
82
+
83
+ ```BASH
84
+ cd src/addons/volto-timeline-block/
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-timeline-block` 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
+ ```
package/README.md CHANGED
@@ -22,35 +22,25 @@
22
22
  ![Timeline Block](https://github.com/eea/volto-timeline-block/raw/develop/docs/timeline-block.png)
23
23
  ![Timeline Block Demo](https://github.com/eea/volto-timeline-block/raw/docs/docs/volto-timeline.gif)
24
24
 
25
-
26
25
  ## Getting started
27
26
 
28
27
  ### Try volto-timeline-block with Docker
29
28
 
30
- 1. Get the latest Docker images
31
-
32
- ```
33
- docker pull plone
34
- docker pull plone/volto
35
- ```
36
-
37
- 1. Start Plone backend
38
- ```
39
- docker run -d --name plone -p 8080:8080 -e SITE=Plone -e PROFILES="profile-plone.restapi:blocks" plone
40
- ```
41
-
42
- 1. Start Volto frontend
43
-
44
- ```
45
- docker run -it --rm -p 3000:3000 --link plone -e ADDONS="@eeacms/volto-timeline-block" plone/volto
46
- ```
29
+ git clone https://github.com/eea/volto-timeline-block.git
30
+ cd volto-timeline-block
31
+ make
32
+ make start
47
33
 
48
- 1. Go to http://localhost:3000
34
+ Go to http://localhost:3000
49
35
 
50
36
  ### Add volto-timeline-block to your Volto project
51
37
 
52
38
  1. Make sure you have a [Plone backend](https://plone.org/download) up-and-running at http://localhost:8080/Plone
53
39
 
40
+ ```Bash
41
+ docker compose up backend
42
+ ```
43
+
54
44
  1. Start Volto frontend
55
45
 
56
46
  * If you already have a volto project, just update `package.json`:
@@ -61,7 +51,7 @@
61
51
  ],
62
52
 
63
53
  "dependencies": {
64
- "@eeacms/volto-timeline-block": "^1.0.0"
54
+ "@eeacms/volto-timeline-block": "*"
65
55
  }
66
56
  ```
67
57
 
@@ -69,7 +59,7 @@
69
59
 
70
60
  ```
71
61
  npm install -g yo @plone/generator-volto
72
- yo @plone/volto my-volto-project --addon @eeacms/volto-timeline-block
62
+ yo @plone/volto my-volto-project --canary --addon @eeacms/volto-timeline-block
73
63
  cd my-volto-project
74
64
  ```
75
65
 
@@ -102,4 +92,3 @@ See [LICENSE.md](https://github.com/eea/volto-timeline-block/blob/master/LICENSE
102
92
  ## Funding
103
93
 
104
94
  [European Environment Agency (EU)](http://eea.europa.eu)
105
-
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: 8888,
5
+ defaultCommandTimeout: 5000,
6
6
  chromeWebSecurity: false,
7
7
  reporter: 'junit',
8
8
  video: true,
9
9
  retries: {
10
- runMode: 8,
10
+ runMode: 1,
11
11
  openMode: 0,
12
12
  },
13
13
  reporterOptions: {
@@ -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,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
+
package/locales/volto.pot CHANGED
@@ -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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-timeline-block",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
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,8 +20,31 @@
20
20
  "@cypress/code-coverage": "^3.10.0",
21
21
  "@plone/scripts": "*",
22
22
  "babel-plugin-transform-class-properties": "^6.24.1",
23
+ "husky": "*",
24
+ "lint-staged": "*",
23
25
  "md5": "^2.3.0"
24
26
  },
27
+ "lint-staged": {
28
+ "src/**/*.{js,jsx,ts,tsx,json}": [
29
+ "make lint-fix",
30
+ "make prettier-fix"
31
+ ],
32
+ "src/**/*.{jsx}": [
33
+ "make i18n"
34
+ ],
35
+ "theme/**/*.{css,less}": [
36
+ "make stylelint-fix"
37
+ ],
38
+ "src/**/*.{css,less}": [
39
+ "make stylelint-fix"
40
+ ],
41
+ "theme/**/*.overrides": [
42
+ "make stylelint-fix"
43
+ ],
44
+ "src/**/*.overrides": [
45
+ "make stylelint-fix"
46
+ ]
47
+ },
25
48
  "scripts": {
26
49
  "release": "release-it",
27
50
  "release-major-beta": "release-it major --preRelease=beta",
@@ -39,6 +62,7 @@
39
62
  "lint:fix": "make lint-fix",
40
63
  "i18n": "make i18n",
41
64
  "cypress:run": "make cypress-run",
42
- "cypress:open": "make cypress-open"
65
+ "cypress:open": "make cypress-open",
66
+ "prepare": "husky install"
43
67
  }
44
68
  }
@@ -0,0 +1,77 @@
1
+ import React from 'react';
2
+ import { render, screen } from '@testing-library/react';
3
+ import { unmountComponentAtNode } from 'react-dom';
4
+ import View from './View';
5
+ import moment from 'moment';
6
+ import '@testing-library/jest-dom/extend-expect';
7
+
8
+ jest.mock('@plone/volto/helpers/Loadable/Loadable', () => ({
9
+ injectLazyLibs: () => (component) => component,
10
+ }));
11
+
12
+ jest.mock('moment', () => {
13
+ const moment = jest.requireActual('moment');
14
+
15
+ return { default: moment };
16
+ });
17
+
18
+ describe('View and Timeline components', () => {
19
+ let container = null;
20
+
21
+ beforeEach(() => {
22
+ container = document.createElement('div');
23
+ document.body.appendChild(container);
24
+ });
25
+
26
+ afterEach(() => {
27
+ unmountComponentAtNode(container);
28
+ container.remove();
29
+ container = null;
30
+ });
31
+
32
+ it('should render empty timeline in edit mode', () => {
33
+ render(<View data={{ items: undefined }} mode="edit" />, container);
34
+
35
+ expect(screen.getByText('Add Timeline items')).toBeInTheDocument();
36
+ });
37
+
38
+ it('should render timeline item with correct data', () => {
39
+ const item = {
40
+ datetime: '2023-01-01',
41
+ title: 'Test Event',
42
+ description: 'Test Description',
43
+ color: 'blue',
44
+ icon: 'star',
45
+ };
46
+ const data = { items: [item], reversed: false };
47
+
48
+ const { getByText } = render(
49
+ <View data={data} mode="view" moment={moment} />,
50
+ container,
51
+ );
52
+
53
+ expect(getByText('Test Event')).toBeInTheDocument();
54
+ expect(getByText('Test Description')).toBeInTheDocument();
55
+ expect(getByText('Jan 1, 2023 12:00 AM')).toBeInTheDocument();
56
+ });
57
+
58
+ it('should render timeline item with correct data', () => {
59
+ const item = {
60
+ datetime: '2023-01-01',
61
+ title: 'Test Event',
62
+ description: 'Test Description',
63
+ color: undefined,
64
+ icon: 'star',
65
+ };
66
+ const data = { items: [item], reversed: true, hideTime: true };
67
+
68
+ const { getByText } = render(
69
+ <View data={data} mode="view" moment={moment} />,
70
+ container,
71
+ );
72
+
73
+ expect(getByText('Test Event')).toBeInTheDocument();
74
+ expect(getByText('Test Description')).toBeInTheDocument();
75
+ expect(getByText('Jan 1, 2023')).toBeInTheDocument();
76
+ });
77
+ });
@@ -1 +0,0 @@
1
- module.exports = require('@plone/volto/babel');