Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Volto and Plone #21

Merged
merged 12 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ jobs:
run: pipx install hatch

- name: Generate Constraints file
run: pipx run mxdev -c mx.ini
run: |
make constraints-mxdev.txt
pipx run mxdev -c mx.ini

- uses: actions/setup-python@v5
with:
Expand All @@ -72,7 +74,9 @@ jobs:
run: pipx install hatch

- name: Generate Constraints file
run: pipx run mxdev -c mx.ini
run: |
make constraints-mxdev.txt
pipx run mxdev -c mx.ini

- uses: actions/setup-python@v5
with:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Compute several vars needed for the build
id: vars
run: |
echo 'BASE_TAG=sha-'$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT
echo "BASE_TAG=sha-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
python3 -c 'import json; data = json.load(open("./mrs.developer.json")); print("VOLTO_VERSION=" + data["core"].get("tag") or "latest")' >> $GITHUB_OUTPUT
- name: Test vars
run: |
Expand All @@ -46,7 +46,9 @@ jobs:
node-version: ${{ env.NODE_VERSION }}

- name: Enable corepack
run: corepack enable
run: |
npm i -g corepack@latest
corepack enable

- name: Get pnpm store directory
shell: bash
Expand Down
4 changes: 3 additions & 1 deletion backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
ARG PLONE_VERSION=6.0.11
ARG PLONE_VERSION=6.0.14
FROM plone/server-builder:${PLONE_VERSION} AS builder

