A plugin is published like any npm 2,036 package. Its package.json adds the ecosystem:cordova keyword, which tools use to find plugins, a cordova block naming the plugin ID and platforms, and optional cordovaDependencies, which the CLI checks before choosing a version (Managing Plugins):
{
"name": "cordova-plugin-booknest",
"version": "1.0.0",
"description": "Reading helpers for BookNest: font scale and reading reminders",
"keywords": ["ecosystem:cordova", "cordova-android"],
"license": "Apache-2.0",
"repository": "github:example/cordova-plugin-booknest",
"files": ["plugin.xml", "www/", "src/"],
"cordova": { "id": "cordova-plugin-booknest", "platforms": ["android"] },
"engines": {
"cordovaDependencies": { "1.0.0": { "cordova-android": ">=14.0.0" } }
}
}files keeps test folders and notes out of the tarball. Check the name is free with npm view (it returned 404 here), then do a dry run, which shows exactly what would be uploaded:
cd local-plugins/cordova-plugin-booknest
npm publish --dry-runOutput
... npm notice === Tarball Contents === npm notice 499B package.json npm notice 979B plugin.xml npm notice 2.6kB src/android/BookNestPlugin.java npm notice 344B www/booknest.js ... + cordova-plugin-booknest@1.0.0
A real npm publish needs npm login (the dry run warned about it). Keep plugin.xml's version equal to package.json's, and publish a new major version whenever you raise the <engine> floor.