May 21, 2021 Cordova
Cordova plugman is a useful command line tool for installing and managing plug-ins. /b10> If you want your app to run on a specific platform, you should use plugman. /b11> If you are creating a cross-platform app, you should use cordova-cli, which modifies plug-ins for different platforms.
Open the command prompt window and run the following snippets of code to install the pugman.
C:\Users\username\Desktop\CordovaProject>npm install -g plugman
To show you how to install the Cordova plug-in using pugman, we'll use the Camera plug-in as an example.
C:\Users\username\Desktop\CordovaProject>plugman install --platform android --project platforms\android --plugin cordova-plugin-camera plugman uninstall --platform android --project platforms\android --plugin cordova-plugin-camera
There are three required parameters, as shown below.
- platform - the platform we use (android, ios, amazon-fire os, wp8, blackberry 10).
- Project - The path to the project build. /b10> In our example, it's the platforms, the android directory.
- plugin - the plug-in we want to install.
If you set valid parameters, the command prompt window should output the following.
You can uninstall the method in a similar way.
C:\Users\username\Desktop\CordovaProject>plugman uninstall --platform android --project platforms\android --plugin cordova-plugin-camera
The command prompt console will have the following output.
Plugman provides some additional methods that you can use. /b10> You can see it in the table below.
Serial number | Method and description |
---|---|
1 |
install Used to install the Cordova plug-in. |
2 |
uninstall Used to uninstall the Cordova plug-in. |
3 |
fetch Used to copy the Cordova plug-in to a specific location. |
4 |
prepare Used to update profiles to help with JS module support. |
5 |
adduser Used to add user accounts to the registry. |
6 |
publish Used to publish plug-ins to the registry. |
7 |
unpublish Used to unsubscribe plug-ins from the registry. |
8 |
search Used to search for plug-ins in the registry. |
9 |
config Used for registry settings configuration. |
10 |
create Used to create custom plug-ins. |
11 |
platform Used to add or remove platforms from custom-created plug-ins. |
If you're stuck, you can always use the plugman -help command. /b10> You can use plugman -v to check the version. /b11> To search for plug-ins, you can use plugman search, and finally you can use the plugman config set registry command to change the plug-in registry.
Because Cordova is typically used for cross-platform development, we'll install plug-ins using the Cordova CLI instead of Plugman in the next tutorial.