diff --git a/main.js b/main.js index 3de71a69..fadb1a19 100755 --- a/main.js +++ b/main.js @@ -36,7 +36,7 @@ const known_opts = { ], project: path, plugin: [String, path, url, Array], - version: Boolean, + version: String, help: Boolean, debug: Boolean, silent: Boolean, @@ -45,7 +45,11 @@ const known_opts = { variable: Array, www: path, searchpath: [path, Array], - save: Boolean + save: Boolean, + name: String, + platform_id: String, + platform_version: String, + plugins_dir: String }; const shortHands = { var: ['--variable'], v: ['--version'], h: ['--help'] }; diff --git a/package.json b/package.json index 38456fa5..ca0a1f98 100644 --- a/package.json +++ b/package.json @@ -17,18 +17,19 @@ }, "engineStrict": true, "dependencies": { - "cordova-lib": "8.0.0", - "nopt": "1.0.9" + "cordova-lib": "^9.0.0", + "nopt": "^4.0.1" }, "devDependencies": { - "eslint": "^4.2.0", - "eslint-config-semistandard": "^11.0.0", - "eslint-config-standard": "^10.2.1", - "eslint-plugin-import": "^2.3.0", - "eslint-plugin-node": "^5.0.0", - "eslint-plugin-promise": "^3.5.0", - "eslint-plugin-standard": "^3.0.1", - "jasmine": "^3.1.0" + "eslint": "^5.15.3", + "eslint-config-semistandard": "^13.0.0", + "eslint-config-standard": "^12.0.0", + "eslint-plugin-import": "^2.16.0", + "eslint-plugin-node": "^8.0.1", + "eslint-plugin-promise": "^4.0.1", + "eslint-plugin-standard": "^4.0.0", + "jasmine": "^3.3.1", + "rewire": "^4.0.1" }, "bin": { "plugman": "./main.js" diff --git a/spec/nopt.interface.spec.js b/spec/nopt.interface.spec.js index 88eb1b56..bedfcbf9 100644 --- a/spec/nopt.interface.spec.js +++ b/spec/nopt.interface.spec.js @@ -16,12 +16,16 @@ specific language governing permissions and limitations under the License. */ -var nopt = require('nopt'); +const nopt = require('nopt'); +const rewire = require('rewire'); +const main = rewire('../main'); + +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']); -describe('nopt interface check', function () { - // https://issues.apache.org/jira/browse/CB-7915 - it('parameters without assignment operator should be assigned', function () { - var cli_opts = nopt(null, null, ['plugman', 'create', '--name', 'MyName', '--platform_id', 'MyId', '--platform_version', '1.0.0']); expect(cli_opts.name).toEqual('MyName'); expect(cli_opts.platform_id).toEqual('MyId'); expect(cli_opts.platform_version).toEqual('1.0.0');