Skip to content

Commit

Permalink
Merge branch 'master' into typescript-support-in-core
Browse files Browse the repository at this point in the history
* master: (22 commits)
  Release changelog notes for 16.20.1
  Release 17.0.0-alpha.5
  Generate a split sitemap (also fix robots.txt) (#4639)
  Fix search block in edit mode re-queries multiple blocks with an empty search text (#4694)
  Fix Move to top of folder ordering in folder content view (#4691)
  Changelog
  Revert "Add current page parameter to the route in the listing and search block pagination (#4159)" (#4695)
  Release generate-volto 7.0.0-alpha.4
  Force the resolution of the `react-error-overlay` package to `6.0.9` (#4687)
  Fix training links (#4635)
  Release 17.0.0-alpha.4
  Release changelog notes for 16.20.0 (#4684)
  Update to latest backend versions (#4682)
  Support RelationList field with StaticCatalogVocabulary and SelectWidget. (#4614)
  Load a theme via a `theme` key in `volto.config.js` or in `package.json` (#4625)
  docs: improve creating view documentation (#4636)
  fix sitemap.xml.gz is not compressed #4622 (v2) (#4663)
  Make URL a literal string to fix broken link (#4667)
  Move developer guidelines to contributing #4665 (#4666)
  Update Volto contributing to align with and refer to the new Plone co… (#4634)
  ...
  • Loading branch information
sneridagh committed Apr 17, 2023
2 parents 8480cae + d6acb08 commit a36e7ff
Show file tree
Hide file tree
Showing 68 changed files with 970 additions and 459 deletions.
89 changes: 87 additions & 2 deletions CHANGELOG.md
Expand Up @@ -8,6 +8,54 @@

<!-- towncrier release notes start -->

## 17.0.0-alpha.5 (2023-04-14)

### Bugfix

- Generate a split sitemap @reebalazs [#4638](https://github.com/plone/volto/issues/4638)
- Fix Move to top of folder ordering in folder content view @iFlameing [#4690](https://github.com/plone/volto/issues/4690)
- Revert "Add current page parameter to the route in the listing and search block pagination (#4159)" @sneridagh [#4695](https://github.com/plone/volto/issues/4695)
- Fix search block in edit mode re-queries multiple blocks with an empty search text @reebalazs [#4697](https://github.com/plone/volto/issues/4697)

### Documentation

- Update links for 2022 Training archive. @stevepiercy [#4635](https://github.com/plone/volto/issues/4635)


## 17.0.0-alpha.4 (2023-04-12)

### Feature

- DefaultView (view of fields for content types with blocks disabled): Show field name as tip on hover of label. @ksuess [#4598](https://github.com/plone/volto/issues/4598)
- Support RelationList field with named StaticCatalogVocabulary and SelectWidget. @ksuess [#4614](https://github.com/plone/volto/issues/4614)
- Support for declaring a theme in `volto.config.js` or in `package.json`
Add two entry points to allow extension of a theme from other add-ons. @sneridagh [#4625](https://github.com/plone/volto/issues/4625)
- Set sameSite in I18N_LANGUAGE cookie @sneridagh [#4627](https://github.com/plone/volto/issues/4627)
- Added querystring search get option. @robgietema [#4658](https://github.com/plone/volto/issues/4658)

### Bugfix

- Added current page parameter to route in listing and search block pagination - Fix: #3868 @bipoza [#4159](https://github.com/plone/volto/issues/4159)
- Fix regexp that checks valid URLs and improve tests [cekk] [#4601](https://github.com/plone/volto/issues/4601)
- Fixed wrong localization on password reset page @iRohitSingh [#4656](https://github.com/plone/volto/issues/4656)
- fix sitemap.xml.gz not is not compressed @dobri1408 [#4663](https://github.com/plone/volto/issues/4663)

### Internal

- Trigger CI workflows to run from external pull requests. @davisagli [#4629](https://github.com/plone/volto/issues/4629)
- Update to p.restapi 8.36.0 and Plone 6.0.3 @sneridagh [#4682](https://github.com/plone/volto/issues/4682)

### Documentation

- Added `JavaScript` and `NodeJS` as accepted spellings, and deviations of them as rejected spellings. @utkkkarshhh [#3092](https://github.com/plone/volto/issues/3092)
- Fix documentation build, add pins @sneridagh [#4626](https://github.com/plone/volto/issues/4626)
- Update Volto contributing to align with and refer to the new Plone core code contributing requirements. @stevepiercy [#4634](https://github.com/plone/volto/issues/4634)
- Improve creating views documentation page. @rboixaderg [#4636](https://github.com/plone/volto/issues/4636)
- Razzle upgrade notice in upgrade guide @sneridagh [#4641](https://github.com/plone/volto/issues/4641)
- Rename "Developer Guidelines" to "Contributing". @stevepiercy [#4666](https://github.com/plone/volto/issues/4666)
- Fix broken link to `ReactJS.org`. @stevepiercy [#4667](https://github.com/plone/volto/issues/4667)


## 17.0.0-alpha.3 (2023-03-22)

### Feature
Expand All @@ -24,7 +72,7 @@

- Deleted duplicate import and fixed training URLs. @yahya-cloud [#4523](https://github.com/plone/volto/issues/4523)
- Fix grammar in PR #4542. @stevepiercy [#4555](https://github.com/plone/volto/issues/4555)
- Fix broken links at ReactJS.org. @stevepiercy [#4569](https://github.com/plone/volto/issues/4569)
- Fix broken links at `ReactJS.org`. @stevepiercy [#4569](https://github.com/plone/volto/issues/4569)
- Fix video warnings and link errors. @stevepiercy [#4578](https://github.com/plone/volto/issues/4578)


Expand Down Expand Up @@ -112,6 +160,43 @@
- Use a universal static path for both documentation and volto repos. @stevepiercy [#4376](https://github.com/plone/volto/issues/4376)


## 16.20.1 (2023-04-14)

### Bugfix

- Generate a split sitemap @reebalazs [#4638](https://github.com/plone/volto/issues/4638)
- Fix Move to top of folder ordering in folder content view @iFlameing [#4690](https://github.com/plone/volto/issues/4690)
- Revert "Add current page parameter to the route in the listing and search block pagination (#4159)" @sneridagh [#4695](https://github.com/plone/volto/issues/4695)
- Fix search block in edit mode re-queries multiple blocks with an empty search text @reebalazs [#4697](https://github.com/plone/volto/issues/4697)


## 16.20.0 (2023-04-12)

### Feature

- Support RelationList field with named StaticCatalogVocabulary and SelectWidget. @ksuess [#4614](https://github.com/plone/volto/issues/4614)
- Support for declaring a theme in `volto.config.js` or in `package.json`
Add two entry points to allow extension of a theme from other add-ons. @sneridagh [#4625](https://github.com/plone/volto/issues/4625)
- Added querystring search get option. @robgietema [#4658](https://github.com/plone/volto/issues/4658)

### Bugfix

- Added current page parameter to route in listing and search block pagination - Fix: #3868 @bipoza [#4159](https://github.com/plone/volto/issues/4159)
- Fixed wrong localization on password reset page @iRohitSingh [#4656](https://github.com/plone/volto/issues/4656)
- fix sitemap.xml.gz not is not compressed @dobri1408 [#4663](https://github.com/plone/volto/issues/4663)

### Internal

- Update to p.restapi 8.36.0 and Plone 6.0.3 @sneridagh [#4682](https://github.com/plone/volto/issues/4682)

### Documentation

- Update Volto contributing to align with and refer to the new Plone core code contributing requirements. @stevepiercy [#4634](https://github.com/plone/volto/issues/4634)
- Improve creating views documentation page. @rboixaderg [#4636](https://github.com/plone/volto/issues/4636)
- Rename "Developer Guidelines" to "Contributing". @stevepiercy [#4666](https://github.com/plone/volto/issues/4666)
- Fix broken link to `ReactJS.org`. @stevepiercy [#4667](https://github.com/plone/volto/issues/4667)


## 16.19.0 (2023-04-04)

### Feature
Expand Down Expand Up @@ -143,7 +228,7 @@

### Documentation

- Fix broken links at ReactJS.org. @stevepiercy [#4569](https://github.com/plone/volto/issues/4569)
- Fix broken links at `ReactJS.org`. @stevepiercy [#4569](https://github.com/plone/volto/issues/4569)
- Fix video warnings and link errors. @stevepiercy [#4578](https://github.com/plone/volto/issues/4578)


Expand Down
8 changes: 4 additions & 4 deletions Makefile
Expand Up @@ -13,15 +13,15 @@ MAKEFLAGS+=--no-builtin-rules
# Project settings

INSTANCE_PORT=8080
DOCKER_IMAGE=plone/server-dev:6.0.2
DOCKER_IMAGE_ACCEPTANCE=plone/server-acceptance:6.0.2
KGS=
DOCKER_IMAGE=plone/server-dev:6.0.3
DOCKER_IMAGE_ACCEPTANCE=plone/server-acceptance:6.0.3
KGS=plone.restapi==8.36.0
NODEBIN = ./node_modules/.bin
SCRIPTSPACKAGE = ./packages/scripts

# Plone 5 legacy
DOCKER_IMAGE5=plone/plone-backend:5.2.10
KGS5=plone.restapi==8.35.0 plone.volto==4.0.7 plone.rest==3.0.0
KGS5=plone.restapi==8.36.0 plone.volto==4.0.7 plone.rest==3.0.0
TESTING_ADDONS=plone.app.robotframework==2.0.0 plone.app.testing==7.0.0

# Sphinx variables
Expand Down
13 changes: 5 additions & 8 deletions README.md
Expand Up @@ -186,19 +186,16 @@ You can find the latest (in-progress) documentation in [https://6.dev-docs.plone

## Training

On the [Plone Trainings Website](https://training.plone.org) you'll find
Volto-dedicated open training materials, plus React and other
JavaScript-centered trainings.
On the [Plone Training website](https://training.plone.org), you'll find Volto-dedicated training materials, plus other JavaScript-centered trainings.

- [Mastering Plone 6 Development](https://training.plone.org/mastering-plone/)
The comprehensive training on Plone 6 with best practice tips for developers and integrators.
- [Volto](https://training.plone.org/5/volto/index.html)
A detailed training on how to create your own website using Volto frontend.
- [Volto Hands-On](https://training.plone.org/voltohandson/index.html)
- [Volto Add-ons Development](https://training.plone.org/voltoaddons/index.html)
- [Plone Deployment](https://training.plone.org/5/plone-deployment/index.html)
- [React](https://training.plone.org/react/index.html)
- [JavaScript For Plone Developers](https://training.plone.org/5/javascript/index.html)
- [Effective Volto](https://training.plone.org/effective-volto/index.html)
- [Plone Deployment](https://training.plone.org/plone-deployment/index.html)
- [Volto](https://2022.training.plone.org/volto/index.html) (archived)
- [JavaScript For Plone Developers](https://2022.training.plone.org/javascript/index.html) (archived)

## Talks

Expand Down
34 changes: 34 additions & 0 deletions addon-registry.js
Expand Up @@ -136,6 +136,11 @@ class AddonConfigurationRegistry {
this.packages = {};
this.customizations = new Map();

// Theme from a package.json key, from volto.config.js or from an ENV VAR
// Programatically via volto.config.js wins or the ENV VAR if present
this.theme =
packageJson.theme || this.voltoConfigJS.theme || process.env.THEME;

this.initDevelopmentPackages();
this.initPublishedPackages();
this.initAddonsFromEnvVar();
Expand Down Expand Up @@ -363,6 +368,35 @@ class AddonConfigurationRegistry {
.filter((e) => e);
}

getCustomThemeAddons() {
const customThemeAddonsInfo = {
variables: [],
main: [],
};

this.getAddonDependencies().forEach((addon) => {
const normalizedAddonName = addon.split(':')[0];
// We have two possible insertion points, variables and main

const customThemeVariables = `${this.packages[normalizedAddonName].modulePath}/theme/_variables.scss`;
const customThemeMain = `${this.packages[normalizedAddonName].modulePath}/theme/_main.scss`;
if (
fs.existsSync(customThemeVariables) &&
normalizedAddonName !== this.theme
) {
customThemeAddonsInfo.variables.push(normalizedAddonName);
}
if (
fs.existsSync(customThemeMain) &&
normalizedAddonName !== this.theme
) {
customThemeAddonsInfo.main.push(normalizedAddonName);
}
});

return customThemeAddonsInfo;
}

/**
* Returns a mapping name:diskpath to be uses in webpack's resolve aliases
*/
Expand Down
2 changes: 1 addition & 1 deletion api/buildout.cfg
@@ -1,7 +1,7 @@
[buildout]
index = https://pypi.org/simple/
extends =
http://dist.plone.org/release/6.0.2/versions.cfg
http://dist.plone.org/release/6.0.3/versions.cfg
version-constraints.cfg
versions.cfg
parts = instance plonesite site-packages test robot-server
Expand Down
2 changes: 1 addition & 1 deletion api/versions.cfg
Expand Up @@ -5,7 +5,7 @@ async-generator = 1.10
collective.folderishtypes = 3.0.0
collective.recipe.plonesite = 1.12.0
h11 = 0.12.0
plone.restapi = 8.35.1
plone.restapi = 8.36.0
plone.volto = 4.0.7
prompt-toolkit = 2.0.10
pyOpenSSL = 21.0.0
Expand Down
79 changes: 79 additions & 0 deletions create-theme-addons-loader.js
@@ -0,0 +1,79 @@
const path = require('path');
const fs = require('fs');
const tmp = require('tmp');
const cryptoRandomString = require('crypto-random-string');

const titleCase = (w) => w.slice(0, 1).toUpperCase() + w.slice(1, w.length);

/*
* Transforms a package name to javascript variable name
*/
function nameFromPackage(name) {
name =
name.replace(/[@~./\\:\s]/gi, '') ||
cryptoRandomString({ length: 10, characters: 'abcdefghijk' });
return name
.split('-')
.map((w, i) => (i > 0 ? titleCase(w) : w))
.join('');
}

/*
* Creates a static file with code necessary to load the addons configuration
*
*/
function getAddonsLoaderCode(name, customThemeAddons = []) {
let buf = `/*
This file is autogenerated. Don't change it directly.
Add a ./theme/_${name}.scss in your add-on to load your theme customizations in the current theme.
*/
`;
customThemeAddons.forEach((addon) => {
const customization = `${addon}/theme/${name}`;
const line = `@import '${customization}';\n`;
buf += line;
});

return buf;
}

module.exports = ({ main, variables }) => {
// const addonsThemeLoaderVariablesPath = path.join(
// process.cwd(),
// 'src',
// '_variables.scss',
// );
// const addonsThemeLoaderMainPath = path.join(
// process.cwd(),
// 'src',
// '_main.scss',
// );

// const addonsThemeLoaderVariablesPath = path.join(
// process.cwd(),
// 'src',
// '_variables.scss',
// );
// const addonsThemeLoaderMainPath = path.join(
// process.cwd(),
// 'src',
// '_main.scss',
// );

const addonsThemeLoaderVariablesPath = tmp.tmpNameSync({ postfix: '.scss' });
const addonsThemeLoaderMainPath = tmp.tmpNameSync({ postfix: '.scss' });
fs.writeFileSync(
addonsThemeLoaderVariablesPath,
new Buffer.from(getAddonsLoaderCode('variables', variables)),
);
fs.writeFileSync(
addonsThemeLoaderMainPath,
new Buffer.from(getAddonsLoaderCode('main', main)),
);

return [addonsThemeLoaderVariablesPath, addonsThemeLoaderMainPath];
};

module.exports.getAddonsLoaderCode = getAddonsLoaderCode;
module.exports.nameFromPackage = nameFromPackage;
1 change: 1 addition & 0 deletions docs/source/addons/index.md
Expand Up @@ -14,6 +14,7 @@ myst:
i18n
best-practices
theme
```

There are several advanced scenarios where we might want to have more control
Expand Down

0 comments on commit a36e7ff

Please sign in to comment.