Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into typescript-support-in-core
* 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
Showing
68 changed files
with
970 additions
and
459 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.