A scaffolding tool for generating a basic structure for a Cordova plugin.
% npm init @havesource/cordova-plugin@latest
Note: 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.json
for thename
andcordova.id
fields.plugin.xml
for theid
attribute.
-
Readable Name: (Cordova Sample Plugin)
This is a human-readable name for the plugin, which is set in the
name
element of theplugin.xml
file. -
Description: (A sample Cordova plugin.)
A brief description of your plugin, which will be added to the
description
field in the npmpackage.json
andplugin.xml
files. -
License (SPDX format)
Specify the license your plugin will use, following the SPDX format.
It will be added to the
license
field in the npmpackage.json
andplugin.xml
files.If you have a custom or proprietary license, enter
"SEE LICENSE IN LICENSE"
, and be sure to create aLICENSE
file. -
Author
This is optional.
If provided, it will be added to the
author
field in the npmpackage.json
andplugin.xml
files.When empty, the
author
field 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
platforms
section in thepackage.json
, the correspondingplatform
elements 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.