@eeacms/volto-eea-versions 2.0.2 → 3.0.0
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 +6 -14
- package/README.md +27 -100
- package/babel.config.js +1 -17
- package/package.json +34 -18
- package/tsconfig.json +43 -0
- package/vitest.config.mjs +279 -0
- package/{jest.setup.js → vitest.setup.jsx} +20 -11
- package/.coverage.babel.config.js +0 -9
- package/.eslintrc.js +0 -65
- package/.github/workflows/betterleaks.yml +0 -133
- package/.gitleaks.toml +0 -89
- package/.husky/pre-commit +0 -2
- package/DEVELOP.md +0 -108
- package/RELEASE.md +0 -74
- package/bootstrap +0 -41
- package/cypress.config.js +0 -27
- package/docker-compose.yml +0 -32
- package/jest-addon.config.js +0 -58
|
@@ -1,19 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { vi } from 'vitest';
|
|
2
2
|
import configureStore from 'redux-mock-store';
|
|
3
3
|
import thunk from 'redux-thunk';
|
|
4
4
|
import { blocksConfig } from '@plone/volto/config/Blocks';
|
|
5
5
|
import installSlate from '@plone/volto-slate/index';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
global.jest = vi;
|
|
8
|
+
|
|
9
|
+
global.jest = {
|
|
10
|
+
...global.jest,
|
|
11
|
+
advanceTimersByTime: vi.advanceTimersByTime.bind(vi),
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
var mockSemanticComponents = await vi.importActual('semantic-ui-react');
|
|
15
|
+
var mockComponents = await vi.importActual('@plone/volto/components');
|
|
16
|
+
var mockRegistry = await vi.importActual('@plone/volto/registry');
|
|
17
|
+
var config = mockRegistry.default;
|
|
10
18
|
|
|
11
19
|
config.blocks.blocksConfig = {
|
|
12
20
|
...blocksConfig,
|
|
13
21
|
...config.blocks.blocksConfig,
|
|
14
22
|
};
|
|
15
23
|
|
|
16
|
-
|
|
24
|
+
vi.doMock('semantic-ui-react', () => ({
|
|
17
25
|
__esModule: true,
|
|
18
26
|
...mockSemanticComponents,
|
|
19
27
|
Popup: ({ content, trigger }) => {
|
|
@@ -26,7 +34,7 @@ jest.doMock('semantic-ui-react', () => ({
|
|
|
26
34
|
},
|
|
27
35
|
}));
|
|
28
36
|
|
|
29
|
-
|
|
37
|
+
vi.doMock('@plone/volto/components', () => {
|
|
30
38
|
return {
|
|
31
39
|
__esModule: true,
|
|
32
40
|
...mockComponents,
|
|
@@ -34,13 +42,14 @@ jest.doMock('@plone/volto/components', () => {
|
|
|
34
42
|
};
|
|
35
43
|
});
|
|
36
44
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
)
|
|
45
|
+
vi.doMock('@plone/volto/registry', () => ({
|
|
46
|
+
...mockRegistry,
|
|
47
|
+
default: [installSlate].reduce((acc, apply) => apply(acc), config),
|
|
48
|
+
}));
|
|
40
49
|
|
|
41
50
|
const mockStore = configureStore([thunk]);
|
|
42
51
|
|
|
43
|
-
global.fetch =
|
|
52
|
+
global.fetch = vi.fn(() =>
|
|
44
53
|
Promise.resolve({
|
|
45
54
|
json: () => Promise.resolve({}),
|
|
46
55
|
}),
|
|
@@ -50,7 +59,7 @@ global.store = mockStore({
|
|
|
50
59
|
intl: {
|
|
51
60
|
locale: 'en',
|
|
52
61
|
messages: {},
|
|
53
|
-
formatMessage:
|
|
62
|
+
formatMessage: vi.fn(),
|
|
54
63
|
},
|
|
55
64
|
content: {
|
|
56
65
|
create: {},
|
package/.eslintrc.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const projectRootPath = fs.realpathSync(__dirname + '/../../../');
|
|
4
|
-
|
|
5
|
-
let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto');
|
|
6
|
-
let configFile;
|
|
7
|
-
if (fs.existsSync(`${projectRootPath}/tsconfig.json`))
|
|
8
|
-
configFile = `${projectRootPath}/tsconfig.json`;
|
|
9
|
-
else if (fs.existsSync(`${projectRootPath}/jsconfig.json`))
|
|
10
|
-
configFile = `${projectRootPath}/jsconfig.json`;
|
|
11
|
-
|
|
12
|
-
if (configFile) {
|
|
13
|
-
const jsConfig = require(configFile).compilerOptions;
|
|
14
|
-
const pathsConfig = jsConfig.paths;
|
|
15
|
-
if (pathsConfig['@plone/volto'])
|
|
16
|
-
voltoPath = `./${jsConfig.baseUrl}/${pathsConfig['@plone/volto'][0]}`;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const { AddonRegistry } = require('@plone/registry/addon-registry');
|
|
20
|
-
const { registry } = AddonRegistry.init(projectRootPath);
|
|
21
|
-
|
|
22
|
-
// Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
|
|
23
|
-
const addonAliases = Object.keys(registry.packages).map((o) => [
|
|
24
|
-
o,
|
|
25
|
-
registry.packages[o].modulePath,
|
|
26
|
-
]);
|
|
27
|
-
|
|
28
|
-
const addonExtenders = registry.getEslintExtenders().map((m) => require(m));
|
|
29
|
-
|
|
30
|
-
const defaultConfig = {
|
|
31
|
-
extends: `${voltoPath}/.eslintrc`,
|
|
32
|
-
settings: {
|
|
33
|
-
'import/resolver': {
|
|
34
|
-
alias: {
|
|
35
|
-
map: [
|
|
36
|
-
['@plone/volto', '@plone/volto/src'],
|
|
37
|
-
['@plone/volto-slate', '@plone/volto-slate/src'],
|
|
38
|
-
...addonAliases,
|
|
39
|
-
['@package', `${__dirname}/src`],
|
|
40
|
-
['@root', `${__dirname}/src`],
|
|
41
|
-
['~', `${__dirname}/src`],
|
|
42
|
-
],
|
|
43
|
-
extensions: ['.js', '.jsx', '.json'],
|
|
44
|
-
},
|
|
45
|
-
'babel-plugin-root-import': {
|
|
46
|
-
rootPathSuffix: 'src',
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
rules: {
|
|
51
|
-
'react/jsx-no-target-blank': [
|
|
52
|
-
'error',
|
|
53
|
-
{
|
|
54
|
-
allowReferrer: true,
|
|
55
|
-
},
|
|
56
|
-
],
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const config = addonExtenders.reduce(
|
|
61
|
-
(acc, extender) => extender.modify(acc),
|
|
62
|
-
defaultConfig,
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
module.exports = config;
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
name: Betterleaks
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
pull_request:
|
|
6
|
-
|
|
7
|
-
permissions:
|
|
8
|
-
contents: read
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
scan:
|
|
12
|
-
name: Scan for secrets
|
|
13
|
-
runs-on: ubuntu-latest
|
|
14
|
-
env:
|
|
15
|
-
SMTP_URL: ${{ secrets.SMTP_URL }}
|
|
16
|
-
SMTP_PORT: ${{ secrets.SMTP_PORT || '25' }}
|
|
17
|
-
SMTP_EMAIL: ${{ secrets.SMTP_EMAIL }}
|
|
18
|
-
SMTP_PASSWORD: ${{ secrets.SMTP_PASSWORD }}
|
|
19
|
-
steps:
|
|
20
|
-
- name: Checkout repository
|
|
21
|
-
uses: actions/checkout@v4
|
|
22
|
-
with:
|
|
23
|
-
fetch-depth: 1
|
|
24
|
-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
25
|
-
|
|
26
|
-
- name: Run Betterleaks
|
|
27
|
-
id: betterleaks
|
|
28
|
-
continue-on-error: true
|
|
29
|
-
uses: dortort/betterleaks-action@v0.1.0
|
|
30
|
-
with:
|
|
31
|
-
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
32
|
-
scan-mode: dir
|
|
33
|
-
scan-path: .
|
|
34
|
-
config: .gitleaks.toml
|
|
35
|
-
report-format: json
|
|
36
|
-
report-path: betterleaks-report.json
|
|
37
|
-
redact: "true"
|
|
38
|
-
no-color: "true"
|
|
39
|
-
no-banner: "true"
|
|
40
|
-
fail-on-leak: "true"
|
|
41
|
-
|
|
42
|
-
- name: Upload Betterleaks report
|
|
43
|
-
if: always()
|
|
44
|
-
uses: actions/upload-artifact@v4
|
|
45
|
-
with:
|
|
46
|
-
name: betterleaks-report
|
|
47
|
-
path: betterleaks-report.json
|
|
48
|
-
if-no-files-found: ignore
|
|
49
|
-
|
|
50
|
-
- name: Build Betterleaks email summary
|
|
51
|
-
id: leak_summary
|
|
52
|
-
if: steps.betterleaks.outcome == 'failure'
|
|
53
|
-
shell: bash
|
|
54
|
-
run: |
|
|
55
|
-
if [[ -s betterleaks-report.json ]]; then
|
|
56
|
-
jq -r '
|
|
57
|
-
def one_line:
|
|
58
|
-
tostring
|
|
59
|
-
| gsub("[\r\n]+"; " ")
|
|
60
|
-
| if length > 240 then .[0:240] + "..." else . end;
|
|
61
|
-
|
|
62
|
-
.[:20][]
|
|
63
|
-
| "- " + (.RuleID // "unknown-rule")
|
|
64
|
-
+ " at " + (.File // "unknown-file")
|
|
65
|
-
+ ":" + ((.StartLine // 0) | tostring)
|
|
66
|
-
+ "\n match: " + ((.Match // .Secret // "REDACTED") | one_line)
|
|
67
|
-
' betterleaks-report.json > betterleaks-email-summary.txt
|
|
68
|
-
|
|
69
|
-
count="$(jq 'length' betterleaks-report.json)"
|
|
70
|
-
if (( count > 20 )); then
|
|
71
|
-
{
|
|
72
|
-
echo ""
|
|
73
|
-
echo "... and $((count - 20)) more finding(s). Download the artifact for full details."
|
|
74
|
-
} >> betterleaks-email-summary.txt
|
|
75
|
-
fi
|
|
76
|
-
else
|
|
77
|
-
echo "No JSON report was generated. Download the workflow logs for details." > betterleaks-email-summary.txt
|
|
78
|
-
fi
|
|
79
|
-
|
|
80
|
-
{
|
|
81
|
-
echo "text<<BETTERLEAKS_SUMMARY"
|
|
82
|
-
cat betterleaks-email-summary.txt
|
|
83
|
-
echo "BETTERLEAKS_SUMMARY"
|
|
84
|
-
} >> "$GITHUB_OUTPUT"
|
|
85
|
-
|
|
86
|
-
- name: Resolve committer email
|
|
87
|
-
id: committer
|
|
88
|
-
if: steps.betterleaks.outcome == 'failure'
|
|
89
|
-
shell: bash
|
|
90
|
-
run: |
|
|
91
|
-
committer_email="$(git log -1 --format='%ce')"
|
|
92
|
-
author_email="$(git log -1 --format='%ae')"
|
|
93
|
-
email="$committer_email"
|
|
94
|
-
if [[ -z "$email" || "$email" == *"noreply.github.com"* ]]; then
|
|
95
|
-
email="$author_email"
|
|
96
|
-
fi
|
|
97
|
-
if [[ "$email" =~ ^[^[:space:]@]+@[^[:space:]@]+\.[^[:space:]@]+$ && "$email" != *"noreply.github.com"* ]]; then
|
|
98
|
-
echo "email=$email" >> "$GITHUB_OUTPUT"
|
|
99
|
-
else
|
|
100
|
-
echo "No deliverable committer email found; skipping Betterleaks email notification."
|
|
101
|
-
echo "email=" >> "$GITHUB_OUTPUT"
|
|
102
|
-
fi
|
|
103
|
-
|
|
104
|
-
- name: Email committer on Betterleaks failure
|
|
105
|
-
if: steps.betterleaks.outcome == 'failure' && steps.committer.outputs.email != '' && env.SMTP_URL != '' && env.SMTP_EMAIL != ''
|
|
106
|
-
uses: dawidd6/action-send-mail@v18
|
|
107
|
-
with:
|
|
108
|
-
server_address: ${{ env.SMTP_URL }}
|
|
109
|
-
server_port: ${{ env.SMTP_PORT }}
|
|
110
|
-
secure: ${{ env.SMTP_PORT == '465' }}
|
|
111
|
-
username: ${{ env.SMTP_EMAIL }}
|
|
112
|
-
password: ${{ env.SMTP_PASSWORD }}
|
|
113
|
-
from: ${{ env.SMTP_EMAIL }}
|
|
114
|
-
to: ${{ steps.committer.outputs.email }}
|
|
115
|
-
subject: "[Betterleaks] Secret scan failed in ${{ github.repository }}"
|
|
116
|
-
body: |
|
|
117
|
-
Betterleaks detected one or more potential secrets.
|
|
118
|
-
|
|
119
|
-
Repository: ${{ github.repository }}
|
|
120
|
-
Branch: ${{ github.ref_name }}
|
|
121
|
-
Commit: ${{ github.sha }}
|
|
122
|
-
Workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
|
123
|
-
|
|
124
|
-
Findings:
|
|
125
|
-
${{ steps.leak_summary.outputs.text }}
|
|
126
|
-
|
|
127
|
-
Download the betterleaks-report artifact from the workflow run for details.
|
|
128
|
-
|
|
129
|
-
- name: Fail if Betterleaks found leaks
|
|
130
|
-
if: steps.betterleaks.outcome == 'failure'
|
|
131
|
-
run: |
|
|
132
|
-
echo "Betterleaks detected one or more secrets. Download the betterleaks-report artifact from this workflow run for details."
|
|
133
|
-
exit 1
|
package/.gitleaks.toml
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
title = "Betterleaks config"
|
|
2
|
-
|
|
3
|
-
[extend]
|
|
4
|
-
useDefault = true
|
|
5
|
-
|
|
6
|
-
[[rules]]
|
|
7
|
-
id = "secret-literal-assignment"
|
|
8
|
-
description = "Secret-like literal assignment in source, YAML, env and config files"
|
|
9
|
-
regex = '''(?i)([A-Za-z0-9_.-]*(?:password|passwd|pwd|api[_-]?key|apikey|access[_-]?key|secret[_-]?access[_-]?key|private[_-]?key|client[_-]?secret|consumer[_-]?key|consumer[_-]?secret|(?:auth|access|refresh|session|api|bearer|id|jwt|csrf|xsrf|oauth)[_-]?token|translate[_-]?auth|translation[_-]?auth|auth[_-]?password|auth[_-]?key|auth[_-]?credentials|database[_-]?url|connection[_-]?string)[A-Za-z0-9_.-]*)[ \t]*[:=][ \t]*["'']?([^"''[:space:]#{}$.][^"''\n#{}]{2,})["'']?'''
|
|
10
|
-
secretGroup = 2
|
|
11
|
-
keywords = [
|
|
12
|
-
"password",
|
|
13
|
-
"passwd",
|
|
14
|
-
"pwd",
|
|
15
|
-
"api_key",
|
|
16
|
-
"apikey",
|
|
17
|
-
"access_key",
|
|
18
|
-
"private_key",
|
|
19
|
-
"client_secret",
|
|
20
|
-
"consumer_key",
|
|
21
|
-
"consumer_secret",
|
|
22
|
-
"auth_token",
|
|
23
|
-
"access_token",
|
|
24
|
-
"refresh_token",
|
|
25
|
-
"session_token",
|
|
26
|
-
"api_token",
|
|
27
|
-
"bearer_token",
|
|
28
|
-
"id_token",
|
|
29
|
-
"jwt_token",
|
|
30
|
-
"csrf_token",
|
|
31
|
-
"xsrf_token",
|
|
32
|
-
"oauth_token",
|
|
33
|
-
"translate_auth",
|
|
34
|
-
"translation_auth",
|
|
35
|
-
"auth_password",
|
|
36
|
-
"auth_key",
|
|
37
|
-
"auth_credentials",
|
|
38
|
-
"database_url",
|
|
39
|
-
"connection_string"
|
|
40
|
-
]
|
|
41
|
-
tags = ["literal-secret"]
|
|
42
|
-
|
|
43
|
-
[[rules]]
|
|
44
|
-
id = "env-short-secret-assignment"
|
|
45
|
-
description = "Uppercase env-style PASS/TOKEN/SECRET assignment"
|
|
46
|
-
regex = '''\b((?:PASS|TOKEN|SECRET|[A-Z0-9_]*(?:_PASS|_TOKEN|_SECRET|PASS_|TOKEN_|SECRET_)[A-Z0-9_]*))[ \t]*[:=][ \t]*["'']?([^"''[:space:]#{}$.][^"''\n#{}]{2,})["'']?'''
|
|
47
|
-
secretGroup = 2
|
|
48
|
-
keywords = [
|
|
49
|
-
"PASS",
|
|
50
|
-
"TOKEN",
|
|
51
|
-
"SECRET"
|
|
52
|
-
]
|
|
53
|
-
tags = ["env", "literal-secret"]
|
|
54
|
-
|
|
55
|
-
[[rules]]
|
|
56
|
-
id = "standalone-sk-token"
|
|
57
|
-
description = "Standalone sk-* token not attached to a secret-like variable name"
|
|
58
|
-
regex = '''(?i)\b(sk-[A-Za-z0-9][A-Za-z0-9_-]{20,})\b'''
|
|
59
|
-
secretGroup = 1
|
|
60
|
-
entropy = 2.5
|
|
61
|
-
keywords = ["sk-"]
|
|
62
|
-
tags = ["standalone-token", "generic"]
|
|
63
|
-
|
|
64
|
-
[[rules]]
|
|
65
|
-
id = "dotenv-only-jest-setup"
|
|
66
|
-
description = ".env may only contain the committed Jest setup lines"
|
|
67
|
-
path = '''(?i)(^|/)\.env$'''
|
|
68
|
-
regex = '''(?m)^(.+)$'''
|
|
69
|
-
secretGroup = 1
|
|
70
|
-
tags = ["file", "dotenv"]
|
|
71
|
-
[[rules.allowlists]]
|
|
72
|
-
regexTarget = "match"
|
|
73
|
-
regexes = [
|
|
74
|
-
'''^JEST_USE_SETUP=OFF # Jest configuration variables: ON, OFF\r?$''',
|
|
75
|
-
]
|
|
76
|
-
|
|
77
|
-
[[rules]]
|
|
78
|
-
id = "forbidden-secret-file"
|
|
79
|
-
description = "Forbidden secret-bearing file committed to repository"
|
|
80
|
-
path = '''(?i)(^|/)(\.env\..*|\.npmrc|\.pypirc|id_rsa|id_ed25519|.*\.(pem|key|p12|pfx|jks|kubeconfig))$'''
|
|
81
|
-
regex = '''(?s).{1,}'''
|
|
82
|
-
tags = ["file", "secret-file"]
|
|
83
|
-
|
|
84
|
-
[[allowlists]]
|
|
85
|
-
description = "Allow Jenkins SonarQube token environment variable reference"
|
|
86
|
-
regexTarget = "match"
|
|
87
|
-
regexes = [
|
|
88
|
-
'''SONAR_AUTH_TOKEN''',
|
|
89
|
-
]
|
package/.husky/pre-commit
DELETED
package/DEVELOP.md
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
# volto-eea-versions
|
|
2
|
-
|
|
3
|
-
## Develop
|
|
4
|
-
|
|
5
|
-
1. Make sure you have `docker` and `docker compose` installed and running on your machine:
|
|
6
|
-
|
|
7
|
-
```Bash
|
|
8
|
-
git clone https://github.com/eea/volto-eea-versions.git
|
|
9
|
-
cd volto-eea-versions
|
|
10
|
-
git checkout -b bugfix-123456 develop
|
|
11
|
-
make
|
|
12
|
-
make start
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
1. Wait for `Volto started at 0.0.0.0:3000` meesage
|
|
16
|
-
|
|
17
|
-
1. Go to http://localhost:3000
|
|
18
|
-
|
|
19
|
-
1. Initialize git hooks
|
|
20
|
-
|
|
21
|
-
```Bash
|
|
22
|
-
yarn prepare
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
1. Happy hacking!
|
|
26
|
-
|
|
27
|
-
### Or add @eeacms/volto-eea-versions to your Volto project
|
|
28
|
-
|
|
29
|
-
Before starting make sure your development environment is properly set. See the official Plone documentation for [creating a project with Cookieplone](https://6.docs.plone.org/install/create-project-cookieplone.html) and [installing an add-on in development mode in Volto 18 and 19](https://6.docs.plone.org/volto/development/add-ons/install-an-add-on-dev-18.html).
|
|
30
|
-
|
|
31
|
-
For new Volto 18+ projects, use Cookieplone. It includes `mrs-developer` by default.
|
|
32
|
-
|
|
33
|
-
1. Create a new Volto project with Cookieplone
|
|
34
|
-
|
|
35
|
-
uvx cookieplone project
|
|
36
|
-
cd project-title
|
|
37
|
-
|
|
38
|
-
1. Add the following to `mrs.developer.json`:
|
|
39
|
-
|
|
40
|
-
{
|
|
41
|
-
"volto-eea-versions": {
|
|
42
|
-
"output": "packages",
|
|
43
|
-
"url": "https://github.com/eea/volto-eea-versions.git",
|
|
44
|
-
"package": "@eeacms/volto-eea-versions",
|
|
45
|
-
"branch": "develop",
|
|
46
|
-
"path": "src"
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
1. Add `@eeacms/volto-eea-versions` to the `addons` key in your project `volto.config.js`
|
|
51
|
-
|
|
52
|
-
1. Install or refresh the project setup
|
|
53
|
-
|
|
54
|
-
make install
|
|
55
|
-
|
|
56
|
-
1. Start backend in one terminal
|
|
57
|
-
|
|
58
|
-
make backend-start
|
|
59
|
-
|
|
60
|
-
...wait for backend to setup and start, ending with `Ready to handle requests`
|
|
61
|
-
|
|
62
|
-
...you can also check http://localhost:8080/Plone
|
|
63
|
-
|
|
64
|
-
1. Start frontend in a second terminal
|
|
65
|
-
|
|
66
|
-
make frontend-start
|
|
67
|
-
|
|
68
|
-
1. Go to http://localhost:3000
|
|
69
|
-
|
|
70
|
-
1. Happy hacking!
|
|
71
|
-
|
|
72
|
-
cd packages/volto-eea-versions
|
|
73
|
-
|
|
74
|
-
For legacy Volto 17 projects, keep using the yarn-based workflow from the Volto 17 documentation.
|
|
75
|
-
|
|
76
|
-
## Cypress
|
|
77
|
-
|
|
78
|
-
To run cypress locally, first make sure you don't have any Volto/Plone running on ports `8080` and `3000`.
|
|
79
|
-
|
|
80
|
-
You don't have to be in a `clean-volto-project`, you can be in any Volto Frontend
|
|
81
|
-
project where you added `volto-eea-versions` to `mrs.developer.json`
|
|
82
|
-
|
|
83
|
-
Go to:
|
|
84
|
-
|
|
85
|
-
```BASH
|
|
86
|
-
cd packages/volto-eea-versions/
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
Start:
|
|
90
|
-
|
|
91
|
-
```Bash
|
|
92
|
-
make
|
|
93
|
-
make start
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
This will build and start with Docker a clean `Plone backend` and `Volto Frontend` with `volto-eea-versions` block installed.
|
|
97
|
-
|
|
98
|
-
Open Cypress Interface:
|
|
99
|
-
|
|
100
|
-
```Bash
|
|
101
|
-
make cypress-open
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
Or run it:
|
|
105
|
-
|
|
106
|
-
```Bash
|
|
107
|
-
make cypress-run
|
|
108
|
-
```
|
package/RELEASE.md
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
## Release
|
|
2
|
-
|
|
3
|
-
### Automatic release using Jenkins
|
|
4
|
-
|
|
5
|
-
* 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.
|
|
6
|
-
* It runs on every commit on `master` branch, which is protected from direct commits, only allowing pull request merge commits.
|
|
7
|
-
* 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.
|
|
8
|
-
* 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.
|
|
9
|
-
* 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.
|
|
10
|
-
* The version format must be MAJOR.MINOR.PATCH. By default, next release is set to next minor version (with patch 0).
|
|
11
|
-
* 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.
|
|
12
|
-
* Automated commits and commits with [JENKINS] or [YARN] in the commit log are excluded from `CHANGELOG.md` file.
|
|
13
|
-
|
|
14
|
-
### Manual release from the develop branch ( beta release )
|
|
15
|
-
|
|
16
|
-
#### Installation and configuration of release-it
|
|
17
|
-
|
|
18
|
-
You need to first install the [release-it](https://github.com/release-it/release-it) client.
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
npm install -g release-it
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
Release-it uses the configuration written in the [`.release-it.json`](./.release-it.json) file located in the root of the repository.
|
|
25
|
-
|
|
26
|
-
Release-it is a tool that automates 4 important steps in the release process:
|
|
27
|
-
|
|
28
|
-
1. Version increase in `package.json` ( increased from the current version in `package.json`)
|
|
29
|
-
2. `CHANGELOG.md` automatic generation from commit messages ( grouped by releases )
|
|
30
|
-
3. GitHub release on the commit with the changelog and package.json modification on the develop branch
|
|
31
|
-
4. NPM release ( by default it's disabled, but can be enabled in the configuration file )
|
|
32
|
-
|
|
33
|
-
To configure the authentification, you need to export GITHUB_TOKEN for [GitHub](https://github.com/settings/tokens)
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
export GITHUB_TOKEN="${GITHUB_TOKEN}"
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
To configure npm, you can use the `npm login` command or use a configuration file with a TOKEN :
|
|
40
|
-
|
|
41
|
-
```
|
|
42
|
-
echo "//registry.npmjs.org/:_authToken=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY" > .npmrc
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
#### Using release-it tool
|
|
46
|
-
|
|
47
|
-
There are 3 yarn scripts that can be run to do the release
|
|
48
|
-
|
|
49
|
-
##### yarn release-beta
|
|
50
|
-
|
|
51
|
-
Automatically calculates and presents 3 beta versions - patch, minor and major for you to choose ( or Other for manual input).
|
|
52
|
-
|
|
53
|
-
```
|
|
54
|
-
? Select increment (next version):
|
|
55
|
-
❯ prepatch (0.1.1-beta.0)
|
|
56
|
-
preminor (0.2.0-beta.0)
|
|
57
|
-
premajor (1.0.0-beta.0)
|
|
58
|
-
Other, please specify...
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
##### yarn release-major-beta
|
|
62
|
-
|
|
63
|
-
Same as `yarn release-beta`, but with premajor version pre-selected.
|
|
64
|
-
|
|
65
|
-
##### yarn release
|
|
66
|
-
|
|
67
|
-
Generic command, does not automatically add the `beta` to version, but you can still manually write it if you choose Other.
|
|
68
|
-
|
|
69
|
-
#### Important notes
|
|
70
|
-
|
|
71
|
-
> 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.
|
|
72
|
-
|
|
73
|
-
> 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).
|
|
74
|
-
|
package/bootstrap
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const ejs = require('ejs');
|
|
4
|
-
|
|
5
|
-
const currentDir = path.basename(process.cwd());
|
|
6
|
-
|
|
7
|
-
const bootstrap = function (ofile) {
|
|
8
|
-
fs.readFile(ofile, 'utf8', function (err, data) {
|
|
9
|
-
if (err) {
|
|
10
|
-
return console.log(err);
|
|
11
|
-
}
|
|
12
|
-
const result = ejs.render(data, {
|
|
13
|
-
addonName: `@eeacms/${currentDir}`,
|
|
14
|
-
name: currentDir
|
|
15
|
-
});
|
|
16
|
-
const output = ofile.replace('.tpl', '');
|
|
17
|
-
fs.writeFile(output, result, 'utf8', function (err) {
|
|
18
|
-
if (err) {
|
|
19
|
-
return console.log(err);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
if (ofile.includes('.tpl')) {
|
|
23
|
-
fs.unlink(ofile, (err) => {
|
|
24
|
-
if (err) {
|
|
25
|
-
return console.error(err);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
fs.readdir(".", { withFileTypes: true }, (err, dirents) => {
|
|
33
|
-
const files = dirents
|
|
34
|
-
.filter(dirent => dirent.isFile())
|
|
35
|
-
.map(dirent => dirent.name);
|
|
36
|
-
files.forEach(function (file) {
|
|
37
|
-
if (file != 'bootstrap') {
|
|
38
|
-
bootstrap(file);
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
});
|
package/cypress.config.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const { defineConfig } = require('cypress');
|
|
2
|
-
|
|
3
|
-
module.exports = defineConfig({
|
|
4
|
-
viewportWidth: 1280,
|
|
5
|
-
defaultCommandTimeout: 8888,
|
|
6
|
-
chromeWebSecurity: false,
|
|
7
|
-
reporter: 'junit',
|
|
8
|
-
video: false,
|
|
9
|
-
retries: {
|
|
10
|
-
runMode: 2,
|
|
11
|
-
openMode: 0,
|
|
12
|
-
},
|
|
13
|
-
reporterOptions: {
|
|
14
|
-
mochaFile: 'cypress/reports/cypress-[hash].xml',
|
|
15
|
-
jenkinsMode: true,
|
|
16
|
-
toConsole: true,
|
|
17
|
-
},
|
|
18
|
-
e2e: {
|
|
19
|
-
setupNodeEvents(on, config) {
|
|
20
|
-
// e2e testing node events setup code
|
|
21
|
-
require('@cypress/code-coverage/task')(on, config);
|
|
22
|
-
require('cypress-fail-fast/plugin')(on, config);
|
|
23
|
-
return config;
|
|
24
|
-
},
|
|
25
|
-
baseUrl: 'http://localhost:3000',
|
|
26
|
-
},
|
|
27
|
-
});
|
package/docker-compose.yml
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
version: "3"
|
|
2
|
-
services:
|
|
3
|
-
backend:
|
|
4
|
-
image: eeacms/plone-backend
|
|
5
|
-
ports:
|
|
6
|
-
- "8080:8080"
|
|
7
|
-
environment:
|
|
8
|
-
SITE: "Plone"
|
|
9
|
-
PROFILES: "eea.kitkat:testing"
|
|
10
|
-
|
|
11
|
-
frontend:
|
|
12
|
-
build:
|
|
13
|
-
context: ./
|
|
14
|
-
dockerfile: ./Dockerfile
|
|
15
|
-
args:
|
|
16
|
-
ADDON_NAME: "${ADDON_NAME}"
|
|
17
|
-
ADDON_PATH: "${ADDON_PATH}"
|
|
18
|
-
VOLTO_VERSION: ${VOLTO_VERSION:-18-yarn}
|
|
19
|
-
ports:
|
|
20
|
-
- "3000:3000"
|
|
21
|
-
- "3001:3001"
|
|
22
|
-
depends_on:
|
|
23
|
-
- backend
|
|
24
|
-
volumes:
|
|
25
|
-
- ./:/app/src/addons/${ADDON_PATH}
|
|
26
|
-
environment:
|
|
27
|
-
CI: "true"
|
|
28
|
-
NODE_ENV: "development"
|
|
29
|
-
RAZZLE_JEST_CONFIG: "src/addons/${ADDON_PATH}/jest-addon.config.js"
|
|
30
|
-
RAZZLE_INTERNAL_API_PATH: "http://backend:8080/Plone"
|
|
31
|
-
RAZZLE_DEV_PROXY_API_PATH: "http://backend:8080/Plone"
|
|
32
|
-
HOST: "0.0.0.0"
|