@ionic/cli-utils
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -184,2 +184,3 @@ /// <reference types="inquirer" /> | ||
unload(): Promise<void>; | ||
prerun(inputs: CommandLineInputs, options: CommandLineOptions): Promise<void | number>; | ||
run(inputs: CommandLineInputs, options: CommandLineOptions, validationErrors: ValidationError[]): Promise<void | number>; | ||
@@ -186,0 +187,0 @@ execute(inputs?: CommandLineInputs): Promise<void>; |
@@ -11,2 +11,3 @@ import * as superagent from 'superagent'; | ||
unload(): Promise<void>; | ||
prerun(inputs: CommandLineInputs, options: CommandLineOptions): Promise<void | number>; | ||
run(inputs: CommandLineInputs, options: CommandLineOptions, validationErrors: ValidationError[]): Promise<void | number>; | ||
@@ -13,0 +14,0 @@ execute(inputs?: CommandLineInputs): Promise<void>; |
@@ -27,2 +27,5 @@ "use strict"; | ||
} | ||
prerun(inputs, options) { | ||
return __awaiter(this, void 0, void 0, function* () { }); | ||
} | ||
run(inputs, options, validationErrors) { | ||
@@ -35,2 +38,3 @@ return __awaiter(this, void 0, void 0, function* () { }); | ||
const argv = minimist(this.env.pargv, options); | ||
let r; | ||
let validationErrors = []; | ||
@@ -46,6 +50,16 @@ if (inputs) { | ||
} | ||
r = yield this.prerun(argv._, argv); | ||
if (typeof r === 'number') { | ||
if (r > 0) { | ||
throw this.exit('', r); | ||
} | ||
return; | ||
} | ||
yield utils_1.collectInputs(argv._, this.metadata); | ||
const r = yield this.run(argv._, argv, validationErrors); | ||
if (typeof r === 'number' && r > 0) { | ||
throw this.exit('', r); | ||
r = yield this.run(argv._, argv, validationErrors); | ||
if (typeof r === 'number') { | ||
if (r > 0) { | ||
throw this.exit('', r); | ||
} | ||
return; | ||
} | ||
@@ -52,0 +66,0 @@ }); |
import { Validator, Validators } from '../definitions'; | ||
export declare const validators: Validators; | ||
export declare function combine(validators: Validator[]): Validator; | ||
export declare function contains(values: string[]): Validator; |
@@ -5,3 +5,3 @@ "use strict"; | ||
exports.validators = { | ||
required: function (input, key) { | ||
required(input, key) { | ||
if (!input) { | ||
@@ -17,3 +17,3 @@ if (key) { | ||
}, | ||
email: function (input, key) { | ||
email(input, key) { | ||
if (!utils_1.isValidEmail(input)) { | ||
@@ -42,1 +42,7 @@ if (key) { | ||
exports.combine = combine; | ||
function contains(values) { | ||
return function (input) { | ||
return values.indexOf(input) !== 0; | ||
}; | ||
} | ||
exports.contains = contains; |
{ | ||
"name": "@ionic/cli-utils", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Ionic CLI Utils", | ||
@@ -5,0 +5,0 @@ "homepage": "https://ionic.io/", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
79527
2142
1