Skip to content

Commit

Permalink
Merge branch 'master' into plone6-docs
Browse files Browse the repository at this point in the history
* master: (25 commits)
  Add projectId for Cypress dashboard (#3023)
  Docs: faster onboarding, identify running processes, improve internal proxy clarification (#3010)
  Pin pyOpenSSL to 21.1.0
  Back to development
  Release 14.7.0
  Prepare for release
  Fix changelog
  Look ma, no `momentjs`! (#2910)
  Back to development
  Release 14.6.0
  Prepare for release
  Fix ObjectWidget story (#3009)
  Use `volto.config.js` as dynamic configuration for addons. It adds up… (#3008)
  fix: enable url with 'underscore' char
  fix: fixed italian translations
  Back to development
  Release 14.5.0
  Prepare for release
  Chenges to lockfile not saved, apparently :/
  Fix `language-independent-field` CSS class styling (#3005)
  ...
  • Loading branch information
sneridagh committed Feb 2, 2022
2 parents 00c76fb + facd3c9 commit 5637f63
Show file tree
Hide file tree
Showing 77 changed files with 2,496 additions and 327 deletions.
46 changes: 44 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Change Log

## 14.4.1 (unreleased)
## 14.7.1 (unreleased)

### Breaking

Expand All @@ -12,9 +12,50 @@

### Internal

- Lazyload react-beautiful-dnd @tiberiuichim
### Docs

Update documentation for internal proxy & other smaller reorganisation for quicker onboarding of
new users/evaluators. @fredvd

## 14.7.0 (2022-01-28)

### Feature

- Add `<FormattedDate>` and `<FormattedRelativeDate>` components. Check their Storybook stories for details. This is part of ongoing work to minimize the use of 'deprecated' momentjs. @sneridagh @tiberiuichim

### Internal

- Upgrade jest to latest release, 27 major. @tiberiuichim
- Lazyload momentjs. `parseDateTime` helper now requires passing the momentjs library @tiberiuichim

## 14.6.0 (2022-01-27)

### Feature

- Use `volto.config.js` as dynamic configuration for addons. It adds up to the `package.json` `addons` key, allowing dynamic load of addons (eg. via environment variables) @sneridagh

### Internal

- Fix ObjectListWidget story bug caused by lazyloading dnd libraries
@tiberiuichim

## 14.5.0 (2022-01-26)

### Feature

- VocabularyTermsWidget: Token is now on creation of term editable, but stays ineditable afterwards. @ksuess

### Bugfix

- Fix A11Y violations in Navigation @iRohitSingh
- Fix `language-independent-field` CSS class styling @sneridagh

### Internal

- Lazyload react-beautiful-dnd @tiberiuichim
- Lazyload react-dnd @tiberiuichim
- Improve docs on environment variables, add recipes @sneridagh
- Update p.restapi to 8.20.0 and plone.volto to 4.0.0a1 and plone.rest to 2.0.0a2 @sneridagh

## 14.4.0 (2022-01-21)

Expand All @@ -32,6 +73,7 @@

### Bugfix

- Fix ListingBlock to add "No results" message when there are no messages @erral
- Fix overflow table in Content view @giuliaghisini
- Fixed url validation in FormValidation to admit ip addresses. @giuliaghisini
- Upgrade to plone.restapi 8.19.0 (to support the language independent fields serialization) @sneridagh
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ MAKEFLAGS+=--no-builtin-rules

INSTANCE_PORT=8080
DOCKER_IMAGE=plone/plone-backend:5.2.6
KGS=plone.restapi==8.19.0 plone.app.iterate==4.0.2 plone.rest==2.0.0a1 plone.app.vocabularies==4.3.0 plone.volto==3.1.0a8
KGS=plone.restapi==8.20.0 plone.volto==4.0.0a2 plone.rest==2.0.0a2 plone.app.iterate==4.0.2 plone.app.vocabularies==4.3.0

# Recipe snippets for reuse

Expand Down Expand Up @@ -91,7 +91,7 @@ start-backend: ## Start Plone Backend

.PHONY: start-backend-docker
start-backend-docker:
docker run -it --rm --name=plone -p 8080:8080 -e SITE=Plone -e ADDONS="plone.volto" -e ZCML="plone.volto.cors" plone
docker run -it --rm -p 8080:8080 -e SITE=Plone -e ADDONS='$(KGS)' $(DOCKER_IMAGE)

.PHONY: start-backend-docker-guillotina
start-backend-docker-guillotina:
Expand Down
10 changes: 10 additions & 0 deletions __tests__/addon-registry.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ describe('AddonConfigurationRegistry', () => {
'test-addon',
'test-released-addon',
'test-released-source-addon',
'my-volto-config-addon',
'test-released-dummy',
'test-released-unmentioned',
]);
Expand Down Expand Up @@ -60,6 +61,13 @@ describe('AddonConfigurationRegistry', () => {
name: 'test-released-unmentioned',
packageJson: `${base}/node_modules/test-released-unmentioned/package.json`,
},
'my-volto-config-addon': {
addons: ['test-released-dummy'],
isPublishedPackage: false,
modulePath: `${base}/addons/my-volto-config-addon/src`,
name: 'my-volto-config-addon',
packageJson: `${base}/addons/my-volto-config-addon/package.json`,
},
'test-released-dummy': {
addons: ['test-released-unmentioned'],
isPublishedPackage: false,
Expand All @@ -74,6 +82,7 @@ describe('AddonConfigurationRegistry', () => {
const base = path.join(__dirname, 'fixtures', 'test-volto-project');
const reg = new AddonConfigurationRegistry(base);
expect(reg.getResolveAliases()).toStrictEqual({
'my-volto-config-addon': `${base}/addons/my-volto-config-addon/src`,
'test-addon': `${base}/addons/test-addon/src`,
'test-released-addon': `${base}/node_modules/test-released-addon`,
'test-released-dummy': `${base}/addons/test-released-dummy`,
Expand All @@ -98,6 +107,7 @@ describe('AddonConfigurationRegistry', () => {
'test-addon',
'test-released-addon',
'test-released-source-addon',
'my-volto-config-addon',
]);
});

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "test-addon",
"customizationPaths": [
"src/custom-addons"
],
"addons": [
"test-released-dummy"
]
}
Empty file.
3 changes: 2 additions & 1 deletion __tests__/fixtures/test-volto-project/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"compilerOptions": {
"paths": {
"test-addon": ["test-addon/src"],
"test-released-dummy": ["test-released-dummy"]
"test-released-dummy": ["test-released-dummy"],
"my-volto-config-addon": ["my-volto-config-addon/src"]
},
"baseUrl": "addons"
}
Expand Down
3 changes: 3 additions & 0 deletions __tests__/fixtures/test-volto-project/volto.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
addons: ['my-volto-config-addon'],
};
17 changes: 15 additions & 2 deletions addon-registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,26 @@ class AddonConfigurationRegistry {
projectRootPath,
'package.json',
)));
// Loads the dynamic config, if any
if (fs.existsSync(path.join(projectRootPath, 'volto.config.js'))) {
this.voltoConfigJS = require(path.join(
projectRootPath,
'volto.config.js',
));
} else {
this.voltoConfigJS = [];
}
this.resultantMergedAddons = [
...(packageJson.addons || []),
...(this.voltoConfigJS.addons || []),
];

this.projectRootPath = projectRootPath;
this.voltoPath =
packageJson.name === '@plone/volto'
? `${projectRootPath}`
: `${projectRootPath}/node_modules/@plone/volto`;
this.addonNames = (packageJson.addons || []).map((s) => s.split(':')[0]);
this.addonNames = this.resultantMergedAddons.map((s) => s.split(':')[0]);
this.packages = {};
this.customizations = new Map();

Expand All @@ -114,7 +127,7 @@ class AddonConfigurationRegistry {
this.initTestingPackages();

this.dependencyGraph = buildDependencyGraph(
packageJson.addons || [],
this.resultantMergedAddons,
(name) => {
this.initPublishedPackage(name);
return this.packages[name].addons || [];
Expand Down
5 changes: 3 additions & 2 deletions api/buildout.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,14 @@ eggs = ${instance:eggs}
setuptools =
zc.buildout =
# force to latest p.restapi
plone.restapi = 8.19.0
plone.restapi = 8.20.0
# new JSON only traversal
plone.rest = 2.0.0a1
plone.rest = 2.0.0a2
# Using working copy support in Volto requires it
plone.app.iterate = 4.0.2
# plone.volto requires it
plone.app.vocabularies = 4.3.0
pyOpenSSL = 21.0.0

plone.volto =
robotframework =
Expand Down
3 changes: 2 additions & 1 deletion cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"viewportWidth": 1280,
"ignoreTestFiles": ["*~"],
"integrationFolder": "cypress/tests/core",
"chromeWebSecurity": false
"chromeWebSecurity": false,
"projectId": "5iy5e2"
}
4 changes: 1 addition & 3 deletions cypress/tests/core-sandbox/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ context('Search action tests', () => {
cy.navigate('/newsitem/edit');

// Add subject
cy.get('a:contains("Categorization")')
.click()
.get('.field-wrapper-subjects input')
cy.get('.field-wrapper-subjects input')
.type('garden', { force: true })
.type('{enter}');
cy.get('#toolbar-save').click();
Expand Down
8 changes: 4 additions & 4 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,15 @@ extra_css:

nav:
- Getting Started:
- Bootstrap Volto: 'getting-started/install.md'
- Installing Volto: 'getting-started/install.md'
- Developer roadmap: 'getting-started/roadmap.md'
- Learning resources: 'getting-started/others.md'
- How does it work under the hood: 'getting-started/howdoesitwork.md'
- Design principles: 'design-principles/index.md'
- Style Guide: 'style-guide/index.md'
- Configuration:
- What is configurable?: 'configuration/how-to.md'
- Settings reference guide: 'configuration/settings-reference.md'
- Zero config builds: 'configuration/zero-config-builds.md'
- Internal proxy: 'configuration/internalproxy.md'
- Dynamic Volto Addons Configuration: 'configuration/volto-config-js.md'
- Backend configuration: 'configuration/backend.md'
- Richeditor settings: 'configuration/richeditor-settings.md'
- Multilingual: 'configuration/multilingual.md'
Expand Down Expand Up @@ -79,6 +77,8 @@ nav:
- Performance improvements: 'deploying/performance.md'
- Upgrade Guide: 'upgrade-guide/index.md'
- Developer Guidelines:
- Design principles: 'developer-guidelines/design-principles.md'
- Style Guide: 'developer-guidelines/style-guide.md'
- Language features: 'developer-guidelines/language-features.md'
- Linting: 'developer-guidelines/linting.md'
- React: 'developer-guidelines/react.md'
Expand Down
17 changes: 7 additions & 10 deletions docs/source/configuration/backend.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,20 @@ html_meta:
# Backend configuration

## plone.volto
<<<<<<< HEAD
In order to fully support all Volto features, the Plone backend content API needs to be prepared for Volto. The add'on `plone.volto` does all the heavy lifting for you and is ready to use in your own projects. We used it in our Getting Started section.

In order to fully support all Volto features, the Plone backend, needs to be prepared for
Volto. This involves configuration, add-ons installation and some patches to the core.
The add'on `plone.volto` does all the heavy lifting for you and it's ready to use
in your own projects. We used it in our Getting Started section.

However, this package is oppinionated and might not fit your needs, so if you want to
use your own integration package instead, just take a look at the features it provides,
This package is slightly opinionated but provides the correct default settings for when
you want to start with Volto. If you have advanced needs or want to move the setting to
your own integration package instead, just take a look at the features it provides,
copy the ones you need for your project and create your own integration package.

https://github.com/plone/plone.volto

!!! tip
From Volto 5.1 and above, Volto features an internal proxy to your API server. So
you don't have to deal with CORS. It's enabled by default, pointing to the server
specified in the `devProxyToApiPath` Volto settings (http://localhost:8080/Plone).
See [here](../configuration/internalproxy.md) for more details.
you don't have to deal with CORS issues. It's enabled by default, pointing to the server specified in the `devProxyToApiPath` Volto settings
(http://localhost:8080/Plone). See [here](../configuration/internalproxy.md) for more information.

## Install a Plone backend locally without Docker

Expand Down
27 changes: 24 additions & 3 deletions docs/source/configuration/environmentvariables.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,29 @@ In the frontend we can access this variable with:
window.env.RAZZLE_MY_VARIABLE
```

## RAZZLE_LEGACY_TRAVERSE
## Runtime environment variables

All the environment variables that are configurable work at runtime, not only at build time. This works since Volto 13 onwards.

!!! info
Before Volto 13, you'd do:

```bash
RAZZLE_API_PATH=https://plone.org yarn build && yarn start:prod
```

From Volto 13 onwards, you can now do:

```bash
yarn build && RAZZLE_API_PATH=https://plone.org yarn start:prod
```

This brings you a lot of power since you don't have to rebuild on every config change. You can also generate builds on your CI, then deploy them anywhere.


## Environment variables reference

### RAZZLE_LEGACY_TRAVERSE

From Volto 14 onwards, Seamless mode is the recommended way of setting up your depoloyments. However, it forces you to upgrade several packages in the backend (`plone.restapi` and `plone.rest`) and adjust your web server configuration accordingly.

Expand All @@ -33,7 +55,7 @@ In case you can't afford or change your deployment, you can still upgrade Volto
RAZZLE_LEGACY_TRAVERSE=true yarn start:prod
```

## VOLTO_ROBOTSTXT
### VOLTO_ROBOTSTXT

You can override the robots.txt file with an environment variable called
`VOLTO_ROBOTSTXT`. This is useful when using the same build on multiple
Expand All @@ -48,7 +70,6 @@ Disallow: /" yarn start
If you want to use the `VOLTO_ROBOTSTXT` environment variable, make sure to
delete the file `public/robots.txt` from your project.


### DEBUG

It will enable the log several logging points scattered through the Volto code. It uses the `volto:` namespace.
Expand Down
7 changes: 4 additions & 3 deletions docs/source/configuration/how-to.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ like:
const absoluteUrl = `${config.settings.apiPath}/${content.url}`
```

Both add-ons and projects can extend Volto's configuration registry. First the add-ons
configuration is applied, in the order they are defined in `package.json`, then finally
the project configuration is applied. Visualized like a pipe would be:
Both the main project and individual add-ons can extend Volto's configuration registry.
First the add-ons configuration is applied, in the order they are defined in
`package.json`, then finally the project configuration is applied. Visualized like
a pipe would be:

> Default Volto configuration -> Add-on 1 -> Add-on 2 -> ... -> Add-on n -> Project
Expand Down
Loading

0 comments on commit 5637f63

Please sign in to comment.