WORKDIR /app
Expand All @@ -13,7 +13,9 @@ COPY . src
RUN <<EOT
set -e
bin/pip install mxdev uv hatch
cp /app/constraints.txt /app/src/constraints.txt
cd /app/src
echo "-c constraints.txt" > requirements.txt
../bin/hatch build
../bin/mxdev -c mx.ini
../bin/uv pip install dist/*.whl -c constraints-mxdev.txt
Expand Down
4 changes: 1 addition & 3 deletions backend/mx.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@

[settings]
main-package = .
version-overrides =
plone.base==1.4.0
plone.volto==4.4.3
; version-overrides =

; example section to use packages from git
; [example.contenttype]
Expand Down
1 change: 1 addition & 0 deletions backend/news/22.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Atualiza versão do Plone para 6.0.14 [@ericof]
7 changes: 2 additions & 5 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = [
{ name = "PloneGov-BR", email = "[email protected]" },
]
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.11"
license = "MIT"
keywords = ["Plone", "Python", "Intranet", "Brasil"]
classifiers = [
Expand All @@ -16,9 +16,6 @@ classifiers = [
"Framework :: Plone :: Distribution",
"Framework :: Plone :: 6.0",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Operating System :: OS Independent",
Expand Down Expand Up @@ -89,7 +86,7 @@ dependencies = [
"pytest-cov==5.0.0",
"pytest-plone>=0.5.0",
"pytest",
"towncrier==23.11.0",
"towncrier",
"zpretty",
]

Expand Down
2 changes: 1 addition & 1 deletion backend/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.0.13
6.0.14
30 changes: 22 additions & 8 deletions frontend/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ if (fs.existsSync(`${projectRootPath}/core`))
else if (fs.existsSync(`${projectRootPath}/../../core`))
coreLocation = `${projectRootPath}/../../core`;

const { registry } = AddonRegistry.init(
`${coreLocation}/packages/volto`,
);
const { registry } = AddonRegistry.init(`${coreLocation}/packages/volto`);

// Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
const addonAliases = Object.keys(registry.packages).map((o) => [
Expand All @@ -22,18 +20,34 @@ module.exports = {
extends: `${coreLocation}/packages/volto/.eslintrc`,
rules: {
'import/no-unresolved': 1,
'no-restricted-imports': [
'error',
{
name: '@plone/volto/components',
message:
'Importing from barrel files is not allowed. Please use direct imports of the modules instead.',
},
{
name: '@plone/volto/helpers',
message:
'Importing from barrel files is not allowed. Please use direct imports of the modules instead.',
},
{
name: '@plone/volto/actions',
message:
'Importing from barrel files is not allowed. Please use direct imports of the modules instead.',
},
],
},
settings: {
'import/resolver': {
alias: {
map: [
['@plone/volto', `${coreLocation}/packages/volto/src`],
['@plone/volto-slate', `${coreLocation}/packages/volto-slate/src`],
['@plone/registry', `${coreLocation}/packages/registry/src`],
[
'@plone/volto-slate',
`${coreLocation}/volto-slate/src`,
],
[
'portalbrasil-intranet',
'@plonegovbr/portalbrasil-intranet',
'./packages/portalbrasil-intranet/src',
],
...addonAliases,
Expand Down
1 change: 1 addition & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ core
node_modules
results
yarn.lock
/public
4 changes: 2 additions & 2 deletions frontend/.storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ module.exports = {
[],
defaultRazzleOptions,
);
const AddonConfigurationRegistry = require('@plone/registry/src/addon-registry');
const { AddonRegistry } = require('@plone/registry/addon-registry');

const registry = new AddonConfigurationRegistry(projectRootPath);
const { registry } = AddonRegistry.init(projectRootPath);

config = lessPlugin({ registry }).modifyWebpackConfig({
env: { target: 'web', dev: 'dev' },
Expand Down
21 changes: 16 additions & 5 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ FROM plone/frontend-builder:${VOLTO_VERSION} AS builder
COPY --chown=node packages/portalbrasil-intranet /app/packages/portalbrasil-intranet
COPY --chown=node volto.config.js /app/
COPY --chown=node package.json /app/package.json.temp
COPY --chown=node mrs.developer.json /app/
COPY --chown=node pnpm-workspace.yaml /app/

RUN --mount=type=cache,id=pnpm,target=/app/.pnpm-store,uid=1000 <<EOT
python3 -c "import json; data = json.load(open('package.json.temp')); deps = data['dependencies']; data['dependencies'].update(deps); json.dump(data, open('package.json', 'w'), indent=2)"
rm package.json.temp
pnpm install && pnpm build:deps
pnpm build
pnpm install --prod
set -e
python3 -c "import json; orig_data = json.load(open('package.json.temp')); orig_deps = orig_data['dependencies']; data = json.load(open('package.json')); data['dependencies'].update(orig_deps); json.dump(data, open('package.json', 'w'), indent=2)"
rm package.json.temp
pnpm dlx mrs-developer missdev --no-config --fetch-https
pnpm install && pnpm build:deps
pnpm build
pnpm install --prod
EOT

FROM plone/frontend-prod-config:${VOLTO_VERSION}
Expand All @@ -22,3 +26,10 @@ LABEL maintainer="PloneGov-BR <[email protected]>" \
org.label-schema.vendor="PloneGov-BR"

COPY --from=builder /app/ /app/

RUN <<EOT
set -e
corepack enable pnpm
corepack use [email protected]
corepack prepare [email protected] --activate
EOT
10 changes: 5 additions & 5 deletions frontend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ help: ## Show this help
install: ## Installs the add-on in a development environment
pnpm dlx mrs-developer missdev --no-config --fetch-https
pnpm i
pnpm build:deps
make build-deps

.PHONY: start
start: ## Starts Volto, allowing reloading of the add-on during development
Expand All @@ -63,7 +63,7 @@ i18n: ## Sync i18n

.PHONY: ci-i18n
ci-i18n: ## Check if i18n is not synced
pnpm --filter $(ADDON_NAME) i18n && git diff --exit-code -- packages '*.pot' '*.po'
pnpm --filter $(ADDON_NAME) i18n && git diff -G'^[^\"POT]' --exit-code

.PHONY: format
format: ## Format codebase
Expand All @@ -83,13 +83,13 @@ release: ## Release the add-on on npmjs.org

.PHONY: release-dry-run
release-dry-run: ## Dry-run the release of the add-on on npmjs.org
pnpm dry-release
pnpm release

.PHONY: test
test: ## Run unit tests
pnpm test

.PHONY: test-ci
.PHONY: ci-test
ci-test: ## Run unit tests in CI
# Unit Tests need the i18n to be built
VOLTOCONFIG=$(pwd)/volto.config.js pnpm --filter @plone/volto i18n
Expand All @@ -110,7 +110,7 @@ storybook-start: ## Start Storybook server on port 6006
storybook-build: ## Build Storybook
@echo "$(GREEN)==> Build Storybook$(RESET)"
mkdir -p $(CURRENT_DIR)/.storybook-build
pnpm run build-storybook -o $(CURRENT_DIR)/.storybook-build
pnpm run storybook-build -o $(CURRENT_DIR)/.storybook-build

## Acceptance
.PHONY: acceptance-frontend-dev-start
Expand Down
7 changes: 3 additions & 4 deletions frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

Solução de Intranet construída com Plone

[![npm](https://img.shields.io/npm/v/portalbrasil-intranet)](https://www.npmjs.com/package/portalbrasil-intranet)
[![npm](https://img.shields.io/npm/v/@plonegovbr/portalbrasil-intranet)](`https://www.npmjs.com/package/@plonegovbr/portalbrasil-intranet`)
[![](https://img.shields.io/badge/-Storybook-ff4785?logo=Storybook&logoColor=white&style=flat-square)](https://plonegovbr.github.io/portalbrasil-intranet/)
[![Code analysis checks](https://github.com/plonegovbr/portalbrasil-intranet/actions/workflows/code.yml/badge.svg)](https://github.com/plonegovbr/portalbrasil-intranet/actions/workflows/code.yml)
[![Unit tests](https://github.com/plonegovbr/portalbrasil-intranet/actions/workflows/unit.yml/badge.svg)](https://github.com/plonegovbr/portalbrasil-intranet/actions/workflows/unit.yml)
[![Unit tests](https://github.com/plonegovbr/portalbrasil-intranet/actions/workflows/frontend.yml/badge.svg)](https://github.com/plonegovbr/portalbrasil-intranet/actions/workflows/frontend.yml)

## Features

Expand Down Expand Up @@ -200,4 +199,4 @@ The project is licensed under the MIT license.

## Credits and Acknowledgements 🙏

Crafted with care by **This was generated by [cookiecutter-volto](https://github.com/plone/cookiecutter-volto/frontend_addon) on 2024-07-01 21:48:54**. A special thanks to all contributors and supporters!
Crafted with care by **This was generated by [cookiecutter-volto](https://github.com/plone/cookiecutter-volto/frontend_addon) on 2025-02-05 15:03:10**. A special thanks to all contributors and supporters!
2 changes: 2 additions & 0 deletions frontend/cypress/tests/example.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ context('Example Acceptance Tests', () => {
contentTitle: 'Test document',
});
cy.autologin();
cy.intercept('GET', '/**/document*').as('content');
});

