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

Move add-on registry in its own package #4949

Merged
merged 56 commits into from
Nov 4, 2023
Merged

Conversation

sneridagh
Copy link
Member

@sneridagh sneridagh commented Jul 5, 2023

This builds upon the typescript-support-in-core branch.

It moves the Volto add-on registry to its own package @plone/registry. It will allow to have the feature portable to other frameworks other than Volto itself. Internally, Volto uses it by path, so it does not relies on a released version.
It uses TypeScript, and an initial typing of the registry is in place already.

It also features the same treatment for the @plone/scripts use of i18n script.

sneridagh and others added 22 commits April 6, 2023 18:56
…problems if a `.ts` file is found anywhere in the build

Checkpoint
…nstead only for `.js` files.

Delete test files
* 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)
  ...
* master: (29 commits)
  Remove max_line_length from .editorconfig (#4776)
  Fix bug showing logs at the browsers when richtext widget is use (#4780)
  Show expired and future content in contents view (#4764)
  Fix reducing expanders loaded in a subrequest (#4761)
  Update release notes for 16.20.5 and 16.20.6 (#4759)
  Release 17.0.0-alpha.7
  Try to sort out volto's use of language codes (#4741)
  Improve .npmignore to not include not needed files/folders (#4746)
  Release 17.0.0-alpha.6
  Control panel list SSR (#3749)
  Open all accordion'd content in InlineForm by default, allow arbitrarily close any number of them (#4178)
  Upgrade to Plone 6.0.4 (#4743)
  fix: unresponsive add page (#4507)
  Apply suggestion from browser for password field (#4524)
  (fix):Object.normaliseMail: Cannot read properties of null (#4558)
  Fix link in Volto, remove from linkcheck ignore in Documentation v6.0 (#4742)
  added documentation regarding the static middleware #4518 (#4736)
  Closes issue #4567 (#4570)
  Fix whitespace in locales created by the generator (#4737)
  Tidy up from synch with 16.x.x (#4728)
  ...
Co-authored-by: Victor Fernandez de Alba <sneridagh@gmail.com>
* master:
  Release changelog for 16.20.7 (#4816)
  Release 17.0.0-alpha.8
  Add supported languages (#4811)
  Fix html tag lang attribute in SSR (#4803)
  Finnish translation forwardport (#4084) (#4810)
  Control panel for relations (#3382)
  Add guard in case of malformed blocks are present (at least id and title should be present) (#4802)
  fixed the issue #4660 - shouldn't use a hook like function name for a variable (#4693)
  Fix HMR of @plone/volto (#4799)
* master: (29 commits)
  Remove anonymous function calls. Remove default exports from. (#4917)
  Release 17.0.0-alpha.14
  Linked headlines (#3540)
  Release notes for 16.20.8 16.21.0 16.21.1 (#4910)
  Spanish translation (#4896)
  Refactor Anontools (#4845)
  Update to plone-backend 6.0.5 (#4897)
  Release 17.0.0-alpha.13
  Enforce max upload size (#4868)
  Fix and improve the `addStyling` helper (#4880)
  Release 17.0.0-alpha.12
  Fix regression in horizontal scroll in contents view, add it back (#4872)
  Configurable Container component from registry for some key route views. (#4871)
  Allow to deselect color in ColorPickerWidget. (#4839)
  Release 17.0.0-alpha.11
  Pagination with router params (#4698)
  Release 17.0.0-alpha.10
  feat(slate): Add css identifier to slate style menu options (#4847)
  Update Brazilian Portuguese translations (Fixes #4853)
  Convert header class to function (#4767)
  ...
* master:
  Add a marker in the props for `RenderBlocks` in case that we have a container (#4932)
  Update the 'version addded' information regarding the Grid block in docs
  Release 17.0.0-alpha.16
  Grid block in core + primitive Container block (#3180)
  Release 17.0.0-alpha.15
  Fix changelog message and docs for #4848 (#4927)
  Add Storybook story for useDetectClickOutside hook with several demos (#4923)
  Fix the experimental add new block button position, compensate the ic… (#4924)
  Use proper heading tag (depending on the headline) in default listing template (#4848)
  Fix Annontools storyBook (#4921)
@netlify
Copy link

netlify bot commented Jul 5, 2023

Deploy Preview for volto canceled.

Name Link
🔨 Latest commit d240400
🔍 Latest deploy log https://app.netlify.com/sites/volto/deploys/654614a95866ab00081a48cd

@cypress
Copy link

cypress bot commented Jul 5, 2023

Passing run #7187 ↗︎

0 577 20 0 Flakiness 0
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.

Details:

Merge branch 'typescript-support-in-core' into registryinownpackage
Project: Volto Commit: 41ef1552a9
Status: Passed Duration: 17:37 💡
Started: Sep 13, 2023 10:28 AM Ended: Sep 13, 2023 10:46 AM

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

Copy link
Member

@davisagli davisagli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sneridagh What is the benefit of moving it? Won't it potentially cause issues with hoisting?

@sneridagh
Copy link
Member Author

@davisagli World domination! ;) This will allow us to use the add-on registry somewhere else outside Volto. I'm experimenting with adding it to a NextJS build. I have a PoC already working :) It's quite promising.

Base automatically changed from typescript-support-in-core to master September 18, 2023 11:45
* master: (31 commits)
  Refactor Content Rename Model (#4971)
  Refactor Content Tags Modal  (#4970)
  Refactor Content workflow Modal  (#4969)
  Refactor Content Property Model  (#4968)
  Refactor Sidebar (#4965)
  Refactor PersonalTool component (#4954)
  Fix standalone navigation action call if expander is set (#5197)
  Fix api convenience buildout build
  Fix instruction to fetch add-on from repo (#5196)
  Remove JSON files from being linted by ESlint, since it's not its pur… (#5194)
  Release generate-volto 7.0.0-alpha.8
  Add missing empty lock to acceptance generator addon folder (#5193)
  Release generate-volto 7.0.0-alpha.7
  Release 17.0.0-alpha.27
  TypeScript support in core (#4662)
  Update delete content modal for link integrity (#4786)
  Add external className to slate Link view. (#5188)
  Release generate-volto 7.0.0-alpha.6
  Fix addon i18n local command when executed outside the scope of a Volto project. (#5181)
  Release 17.0.0-alpha.26
  ...
@mtoepfl
Copy link

mtoepfl commented Sep 30, 2023

I`m going to test this branch with my mtoepfl-typescript branch.

In which I try to "merge" my work from last year sprint in Namur, where I type some basics like src/helpers/index.ts and first blocks like Title and Listing.

I put the types in extra .d.ts files where possible, so the "confusion" for none-typescript developers is minimal. Also if they shadow core-blocks and they are able to inherit from this types easily and extend it.

I`m looking forward for your feedback and to discuss this changes in person soon!

* main: (36 commits)
  Fix master-> main renaming in tests and docs (#5251)
  Release generate-volto 7.0.1
  Move the news item to the right place
  Update to latest volto-testing in generator (#5248)
  Release @plone/volto-testing 4.0.0
  Release generate-volto 7.0.0
  Update generators to final Volto 17 (#5247)
  Sync proper 17.0.0 release notes including all notes for the final release.
  Release 17.0.0
  Update npmignore to ignore .yarn folder
  Release generate-volto 7.0.0-alpha.12
  Update Plone and Volto versions in generators (#5246)
  Release generate-volto 7.0.0-alpha.11
  Fix parser in addon generator boilerplate (#5243)
  mention ipn website (#5241)
  Release 17.0.0-alpha.30
  Upgrade to latest release-it
  Fix dependency problem, 'moment-locales-webpack-plugin' can't be in devDeps, since Razzle needs it in the projects. (#5236)
  Release 17.0.0-alpha.28
  Release generate-volto 7.0.0-alpha.10
  ...
Copy link

@mtoepfl mtoepfl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a first review. Sorry for being nitpicking, but as I understood you asked me for feedback especially on typings.

As said, I will test it out. But in my opinion this type of utility can show the benifits of strong typing very well.

export type AddonReducersConfig = {};
export type AddonRoutesConfig = {};
export type SlotsConfig = {};

export type ComponentsConfig = {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI you can write this more readable as:

export type ComponentsConfig = Record<string, { component: React.ComponentType }>;

As far as I know, the used syntax is prefered if you extend this types with other attributes, eg.:

export type ComponentsConfig = {
   [key: string]: { component: React.ComponentType };
   name2: { component: Function; };
   name3: { component: string; };
};

/**
* The group of the block
*/
blockSchema?: ({ props, intl }: { props: unknown; intl: unknown }) => object;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another readability thingy, not needed twice:

blockSchema?: ({ props, intl }: { props: unknown; intl: unknown }) => object;

blockSchema?: (payload: { props: unknown; intl: unknown }) => object;

also Record<string, unkown> instead of object seams more explicit to me in this cases.

packages/registry/src/index.ts Outdated Show resolved Hide resolved
* main: (38 commits)
  A11y - Updated aria-labels for landmarks, added landmark for sidebar and plug skiplinks (#5290)
  (FIX): put padding so the text is not clipped (#5305)
  Add upgrade docs for users of `@kitconcept/volto-blocks-grid` addon (#5333)
  Add new multilingual acceptance tests with Seamless mode enabled (#5332)
  Fix reference to installation (#5328)
  Fix compare translations view (#5327)
  Release 17.2.0
  Fix to return correct results when loading the search block from a URL (#5298)
  Allow multiple path criteria (#5317)
  Release 17.1.1
  Added guard in `flattenScales` in edge case image is undefined (#5318)
  Normalize the shape of the image component `item` prop if it contains the serialized object after creation to match the one in the catalog. (#5266)
  Release 17.1.0
  move the function to get the lead image sizes to the block configuration (#5289)
  Removed default aspect-ratio from Image component (#5278)
  Added support for `blocksConfig` configuration in the listing block (#5310)
  fix: logo and login storybook (#5286)
  Refactor Logo component to improve the conditional link to the root (#5280)
  Fix hierarchy of readme headings
  Clean up readme and install docs (#5287)
  ...
@sneridagh
Copy link
Member Author

sneridagh commented Oct 28, 2023

@mtoepfl I added your suggestions.

I also updated the latest updates from @plone/client in here. I'm foreseeing a new package @plone/types because we will need to share the types across packages outside Volto. For now it's easier to develop types where the action is happening (which I think is the client). We can postpone it until they are more "stable" for now it's fine to sync them from time to time.

@stevepiercy I've added a README here, based on other docs that we have and I made it "agnostic" not tied to Volto necessarily. Please take a look and sorry in advance, I did it quickly and might have lots of inconsistencies. I might have another look tomorrow. I would like to have this excerpt in here because I want the package to be self-explaining (eg. someone that comes out of the blue and must understand the capabilities of this package, being comprehensive enough for someone alien to Volto is paramount).

Copy link
Collaborator

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly English grammar and syntax, a few one sentence per line style things, and a few questions.

news/4949.feature Outdated Show resolved Hide resolved
news/4662.feature Outdated Show resolved Hide resolved
packages/registry/create-theme-addons-loader.js Outdated Show resolved Hide resolved
packages/registry/package.json Outdated Show resolved Hide resolved
"maintainers": [
{
"name": "Plone Foundation",
"email": "plone-developers@lists.sourceforge.net",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This list is unused. What is the source? That should be fixed, too.

https://sourceforge.net/p/plone/mailman/plone-developers/

Suggested change
"email": "plone-developers@lists.sourceforge.net",

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw this one in a lot of packages. Maybe we should bring it to the steering circle.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to the agenda: https://docs.google.com/document/d/1Iafw7MuTnG3l1j3fB1TbMgtADlhJGclSk7S8K0tTXeA/edit. If possible, can a merge be delayed until after the next meeting on Thu, Nov 2?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I visited Alpha Centauri to the planning department, rappelled to the cellar with a headlamp, into the disused lavatory, pried opened the stuck file cabinet, fought off the leopard to view the display, then filed a complaint.

This one was overlooked, but it should not block merging. Instead I can open a new issue until we can bring it to the steering committee or we can make an executive decision for what should be the effective email address, if any.

packages/registry/README.md Outdated Show resolved Hide resolved
packages/registry/README.md Outdated Show resolved Hide resolved
packages/registry/README.md Outdated Show resolved Hide resolved
packages/registry/README.md Outdated Show resolved Hide resolved
packages/registry/README.md Outdated Show resolved Hide resolved
sneridagh and others added 5 commits October 31, 2023 11:54
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Copy link
Collaborator

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple more fixes, and it should be good to go. I also pushed up a few more words to ignore when running Vale for spell check.

packages/registry/README.md Outdated Show resolved Hide resolved
packages/registry/README.md Outdated Show resolved Hide resolved
packages/registry/README.md Outdated Show resolved Hide resolved
packages/registry/README.md Outdated Show resolved Hide resolved
packages/registry/README.md Outdated Show resolved Hide resolved
sneridagh and others added 2 commits November 2, 2023 13:19
Co-authored-by: Steve Piercy <web@stevepiercy.com>
* main:
  Add support for TS files in add-on registry shadowing system (#5354)
  Fix Sphinx toctree warnings from included CHANGELOG.md (#5135)
  Remove regex from sphinx-copybutton config, now that linenos are excl… (#5346)
  Release 17.3.0
  Fix DatetimeWidget on FF, the button default if no type is set is sen… (#5343)
  Call applyBlockDefaults from addBlock/insertBlock, add initialValue() configuration option for blocks (#5320)
@sneridagh
Copy link
Member Author

“There’s no point in acting surprised about it. All the planning charts and demolition orders have been on display at your local planning department in Alpha Centauri for 50 of your Earth years, so you’ve had plenty of time to lodge any formal complaint and it’s far too late to start making a fuss about it now. … What do you mean you’ve never been to Alpha Centauri? Oh, for heaven’s sake, mankind, it’s only four light years away, you know. I’m sorry, but if you can’t be bothered to take an interest in local affairs, that’s your own lookout. Energize the demolition beams.”

― Douglas Adams, The Hitchhiker's Guide to the Galaxy

Quoting master Adams, as nobody filled any complain :) I'm about to merge this one, starting the 18 alpha phase, continuing with our plans for world domination.

/cc @plone/volto-team

@sneridagh sneridagh merged commit 2fb8128 into main Nov 4, 2023
49 checks passed
@sneridagh sneridagh deleted the registryinownpackage branch November 4, 2023 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants