opral / inlang-message-sdk

0 stars 0 forks source link

feat: settings schema in installedPlugin & installedMessagelintRule #3

Closed NilsJacobsen closed 3 months ago

NilsJacobsen commented 3 months ago

I want to build the settings ui component based on the schema I get from the installed lint rules and plugins. The installed API only gives me access to id displayName description module.

Porposal:

export type InstalledPlugin = {
    id: Plugin["id"]
    displayName: Plugin["displayName"]
    description: Plugin["description"]
    /**
     * The module which the plugin is installed from.
     */
    module: string
    // disabled: boolean
+   settingsSchema: Plugin["settingsSchema"]
}

Same for message lint rule...

        const installedPlugins = () => {
            if (!resolvedModules()) return []
            return resolvedModules()!.plugins.map((plugin) => ({
                id: plugin.id,
                displayName: plugin.displayName,
                description: plugin.description,
                module:
                    resolvedModules()?.meta.find((m) => m.id.includes(plugin.id))?.module ??
                    "Unknown module. You stumbled on a bug in inlang's source code. Please open an issue.",
+                settingsSchema: plugin.settingsSchema,
            })) satisfies Array<InstalledPlugin>
        }

Same for message lint rule...

It seems like an easy PR. @jurgen.leschner, let me know if I should open a PR to add this.

linear[bot] commented 3 months ago

MESDK-38 feat: settings schema in installedPlugin & installedMessagelintRule

samuelstroschein commented 3 months ago

@nils.jacobsen jürgen is OOO this week. this change seems more than reasonable. hence, feel free to open a PR, put me in review and let's get this out

NilsJacobsen commented 3 months ago

Alright 👍