@eeacms/volto-editing-progress 0.1.2 → 0.1.6

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,8 +4,36 @@ 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
+ #### [0.1.6](https://github.com/eea/volto-editing-progress/compare/0.1.5...0.1.6)
8
+
9
+ - Add SonarQube badges [`62c51d7`](https://github.com/eea/volto-editing-progress/commit/62c51d71b3586eaa4cfba7a9ead5e2970a536624)
10
+ - Refs #142010 - Optimize Volto-addons gitflow pipelines [`ecaea55`](https://github.com/eea/volto-editing-progress/commit/ecaea55e1987fdcf4228075fa05414f71922ba0c)
11
+
12
+ #### [0.1.5](https://github.com/eea/volto-editing-progress/compare/0.1.4...0.1.5)
13
+
14
+ > 24 June 2021
15
+
16
+ - Refs #124587 ensure we have document sidebar active on edit: [`#5`](https://github.com/eea/volto-editing-progress/pull/5)
17
+ - Refs #124587 lint fix: [`1fdaf0a`](https://github.com/eea/volto-editing-progress/commit/1fdaf0a2b7d003bc4c153b33f3d42dc02ed0359b)
18
+
19
+ #### [0.1.4](https://github.com/eea/volto-editing-progress/compare/0.1.3...0.1.4)
20
+
21
+ > 18 June 2021
22
+
23
+ - Refs #124587 ensure that the scroll to hash flashes everytime it's sc… [`#4`](https://github.com/eea/volto-editing-progress/pull/4)
24
+ - Refs #124587 ensure that the scroll to hash flashes everytime it's scrolled into view [`4052cf2`](https://github.com/eea/volto-editing-progress/commit/4052cf212e74690ca5f43adf79b679aef2167358)
25
+
26
+ #### [0.1.3](https://github.com/eea/volto-editing-progress/compare/0.1.2...0.1.3)
27
+
28
+ > 18 June 2021
29
+
30
+ - Refs #124587 fixed use object if it's found and we have no field div: [`#3`](https://github.com/eea/volto-editing-progress/pull/3)
31
+
7
32
  #### [0.1.2](https://github.com/eea/volto-editing-progress/compare/0.1.1...0.1.2)
8
33
 
34
+ > 15 June 2021
35
+
36
+ - Refs #124587 implemented scroll to field with a flash effect [`#2`](https://github.com/eea/volto-editing-progress/pull/2)
9
37
  - Refs #124587 fixed linting and removed marking of soft required from edit: [`d1e9deb`](https://github.com/eea/volto-editing-progress/commit/d1e9debedb5ca0d0b78570e188ed0df81211588f)
10
38
  - Refs #124587 added scroll into view when we have a hash in view [`901c66b`](https://github.com/eea/volto-editing-progress/commit/901c66bd90f8050a6664ca85770de6b709d48d29)
11
39
 
@@ -14,7 +42,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
14
42
  > 10 June 2021
15
43
 
16
44
  - Cypress code coverage [`#1`](https://github.com/eea/volto-editing-progress/pull/1)
17
- - [JENKINS] - Fix stylelint [`53ea81b`](https://github.com/eea/volto-editing-progress/commit/53ea81b9fd99913adbec69b25f2b456c40d4c5a7)
18
45
  - Refs #124587 lint fixing [`2bc7ffa`](https://github.com/eea/volto-editing-progress/commit/2bc7ffa48535a1f032bfbfa242f0d0f9c09ad9b2)
19
46
  - Refs #124587 wip setting bullets for soft required fields on edit [`5d0cd54`](https://github.com/eea/volto-editing-progress/commit/5d0cd54200117bda9b2fb9bb1ec56f270b6d3c33)
20
47
  - Refs #124587 changed the following: [`5ac614f`](https://github.com/eea/volto-editing-progress/commit/5ac614f89fd9bef5775052f5ec1a171256235d1e)
package/Jenkinsfile CHANGED
@@ -4,13 +4,37 @@ pipeline {
4
4
  environment {
5
5
  GIT_NAME = "volto-editing-progress"
6
6
  NAMESPACE = "@eeacms"
7
- SONARQUBE_TAGS = "volto.eea.europa.eu"
7
+ SONARQUBE_TAGS = "volto.eea.europa.eu,www.eea.europa.eu-ims"
8
8
  DEPENDENCIES = ""
9
9
  }
10
10
 
11
11
  stages {
12
12
 
13
+ stage('Release') {
14
+ when {
15
+ allOf {
16
+ environment name: 'CHANGE_ID', value: ''
17
+ branch 'master'
18
+ }
19
+ }
20
+ steps {
21
+ node(label: 'docker') {
22
+ withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN'),string(credentialsId: 'eea-jenkins-npm-token', variable: 'NPM_TOKEN')]) {
23
+ sh '''docker pull eeacms/gitflow'''
24
+ 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'''
25
+ }
26
+ }
27
+ }
28
+ }
29
+
13
30
  stage('Code') {
31
+ when {
32
+ allOf {
33
+ environment name: 'CHANGE_ID', value: ''
34
+ not { changelog '.*^Automated release [0-9\\.]+$' }
35
+ not { branch 'master' }
36
+ }
37
+ }
14
38
  steps {
15
39
  parallel(
16
40
 
@@ -36,6 +60,15 @@ pipeline {
36
60
  }
37
61
 
38
62
  stage('Tests') {
63
+ when {
64
+ allOf {
65
+ environment name: 'CHANGE_ID', value: ''
66
+ anyOf {
67
+ not { changelog '.*^Automated release [0-9\\.]+$' }
68
+ branch 'master'
69
+ }
70
+ }
71
+ }
39
72
  steps {
40
73
  parallel(
41
74
 
@@ -75,6 +108,15 @@ pipeline {
75
108
  }
76
109
 
77
110
  stage('Integration tests') {
111
+ when {
112
+ allOf {
113
+ environment name: 'CHANGE_ID', value: ''
114
+ anyOf {
115
+ not { changelog '.*^Automated release [0-9\\.]+$' }
116
+ branch 'master'
117
+ }
118
+ }
119
+ }
78
120
  steps {
79
121
  parallel(
80
122
 
@@ -122,10 +164,16 @@ pipeline {
122
164
  }
123
165
 
124
166
  stage('Report to SonarQube') {
125
- // Exclude Pull-Requests
126
167
  when {
127
168
  allOf {
128
169
  environment name: 'CHANGE_ID', value: ''
170
+ anyOf {
171
+ branch 'master'
172
+ allOf {
173
+ branch 'develop'
174
+ not { changelog '.*^Automated release [0-9\\.]+$' }
175
+ }
176
+ }
129
177
  }
130
178
  }
131
179
  steps {
@@ -156,8 +204,8 @@ pipeline {
156
204
  steps {
157
205
  node(label: 'docker') {
158
206
  script {
159
- if ( env.CHANGE_BRANCH != "develop" && !( env.CHANGE_BRANCH.startsWith("hotfix")) ) {
160
- error "Pipeline aborted due to PR not made from develop or hotfix branch"
207
+ if ( env.CHANGE_BRANCH != "develop" ) {
208
+ error "Pipeline aborted due to PR not made from develop branch"
161
209
  }
162
210
  withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN')]) {
163
211
  sh '''docker pull eeacms/gitflow'''
@@ -168,23 +216,6 @@ pipeline {
168
216
  }
169
217
  }
170
218
 
171
- stage('Release') {
172
- when {
173
- allOf {
174
- environment name: 'CHANGE_ID', value: ''
175
- branch 'master'
176
- }
177
- }
178
- steps {
179
- node(label: 'docker') {
180
- withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN'),string(credentialsId: 'eea-jenkins-npm-token', variable: 'NPM_TOKEN')]) {
181
- sh '''docker pull eeacms/gitflow'''
182
- 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'''
183
- }
184
- }
185
- }
186
- }
187
-
188
219
  }
189
220
 
190
221
  post {
package/README.md CHANGED
@@ -1,13 +1,25 @@
1
1
  # volto-editing-progress
2
+
2
3
  [![Releases](https://img.shields.io/github/v/release/eea/volto-editing-progress)](https://github.com/eea/volto-editing-progress/releases)
4
+
3
5
  [![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto-addons%2Fvolto-editing-progress%2Fmaster&subject=master)](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-editing-progress/job/master/display/redirect)
6
+ [![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-editing-progress-master&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-editing-progress-master)
7
+ [![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-editing-progress-master&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-editing-progress-master)
8
+ [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-editing-progress-master&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-editing-progress-master)
9
+ [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-editing-progress-master&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-editing-progress-master)
10
+
4
11
  [![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto-addons%2Fvolto-editing-progress%2Fdevelop&subject=develop)](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-editing-progress/job/develop/display/redirect)
12
+ [![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-editing-progress-develop&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-editing-progress-develop)
13
+ [![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-editing-progress-develop&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-editing-progress-develop)
14
+ [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-editing-progress-develop&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-editing-progress-develop)
15
+ [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-editing-progress-develop&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-editing-progress-develop)
5
16
 
6
- [Volto](https://github.com/plone/volto) add-on
17
+
18
+ [Volto](https://github.com/plone/volto) add-on: Editing progress
7
19
 
8
20
  ## Features
9
21
 
10
- Demo GIF
22
+ Document Editing progress bar in Volto
11
23
 
12
24
  ## Getting started
13
25
 
@@ -70,6 +82,81 @@ Demo GIF
70
82
 
71
83
  1. Happy editing!
72
84
 
85
+ ## Release
86
+
87
+ ### Automatic release using Jenkins
88
+
89
+ * 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.
90
+ * It runs on every commit on `master` branch, which is protected from direct commits, only allowing pull request merge commits.
91
+ * 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.
92
+ * 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.
93
+ * 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.
94
+ * The version format must be MAJOR.MINOR.PATCH. By default, next release is set to next minor version (with patch 0).
95
+ * 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.
96
+ * Automated commits and commits with [JENKINS] or [YARN] in the commit log are excluded from `CHANGELOG.md` file.
97
+
98
+ ### Manual release from the develop branch ( beta release )
99
+
100
+ #### Installation and configuration of release-it
101
+
102
+ You need to first install the [release-it](https://github.com/release-it/release-it) client.
103
+
104
+ ```
105
+ npm install -g release-it
106
+ ```
107
+
108
+ Release-it uses the configuration written in the [`.release-it.json`](./.release-it.json) file located in the root of the repository.
109
+
110
+ Release-it is a tool that automates 4 important steps in the release process:
111
+
112
+ 1. Version increase in `package.json` ( increased from the current version in `package.json`)
113
+ 2. `CHANGELOG.md` automatic generation from commit messages ( grouped by releases )
114
+ 3. GitHub release on the commit with the changelog and package.json modification on the develop branch
115
+ 4. NPM release ( by default it's disabled, but can be enabled in the configuration file )
116
+
117
+ To configure the authentification, you need to export GITHUB_TOKEN for [GitHub](https://github.com/settings/tokens)
118
+
119
+ ```
120
+ export GITHUB_TOKEN=XXX-XXXXXXXXXXXXXXXXXXXXXX
121
+ ```
122
+
123
+ To configure npm, you can use the `npm login` command or use a configuration file with a TOKEN :
124
+
125
+ ```
126
+ echo "//registry.npmjs.org/:_authToken=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY" > .npmrc
127
+ ```
128
+
129
+ #### Using release-it tool
130
+
131
+ There are 3 yarn scripts that can be run to do the release
132
+
133
+ ##### yarn release-beta
134
+
135
+ Automatically calculates and presents 3 beta versions - patch, minor and major for you to choose ( or Other for manual input).
136
+
137
+ ```
138
+ ? Select increment (next version):
139
+ ❯ prepatch (0.1.1-beta.0)
140
+ preminor (0.2.0-beta.0)
141
+ premajor (1.0.0-beta.0)
142
+ Other, please specify...
143
+ ```
144
+
145
+ ##### yarn release-major-beta
146
+
147
+ Same as `yarn release-beta`, but with premajor version pre-selected.
148
+
149
+ ##### yarn release
150
+
151
+ Generic command, does not automatically add the `beta` to version, but you can still manually write it if you choose Other.
152
+
153
+ #### Important notes
154
+
155
+ > 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.
156
+
157
+ > 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).
158
+
159
+
73
160
  ## How to contribute
74
161
 
75
162
  See [DEVELOP.md](https://github.com/eea/volto-editing-progress/blob/master/DEVELOP.md).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-editing-progress",
3
- "version": "0.1.2",
3
+ "version": "0.1.6",
4
4
  "description": "@eeacms/volto-editing-progress: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -23,6 +23,8 @@
23
23
  },
24
24
  "scripts": {
25
25
  "release": "release-it",
26
+ "release-major-beta": "release-it major --preRelease=beta",
27
+ "release-beta": "release-it --preRelease=beta",
26
28
  "bootstrap": "npm install -g ejs; npm link ejs; node bootstrap",
27
29
  "stylelint": "../../../node_modules/stylelint/bin/stylelint.js --allow-empty-input 'src/**/*.{css,less}'",
28
30
  "stylelint:overrides": "../../../node_modules/.bin/stylelint --syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides'",
@@ -9,15 +9,30 @@ const ScrollIntoView = (props) => {
9
9
  }
10
10
  let count = 0;
11
11
  if (location.hash) {
12
+ function switchToDocumentSidebarTab(hash) {
13
+ const isEdit = location.pathname.endsWith('/edit');
14
+ if (isEdit && hash.indexOf('fieldset') !== -1) {
15
+ const form_tabs = document.querySelector(
16
+ '.sidebar-container .formtabs',
17
+ );
18
+ const first_tab = form_tabs && form_tabs.firstElementChild;
19
+ if (first_tab && !first_tab.classList.contains('active')) {
20
+ first_tab.click();
21
+ }
22
+ }
23
+ }
24
+ const hash = location.hash.split('#')[1];
12
25
  function scrollIdIntoView() {
13
26
  count += 1;
14
- const obj = document.getElementById(
15
- window.decodeURIComponent(location.hash.split('#')[1]),
16
- );
27
+ const obj = document.getElementById(window.decodeURIComponent(hash));
17
28
  if (obj) {
18
- const parent = obj.closest('.field');
29
+ switchToDocumentSidebarTab(hash);
30
+ const parent = obj.closest('.field') || obj;
31
+ document.querySelectorAll('.flash-effect').forEach(function (el) {
32
+ el.classList.remove('flash-effect');
33
+ });
19
34
  parent.scrollIntoView({ behavior: 'smooth', block: 'center' });
20
- parent.classList.add('flash-effect');
35
+ window.setTimeout(() => parent.classList.add('flash-effect'), 10);
21
36
  window.clearInterval(id);
22
37
  }
23
38
  if (count > 40) {
@@ -26,7 +41,7 @@ const ScrollIntoView = (props) => {
26
41
  }
27
42
  const id = window.setInterval(scrollIdIntoView, 250);
28
43
  }
29
- }, [location.hash]);
44
+ }, [location.hash, location.pathname]);
30
45
 
31
46
  return null;
32
47
  };