Capacitor plugins can either be added directly to your app or split out into their own packages. For the latter, use the Plugin Generator to begin.
Capacitor has a plugin generator that you can use to begin working on your plugin.
Before continuing, you may want to make sure you’re using the latest Node LTS version and npm 6+.
In a new terminal, run the following:
npm init @capacitor/plugin
The generator will prompt you for input. You can also supply command-line options (see the GitHub repo).
Now it’s up to you to make your plugin do something truly awesome! Read on to learn how to implement new functionality, test the plugin locally, and publish it on npm.