A scaffolding tool for generating a basic structure for a Cordova plugin.
% npm init @havesource/cordova-plugin@latestNote: Omitting the @latest tag will use the previously cached version instead of fetching the newest release.
% npm install -g @havesource/cordova-plugin@latest
% create-cordova-plugin% npm install @havesource/cordova-plugin@latest
% npx create-cordova-plugin-
ID (npm package & directory name): (cordova-plugin-sample)
This is the directory and plugin name.
The following area will be set:
package.jsonfor thenameandcordova.idfields.plugin.xmlfor theidattribute.
-
Readable Name: (Cordova Sample Plugin)
This is a human-readable name for the plugin, which is set in the
nameelement of theplugin.xmlfile. -
Description: (A sample Cordova plugin.)
A brief description of your plugin, which will be added to the
descriptionfield in the npmpackage.jsonandplugin.xmlfiles. -
License (SPDX format)
Specify the license your plugin will use, following the SPDX format.
It will be added to the
licensefield in the npmpackage.jsonandplugin.xmlfiles.If you have a custom or proprietary license, enter
"SEE LICENSE IN LICENSE", and be sure to create aLICENSEfile. -
Author
This is optional.
If provided, it will be added to the
authorfield in the npmpackage.jsonandplugin.xmlfiles.When empty, the
authorfield will still be created but with empty values. -
Supported Platform: (Press to select, to toggle all, to invert selection, and to proceed)
Select the platforms that your plugin will support.
The tool will populate the
platformssection in thepackage.json, the correspondingplatformelements in theplugin.xml, and create mocked native folders and files. -
API Name: (SamplePlugin)
This will be the name used when creating the native class files of the supported platform you pick and the front-end JS API of your plugin.
-
Android Package Name: (com.example.sampleplugin)
This prompt appears if you selected Android as a supported platform. Enter the package name that will be used for the Android plugin code. This should be distinct from your app’s package name.