Skip to content

Commit

Permalink
Merge branch 'main' into renamemakefiletargets
Browse files Browse the repository at this point in the history
* main:
  Remove `api` folder. Add `backend` folder using latest backend best practices (#6110)
  Rename files with wrong extension `js->jsx` when they contain JSX. (#6114)
  Improve shadowing by including the support for `js->jsx` extensions in… (#6113)
  issue-5452 markdown shortcut (#5495)
  • Loading branch information
sneridagh committed Jun 19, 2024
2 parents 704ad38 + 75403e3 commit fc6285a
Show file tree
Hide file tree
Showing 35 changed files with 32 additions and 259 deletions.
86 changes: 0 additions & 86 deletions api/Makefile

This file was deleted.

60 changes: 0 additions & 60 deletions api/README.rst

This file was deleted.

87 changes: 0 additions & 87 deletions api/buildout.cfg

This file was deleted.

1 change: 0 additions & 1 deletion api/requirements.txt

This file was deleted.

12 changes: 0 additions & 12 deletions api/version-constraints.cfg

This file was deleted.

8 changes: 0 additions & 8 deletions api/versions.cfg

This file was deleted.

1 change: 1 addition & 0 deletions packages/registry/news/6113.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve shadowing by including the support for js->jsx extensions in old shadows. This allow support for upcoming renaming of files that should be jsx and are js. @sneridagh
14 changes: 13 additions & 1 deletion packages/registry/src/addon-registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -518,13 +518,25 @@ class AddonConfigurationRegistry {
}
}

/**
*Covers the use case that the file was a jsx, but was created using .js extension
*
* @param {*} filePath
*/
function simpleSwapFileExtension(filePath) {
// Extract the current file extension
const currentExtension = filePath.split('.').pop();
return filePath.replace(`.${currentExtension}`, '.jsx');
}

const targetPath = filename.replace(customPath, sourcePath);
// We try to find the source to shadow with the exact path
// and we try also with the extension changed in search for JS<->TS
// correspondence
if (
fs.existsSync(targetPath) ||
fs.existsSync(changeFileExtension(targetPath))
fs.existsSync(changeFileExtension(targetPath)) ||
fs.existsSync(simpleSwapFileExtension(targetPath))
) {
aliases[
filename
Expand Down
1 change: 1 addition & 0 deletions packages/volto-slate/news/5452.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
In the Slate text block, the markup shortcuts for heading and blockquote work again. @kHAPPY2004
1 change: 1 addition & 0 deletions packages/volto-slate/news/6114.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Rename files with wrong extension `js->jsx` when they contain JSX. @sneridagh
3 changes: 3 additions & 0 deletions packages/volto-slate/src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export const P = 'p';
export const LI = 'li';
export const UL = 'ul';
export const OL = 'ol';
export const H2 = 'h2';
export const H3 = 'h3';
export const BLOCKQUOTE = 'blockquote';

// dom parsing node information
export const TEXT_NODE = 3;
Expand Down
8 changes: 4 additions & 4 deletions packages/volto-slate/src/editor/plugins/Markdown/constants.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { toggleList } from './utils';
import { isBlockActive } from '@plone/volto-slate/utils';
import { UL, OL, LI } from '@plone/volto-slate/constants';
import { UL, OL, LI, H2, H3, BLOCKQUOTE } from '@plone/volto-slate/constants';

/**
* Uses the old toggleList function to toggle lists on or off or from a type to another.
Expand All @@ -22,11 +22,11 @@ export const localToggleList = (editor, format) => {
*/
export const autoformatRules = [
{
type: 'h2',
type: H2,
markup: '#',
},
{
type: 'h3',
type: H3,
markup: '##',
},
{
Expand All @@ -44,7 +44,7 @@ export const autoformatRules = [
},
},
{
type: 'blockquote',
type: BLOCKQUOTE,
markup: ['>'],
// preFormat,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ export const autoformatBlock = (editor, type, at, { preFormat, format }) => {
Transforms.setNodes(
editor,
{ type },
{ at },
{ match: (n) => Editor.isBlock(editor, n) },
);
} else {
Expand Down
2 changes: 2 additions & 0 deletions packages/volto/__tests__/addon-registry-project.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ describe('AddonConfigurationRegistry - Project', () => {
const base = path.join(__dirname, 'fixtures', 'test-volto-project');
const reg = new AddonConfigurationRegistry(base);
expect(reg.getProjectCustomizationPaths()).toStrictEqual({
'@plone/volto/LanguageSwitcher': `${base}/src/customizations/LanguageSwitcher.js`,
'@plone/volto/TSComponent': `${base}/src/customizations/TSComponent.jsx`,
'@plone/volto/client': `${base}/src/customizations/client.js`,
'@plone/volto/routes': `${base}/src/customizations/routes.tsx`,
Expand All @@ -149,6 +150,7 @@ describe('AddonConfigurationRegistry - Project', () => {
const base = path.join(__dirname, 'fixtures', 'test-volto-project');
const reg = new AddonConfigurationRegistry(base);
expect(reg.getAddonCustomizationPaths()).toStrictEqual({
'@plone/volto/LanguageSwitcher': `${base}/node_modules/test-released-source-addon/src/customizations/LanguageSwitcher.js`,
'@plone/volto/TSComponent': `${base}/node_modules/test-released-source-addon/src/customizations/TSComponent.jsx`,
'@plone/volto/client': `${base}/node_modules/test-released-source-addon/src/customizations/client.js`,
'@plone/volto/routes': `${base}/node_modules/test-released-source-addon/src/customizations/routes.tsx`,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//
1 change: 1 addition & 0 deletions packages/volto/news/6110.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove `api` folder. Add `backend` folder using latest backend best practices. @sneridagh
1 change: 1 addition & 0 deletions packages/volto/news/6113.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve shadowing by including the support for js->jsx extensions in old shadows. This allow support for upcoming renaming of files that should be jsx and are js. @sneridagh
1 change: 1 addition & 0 deletions packages/volto/news/6114.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Rename files with wrong extension `js->jsx` when they contain JSX. @sneridagh
File renamed without changes.
File renamed without changes.

0 comments on commit fc6285a

Please sign in to comment.