@eeacms/volto-editing-progress 0.1.4 → 0.1.8

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,34 @@ 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.8](https://github.com/eea/volto-editing-progress/compare/0.1.7...0.1.8)
8
+
9
+
10
+ #### [0.1.7](https://github.com/eea/volto-editing-progress/compare/0.1.6...0.1.7)
11
+
12
+ > 23 December 2021
13
+
14
+ - Update cypress tests to work also with slate [`#7`](https://github.com/eea/volto-editing-progress/pull/7)
15
+
16
+ #### [0.1.6](https://github.com/eea/volto-editing-progress/compare/0.1.5...0.1.6)
17
+
18
+ > 18 December 2021
19
+
20
+ - Add SonarQube badges [`#6`](https://github.com/eea/volto-editing-progress/pull/6)
21
+ - Refs #142010 - Optimize Volto-addons gitflow pipelines [`ecaea55`](https://github.com/eea/volto-editing-progress/commit/ecaea55e1987fdcf4228075fa05414f71922ba0c)
22
+
23
+ #### [0.1.5](https://github.com/eea/volto-editing-progress/compare/0.1.4...0.1.5)
24
+
25
+ > 24 June 2021
26
+
27
+ - Refs #124587 ensure we have document sidebar active on edit: [`#5`](https://github.com/eea/volto-editing-progress/pull/5)
28
+ - Refs #124587 lint fix: [`1fdaf0a`](https://github.com/eea/volto-editing-progress/commit/1fdaf0a2b7d003bc4c153b33f3d42dc02ed0359b)
29
+
7
30
  #### [0.1.4](https://github.com/eea/volto-editing-progress/compare/0.1.3...0.1.4)
8
31
 
32
+ > 18 June 2021
33
+
34
+ - Refs #124587 ensure that the scroll to hash flashes everytime it's sc… [`#4`](https://github.com/eea/volto-editing-progress/pull/4)
9
35
  - 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)
10
36
 
11
37
  #### [0.1.3](https://github.com/eea/volto-editing-progress/compare/0.1.2...0.1.3)
@@ -27,7 +53,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
27
53
  > 10 June 2021
28
54
 
29
55
  - Cypress code coverage [`#1`](https://github.com/eea/volto-editing-progress/pull/1)
30
- - [JENKINS] - Fix stylelint [`53ea81b`](https://github.com/eea/volto-editing-progress/commit/53ea81b9fd99913adbec69b25f2b456c40d4c5a7)
31
56
  - Refs #124587 lint fixing [`2bc7ffa`](https://github.com/eea/volto-editing-progress/commit/2bc7ffa48535a1f032bfbfa242f0d0f9c09ad9b2)
32
57
  - Refs #124587 wip setting bullets for soft required fields on edit [`5d0cd54`](https://github.com/eea/volto-editing-progress/commit/5d0cd54200117bda9b2fb9bb1ec56f270b6d3c33)
33
58
  - 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
 
@@ -82,7 +124,7 @@ pipeline {
82
124
  node(label: 'docker') {
83
125
  script {
84
126
  try {
85
- sh '''docker pull plone; docker run -d --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="profile-plone.restapi:blocks" plone fg'''
127
+ sh '''docker pull plone; docker run -d --rm --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="profile-plone.restapi:blocks" plone fg'''
86
128
  sh '''docker pull plone/volto-addon-ci; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" plone/volto-addon-ci cypress'''
87
129
  } finally {
88
130
  try {
@@ -100,7 +142,8 @@ pipeline {
100
142
  reportName: 'CypressCoverage',
101
143
  reportTitles: 'Integration Tests Code Coverage'])
102
144
  }
103
- archiveArtifacts artifacts: 'cypress-reports/videos/*.mp4', fingerprint: true
145
+ sh '''touch empty_file; for ok_test in $(grep -E 'file=.*failures="0"' $(grep 'testsuites .*failures="0"' $(find cypress-results -name *.xml) empty_file | awk -F: '{print $1}') empty_file | sed 's/.* file="\\(.*\\)" time.*/\\1/' | sed 's#^cypress/integration/##g' | sed 's#^../../../node_modules/@eeacms/##g'); do rm -f cypress-reports/videos/$ok_test.mp4; rm -f cypress-reports/$ok_test.mp4; done'''
146
+ archiveArtifacts artifacts: 'cypress-reports/**/*.mp4', fingerprint: true, allowEmptyArchive: true
104
147
  stash name: "cypress-coverage", includes: "cypress-coverage/**", allowEmpty: true
105
148
  }
106
149
  finally {
@@ -122,10 +165,16 @@ pipeline {
122
165
  }
123
166
 
124
167
  stage('Report to SonarQube') {
125
- // Exclude Pull-Requests
126
168
  when {
127
169
  allOf {
128
170
  environment name: 'CHANGE_ID', value: ''
171
+ anyOf {
172
+ branch 'master'
173
+ allOf {
174
+ branch 'develop'
175
+ not { changelog '.*^Automated release [0-9\\.]+$' }
176
+ }
177
+ }
129
178
  }
130
179
  }
131
180
  steps {
@@ -156,8 +205,8 @@ pipeline {
156
205
  steps {
157
206
  node(label: 'docker') {
158
207
  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"
208
+ if ( env.CHANGE_BRANCH != "develop" ) {
209
+ error "Pipeline aborted due to PR not made from develop branch"
161
210
  }
162
211
  withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN')]) {
163
212
  sh '''docker pull eeacms/gitflow'''
@@ -168,23 +217,6 @@ pipeline {
168
217
  }
169
218
  }
170
219
 
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
220
  }
189
221
 
190
222
  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).
@@ -6,15 +6,13 @@ describe('Blocks Tests', () => {
6
6
 
7
7
  it('Add Block: Empty', () => {
8
8
  // Change page title
9
- cy.get('.documentFirstHeading > .public-DraftStyleDefault-block')
10
- .clear()
11
- .type('My Add-on Page')
12
- .get('.documentFirstHeading span[data-text]')
13
- .contains('My Add-on Page');
14
-
15
- cy.get('.documentFirstHeading > .public-DraftStyleDefault-block').type(
16
- '{enter}',
17
- );
9
+ cy.get('[contenteditable=true]').first().clear();
10
+
11
+ cy.get('[contenteditable=true]').first().type('My Add-on Page');
12
+
13
+ cy.get('.documentFirstHeading').contains('My Add-on Page');
14
+
15
+ cy.get('[contenteditable=true]').first().type('{enter}');
18
16
 
19
17
  // Add block
20
18
  cy.get('.ui.basic.icon.button.block-add-button').first().click();
@@ -44,7 +44,7 @@ export const setupBeforeEach = () => {
44
44
  cy.waitForResourceToLoad('@types');
45
45
  cy.waitForResourceToLoad('my-page');
46
46
  cy.navigate('/cypress/my-page/edit');
47
- cy.get(`.block.title [data-contents]`);
47
+ cy.get(`.block.title h1`);
48
48
  };
49
49
 
50
50
  export const tearDownAfterEach = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-editing-progress",
3
- "version": "0.1.4",
3
+ "version": "0.1.8",
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,17 +9,29 @@ 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) {
29
+ switchToDocumentSidebarTab(hash);
18
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
- if (parent.classList.contains('flash-effect')) {
21
- parent.classList.remove('flash-effect');
22
- }
23
35
  window.setTimeout(() => parent.classList.add('flash-effect'), 10);
24
36
  window.clearInterval(id);
25
37
  }
@@ -29,7 +41,7 @@ const ScrollIntoView = (props) => {
29
41
  }
30
42
  const id = window.setInterval(scrollIdIntoView, 250);
31
43
  }
32
- }, [location.hash]);
44
+ }, [location.hash, location.pathname]);
33
45
 
34
46
  return null;
35
47
  };