Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ionic/cli-framework

Package Overview
Dependencies
Maintainers
15
Versions
203
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ionic/cli-framework - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

12

CHANGELOG.md

@@ -6,2 +6,14 @@ # Change Log

<a name="1.5.0"></a>
# [1.5.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/cli-framework@1.4.0...@ionic/cli-framework@1.5.0) (2018-11-27)
### Features
* **help:** weaken the color of deprecated commands and options ([66f48d8](https://github.com/ionic-team/ionic-cli/commit/66f48d8))
* **shell:** error for subprocesses that exit via signal ([3af1cee](https://github.com/ionic-team/ionic-cli/commit/3af1cee))
<a name="1.4.0"></a>

@@ -8,0 +20,0 @@ # [1.4.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/cli-framework@1.3.0...@ionic/cli-framework@1.4.0) (2018-11-20)

1

errors.d.ts

@@ -5,2 +5,3 @@ import { ValidationError } from './definitions';

export declare const ERROR_SHELL_NON_ZERO_EXIT = "ERR_ICF_SHELL_NON_ZERO_EXIT";
export declare const ERROR_SHELL_SIGNAL_EXIT = "ERR_ICF_SHELL_SIGNAL_EXIT";
export declare const ERROR_SHELL_COMMAND_NOT_FOUND = "ERR_ICF_SHELL_COMMAND_NOT_FOUND";

@@ -7,0 +8,0 @@ export declare const ERROR_IPC_MODULE_INACCESSIBLE = "ERR_ICF_IPC_MODULE_INACCESSIBLE";

@@ -8,2 +8,3 @@ "use strict";

exports.ERROR_SHELL_NON_ZERO_EXIT = 'ERR_ICF_SHELL_NON_ZERO_EXIT';
exports.ERROR_SHELL_SIGNAL_EXIT = 'ERR_ICF_SHELL_SIGNAL_EXIT';
exports.ERROR_SHELL_COMMAND_NOT_FOUND = 'ERR_ICF_SHELL_COMMAND_NOT_FOUND';

@@ -10,0 +11,0 @@ exports.ERROR_IPC_MODULE_INACCESSIBLE = 'ERR_ICF_IPC_MODULE_INACCESSIBLE';

1

lib/command.d.ts

@@ -62,2 +62,1 @@ import { CommandInstanceInfo, CommandLineInputs, CommandLineOptions, CommandMapGetter, CommandMetadata, CommandMetadataInput, CommandMetadataOption, CommandPathItem, HydratedCommandMetadata, HydratedNamespaceMetadata, ICommand, ICommandMap, INamespace, INamespaceMap, NamespaceLocateOptions, NamespaceLocateResult, NamespaceMapGetter, NamespaceMetadata } from '../definitions';

export declare function generateCommandPath<C extends ICommand<C, N, M, I, O>, N extends INamespace<C, N, M, I, O>, M extends CommandMetadata<I, O>, I extends CommandMetadataInput, O extends CommandMetadataOption>(cmd: C): Promise<CommandPathItem<C, N, M, I, O>[]>;
export declare function isCommandVisible<C extends ICommand<C, N, M, I, O>, N extends INamespace<C, N, M, I, O>, M extends CommandMetadata<I, O>, I extends CommandMetadataInput, O extends CommandMetadataOption>(cmd: HydratedCommandMetadata<C, N, M, I, O>): Promise<boolean>;

@@ -8,3 +8,2 @@ "use strict";

const string_1 = require("../utils/string");
const options_1 = require("./options");
const validators_1 = require("./validators");

@@ -236,8 +235,1 @@ class BaseCommand {

exports.generateCommandPath = generateCommandPath;
function isCommandVisible(cmd) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const ns = yield cmd.namespace.getMetadata();
return (!cmd.groups || !cmd.groups.includes(options_1.CommandGroup.Hidden)) && (!ns.groups || !ns.groups.includes(options_1.NamespaceGroup.Hidden));
});
}
exports.isCommandVisible = isCommandVisible;
import { CommandMetadata, CommandMetadataInput, CommandMetadataOption, HydratedCommandMetadata, HydratedNamespaceMetadata, ICommand, INamespace, NamespaceLocateResult, NamespaceMetadata } from '../definitions';
import { Colors } from './colors';
export declare enum CommandGroup {
Deprecated = "deprecated",
Hidden = "hidden",
Beta = "beta",
Experimental = "experimental"
}
export declare enum NamespaceGroup {
Deprecated = "deprecated",
Hidden = "hidden",
Beta = "beta",
Experimental = "experimental"
}
export declare enum OptionGroup {
Deprecated = "deprecated",
Hidden = "hidden",
Beta = "beta",
Experimental = "experimental",
Advanced = "advanced"
}
export declare function isOptionVisible<O extends CommandMetadataOption>(opt: O): Promise<boolean>;
export declare function isCommandVisible<C extends ICommand<C, N, M, I, O>, N extends INamespace<C, N, M, I, O>, M extends CommandMetadata<I, O>, I extends CommandMetadataInput, O extends CommandMetadataOption>(cmd: HydratedCommandMetadata<C, N, M, I, O>): Promise<boolean>;
export declare abstract class HelpFormatter {

@@ -34,23 +55,2 @@ protected readonly colors: Colors;

export declare class NamespaceStringHelpFormatter<C extends ICommand<C, N, M, I, O>, N extends INamespace<C, N, M, I, O>, M extends CommandMetadata<I, O>, I extends CommandMetadataInput, O extends CommandMetadataOption> extends NamespaceHelpFormatter<C, N, M, I, O> {
/**
* Insert text that appears before a commands's summary.
*
* @param meta: The metadata of the command.
*/
formatBeforeCommandSummary?(meta: HydratedCommandMetadata<C, N, M, I, O>): Promise<string>;
/**
* Insert text before summaries of listed subnamespaces.
*
* @param meta The metadata of the namespace.
* @param commands An array of the metadata of the namespace's commands.
*/
formatBeforeNamespaceSummary?(meta: HydratedNamespaceMetadata<C, N, M, I, O>, commands: ReadonlyArray<HydratedCommandMetadata<C, N, M, I, O>>): Promise<string>;
/**
* Insert text before the namespace's summary.
*/
formatBeforeSummary?(): Promise<string>;
/**
* Insert text after the namespace's summary.
*/
formatAfterSummary?(): Promise<string>;
formatHeader(): Promise<string>;

@@ -66,2 +66,20 @@ formatSummary(): Promise<string>;

/**
* Insert text before the namespace's summary.
*
* @param meta: The metadata of the namespace.
*/
formatBeforeSummary(meta: NamespaceMetadata): Promise<string>;
/**
* Insert text after the namespace's summary.
*
* @param meta: The metadata of the namespace.
*/
formatAfterSummary(meta: NamespaceMetadata): Promise<string>;
/**
* Insert text that appears before a commands's summary.
*
* @param meta: The metadata of the command.
*/
formatBeforeCommandSummary(meta: HydratedCommandMetadata<C, N, M, I, O>): Promise<string>;
/**
* Insert text that appears after a commands's summary.

@@ -73,2 +91,9 @@ *

/**
* Insert text that appears before a namespace's summary.
*
* @param meta The metadata of the namespace.
* @param commands An array of the metadata of the namespace's commands.
*/
formatBeforeNamespaceSummary(meta: HydratedNamespaceMetadata<C, N, M, I, O>, commands: ReadonlyArray<HydratedCommandMetadata<C, N, M, I, O>>): Promise<string>;
/**
* Insert text that appears after a namespace's summary.

@@ -111,23 +136,27 @@ *

export declare class CommandStringHelpFormatter<C extends ICommand<C, N, M, I, O>, N extends INamespace<C, N, M, I, O>, M extends CommandMetadata<I, O>, I extends CommandMetadataInput, O extends CommandMetadataOption> extends CommandHelpFormatter<C, N, M, I, O> {
formatHeader(): Promise<string>;
formatSummary(): Promise<string>;
formatDescription(): Promise<string>;
formatInlineInput(input: I): Promise<string>;
formatUsage(): Promise<string>;
formatInputs(): Promise<string>;
formatOptionLine(opt: O): Promise<string>;
/**
* Insert text that appears before an option's summary.
* Insert text before the command's summary.
*
* @param opt The metadata of the option.
* @param meta The metadata of the command.
*/
formatBeforeOptionSummary?(opt: O): Promise<string>;
formatBeforeSummary(meta: M): Promise<string>;
/**
* Insert text before the command's summary.
* Insert text after the command's summary.
*
* @param meta The metadata of the command.
*/
formatBeforeSummary?(): Promise<string>;
formatAfterSummary(meta: M): Promise<string>;
/**
* Insert text after the command's summary.
* Insert text that appears before an option's summary.
*
* @param opt The metadata of the option.
*/
formatAfterSummary?(): Promise<string>;
formatHeader(): Promise<string>;
formatSummary(): Promise<string>;
formatDescription(): Promise<string>;
formatInlineInput(input: I): Promise<string>;
formatUsage(): Promise<string>;
formatInputs(): Promise<string>;
formatOptionLine(opt: O): Promise<string>;
formatBeforeOptionSummary(opt: O): Promise<string>;
formatAfterOptionSummary(opt: O): Promise<string>;

@@ -134,0 +163,0 @@ formatOptionDefault(opt: O): Promise<string>;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const chalk_1 = require("chalk");
const lodash = require("lodash");

@@ -9,6 +10,62 @@ const guards_1 = require("../guards");

const colors_1 = require("./colors");
const command_1 = require("./command");
const options_1 = require("./options");
const validators_1 = require("./validators");
const DEFAULT_DOTS_WIDTH = 32;
var CommandGroup;
(function (CommandGroup) {
CommandGroup["Deprecated"] = "deprecated";
CommandGroup["Hidden"] = "hidden";
CommandGroup["Beta"] = "beta";
CommandGroup["Experimental"] = "experimental";
})(CommandGroup = exports.CommandGroup || (exports.CommandGroup = {}));
var NamespaceGroup;
(function (NamespaceGroup) {
NamespaceGroup["Deprecated"] = "deprecated";
NamespaceGroup["Hidden"] = "hidden";
NamespaceGroup["Beta"] = "beta";
NamespaceGroup["Experimental"] = "experimental";
})(NamespaceGroup = exports.NamespaceGroup || (exports.NamespaceGroup = {}));
var OptionGroup;
(function (OptionGroup) {
OptionGroup["Deprecated"] = "deprecated";
OptionGroup["Hidden"] = "hidden";
OptionGroup["Beta"] = "beta";
OptionGroup["Experimental"] = "experimental";
OptionGroup["Advanced"] = "advanced";
})(OptionGroup = exports.OptionGroup || (exports.OptionGroup = {}));
const OPTION_DECORATIONS = [
[OptionGroup.Beta, chalk_1.default.red.bold('(beta)')],
[OptionGroup.Deprecated, chalk_1.default.yellow.bold('(deprecated)')],
[OptionGroup.Experimental, chalk_1.default.red.bold('(experimental)')],
];
const COMMAND_DECORATIONS = [
[CommandGroup.Beta, chalk_1.default.red.bold('(beta)')],
[CommandGroup.Deprecated, chalk_1.default.yellow.bold('(deprecated)')],
[CommandGroup.Experimental, chalk_1.default.red.bold('(experimental)')],
];
const NAMESPACE_DECORATIONS = [
[NamespaceGroup.Beta, chalk_1.default.red.bold('(beta)')],
[NamespaceGroup.Deprecated, chalk_1.default.yellow.bold('(deprecated)')],
[NamespaceGroup.Experimental, chalk_1.default.red.bold('(experimental)')],
];
function formatGroupDecorations(decorations, groups) {
if (!groups) {
return '';
}
const prepends = decorations.filter(([g]) => groups.includes(g)).map(([, d]) => d);
return prepends.length ? prepends.join(' ') + ' ' : '';
}
function isOptionVisible(opt) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return !opt.groups || !opt.groups.includes(OptionGroup.Hidden);
});
}
exports.isOptionVisible = isOptionVisible;
function isCommandVisible(cmd) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const ns = yield cmd.namespace.getMetadata();
return (!cmd.groups || !cmd.groups.includes(CommandGroup.Hidden)) && (!ns.groups || !ns.groups.includes(NamespaceGroup.Hidden));
});
}
exports.isCommandVisible = isCommandVisible;
class HelpFormatter {

@@ -36,3 +93,3 @@ constructor({ colors }) {

return tslib_1.__awaiter(this, void 0, void 0, function* () {
return command_1.isCommandVisible(meta);
return isCommandVisible(meta);
});

@@ -73,5 +130,5 @@ }

const metadata = yield this.getNamespaceMetadata();
const summary = ((this.formatBeforeSummary ? yield this.formatBeforeSummary() : '') +
const summary = ((yield this.formatBeforeSummary(metadata)) +
metadata.summary +
(this.formatAfterSummary ? yield this.formatAfterSummary() : ''));
(yield this.formatAfterSummary(metadata)));
const wrappedSummary = format_1.wordWrap(summary, { indentation: fullName.length + 5 });

@@ -136,7 +193,9 @@ return wrappedSummary ? ` - ${wrappedSummary}` : '';

const formattedCommands = yield Promise.all(commands.map((cmd, index) => tslib_1.__awaiter(this, void 0, void 0, function* () {
const summary = ((this.formatBeforeCommandSummary ? yield this.formatBeforeCommandSummary(cmd) : '') +
const wrapColor = cmd.groups && cmd.groups.includes(CommandGroup.Deprecated) ? weak : lodash.identity;
const summary = ((yield this.formatBeforeCommandSummary(cmd)) +
cmd.summary +
(yield this.formatAfterCommandSummary(cmd)));
const wrappedSummary = format_1.wordWrap(summary, { indentation: this.dotswidth + 6 });
return `${input(lodash.tail(cmd.path).map(([p]) => p).join(' '))}${wrappedSummary ? ' ' + fillStringArray[index] + ' ' + wrappedSummary : ''}`;
const line = `${input(lodash.tail(cmd.path).map(([p]) => p).join(' '))}${wrappedSummary ? ' ' + fillStringArray[index] + ' ' + wrappedSummary : ''}`;
return wrapColor(line);
})));

@@ -152,3 +211,3 @@ return formattedCommands;

const formattedNamespaces = yield Promise.all(namespaces.map((meta, i) => tslib_1.__awaiter(this, void 0, void 0, function* () {
const summary = ((this.formatBeforeNamespaceSummary ? yield this.formatBeforeNamespaceSummary(meta, meta.commands) : '') +
const summary = ((yield this.formatBeforeNamespaceSummary(meta, meta.commands)) +
meta.summary +

@@ -163,2 +222,32 @@ (yield this.formatAfterNamespaceSummary(meta, meta.commands)));

/**
* Insert text before the namespace's summary.
*
* @param meta: The metadata of the namespace.
*/
formatBeforeSummary(meta) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return formatGroupDecorations(NAMESPACE_DECORATIONS, meta.groups);
});
}
/**
* Insert text after the namespace's summary.
*
* @param meta: The metadata of the namespace.
*/
formatAfterSummary(meta) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return '';
});
}
/**
* Insert text that appears before a commands's summary.
*
* @param meta: The metadata of the command.
*/
formatBeforeCommandSummary(meta) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return formatGroupDecorations(COMMAND_DECORATIONS, meta.groups);
});
}
/**
* Insert text that appears after a commands's summary.

@@ -177,2 +266,13 @@ *

/**
* Insert text that appears before a namespace's summary.
*
* @param meta The metadata of the namespace.
* @param commands An array of the metadata of the namespace's commands.
*/
formatBeforeNamespaceSummary(meta, commands) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return formatGroupDecorations(NAMESPACE_DECORATIONS, meta.groups);
});
}
/**
* Insert text that appears after a namespace's summary.

@@ -217,3 +317,3 @@ *

return tslib_1.__awaiter(this, void 0, void 0, function* () {
return options_1.isOptionVisible(option);
return isOptionVisible(option);
});

@@ -257,5 +357,5 @@ }

const metadata = yield this.getCommandMetadata();
const summary = ((this.formatBeforeSummary ? yield this.formatBeforeSummary() : '') +
const summary = ((yield this.formatBeforeSummary(metadata)) +
metadata.summary +
(this.formatAfterSummary ? yield this.formatAfterSummary() : ''));
(yield this.formatAfterSummary(metadata)));
const wrappedSummary = format_1.wordWrap(summary, { indentation: fullName.length + 5 });

@@ -315,12 +415,44 @@ return wrappedSummary ? ` - ${wrappedSummary}` : '';

const { weak } = this.colors;
const wrapColor = opt.groups && opt.groups.includes(OptionGroup.Deprecated) ? weak : lodash.identity;
const optionName = options_1.formatOptionName(opt, { colors: this.colors });
const optionNameLength = format_1.stringWidth(optionName);
const fullLength = optionNameLength > this.dotswidth ? optionNameLength + 1 : this.dotswidth;
const fullDescription = ((this.formatBeforeOptionSummary ? yield this.formatBeforeOptionSummary(opt) : '') +
const fullDescription = ((yield this.formatBeforeOptionSummary(opt)) +
opt.summary +
(yield this.formatAfterOptionSummary(opt)));
const wrappedDescription = format_1.wordWrap(fullDescription, { indentation: this.dotswidth + 6 });
return `${optionName} ${weak('.').repeat(fullLength - optionNameLength)} ${wrappedDescription}`;
const line = `${optionName} ${weak('.').repeat(fullLength - optionNameLength)} ${wrappedDescription}`;
return wrapColor(line);
});
}
/**
* Insert text before the command's summary.
*
* @param meta The metadata of the command.
*/
formatBeforeSummary(meta) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return formatGroupDecorations(COMMAND_DECORATIONS, meta.groups);
});
}
/**
* Insert text after the command's summary.
*
* @param meta The metadata of the command.
*/
formatAfterSummary(meta) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return '';
});
}
/**
* Insert text that appears before an option's summary.
*
* @param opt The metadata of the option.
*/
formatBeforeOptionSummary(opt) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return formatGroupDecorations(OPTION_DECORATIONS, opt.groups);
});
}
formatAfterOptionSummary(opt) {

@@ -327,0 +459,0 @@ return tslib_1.__awaiter(this, void 0, void 0, function* () {

@@ -6,21 +6,2 @@ import * as minimist from 'minimist';

export { ParsedArgs } from 'minimist';
export declare enum CommandGroup {
Deprecated = "deprecated",
Hidden = "hidden",
Beta = "beta",
Experimental = "experimental"
}
export declare enum NamespaceGroup {
Deprecated = "deprecated",
Hidden = "hidden",
Beta = "beta",
Experimental = "experimental"
}
export declare enum OptionGroup {
Deprecated = "deprecated",
Hidden = "hidden",
Beta = "beta",
Experimental = "experimental",
Advanced = "advanced"
}
/**

@@ -60,3 +41,2 @@ * Remove options, which are any arguments that starts with a hyphen (-), from

export declare function formatOptionName<O extends CommandMetadataOption>(opt: O, { showAliases, showValueSpec, colors }?: FormatOptionNameOptions): string;
export declare function isOptionVisible<O extends CommandMetadataOption>(opt: O): Promise<boolean>;
export declare function metadataOptionsToParseArgsOptions(commandOptions: ReadonlyArray<CommandMetadataOption>): HydratedParseArgsOptions;

@@ -63,0 +43,0 @@ export declare type OptionPredicate<O extends CommandMetadataOption> = (option: O, value?: ParsedArg) => boolean;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const lodash = require("lodash");

@@ -8,24 +7,2 @@ const minimist = require("minimist");

exports.parseArgs = minimist;
var CommandGroup;
(function (CommandGroup) {
CommandGroup["Deprecated"] = "deprecated";
CommandGroup["Hidden"] = "hidden";
CommandGroup["Beta"] = "beta";
CommandGroup["Experimental"] = "experimental";
})(CommandGroup = exports.CommandGroup || (exports.CommandGroup = {}));
var NamespaceGroup;
(function (NamespaceGroup) {
NamespaceGroup["Deprecated"] = "deprecated";
NamespaceGroup["Hidden"] = "hidden";
NamespaceGroup["Beta"] = "beta";
NamespaceGroup["Experimental"] = "experimental";
})(NamespaceGroup = exports.NamespaceGroup || (exports.NamespaceGroup = {}));
var OptionGroup;
(function (OptionGroup) {
OptionGroup["Deprecated"] = "deprecated";
OptionGroup["Hidden"] = "hidden";
OptionGroup["Beta"] = "beta";
OptionGroup["Experimental"] = "experimental";
OptionGroup["Advanced"] = "advanced";
})(OptionGroup = exports.OptionGroup || (exports.OptionGroup = {}));
/**

@@ -101,8 +78,2 @@ * Remove options, which are any arguments that starts with a hyphen (-), from

exports.formatOptionName = formatOptionName;
function isOptionVisible(opt) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return !opt.groups || !opt.groups.includes(OptionGroup.Hidden);
});
}
exports.isOptionVisible = isOptionVisible;
function metadataOptionsToParseArgsOptions(commandOptions) {

@@ -109,0 +80,0 @@ const options = {

{
"name": "@ionic/cli-framework",
"version": "1.4.0",
"version": "1.5.0",
"description": "The foundation framework of the Ionic CLI",

@@ -5,0 +5,0 @@ "homepage": "https://ionicframework.com/",

@@ -102,12 +102,17 @@ "use strict";

p.on('close', (code, signal) => {
let err;
if (code === 0) {
resolve();
return resolve();
}
if (signal) {
err = new errors_1.ShellCommandError('Signal exit from subprocess.');
err.code = errors_1.ERROR_SHELL_SIGNAL_EXIT;
err.signal = signal;
}
else {
const err = new errors_1.ShellCommandError('Non-zero exit from subprocess.');
err = new errors_1.ShellCommandError('Non-zero exit from subprocess.');
err.code = errors_1.ERROR_SHELL_NON_ZERO_EXIT;
err.exitCode = code;
err.signal = signal ? signal : undefined;
reject(err);
}
reject(err);
});

@@ -114,0 +119,0 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc