Skip to content

Commit

Permalink
Merge pull request #126 from eea/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
avoinea committed Mar 13, 2024
2 parents b83d023 + 4fcefe6 commit 9bbb2ac
Show file tree
Hide file tree
Showing 11 changed files with 186 additions and 86 deletions.
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Jest configuration variables
# - possible values: ON, OFF
JEST_USE_SETUP=OFF
65 changes: 65 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
const fs = require('fs');
const path = require('path');
const projectRootPath = fs.realpathSync(__dirname + '/../../../');

let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto');
let configFile;
if (fs.existsSync(`${projectRootPath}/tsconfig.json`))
configFile = `${projectRootPath}/tsconfig.json`;
else if (fs.existsSync(`${projectRootPath}/jsconfig.json`))
configFile = `${projectRootPath}/jsconfig.json`;

if (configFile) {
const jsConfig = require(configFile).compilerOptions;
const pathsConfig = jsConfig.paths;
if (pathsConfig['@plone/volto'])
voltoPath = `./${jsConfig.baseUrl}/${pathsConfig['@plone/volto'][0]}`;
}

const AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`);
const reg = new AddonConfigurationRegistry(projectRootPath);

// Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
const addonAliases = Object.keys(reg.packages).map((o) => [
o,
reg.packages[o].modulePath,
]);

const addonExtenders = reg.getEslintExtenders().map((m) => require(m));

const defaultConfig = {
extends: `${voltoPath}/.eslintrc`,
settings: {
'import/resolver': {
alias: {
map: [
['@plone/volto', '@plone/volto/src'],
['@plone/volto-slate', '@plone/volto/packages/volto-slate/src'],
...addonAliases,
['@package', `${__dirname}/src`],
['@root', `${__dirname}/src`],
['~', `${__dirname}/src`],
],
extensions: ['.js', '.jsx', '.json'],
},
'babel-plugin-root-import': {
rootPathSuffix: 'src',
},
},
},
rules: {
'react/jsx-no-target-blank': [
'error',
{
allowReferrer: true,
},
],
}
};

const config = addonExtenders.reduce(
(acc, extender) => extender.modify(acc),
defaultConfig,
);

module.exports = config;
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.vscode/
.history
.eslintrc.js
.nyc_output
project
coverage
Expand Down
53 changes: 0 additions & 53 deletions .project.eslintrc.js

This file was deleted.

31 changes: 15 additions & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ All notable changes to this project will be documented in this file. Dates are d

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

### [0.8.0](https://github.com/eea/volto-searchlib/compare/0.7.3...0.8.0) - 12 March 2024

#### :boom: Breaking Change

- breaking(webpack): removed path import as webpack 5 no longer patches node modules to use in the browser [David Ichim - [`cef8cfb`](https://github.com/eea/volto-searchlib/commit/cef8cfb93e9f9fa746d40143f0c95a5d20e98b34)]

#### :house: Internal changes

- chore: package.json [Alin Voinea - [`3a3604c`](https://github.com/eea/volto-searchlib/commit/3a3604cc7e0981dc79d62c5a5213466aef34369c)]

#### :hammer_and_wrench: Others

- Update package.json [ichim-david - [`efd1a90`](https://github.com/eea/volto-searchlib/commit/efd1a90a20dc9280e8968453864f387afe2ece27)]
- test: Update jest,Jenkinsfile,lint to volto-addons-template PR30 [valentinab25 - [`983cc26`](https://github.com/eea/volto-searchlib/commit/983cc26472054a09d4f19a7f6a836cee194e6b0a)]
- test: Update jest,Jenkinsfile,lint to volto-addons-template PR30 [valentinab25 - [`5462660`](https://github.com/eea/volto-searchlib/commit/5462660c1677f5d5404158d2cdb0515493466726)]
### [0.7.3](https://github.com/eea/volto-searchlib/compare/0.7.2...0.7.3) - 30 January 2024

#### :nail_care: Enhancements
Expand All @@ -14,7 +29,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

- test: stylelint [kreafox - [`9fa3848`](https://github.com/eea/volto-searchlib/commit/9fa38484139c10320c74ec9ea7db3fa9c6402919)]
- test: stylint [kreafox - [`95538fd`](https://github.com/eea/volto-searchlib/commit/95538fdd2fa954b9c66b4dbc33ff3d4959b98c24)]
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`7afcb17`](https://github.com/eea/volto-searchlib/commit/7afcb170a82728ffb463d21805f0055cebe06819)]
### [0.7.2](https://github.com/eea/volto-searchlib/compare/0.7.1...0.7.2) - 24 January 2024

#### :hammer_and_wrench: Others
Expand All @@ -30,7 +44,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- style: Automated code fix [eea-jenkins - [`8fabfb5`](https://github.com/eea/volto-searchlib/commit/8fabfb5f02695078dce0b727ca9a8e8368add3a6)]
- style: Automated code fix [eea-jenkins - [`2c0ffe7`](https://github.com/eea/volto-searchlib/commit/2c0ffe7f91d82fc6ef8c1e7b0724e448d6da21e8)]
- style: Automated code fix [eea-jenkins - [`528f293`](https://github.com/eea/volto-searchlib/commit/528f293baa92826890a76aa6044398d91fb9a7ef)]
- chore: [JENKINS] Refactor automated testing [valentinab25 - [`e1801bd`](https://github.com/eea/volto-searchlib/commit/e1801bd0087e8e47a08078a3fa081a8f1be6c5f4)]

#### :hammer_and_wrench: Others

Expand All @@ -41,14 +54,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- fixed slider [Zoltan Szabo - [`db223bf`](https://github.com/eea/volto-searchlib/commit/db223bfe6c13ddb9eb80efbcf5fec4cf13172de5)]
- disable facets while the results are loading [Zoltan Szabo - [`6529042`](https://github.com/eea/volto-searchlib/commit/65290420f7c2100a07c64a51733c3af96db3a89e)]
- in histogram facets only show the range where the buckets are not empty [Zoltan Szabo - [`3994c03`](https://github.com/eea/volto-searchlib/commit/3994c0375590e92f7e1536ebfec817ba9d5cf5f6)]
- test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`d5e1586`](https://github.com/eea/volto-searchlib/commit/d5e15860300831a535982abbe0d76e62f277f5fa)]
- test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`b359f50`](https://github.com/eea/volto-searchlib/commit/b359f50b28613b348440bf602a1550bcb9efedc7)]
- added possibility to configure facets to only be visible for authenticated users [Zoltan Szabo - [`cbbe2ec`](https://github.com/eea/volto-searchlib/commit/cbbe2ec5ac0efc6bff24ef3707a51715b745d56d)]
- hide facets if has no values to show [Zoltan Szabo - [`0a1740a`](https://github.com/eea/volto-searchlib/commit/0a1740a79474690649bd957f6841a2fae741058e)]
- only show the 'More filters' button if there are more filters [Zoltan Szabo - [`96dac21`](https://github.com/eea/volto-searchlib/commit/96dac2193b43b792269548c5351c447d4e9beb93)]
- test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`e2bbc26`](https://github.com/eea/volto-searchlib/commit/e2bbc262dd14cd72e3213291b25fe314a0e105fd)]
- test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`804556f`](https://github.com/eea/volto-searchlib/commit/804556fa4e5f7b8baf3570b55e7f24296a241253)]
- test: [JENKINS] Improve cypress time [valentinab25 - [`0c38ce9`](https://github.com/eea/volto-searchlib/commit/0c38ce972c318c64b70044dfad232202dc311687)]
- * test: add unit tests and modify jest-addon.config for searchlib alias - refs #254313 [ana-oprea - [`620031b`](https://github.com/eea/volto-searchlib/commit/620031b2f9b808a7e2804a5a7eb39c438e132f98)]
### [0.6.7](https://github.com/eea/volto-searchlib/compare/0.6.6...0.6.7) - 17 October 2023

Expand Down Expand Up @@ -94,7 +102,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### :hammer_and_wrench: Others

- test: Fix eslint and yarn i18n [Alin Voinea - [`315d99c`](https://github.com/eea/volto-searchlib/commit/315d99ccc61013bf5f5dc0ce145740a2abc393f8)]
- i18n: Add en [Alin Voinea - [`324f48b`](https://github.com/eea/volto-searchlib/commit/324f48b7f65acc706bb418c224740757a619d6d4)]
- lint fix [ichim-david - [`10ff8dc`](https://github.com/eea/volto-searchlib/commit/10ff8dc42a3ce570b5f53d1eff18d9cace2abb64)]
### [0.6.3](https://github.com/eea/volto-searchlib/compare/0.6.2...0.6.3) - 23 August 2023
Expand Down Expand Up @@ -147,7 +154,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### :house: Internal changes

- chore: [JENKINS] Deprecate circularity website [valentinab25 - [`2953502`](https://github.com/eea/volto-searchlib/commit/2953502af020d9f7867f59a1160efadb3812fe29)]

#### :hammer_and_wrench: Others

Expand Down Expand Up @@ -238,7 +244,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- Fix reading time facet [kreafox - [`c6353ce`](https://github.com/eea/volto-searchlib/commit/c6353cefc8ac3d1fdfb0865f43c7529c767599b5)]
- customize archived-item label for datahub [Zoltan Szabo - [`844576e`](https://github.com/eea/volto-searchlib/commit/844576e5660f0afb78541d536c93099995ace540)]
- Fix full view [Tiberiu Ichim - [`a74c51a`](https://github.com/eea/volto-searchlib/commit/a74c51a649d5aa89190af8c1f5531b3fdf050d43)]
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`f9f4c91`](https://github.com/eea/volto-searchlib/commit/f9f4c9183662cebfc3999e205134b48ccd51cce2)]
### [0.4.27](https://github.com/eea/volto-searchlib/compare/0.4.26...0.4.27) - 1 March 2023

#### :hammer_and_wrench: Others
Expand Down Expand Up @@ -475,7 +480,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

- Prettier [kreafox - [`fe76714`](https://github.com/eea/volto-searchlib/commit/fe76714b187a97010003b9b3203ad4d20c5b794c)]
- Prettier [kreafox - [`b639666`](https://github.com/eea/volto-searchlib/commit/b639666c564298b8a8469588e2e39572dba2bced)]
- Use volto version before yarn 3 [kreafox - [`b6e1e72`](https://github.com/eea/volto-searchlib/commit/b6e1e72a2e2cd8cc5597c1be5c7fd00a404b622f)]
- Make search input placeholder configurable [kreafox - [`18f3f53`](https://github.com/eea/volto-searchlib/commit/18f3f533af4c3f3d95264d8c54a9945d6b869055)]
- Remove dependency [kreafox - [`8f2b0d0`](https://github.com/eea/volto-searchlib/commit/8f2b0d03829f4cd9f2717f1308357c197b60fc53)]
- Fix project eslintrc [kreafox - [`76e3a6e`](https://github.com/eea/volto-searchlib/commit/76e3a6e4000f9aa3db208d057227c0ceea7ad38d)]
Expand All @@ -485,7 +489,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- Fix project eslintrc [kreafox - [`c182a4c`](https://github.com/eea/volto-searchlib/commit/c182a4c89752ca1f767d25e926ec07d7bb036530)]
- Hide more like this from cards view [kreafox - [`3e2d8f7`](https://github.com/eea/volto-searchlib/commit/3e2d8f73776cb49bf9d0a51271ca15a0cac803e6)]
- Cleanup CSS [kreafox - [`42cfa19`](https://github.com/eea/volto-searchlib/commit/42cfa193769c33d1a84a66fd97a18409b221b674)]
- Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`2c105dc`](https://github.com/eea/volto-searchlib/commit/2c105dc7b8ca3767e218e72ddd52ae5df8bb20c7)]
### [0.4.1](https://github.com/eea/volto-searchlib/compare/0.4.0...0.4.1) - 10 November 2022

#### :hammer_and_wrench: Others
Expand Down Expand Up @@ -515,13 +518,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- Add missing less variable [kreafox - [`3329f84`](https://github.com/eea/volto-searchlib/commit/3329f84f2478a194702ba1a6c6934afe2cf598b2)]
- Style update [kreafox - [`8f24f0f`](https://github.com/eea/volto-searchlib/commit/8f24f0f597c9414ed346abe99e5257c1967e1c3a)]
- Change search box color on datahub [kreafox - [`8851e42`](https://github.com/eea/volto-searchlib/commit/8851e4239b4d3e8405c2cb270c2b86ec5e651c8f)]
- Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`a42552c`](https://github.com/eea/volto-searchlib/commit/a42552cfb253523ae8962041497b328694bb4465)]
- Fix landing page cards override [kreafox - [`9504e20`](https://github.com/eea/volto-searchlib/commit/9504e2073cc3501466be2b0c5c67d9f1b6526d99)]
### [0.3.16](https://github.com/eea/volto-searchlib/compare/0.3.15...0.3.16) - 27 September 2022

#### :hammer_and_wrench: Others

- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`c6f41f2`](https://github.com/eea/volto-searchlib/commit/c6f41f2aac8ebb42ffc4cbed636c91371a8ab177)]
### [0.3.15](https://github.com/eea/volto-searchlib/compare/0.3.14...0.3.15) - 21 September 2022

#### :hammer_and_wrench: Others
Expand Down Expand Up @@ -627,7 +628,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- App info CSS & hide footer elements [kreafox - [`fe9172e`](https://github.com/eea/volto-searchlib/commit/fe9172ee2e4f5feadc4e97686ae16d598017e60e)]
- AnswersBox styling & cleanup [kreafox - [`7092994`](https://github.com/eea/volto-searchlib/commit/709299447a6a2aa14d3f93857651898853bd3503)]
- AnswersBox styling [kreafox - [`dfda196`](https://github.com/eea/volto-searchlib/commit/dfda1962d5b4856ed9d41294eabfa636d887ab72)]
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`8e8a206`](https://github.com/eea/volto-searchlib/commit/8e8a206746877118b9f2336b11dfdfadd9d1e408)]
### [0.3.4](https://github.com/eea/volto-searchlib/compare/0.3.3...0.3.4) - 13 June 2022

#### :hammer_and_wrench: Others
Expand Down Expand Up @@ -1164,7 +1164,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- Refs #140559 - Styles for search header. [GhitaB - [`4ec2040`](https://github.com/eea/volto-searchlib/commit/4ec204052740b441992f679ff895864f2a4df0e2)]
- Refs #140559 - Improve facet filters boxes. [GhitaB - [`16aa4ea`](https://github.com/eea/volto-searchlib/commit/16aa4ea83a24ba461e6de4c291a869c532508690)]
- Refs #140559 - Show the selected filters values to the facet label box. [GhitaB - [`f66ebd2`](https://github.com/eea/volto-searchlib/commit/f66ebd20a7b6e5b2ef21a99e175020a3a9e7b2ca)]
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`528b9d6`](https://github.com/eea/volto-searchlib/commit/528b9d647bd4cdab527dfd93b9f85512b1d48c23)]
- Refs #140559 - Styles for source. [GhitaB - [`63f7d70`](https://github.com/eea/volto-searchlib/commit/63f7d70f60a88c77fbfce737a659accd87f86c60)]
- Refs #140559 - White filters bar. [GhitaB - [`90a96f6`](https://github.com/eea/volto-searchlib/commit/90a96f64edf9c2b90859f3a2044cba813964ffa8)]
- Refs #140559 - White filters bar. [GhitaB - [`ad4fd48`](https://github.com/eea/volto-searchlib/commit/ad4fd48c4a24345a7e658699917258117d6c6fb6)]
Expand Down
11 changes: 9 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pipeline {
environment {
GIT_NAME = "volto-searchlib"
NAMESPACE = "@eeacms"
SONARQUBE_TAGS = "volto.eea.europa.eu,clms.land.copernicus.eu,demo-www.eea.europa.eu,prod-www.eea.europa.eu,water.europa.eu-marine,www.eea.europa.eu-en,climate-adapt.eea.europa.eu"
SONARQUBE_TAGS = "volto.eea.europa.eu,clms.land.copernicus.eu,demo-www.eea.europa.eu,prod-www.eea.europa.eu,water.europa.eu-marine,www.eea.europa.eu-en,climate-adapt.eea.europa.eu,water.europa.eu-freshwater"
DEPENDENCIES = ""
BACKEND_PROFILES = "eea.kitkat:testing"
BACKEND_ADDONS = ""
Expand Down Expand Up @@ -162,10 +162,16 @@ pipeline {
script {
try {
sh '''docker run --pull always --rm -d --name="$IMAGE_NAME-plone" -e SITE="Plone" -e PROFILES="$BACKEND_PROFILES" -e ADDONS="$BACKEND_ADDONS" eeacms/plone-backend'''
sh '''docker run -d --shm-size=3g --link $IMAGE_NAME-plone:plone --name="$IMAGE_NAME-cypress" -e "RAZZLE_INTERNAL_API_PATH=http://plone:8080/Plone" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend start-ci'''
sh '''docker run -d --shm-size=4g --link $IMAGE_NAME-plone:plone --name="$IMAGE_NAME-cypress" -e "RAZZLE_INTERNAL_API_PATH=http://plone:8080/Plone" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend start-ci'''
frontend = sh script:'''docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress make check-ci''', returnStatus: true
if ( frontend != 0 ) {
sh '''docker logs $IMAGE_NAME-cypress; exit 1'''
}

sh '''timeout -s 9 1800 docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress make cypress-ci'''
} finally {
try {
if ( frontend == 0 ) {
sh '''rm -rf cypress-videos cypress-results cypress-coverage cypress-screenshots'''
sh '''mkdir -p cypress-videos cypress-results cypress-coverage cypress-screenshots'''
videos = sh script: '''docker cp $IMAGE_NAME-cypress:/app/src/addons/$GIT_NAME/cypress/videos cypress-videos/''', returnStatus: true
Expand All @@ -189,6 +195,7 @@ pipeline {
sh '''for file in $(find cypress-results -name *.xml); do if [ $(grep -E 'failures="[1-9].*"' $file | wc -l) -eq 0 ]; then testname=$(grep -E 'file=.*failures="0"' $file | sed 's#.* file=".*\\/\\(.*\\.[jsxt]\\+\\)" time.*#\\1#' ); rm -f cypress-videos/videos/$testname.mp4; fi; done'''
archiveArtifacts artifacts: 'cypress-videos/**/*.mp4', fingerprint: true, allowEmptyArchive: true
}
}
} finally {
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true
Expand Down
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ cypress-open: ## Open cypress integration tests

.PHONY: cypress-run
cypress-run: ## Run cypress integration tests
CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run --browser chromium
CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run

.PHONY: test
test: ## Run jest tests
Expand Down Expand Up @@ -155,8 +155,11 @@ start-ci:
cd ../..
yarn start

.PHONY: check-ci
check-ci:
$(NODE_MODULES)/.bin/wait-on -t 240000 http://localhost:3000

.PHONY: cypress-ci
cypress-ci:
$(NODE_MODULES)/.bin/wait-on -t 240000 http://localhost:3000
NODE_ENV=development make cypress-run

CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run --browser chromium

0 comments on commit 9bbb2ac

Please sign in to comment.