it('As editor I can add edit a Page', function () {
cy.visit('/document');
cy.navigate('/document/edit');
cy.wait('@content');
cy.get('#toolbar-save').click();
});
});
Expand Down
2 changes: 1 addition & 1 deletion frontend/mrs.developer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"package": "@plone/volto",
"url": "[email protected]:plone/volto.git",
"https": "https://github.com/plone/volto.git",
"tag": "18.1.1"
"tag": "18.8.1"
}
}
10 changes: 8 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"release-major-alpha": "pnpm --filter portalbrasil-intranet release-major-alpha",
"release-alpha": "pnpm --filter portalbrasil-intranet release-alpha",
"storybook": "VOLTOCONFIG=$(pwd)/volto.config.js pnpm --filter @plone/volto storybook dev -p 6006 -c $(pwd)/.storybook",
"build-storybook": "VOLTOCONFIG=$(pwd)/volto.config.js pnpm --filter @plone/volto storybook build -c $(pwd)/.storybook"
"storybook-build": "VOLTOCONFIG=$(pwd)/volto.config.js pnpm --filter @plone/volto build-storybook -c $(pwd)/.storybook"
},
"dependencies": {
"@plone/volto": "workspace:*",
Expand All @@ -40,5 +40,11 @@
"devDependencies": {
"mrs-developer": "^2.2.0"
},
"pnpm": {
"overrides": {
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
"react-refresh": "^0.14.2"
}
},
"packageManager": "[email protected]"
}
}
1 change: 1 addition & 0 deletions frontend/packages/portalbrasil-intranet/news/23.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Atualiza versão do volto para 18.8.1 [@ericof]
21 changes: 10 additions & 11 deletions frontend/packages/portalbrasil-intranet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,18 @@
"@kitconcept/volto-light-theme"
],
"dependencies": {
"@plone/components": "workspace:*",
"@eeacms/volto-accordion-block": "11.0.0",
"@eeacms/volto-pdf-block": "1.0.11",
"@mbarde/volto-image-crop-widget": "0.5.1",
"@kitconcept/volto-button-block": "2.3.1",
"@eeacms/volto-accordion-block": "11.0.4",
"@eeacms/volto-pdf-block": "1.0.12",
"@kitconcept/volto-button-block": "3.0.3",
"@kitconcept/volto-heading-block": "2.4.0",
"@kitconcept/volto-separator-block": "4.1.0",
"@kitconcept/volto-light-theme": "5.0.2",
"@kitconcept/volto-separator-block": "4.1.2",
"@kitconcept/volto-slider-block": "6.3.1",
"@kitconcept/volto-light-theme": "4.0.1",
"@plone-collective/volto-bookmarks": "1.0.2",
"volto-form-block": "^3.9.1",
"volto-subblocks": "^2.1.0",
"@plonegovbr/volto-vlibras": "0.4.0"
"@mbarde/volto-image-crop-widget": "0.5.1",
"@plone-collective/volto-bookmarks": "2.0.1",
"@plone/components": "workspace:*",
"@plonegovbr/volto-vlibras": "0.4.0",
"volto-form-block": "^3.9.1"
},
"peerDependencies": {
"react": "18.2.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { Container } from '@plone/components';
import { Icon, UniversalLink } from '@plone/volto/components';
import { BodyClass } from '@plone/volto/helpers';
import Icon from '@plone/volto/components/theme/Icon/Icon';
import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
import BodyClass from '@plone/volto/helpers/BodyClass/BodyClass';
import config from '@plone/volto/registry';
import { setAcessibilidade } from '../../actions/Acessibilidade/Acessibilidade';
import acessibilidadeIcon from '../../icons/acessibilidade.svg';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { BlockDataForm } from '@plone/volto/components';
import { BlockDataForm } from '@plone/volto/components/manage/Form';
import { areasSchema } from './schema';
import { useIntl } from 'react-intl';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { withBlockExtensions } from '@plone/volto/helpers';
import { SidebarPortal } from '@plone/volto/components';
import { withBlockExtensions } from '@plone/volto/helpers/Extensions';
import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';

import AreasBlockData from './Data';
import AreasBlockView from './View';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { withBlockExtensions } from '@plone/volto/helpers';
import { withBlockExtensions } from '@plone/volto/helpers/Extensions';
import AreasView from './DefaultView';

const AreasBlockView = (props) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { BlockDataForm } from '@plone/volto/components';
import { BlockDataForm } from '@plone/volto/components/manage/Form';
import { colaboradoresSchema } from './schema';
import { useIntl } from 'react-intl';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { withBlockExtensions } from '@plone/volto/helpers';
import { SidebarPortal } from '@plone/volto/components';
import { withBlockExtensions } from '@plone/volto/helpers/Extensions';
import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';

import ColaboradoresBlockData from './Data';
import ColaboradoresBlockView from './View';
Expand Down
Loading