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

feat(cli): extendable plugin configuration types #3858

Merged
merged 5 commits into from
Nov 30, 2020
Merged

Conversation

imhoffd
Copy link
Contributor

@imhoffd imhoffd commented Nov 25, 2020

See ionic-team/capacitor-plugins#115 for examples of plugin changes necessary for adding to the plugin config types.

App developers will need to add <reference> lines at the beginning of their config files to pull in the config types from each plugin.

Example capacitor.config.ts:

/// <reference types="@capacitor/keyboard" />

import type { CapacitorConfig } from '@capacitor/cli';

const config: CapacitorConfig = {
    appId: "com.capacitorjs.testapp",
    appName: "capacitor-testapp",
    bundledWebRuntime: false,
    webDir: "build",
    plugins: {
        Keyboard: {
            // TODO
        }
    },
    cordova: {}
}

export = config;

@imhoffd imhoffd added this to the 3.0.0 milestone Nov 25, 2020
Copy link
Member

@jcesarmobile jcesarmobile left a comment

Choose a reason for hiding this comment

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

If plugins are a separate thing, does it make sense to have types for their configurations here?
What about 3rd party plugins?
What if a plugin adds a new config option and can’t be used until a new CLI is released?

@imhoffd
Copy link
Contributor Author

imhoffd commented Nov 25, 2020

What about 3rd party plugins?

I was thinking about this, and maybe we can do something like declare module '@capacitor/cli' with the types in each plugin. I can play around with this idea. I mostly made this PR to split out these types from the allowlist PR.

@imhoffd imhoffd marked this pull request as draft November 25, 2020 17:34
@imhoffd imhoffd marked this pull request as ready for review November 29, 2020 19:43
@imhoffd imhoffd changed the title feat(cli): add types for plugins configuration feat(cli): extendable plugin configuration types Nov 30, 2020
@imhoffd imhoffd merged commit f789526 into main Nov 30, 2020
@imhoffd imhoffd deleted the config-plugins-types branch November 30, 2020 20:03
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.

2 participants