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 plugins metadata from OB to packages #9400

Closed
ma2ciek opened this issue Apr 1, 2021 · 7 comments
Closed

Move plugins metadata from OB to packages #9400

ma2ciek opened this issue Apr 1, 2021 · 7 comments
Assignees
Labels
squad:platform Issue to be handled by the Platform team. type:task This issue reports a chore (non-production change) and other types of "todos".

Comments

@ma2ciek
Copy link
Contributor

ma2ciek commented Apr 1, 2021

Scope of this ticket:

  • Make a final proposal for the metadata format and verify whether putting that into package.json is a good idea (taking into account that we'll have quite a lot of data there).
  • Move the data from OB to each package and update it to the new format (excludes HTML format - it'll be covered separately).
  • We don't need to scan existing plugins currently. We can base on what's available in OB right now.

[from meeting notes]

Which plugins do we cover?

  • Only the glue code. No reason to cover *Editing, *UI
  • We need to cover soft-deps of other plugins (e.g. CloudServices)

Plugins data

  • Essential data
    • plugin name
    • human-readable plugin name
    • description
    • link to a feature guide
    • path to the plugin
    • additional toolbars
    • requires (soft and other weird requirements)
    • UI components:
      • name
      • path to SVG
        • what about plugins that use icons from other package?
        • relative if local
        • or npm's path: @ckeditor/ckeditor5-core/theme/icons/...
      • type (button, dropdown, split button)
      • additional info (e.g. dropdown config - with or without text/icon?)
      • target toolbar
        • if defined, OB adds it automatically to this toolbar
      • if not, the user can
  • Online builder data
    • metadata of all packages + source SVG files
    • exclusions
      • what about exclusion groups? e.g. upload adapters
      • gets more complicated e.g. in the case of RTE plugins
    • which sample
    • whether to show a certain plugin (e.g. Paragraph, Essentials)
    • "requiresServer"
    • private → premium

The default configuration of builds

  • duplicates the src/ckeditor.js file of each build
  • might be reasonable to write a parser to exclude builtinPlugins and defaultConfig
@ma2ciek ma2ciek added type:task This issue reports a chore (non-production change) and other types of "todos". squad:platform Issue to be handled by the Platform team. squad:dx labels Apr 1, 2021
@Reinmar
Copy link
Member

Reinmar commented Apr 6, 2021

package.json vs separate file:

  • quite a lot of data, would make package.json a lot longer
  • we need to have this published on npm anyway
  • potential performance implications if it lands in package.json
  • separate file - easier for people to learn about it
  • separate file - adds a bit to the mess in each package's root dir
  • separate file - possible to have JS if needed
    • may be harder for integrators to use it
    • but there's an option for the future if we really need it

Decision: Let's have this metadata in a separate file.

File name?

  • package may expose not only plugins
  • we may want to document e.g. a theme in the future
  • do any other systems (Angular, React, other frameworks/cms-es) expose their metadata? what name do they use?

For now: ckeditor-metadata.json

@Reinmar Reinmar added this to the iteration 42 milestone Apr 6, 2021
@ma2ciek ma2ciek self-assigned this Apr 6, 2021
@ma2ciek
Copy link
Contributor Author

ma2ciek commented Apr 6, 2021

This is my current proposal:

interface PluginMetadata {
    /** The human readable plugin name. */
    name: string;

    /** The plugin's JS class name */
    className: string;

    /** A path to the plugin, relative to the metadata file. */
    path: string;

    /** The plugin's description. */
    description: string;

    /** The plugin's documentation link. */
    docs: string;

    /** The plugin's soft requirements and other not explicit requirements.*/
    requires?: Array<string>;

    /**
     * All toolbar components that the plugin exposes.
     * (buttons and dropdowns, possibly others in the future).
     */
    uiComponents?: Array<UIComponent>;

    /**
     * All toolbar names that are registered by the plugin.
     * These names need to contain the full configuration path
     * (e.g. `table.contentToolbar` and `table.tableToolbar` for `Table`).
     */
    registeredToolbars: Array<string>;

    htmlOutput?: any // To be done. 
}

interface UIComponent {
    /** The type of the component. */
    type: 'button' | 'dropdown' | 'split button';

    /** The component name that the plugin exposes. */
    name: string;

    /** A path to the SVG icon for button-like components. */
    iconPath?: string;

    /** Text content for dropdown-like components. */
    label?: string;

    /**
     * The target toolbars of this UI component. `[ "main" ]` by default.
     *
     * Note that some features may be added to multiple toolbars like `comments`.
     */
    targetToolbars?: Array<string>;
}

I changed from targetToolbar to targetToolbars to support comments and possibly other features in the future that can be placed in various toolbars (e.g. alignment).

@psmyrek
Copy link
Contributor

psmyrek commented Apr 8, 2021

Currently, the plugin preset in Online Builder contains also excludes array to define conflicting plugins. Do we need it in the PluginMetadata?

@ma2ciek
Copy link
Contributor Author

ma2ciek commented Apr 8, 2021

Currently, the plugin preset in Online Builder contains also excludes array to define conflicting plugins. Do we need it in the PluginMetadata?

We have agreed that we'll keep this data in the OB separately for now as this won't be easy for 3rd-party plugins to provide information there - we'd need to introduce some kind of exclusionGroup first and this can be done as a follow-up. (And unfortunately, this approach would not work for some scenarios currently).

@Reinmar
Copy link
Member

Reinmar commented Apr 12, 2021

@ma2ciek What you proposed looks good to me. I'd only consider naming properties of  UIComponents after our UI lib. I think that things like a label are called differently there.

@Reinmar
Copy link
Member

Reinmar commented Apr 12, 2021

Also, perhaps the type of a UIComponent might be the name of the view class? So Button, Dropdown, SplitButton or even ButtonView, etc.

ma2ciek added a commit that referenced this issue Apr 16, 2021
Internal: Add plugins metadata. Closes #9400. Closes #9401.
@ma2ciek
Copy link
Contributor Author

ma2ciek commented Apr 16, 2021

I applied these changes ☝️

Closed by #9473.

@ma2ciek ma2ciek closed this as completed Apr 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
squad:platform Issue to be handled by the Platform team. type:task This issue reports a chore (non-production change) and other types of "todos".
Projects
None yet
Development

No branches or pull requests

3 participants