Skip to content
Browse files
Merge pull request #113 from raphinesse/fix-orgy
Fix orgy
  • Loading branch information
raphinesse committed Apr 10, 2019
2 parents c268cac + 2550497 commit 8d1cd21373efb7bf58494f54f91b66c0f05c4671
Show file tree
Hide file tree
Showing 12 changed files with 206 additions and 155 deletions.
@@ -0,0 +1,13 @@
Create a plugin

Usage: plugman create PARAMETER... [OPTION]...

--name <pluginName> The name of the plugin
--plugin_id <pluginID> An ID for the plugin, ex:
--plugin_version <version> A version for the plugin, ex: 0.0.1

--path <directory> An absolute or relative path for the directory
where the plugin project will be created
--variable NAME=VALUE Extra variables such as description or Author
@@ -0,0 +1,3 @@
Derive a package.json file for a plugin based on its plugin.xml

Usage: plugman createpackagejson <plugin directory>

This file was deleted.

@@ -0,0 +1,26 @@
Install a plugin

Usage: plugman install PARAMETER... [OPTION]...

--platform <platform> The platform for which to install the plugin
--project <directory> Path to a cordova-generated project of <platform>
--plugin <plugin> The spec of the plugin to install. Anything that
could be passed to npm install

--variable NAME=VALUE Some plugins require install-time variables to be
defined. These could be things like API keys/tokens
or other app-specific variables.
--www <directory> www assets for the plugin will be installed into
this directory. Default is to install into the
standard www directory for the platform specified
--plugins_dir <directory> a copy of the plugin will be stored in this
directory. Default is to install into the
<project directory>/plugins folder
--searchpath <directory> when looking up plugins by ID, look in this
directory and each of its subdirectories for the
plugin before hitting the registry. Multiple search
paths can be used by either specifying the flag
multiple times, or by separating paths with a
delimiter (: on 'nix, ; on Windows).
@@ -0,0 +1,4 @@
Add or remove a platform to a plugin

Usage: plugman platform add --platform_name <platform>
plugman platform remove --platform_name <platform>
@@ -0,0 +1,17 @@
Usage: plugman [OPTION]... <command>

These are the available plugman commands:

Manage plugins in a Cordova project
install Install a plugin into a Cordova project
uninstall Uninstall a plugin from a Cordova project

Author plugins
create Create a plugin
createpackagejson Add a package.json file to a plugin
platform Add and remove platforms from a plugin

Global options:
--help, -h Show help for <command> or this if none was given
--debug, -d Enable verbose output
--version, -v Display the plugman version
@@ -0,0 +1,9 @@
Uninstall a plugin

Usage plugman uninstall PARAMETER...

--platform <platform> The platform from which to install the plugin
--project <directory> Path to a cordova-generated project of <platform>
--plugin <plugin-id> The ID of the plugin to remove; see attribute 'id'
of element 'plugin' in plugin.xml
24 main.js
@@ -20,13 +20,20 @@

// copyright (c) 2013 Andrew Lunny, Adobe Systems

// Register custom fail handler for uncaughtException event
process.on('uncaughtException', fail);

// On unhandled promise rejection, log it to STDERR and exit with code 1

const url = require('url');
const path = require('path');

const nopt = require('nopt');

const pkg = require('./package');
const help = require('./src/help');
const commands = require('./src/commands');
const plugman = require('./plugman');
const { cordova_platforms } = require('cordova-lib');

@@ -48,8 +55,8 @@ const known_opts = {
searchpath: [path, Array],
save: Boolean,
name: String,
platform_id: String,
platform_version: String,
plugin_id: String,
plugin_version: String,
plugins_dir: String
const shortHands = { var: ['--variable'], v: ['--version'], h: ['--help'] };
@@ -65,8 +72,6 @@ if (cli_opts.plugins_dir || cli_opts.project) {
path.join(cli_opts.project, 'cordova', 'plugins');

process.on('uncaughtException', fail);

// Set up appropriate logging based on events
if (cli_opts.debug) {
plugman.on('verbose', console.log);
@@ -83,18 +88,19 @@ plugman.on('error', console.error);
if (cli_opts.version) {
} else if ( {
} else if (plugman.commands[cmd]) {
console.log(help(commands[cmd] ? cmd : 'summary'));
} else if (commands[cmd]) {
} else {
process.exitCode = 1;

function fail (error) {
if (cli_opts.debug) {
if (cli_opts && cli_opts.debug) {
process.exitCode = 1;
@@ -18,7 +18,10 @@
"engineStrict": true,
"dependencies": {
"cordova-lib": "^9.0.0",
"nopt": "^4.0.1"
"loud-rejection": "^1.6.0",
"nopt": "^4.0.1",
"p-each-series": "^1.0.0",
"p-try": "^2.2.0"
"devDependencies": {
"eslint": "^5.15.3",
@@ -24,10 +24,10 @@ describe('nopt interface check', () => {
it('parameters without assignment operator should be assigned', () => {
const knownOptions = main.__get__('known_opts');
const shortHands = main.__get__('shortHands');
const cli_opts = nopt(knownOptions, shortHands, ['plugman', 'create', '--name', 'MyName', '--platform_id', 'MyId', '--platform_version', '1.0.0']);
const cli_opts = nopt(knownOptions, shortHands, ['plugman', 'create', '--name', 'MyName', '--plugin_id', 'MyId', '--plugin_version', '1.0.0']);


0 comments on commit 8d1cd21

Please sign in to comment.