Skip to content

Commit 404cb09

Browse files
authored
Merge pull request #23 from eea/develop
fix(toc): make it work, refs #265201
2 parents 8847b07 + b698d9c commit 404cb09

17 files changed

+407
-161
lines changed

.husky/pre-commit

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[ -n "$CI" ] && exit 0
2+
yarn lint-staged

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file. Dates are d
44

55
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
66

7+
### [3.0.8](https://github.com/eea/volto-block-toc/compare/3.0.7...3.0.8) - 16 February 2024
8+
9+
#### :bug: Bug Fixes
10+
11+
- fix(toc): make it work, refs #265201 [Razvan - [`c3728d5`](https://github.com/eea/volto-block-toc/commit/c3728d57750a0495139897609b2cb38f5bcdf7eb)]
12+
13+
#### :house: Internal changes
14+
15+
- chore: husky, lint-staged use fixed versions [valentinab25 - [`3bcf5b1`](https://github.com/eea/volto-block-toc/commit/3bcf5b1a9345f4ddf05b172371941b2a09d1cce0)]
16+
- chore:volto 16 in tests, update docs, fix stylelint overrides [valentinab25 - [`739326d`](https://github.com/eea/volto-block-toc/commit/739326dfeccef5460f706e15718ed5a509549695)]
17+
18+
#### :hammer_and_wrench: Others
19+
20+
- test: EN locales, pre-commit fix, feature PRs checks Refs #257193 [valentinab25 - [`c030d54`](https://github.com/eea/volto-block-toc/commit/c030d5416c7750402d250a2da0d05a5dea75c3a3)]
721
### [3.0.7](https://github.com/eea/volto-block-toc/compare/3.0.6...3.0.7) - 1 September 2023
822

923
#### :bug: Bug Fixes

DEVELOP.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@
1616

1717
1. Go to http://localhost:3000
1818

19-
1. Happy hacking!
19+
1. Initialize git hooks
2020

2121
```Bash
22-
cd src/addons/volto-block-toc/
22+
yarn prepare
2323
```
2424

25+
1. Happy hacking!
26+
2527
### Or add @eeacms/volto-block-toc to your Volto project
2628

2729
Before starting make sure your development environment is properly set. See [Volto Developer Documentation](https://docs.voltocms.com/getting-started/install/)
@@ -50,7 +52,7 @@ Before starting make sure your development environment is properly set. See [Vol
5052

5153
1. Install
5254

53-
$ yarn develop
55+
$ make develop
5456
$ yarn
5557

5658
1. Start backend
@@ -59,8 +61,6 @@ Before starting make sure your development environment is properly set. See [Vol
5961

6062
...wait for backend to setup and start - `Ready to handle requests`:
6163

62-
$ docker logs -f plone
63-
6464
...you can also check http://localhost:8080/Plone
6565

6666
1. Start frontend

Jenkinsfile

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pipeline {
66
NAMESPACE = "@eeacms"
77
SONARQUBE_TAGS = "volto.eea.europa.eu,biodiversity.europa.eu"
88
DEPENDENCIES = ""
9-
VOLTO = ""
9+
VOLTO = "16"
1010
}
1111

1212
stages {
@@ -62,11 +62,17 @@ pipeline {
6262

6363
stage('Tests') {
6464
when {
65-
allOf {
66-
environment name: 'CHANGE_ID', value: ''
67-
anyOf {
68-
not { changelog '.*^Automated release [0-9\\.]+$' }
69-
branch 'master'
65+
anyOf {
66+
allOf {
67+
not { environment name: 'CHANGE_ID', value: '' }
68+
environment name: 'CHANGE_TARGET', value: 'develop'
69+
}
70+
allOf {
71+
environment name: 'CHANGE_ID', value: ''
72+
anyOf {
73+
not { changelog '.*^Automated release [0-9\\.]+$' }
74+
branch 'master'
75+
}
7076
}
7177
}
7278
}
@@ -110,11 +116,17 @@ pipeline {
110116

111117
stage('Integration tests') {
112118
when {
113-
allOf {
114-
environment name: 'CHANGE_ID', value: ''
115-
anyOf {
116-
not { changelog '.*^Automated release [0-9\\.]+$' }
117-
branch 'master'
119+
anyOf {
120+
allOf {
121+
not { environment name: 'CHANGE_ID', value: '' }
122+
environment name: 'CHANGE_TARGET', value: 'develop'
123+
}
124+
allOf {
125+
environment name: 'CHANGE_ID', value: ''
126+
anyOf {
127+
not { changelog '.*^Automated release [0-9\\.]+$' }
128+
branch 'master'
129+
}
118130
}
119131
}
120132
}
@@ -167,13 +179,19 @@ pipeline {
167179

168180
stage('Report to SonarQube') {
169181
when {
170-
allOf {
171-
environment name: 'CHANGE_ID', value: ''
172-
anyOf {
173-
branch 'master'
174-
allOf {
175-
branch 'develop'
176-
not { changelog '.*^Automated release [0-9\\.]+$' }
182+
anyOf {
183+
allOf {
184+
not { environment name: 'CHANGE_ID', value: '' }
185+
environment name: 'CHANGE_TARGET', value: 'develop'
186+
}
187+
allOf {
188+
environment name: 'CHANGE_ID', value: ''
189+
anyOf {
190+
allOf {
191+
branch 'develop'
192+
not { changelog '.*^Automated release [0-9\\.]+$' }
193+
}
194+
branch 'master'
177195
}
178196
}
179197
}
@@ -199,10 +217,16 @@ pipeline {
199217

200218
stage('SonarQube compare to master') {
201219
when {
202-
allOf {
203-
environment name: 'CHANGE_ID', value: ''
204-
branch 'develop'
205-
not { changelog '.*^Automated release [0-9\\.]+$' }
220+
anyOf {
221+
allOf {
222+
not { environment name: 'CHANGE_ID', value: '' }
223+
environment name: 'CHANGE_TARGET', value: 'develop'
224+
}
225+
allOf {
226+
environment name: 'CHANGE_ID', value: ''
227+
branch 'develop'
228+
not { changelog '.*^Automated release [0-9\\.]+$' }
229+
}
206230
}
207231
}
208232
steps {

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,12 @@ stylelint: ## Stylelint
9797

9898
.PHONY: stylelint-overrides
9999
stylelint-overrides:
100-
$(NODE_MODULES)/.bin/stylelint --syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides'
100+
$(NODE_MODULES)/.bin/stylelint --custom-syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides'
101101

102102
.PHONY: stylelint-fix
103103
stylelint-fix: ## Fix stylelint
104104
$(NODE_MODULES)/stylelint/bin/stylelint.js --allow-empty-input 'src/**/*.{css,less}' --fix
105-
$(NODE_MODULES)/.bin/stylelint --syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides' --fix
105+
$(NODE_MODULES)/.bin/stylelint --custom-syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides' --fix
106106

107107
.PHONY: prettier
108108
prettier: ## Prettier

RELEASE.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+

cypress.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ const { defineConfig } = require('cypress');
22

33
module.exports = defineConfig({
44
viewportWidth: 1280,
5-
defaultCommandTimeout: 8888,
5+
defaultCommandTimeout: 5000,
66
chromeWebSecurity: false,
77
reporter: 'junit',
88
video: true,
99
retries: {
10-
runMode: 8,
10+
runMode: 1,
1111
openMode: 0,
1212
},
1313
reporterOptions: {

locales/en/LC_MESSAGES/volto.po

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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.json

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eeacms/volto-block-toc",
3-
"version": "3.0.7",
3+
"version": "3.0.8",
44
"description": "volto-block-toc: Volto add-on",
55
"main": "src/index.js",
66
"author": "European Environment Agency: IDM2 A-Team",
@@ -25,8 +25,31 @@
2525
"@plone/scripts": "*",
2626
"babel-plugin-transform-class-properties": "^6.24.1",
2727
"cypress-fail-fast": "^5.0.1",
28+
"husky": "^8.0.3",
29+
"lint-staged": "^14.0.1",
2830
"md5": "^2.3.0"
2931
},
32+
"lint-staged": {
33+
"src/**/*.{js,jsx,ts,tsx,json}": [
34+
"make lint-fix",
35+
"make prettier-fix"
36+
],
37+
"src/**/*.{jsx}": [
38+
"make i18n"
39+
],
40+
"theme/**/*.{css,less}": [
41+
"make stylelint-fix"
42+
],
43+
"src/**/*.{css,less}": [
44+
"make stylelint-fix"
45+
],
46+
"theme/**/*.overrides": [
47+
"make stylelint-fix"
48+
],
49+
"src/**/*.overrides": [
50+
"make stylelint-fix"
51+
]
52+
},
3053
"scripts": {
3154
"release": "release-it",
3255
"release-major-beta": "release-it major --preRelease=beta",
@@ -44,6 +67,7 @@
4467
"lint:fix": "make lint-fix",
4568
"i18n": "make i18n",
4669
"cypress:run": "make cypress-run",
47-
"cypress:open": "make cypress-open"
70+
"cypress:open": "make cypress-open",
71+
"prepare": "husky install"
4872
}
4973
}

src/Block/DefaultTocRenderer.test.jsx

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)