Skip to content

Commit

Permalink
Merge pull request #29 from eea/develop
Browse files Browse the repository at this point in the history
Release 0.5.0
  • Loading branch information
avoinea authored Jan 17, 2024
2 parents 1fb792d + d771d9c commit ec8cfe2
Show file tree
Hide file tree
Showing 11 changed files with 322 additions and 184 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ 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.5.0](https://github.com/eea/volto-anchors/compare/0.4.2...0.5.0) - 17 January 2024

#### :house: Internal changes

- chore: husky, lint-staged use fixed versions [valentinab25 - [`2314055`](https://github.com/eea/volto-anchors/commit/231405579af163056c4dc0aebe5ca9f53358b5bc)]
- chore:volto 16 in tests, update docs, fix stylint overrides [valentinab25 - [`54ec80c`](https://github.com/eea/volto-anchors/commit/54ec80cf8c8314803cdf75863b13125a33461f33)]

#### :hammer_and_wrench: Others

- Release 0.5.0 [Alin Voinea - [`7ce0db5`](https://github.com/eea/volto-anchors/commit/7ce0db50c0a6a75486560f66b15ee5ef70e545e3)]
- fix tests [Miu Razvan - [`1777cba`](https://github.com/eea/volto-anchors/commit/1777cba0d12a7828c90a447f6076f5feed8db6b0)]
- fix jest [Miu Razvan - [`56d727a`](https://github.com/eea/volto-anchors/commit/56d727a2d276daa49df0733e66ab0f8b5b163620)]
- fix jest [Miu Razvan - [`8f2fd76`](https://github.com/eea/volto-anchors/commit/8f2fd76d21e59dab6136e59ae054f6ecaa8eb8c8)]
- fix jest [Miu Razvan - [`9022f63`](https://github.com/eea/volto-anchors/commit/9022f6343c3d0d2155128c189ee739fab88c8cc9)]
- test: use global tool jdk17 [valentinab25 - [`cf22622`](https://github.com/eea/volto-anchors/commit/cf226221ba3134e7ad38751ab95a0bda8433b6f0)]
- test: use tools directive in sonarqube [valentinab25 - [`87d0286`](https://github.com/eea/volto-anchors/commit/87d02864bb1f999f9f44b4bf6660aa9b728fb69b)]
- test: use java 17 for sonarqubescanner [valentinab25 - [`4fecbdc`](https://github.com/eea/volto-anchors/commit/4fecbdca6201d1fbe46f2910ddd5ce23d004a55c)]
### [0.4.2](https://github.com/eea/volto-anchors/compare/0.4.1...0.4.2) - 29 September 2023

#### :house: Internal changes
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1
ARG VOLTO_VERSION
FROM plone/frontend-builder:${VOLTO_VERSION}
FROM eeacms/frontend-builder:${VOLTO_VERSION}

ARG ADDON_NAME
ARG ADDON_PATH
Expand Down
304 changes: 168 additions & 136 deletions Jenkinsfile

Large diffs are not rendered by default.

42 changes: 38 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ VOLTO_VERSION?=16
ADDON_PATH="${DIR}"
ADDON_NAME="@eeacms/${ADDON_PATH}"
DOCKER_COMPOSE=PLONE_VERSION=${PLONE_VERSION} VOLTO_VERSION=${VOLTO_VERSION} ADDON_NAME=${ADDON_NAME} ADDON_PATH=${ADDON_PATH} docker compose
RAZZLE_INTERNAL_API_PATH?="http://localhost:8080/Plone"
RAZZLE_DEV_PROXY_API_PATH?="${RAZZLE_INTERNAL_API_PATH}"
CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}"



# Top-level targets
.PHONY: all
Expand Down Expand Up @@ -77,11 +82,11 @@ shell: ## Start a shell in the frontend container

.PHONY: cypress-open
cypress-open: ## Open cypress integration tests
NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress open
CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress open

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

.PHONY: test
test: ## Run jest tests
Expand All @@ -97,12 +102,12 @@ stylelint: ## Stylelint

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

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

.PHONY: prettier
prettier: ## Prettier
Expand All @@ -129,3 +134,32 @@ i18n: ## i18n
help: ## Show this help.
@echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)"
head -n 14 Makefile

.PHONY: ci-fix
ci-fix:
echo "Running lint-fix"
make lint-fix
echo "Running prettier-fix"
make prettier-fix
echo "Running stylelint-fix"
make stylelint-fix

.PHONY: test-ci
test-ci:
cd /app
RAZZLE_JEST_CONFIG=src/addons/${ADDON_PATH}/jest-addon.config.js CI=true yarn test src/addons/${ADDON_PATH}/src --watchAll=false --reporters=default --reporters=jest-junit --collectCoverage --coverageReporters lcov cobertura text

.PHONY: start-ci
start-ci:
cp .coverage.babel.config.js /app/babel.config.js
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
CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run --browser chromium
28 changes: 14 additions & 14 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,55 +20,55 @@ You need to first install the [release-it](https://github.com/release-it/release
```
npm install -g release-it
```

Release-it uses the configuration written in the [`.release-it.json`](./.release-it.json) file located in the root of the repository.

Release-it is a tool that automates 4 important steps in the release process:

1. Version increase in `package.json` ( increased from the current version in `package.json`)
2. `CHANGELOG.md` automatic generation from commit messages ( grouped by releases )
3. GitHub release on the commit with the changelog and package.json modification on the develop branch
4. NPM release ( by default it's disabled, but can be enabled in the configuration file )

To configure the authentification, you need to export GITHUB_TOKEN for [GitHub](https://github.com/settings/tokens)
To configure the authentification, you need to export GITHUB_TOKEN for [GitHub](https://github.com/settings/tokens)

```
export GITHUB_TOKEN=XXX-XXXXXXXXXXXXXXXXXXXXXX
```

To configure npm, you can use the `npm login` command or use a configuration file with a TOKEN :

```
echo "//registry.npmjs.org/:_authToken=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY" > .npmrc
```

#### Using release-it tool

There are 3 yarn scripts that can be run to do the release

##### yarn release-beta

Automatically calculates and presents 3 beta versions - patch, minor and major for you to choose ( or Other for manual input).
Automatically calculates and presents 3 beta versions - patch, minor and major for you to choose ( or Other for manual input).

```
? Select increment (next version):
❯ prepatch (0.1.1-beta.0)
preminor (0.2.0-beta.0)
premajor (1.0.0-beta.0)
Other, please specify...
? Select increment (next version):
❯ prepatch (0.1.1-beta.0)
preminor (0.2.0-beta.0)
premajor (1.0.0-beta.0)
Other, please specify...
```

##### yarn release-major-beta

Same as `yarn release-beta`, but with premajor version pre-selected.

##### yarn release

Generic command, does not automatically add the `beta` to version, but you can still manually write it if you choose Other.

#### Important notes

> 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.
> 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.
> 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).
6 changes: 3 additions & 3 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ const { defineConfig } = require('cypress');

module.exports = defineConfig({
viewportWidth: 1280,
defaultCommandTimeout: 5000,
defaultCommandTimeout: 8888,
chromeWebSecurity: false,
reporter: 'junit',
video: true,
video: false,
retries: {
runMode: 1,
runMode: 2,
openMode: 0,
},
reporterOptions: {
Expand Down
14 changes: 11 additions & 3 deletions jest-addon.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,21 @@ module.exports = {
'@plone/volto/cypress': '<rootDir>/node_modules/@plone/volto/cypress',
'@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
'@plone/volto/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
'@package/(.*)$': '<rootDir>/src/$1',
'@root/(.*)$': '<rootDir>/src/$1',
'@package/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
'@root/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
'@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
'@eeacms/(.*?)/(.*)$': '<rootDir>/node_modules/@eeacms/$1/src/$2',
'@plone/volto-slate':
'@plone/volto-slate$':
'<rootDir>/node_modules/@plone/volto/packages/volto-slate/src',
'@plone/volto-slate/(.*)$':
'<rootDir>/node_modules/@plone/volto/packages/volto-slate/src/$1',
'~/(.*)$': '<rootDir>/src/$1',
'load-volto-addons':
'<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
},
transformIgnorePatterns: [
'/node_modules/(?!(@plone|@root|@package|@eeacms)/).*/',
],
transform: {
'^.+\\.js(x)?$': 'babel-jest',
'^.+\\.(png)$': 'jest-file',
Expand All @@ -33,4 +38,7 @@ module.exports = {
statements: 5,
},
},
setupFilesAfterEnv: [
'<rootDir>/node_modules/@eeacms/volto-anchors/jest.setup.js',
],
};
65 changes: 65 additions & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { jest } from '@jest/globals';
import configureStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import { blocksConfig } from '@plone/volto/config/Blocks';
import installSlate from '@plone/volto-slate/index';

var mockSemanticComponents = jest.requireActual('semantic-ui-react');
var mockComponents = jest.requireActual('@plone/volto/components');
var config = jest.requireActual('@plone/volto/registry').default;

config.blocks.blocksConfig = {
...blocksConfig,
...config.blocks.blocksConfig,
};

jest.doMock('semantic-ui-react', () => ({
__esModule: true,
...mockSemanticComponents,
Popup: ({ content, trigger }) => {
return (
<div className="popup">
<div className="trigger">{trigger}</div>
<div className="content">{content}</div>
</div>
);
},
}));

jest.doMock('@plone/volto/components', () => {
return {
__esModule: true,
...mockComponents,
SidebarPortal: ({ children }) => <div id="sidebar">{children}</div>,
};
});

jest.doMock('@plone/volto/registry', () =>
[installSlate].reduce((acc, apply) => apply(acc), config),
);

const mockStore = configureStore([thunk]);

global.fetch = jest.fn(() =>
Promise.resolve({
json: () => Promise.resolve({}),
}),
);

global.store = mockStore({
intl: {
locale: 'en',
messages: {},
formatMessage: jest.fn(),
},
content: {
create: {},
subrequests: [],
},
connected_data_parameters: {},
screen: {
page: {
width: 768,
},
},
});
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-anchors",
"version": "0.4.2",
"version": "0.5.0",
"description": "@eeacms/volto-anchors: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand All @@ -24,8 +24,8 @@
"@plone/scripts": "*",
"babel-plugin-transform-class-properties": "^6.24.1",
"cypress-fail-fast": "^5.0.1",
"husky": "*",
"lint-staged": "*",
"husky": "^8.0.3",
"lint-staged": "^14.0.1",
"md5": "^2.3.0"
},
"lint-staged": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@ import config from '@plone/volto/registry';

const mockStore = configureStore();

jest.mock('@plone/volto/registry', () => ({
blocks: {
blocksConfig: {
blockType: {
tocEntry: jest.fn(),
},
},
},
}));

config.blocks.blocksConfig = {
typeA: {
tocEntry: () => [1, 'Title A'],
Expand Down
12 changes: 2 additions & 10 deletions src/helpers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ const store = mockStore({
},
});

jest.mock('@plone/volto/registry', () => ({
settings: {
slate: {
defaultValue: jest.fn(),
},
},
}));

jest.mock('@plone/volto-slate/editor/render', () => ({
serializeNodes: jest.fn(),
}));
Expand All @@ -36,8 +28,8 @@ describe('createSlateParagraph', () => {

it('should return default value when input is not an array', () => {
const input = 'test';
helpers.createSlateParagraph(input);
expect(config.settings.slate.defaultValue).toHaveBeenCalledTimes(1);
const slate = helpers.createSlateParagraph(input);
expect(slate).toEqual(config.settings.slate.defaultValue('test'));
});

it('should return input when input is an array', () => {
Expand Down

0 comments on commit ec8cfe2

Please sign in to comment.