@eeacms/volto-slate-metadata-mentions 4.0.0 → 4.0.1

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/CHANGELOG.md CHANGED
@@ -4,18 +4,25 @@ 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
- #### [4.0.0](https://github.com/eea/volto-slate-metadata-mentions/compare/3.0.2...4.0.0)
7
+ #### [4.0.1](https://github.com/eea/volto-slate-metadata-mentions/compare/4.0.0...4.0.1)
8
8
 
9
+ - Use a button factory [`#19`](https://github.com/eea/volto-slate-metadata-mentions/pull/19)
10
+ - Add SonarQube badges [`5d68285`](https://github.com/eea/volto-slate-metadata-mentions/commit/5d68285dd04f86628ba7f9174c1945412b5fb9a1)
11
+ - Refs #142010 - Optimize Volto-addons gitflow pipelines [`3a6a696`](https://github.com/eea/volto-slate-metadata-mentions/commit/3a6a69612652cd947d54f77c430bdca21b82a0df)
12
+
13
+ ### [4.0.0](https://github.com/eea/volto-slate-metadata-mentions/compare/3.0.2...4.0.0)
14
+
15
+ > 24 September 2021
16
+
17
+ - Release 4.0.0 [`#18`](https://github.com/eea/volto-slate-metadata-mentions/pull/18)
9
18
  - Use new slate namespaced pluginids [`#17`](https://github.com/eea/volto-slate-metadata-mentions/pull/17)
10
19
  - Allow also dict fields: temporal, geolocation [`49be384`](https://github.com/eea/volto-slate-metadata-mentions/commit/49be3845a5fed9957139ebe88d24adc44b2521d5)
11
- - Add Sonarqube tag using climate-energy-frontend addons list [`53de974`](https://github.com/eea/volto-slate-metadata-mentions/commit/53de9745893b04f14f4688c81e52a857a5fbe7b9)
12
20
 
13
21
  #### [3.0.2](https://github.com/eea/volto-slate-metadata-mentions/compare/3.0.1...3.0.2)
14
22
 
15
23
  > 10 September 2021
16
24
 
17
25
  - Fix cypress api_url [`#16`](https://github.com/eea/volto-slate-metadata-mentions/pull/16)
18
- - Add Sonarqube tag using ims-frontend addons list [`cc67fec`](https://github.com/eea/volto-slate-metadata-mentions/commit/cc67fec41698b99c1382b8be4a9aec4d14806d15)
19
26
 
20
27
  #### [3.0.1](https://github.com/eea/volto-slate-metadata-mentions/compare/3.0.0...3.0.1)
21
28
 
@@ -31,7 +38,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
31
38
  - Update package metadata [`af8c5b3`](https://github.com/eea/volto-slate-metadata-mentions/commit/af8c5b3bf2ce6d9520b3d9378c648a37d8d519d3)
32
39
  - Add ErrorBoundary to Widgets [`f9c7e0d`](https://github.com/eea/volto-slate-metadata-mentions/commit/f9c7e0de20c13305e9dfe09a968753f44e3224ce)
33
40
  - Make sure it doesn't crash if used with SlateJSONField [`60dbd38`](https://github.com/eea/volto-slate-metadata-mentions/commit/60dbd389f217b7341eb0c369abd044424357ab05)
34
- - Add Sonarqube tag using frontend addons list [`7c7f219`](https://github.com/eea/volto-slate-metadata-mentions/commit/7c7f2196bafde9bbb3ecead19d65ff109080e1f1)
35
41
 
36
42
  #### [2.4.0](https://github.com/eea/volto-slate-metadata-mentions/compare/2.3.1...2.4.0)
37
43
 
@@ -74,7 +80,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
74
80
 
75
81
  > 13 May 2021
76
82
 
77
- - [JENKINS] - Auto-release pipeline [`#4`](https://github.com/eea/volto-slate-metadata-mentions/pull/4)
78
83
  - fixed issue with decoration not being removed on cancel if creating a new element [`#5`](https://github.com/eea/volto-slate-metadata-mentions/pull/5)
79
84
  - fixed issue with decoration not being removed if user does not add any mentions on a new element, also should not remove if the user does not change an existing [`e5a6336`](https://github.com/eea/volto-slate-metadata-mentions/commit/e5a6336755730650407d1df7fbe5134af7ce39cd)
80
85
 
@@ -105,8 +110,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
105
110
  > 17 November 2020
106
111
 
107
112
  - Release 1.0.0 [`6575ab3`](https://github.com/eea/volto-slate-metadata-mentions/commit/6575ab300c7889ccfea1d9c20266f1c074ea2b4f)
108
- - [JENKINS] - Fix dependencies [`aef9cf8`](https://github.com/eea/volto-slate-metadata-mentions/commit/aef9cf8b252a8dfab3ebb91977dde05bae2113af)
109
- - [JENKINS] - Add pipeline, update docs [`7b52b37`](https://github.com/eea/volto-slate-metadata-mentions/commit/7b52b37fb673ee3aa05b559d3e1a0188e3c013c1)
110
113
 
111
114
  #### [0.4.2](https://github.com/eea/volto-slate-metadata-mentions/compare/0.4.1...0.4.2)
112
115
 
@@ -194,7 +197,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
194
197
  - Cleanup [`4edb16c`](https://github.com/eea/volto-slate-metadata-mentions/commit/4edb16c39bd1632a285aae1dc4b23bc3121b30af)
195
198
  - Remove unused uid normalizer [`6006d90`](https://github.com/eea/volto-slate-metadata-mentions/commit/6006d9070ca8418c508f002032eca087c851b489)
196
199
  - Cosmetics [`15424a4`](https://github.com/eea/volto-slate-metadata-mentions/commit/15424a48b14117a19c00167966a8fa15bcff8504)
197
- - yarn lint [`45403b3`](https://github.com/eea/volto-slate-metadata-mentions/commit/45403b3962c2c995e22c8c40535098948f6f8d2b)
198
200
  - lint [`9eedfe6`](https://github.com/eea/volto-slate-metadata-mentions/commit/9eedfe614e9202a2fd3d97c5d8cf53a52a43a3a4)
199
201
  - Update widgets to use children; lint [`17b5eec`](https://github.com/eea/volto-slate-metadata-mentions/commit/17b5eecc0ce445c123fd57abbc14e045f4920370)
200
202
  - Style token widget [`4fa52f5`](https://github.com/eea/volto-slate-metadata-mentions/commit/4fa52f5cc7cfde140e482048792c6f1782b4ee4e)
package/Jenkinsfile CHANGED
@@ -4,7 +4,7 @@ pipeline {
4
4
  environment {
5
5
  GIT_NAME = "volto-slate-metadata-mentions"
6
6
  NAMESPACE = "@eeacms"
7
- SONARQUBE_TAGS = "volto.eea.europa.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,climate-energy.eea.europa.eu"
7
+ SONARQUBE_TAGS = "volto.eea.europa.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,climate-energy.eea.europa.eu,sustainability.eionet.europa.eu,forest.eea.europa.eu,clms.land.copernicus.eu,industry.eea.europa.eu,water.europa.eu-freshwater"
8
8
  DEPENDENCIES = ""
9
9
  PLONE_VERSIONS = "plone.schema=1.3.0 plone.restapi=8.9.1"
10
10
  PLONE_ADDONS = "eea.schema.slate"
@@ -12,7 +12,31 @@ pipeline {
12
12
 
13
13
  stages {
14
14
 
15
+ stage('Release') {
16
+ when {
17
+ allOf {
18
+ environment name: 'CHANGE_ID', value: ''
19
+ branch 'master'
20
+ }
21
+ }
22
+ steps {
23
+ node(label: 'docker') {
24
+ withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN'),string(credentialsId: 'eea-jenkins-npm-token', variable: 'NPM_TOKEN')]) {
25
+ sh '''docker pull eeacms/gitflow'''
26
+ sh '''docker run -i --rm --name="$BUILD_TAG-gitflow-master" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_NAME="$GIT_NAME" -e GIT_TOKEN="$GITHUB_TOKEN" -e NPM_TOKEN="$NPM_TOKEN" -e LANGUAGE=javascript eeacms/gitflow'''
27
+ }
28
+ }
29
+ }
30
+ }
31
+
15
32
  stage('Code') {
33
+ when {
34
+ allOf {
35
+ environment name: 'CHANGE_ID', value: ''
36
+ not { changelog '.*^Automated release [0-9\\.]+$' }
37
+ not { branch 'master' }
38
+ }
39
+ }
16
40
  steps {
17
41
  parallel(
18
42
 
@@ -38,6 +62,15 @@ pipeline {
38
62
  }
39
63
 
40
64
  stage('Tests') {
65
+ when {
66
+ allOf {
67
+ environment name: 'CHANGE_ID', value: ''
68
+ anyOf {
69
+ not { changelog '.*^Automated release [0-9\\.]+$' }
70
+ branch 'master'
71
+ }
72
+ }
73
+ }
41
74
  steps {
42
75
  parallel(
43
76
 
@@ -77,6 +110,15 @@ pipeline {
77
110
  }
78
111
 
79
112
  stage('Integration tests') {
113
+ when {
114
+ allOf {
115
+ environment name: 'CHANGE_ID', value: ''
116
+ anyOf {
117
+ not { changelog '.*^Automated release [0-9\\.]+$' }
118
+ branch 'master'
119
+ }
120
+ }
121
+ }
80
122
  steps {
81
123
  parallel(
82
124
 
@@ -124,10 +166,16 @@ pipeline {
124
166
  }
125
167
 
126
168
  stage('Report to SonarQube') {
127
- // Exclude Pull-Requests
128
169
  when {
129
170
  allOf {
130
171
  environment name: 'CHANGE_ID', value: ''
172
+ anyOf {
173
+ branch 'master'
174
+ allOf {
175
+ branch 'develop'
176
+ not { changelog '.*^Automated release [0-9\\.]+$' }
177
+ }
178
+ }
131
179
  }
132
180
  }
133
181
  steps {
@@ -158,8 +206,8 @@ pipeline {
158
206
  steps {
159
207
  node(label: 'docker') {
160
208
  script {
161
- if ( env.CHANGE_BRANCH != "develop" && !( env.CHANGE_BRANCH.startsWith("hotfix")) ) {
162
- error "Pipeline aborted due to PR not made from develop or hotfix branch"
209
+ if ( env.CHANGE_BRANCH != "develop" ) {
210
+ error "Pipeline aborted due to PR not made from develop branch"
163
211
  }
164
212
  withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN')]) {
165
213
  sh '''docker pull eeacms/gitflow'''
@@ -170,23 +218,6 @@ pipeline {
170
218
  }
171
219
  }
172
220
 
173
- stage('Release') {
174
- when {
175
- allOf {
176
- environment name: 'CHANGE_ID', value: ''
177
- branch 'master'
178
- }
179
- }
180
- steps {
181
- node(label: 'docker') {
182
- withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN'),string(credentialsId: 'eea-jenkins-npm-token', variable: 'NPM_TOKEN')]) {
183
- sh '''docker pull eeacms/gitflow'''
184
- sh '''docker run -i --rm --name="$BUILD_TAG-gitflow-master" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_NAME="$GIT_NAME" -e GIT_TOKEN="$GITHUB_TOKEN" -e NPM_TOKEN="$NPM_TOKEN" -e LANGUAGE=javascript eeacms/gitflow'''
185
- }
186
- }
187
- }
188
- }
189
-
190
221
  }
191
222
 
192
223
  post {
package/README.md CHANGED
@@ -1,7 +1,19 @@
1
1
  # volto-slate-metadata-mentions
2
+
2
3
  [![Releases](https://img.shields.io/github/v/release/eea/volto-slate-metadata-mentions)](https://github.com/eea/volto-slate-metadata-mentions/releases)
4
+
3
5
  [![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto-addons%2Fvolto-slate-metadata-mentions%2Fmaster&subject=master)](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-slate-metadata-mentions/job/master/display/redirect)
6
+ [![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-metadata-mentions-master&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-metadata-mentions-master)
7
+ [![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-metadata-mentions-master&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-metadata-mentions-master)
8
+ [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-metadata-mentions-master&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-metadata-mentions-master)
9
+ [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-metadata-mentions-master&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-metadata-mentions-master)
10
+
4
11
  [![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto-addons%2Fvolto-slate-metadata-mentions%2Fdevelop&subject=develop)](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-slate-metadata-mentions/job/develop/display/redirect)
12
+ [![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-metadata-mentions-develop&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-metadata-mentions-develop)
13
+ [![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-metadata-mentions-develop&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-metadata-mentions-develop)
14
+ [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-metadata-mentions-develop&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-metadata-mentions-develop)
15
+ [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-slate-metadata-mentions-develop&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-slate-metadata-mentions-develop)
16
+
5
17
 
6
18
  [Volto Slate](https://github.com/eea/volto-slate/tree/develop) Metadata Mentions
7
19
 
@@ -66,6 +78,81 @@
66
78
 
67
79
  1. Happy editing!
68
80
 
81
+ ## Release
82
+
83
+ ### Automatic release using Jenkins
84
+
85
+ * 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.
86
+ * It runs on every commit on `master` branch, which is protected from direct commits, only allowing pull request merge commits.
87
+ * 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.
88
+ * 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.
89
+ * 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.
90
+ * The version format must be MAJOR.MINOR.PATCH. By default, next release is set to next minor version (with patch 0).
91
+ * 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.
92
+ * Automated commits and commits with [JENKINS] or [YARN] in the commit log are excluded from `CHANGELOG.md` file.
93
+
94
+ ### Manual release from the develop branch ( beta release )
95
+
96
+ #### Installation and configuration of release-it
97
+
98
+ You need to first install the [release-it](https://github.com/release-it/release-it) client.
99
+
100
+ ```
101
+ npm install -g release-it
102
+ ```
103
+
104
+ Release-it uses the configuration written in the [`.release-it.json`](./.release-it.json) file located in the root of the repository.
105
+
106
+ Release-it is a tool that automates 4 important steps in the release process:
107
+
108
+ 1. Version increase in `package.json` ( increased from the current version in `package.json`)
109
+ 2. `CHANGELOG.md` automatic generation from commit messages ( grouped by releases )
110
+ 3. GitHub release on the commit with the changelog and package.json modification on the develop branch
111
+ 4. NPM release ( by default it's disabled, but can be enabled in the configuration file )
112
+
113
+ To configure the authentification, you need to export GITHUB_TOKEN for [GitHub](https://github.com/settings/tokens)
114
+
115
+ ```
116
+ export GITHUB_TOKEN=XXX-XXXXXXXXXXXXXXXXXXXXXX
117
+ ```
118
+
119
+ To configure npm, you can use the `npm login` command or use a configuration file with a TOKEN :
120
+
121
+ ```
122
+ echo "//registry.npmjs.org/:_authToken=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY" > .npmrc
123
+ ```
124
+
125
+ #### Using release-it tool
126
+
127
+ There are 3 yarn scripts that can be run to do the release
128
+
129
+ ##### yarn release-beta
130
+
131
+ Automatically calculates and presents 3 beta versions - patch, minor and major for you to choose ( or Other for manual input).
132
+
133
+ ```
134
+ ? Select increment (next version):
135
+ ❯ prepatch (0.1.1-beta.0)
136
+ preminor (0.2.0-beta.0)
137
+ premajor (1.0.0-beta.0)
138
+ Other, please specify...
139
+ ```
140
+
141
+ ##### yarn release-major-beta
142
+
143
+ Same as `yarn release-beta`, but with premajor version pre-selected.
144
+
145
+ ##### yarn release
146
+
147
+ Generic command, does not automatically add the `beta` to version, but you can still manually write it if you choose Other.
148
+
149
+ #### Important notes
150
+
151
+ > 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.
152
+
153
+ > 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).
154
+
155
+
69
156
  ## How to contribute
70
157
 
71
158
  See [DEVELOP.md](DEVELOP.md).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-slate-metadata-mentions",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "Volto Slate Metadata Mentions Plugin",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -33,6 +33,8 @@
33
33
  },
34
34
  "scripts": {
35
35
  "release": "release-it",
36
+ "release-major-beta": "release-it major --preRelease=beta",
37
+ "release-beta": "release-it --preRelease=beta",
36
38
  "bootstrap": "npm install -g ejs; npm link ejs; node bootstrap",
37
39
  "test": "make test",
38
40
  "test:fix": "make test-update",
@@ -36,6 +36,10 @@ const omittedProps = [
36
36
  'persistentHelper',
37
37
  ];
38
38
 
39
+ const btnFactory = (options) => (props) => (
40
+ <ToolbarButton {...props} {...options} title="Metadata" />
41
+ );
42
+
39
43
  export default (config) => {
40
44
  const opts = {
41
45
  title: 'Metadata',
@@ -63,13 +67,7 @@ export default (config) => {
63
67
  ];
64
68
 
65
69
  // Custom mention Toolbar Button
66
- slate.buttons['mention'] = (props) => (
67
- <ToolbarButton
68
- {...props}
69
- title="Metadata"
70
- {...omit(pluginOptions, omittedProps)}
71
- />
72
- );
70
+ slate.buttons['mention'] = btnFactory(omit(pluginOptions, omittedProps));
73
71
 
74
72
  return config;
75
73
  };