English 中文(简体)
Cordova - Plugman
  • 时间:2024-10-18

Cordova - Plugman


Previous Page Next Page  

Cordova Plugman is a useful command pne tool for instalpng and managing plugins. You should use plugman if your app needs to run on one specific platform. If you want to create a cross-platform app you should use cordova-cp which will modify plugins for different platforms.

Step 1 - Instalpng Plugman

Open the command prompt window and run the following code snippet to install plugman.

C:UsersusernameDesktopCordovaProject>npm install -g plugman

Step 2 - Instalpng Plugins

To understand how to install the Cordova plugin using plugman, we will use the Camera plugin as an example.

C:UsersusernameDesktopCordovaProject>plugman  
   install --platform android --project platformsandroid  
   --plugin cordova-plugin-camera 
   plugman uninstall --platform android --project platformsandroid  
   --plugin cordova-plugin-camera 

We need to consider three parameters as shown above.

    --platform − platform that we are using (android, ios, amazon-fireos, wp8, blackberry10).

    --project − path where the project is built. In our case, it is platformsandroid directory.

    --plugin − the plugin that we want to install.

If you set vapd parameters, the command prompt window should display the following output.

Plugman Install CMD Output

Additional Methods

You can use the uninstall method in similar way.

C:UsersusernameDesktopCordovaProject>plugman uninstall  
   --platform android --project platformsandroid --plugin cordova-plugin-camera 

The command prompt console will display the following output.

Plugman Uninstall CMD Output

Plugman offers some additional methods that can be used. The methods are psted in the following table.

S.No Method & Details
1

install

Used for instalpng Cordova plugins.

2

uninstall

Used for uninstalpng Cordova plugins.

3

fetch

Used for copying Cordova plugin to specific location.

4

prepare

Used for updating configuration file to help JS module support.

5

adduser

Used for adding user account to the registry.

6

pubpsh

Used for pubpshing plugin to the registry.

7

unpubpsh

Used for unpubpshing plugin from the registry.

8

search

Used for searching the plugins in the registry.

9

config

Used for registry settings configuration.

10

create

Used for creating custom plugin.

11

platform

Used for adding or removing platform from the custom created plugin.

Additional Commands

If you are stuck, you can always use the plugman -help command. The version can be checked by using plugman -v. To search for the plugin, you can use plugman search and finally you can change the plugin registry by using the plugman config set registry command.

NOTE

Since Cordova is used for cross platform development, in our subsequent chapters we will use Cordova CLI instead of Plugman for instalpng plugins.

Advertisements