Create custom cordova plugin for ionic
Install plugman for create a custom plugin
https://www.npmjs.com/package/plugman
CLI command:
npm install -g plugman
Create a plugin using plugman:
plugman create --name AppName --plugin_id cordova-plugin-myapp --plugin_version 0.0.1
cd AppName
Create a package json for the plugin:
plugman createpackagejson AppName
Add a platform for android and ios:
plugman platform add --platform_name android
plugman platform add --platform_name ios
Upload the plugin in github repositary
Eg: https://github.com/AndroidManikandan5689/Custom-cordova-plugin-example
Publish the plugin in NPM repository
npm publish --access=public
Login npm for publish the plugin
npm login
Check the existing user through command line
npm whoami
Install the plugin in Ionic/Cordova project from the npm repository
npm install <plugin_name>
ionic cordova plugin add <plugin_name>
(or)
Install the plugin from local director to node modules folder
npm install <local_directory/plugin folder>
Eg: npm install pluginsrc/MicrChequeReader
Install the plugin from local director to ionic plugins folder
ionic cordova plugin add <plugin_id>
Create a package json for the plugin:
plugman createpackagejson AppName
Add a platform for android and ios:
plugman platform add --platform_name android
plugman platform add --platform_name ios
Upload the plugin in github repositary
Eg: https://github.com/AndroidManikandan5689/Custom-cordova-plugin-example
Publish the plugin in NPM repository
npm publish --access=public
Login npm for publish the plugin
npm login
Check the existing user through command line
npm whoami
Install the plugin in Ionic/Cordova project from the npm repository
npm install <plugin_name>
ionic cordova plugin add <plugin_name>
(or)
Install the plugin from local director to node modules folder
npm install <local_directory/plugin folder>
Eg: npm install pluginsrc/MicrChequeReader
Install the plugin from local director to ionic plugins folder
ionic cordova plugin add <plugin_id>
Comments
Post a Comment