@oclif/core
Advanced tools
Comparing version 4.0.0-beta.7 to 4.0.0-beta.8
@@ -24,10 +24,10 @@ /// <reference types="node" /> | ||
export declare const integer: ArgDefinition<number, { | ||
max?: number | undefined; | ||
min?: number | undefined; | ||
max?: number; | ||
min?: number; | ||
}>; | ||
export declare const directory: ArgDefinition<string, { | ||
exists?: boolean | undefined; | ||
exists?: boolean; | ||
}>; | ||
export declare const file: ArgDefinition<string, { | ||
exists?: boolean | undefined; | ||
exists?: boolean; | ||
}>; | ||
@@ -34,0 +34,0 @@ /** |
import { Config } from './config/config'; | ||
import { PJSON, Plugin } from './interfaces'; | ||
import { Configuration, Plugin } from './interfaces'; | ||
type OclifCoreInfo = { | ||
@@ -10,3 +10,3 @@ name: string; | ||
config: Config; | ||
exitCodes: PJSON.Plugin['oclif']['exitCodes']; | ||
exitCodes: Configuration['exitCodes']; | ||
'@oclif/core': OclifCoreInfo; | ||
@@ -25,5 +25,5 @@ }; | ||
get(key: 'rootPlugin'): Plugin | undefined; | ||
get(key: 'exitCodes'): PJSON.Plugin['oclif']['exitCodes'] | undefined; | ||
get(key: 'exitCodes'): Configuration['exitCodes'] | undefined; | ||
private getOclifCoreMeta; | ||
} | ||
export {}; |
@@ -146,3 +146,3 @@ import { Config } from './config'; | ||
[key: string]: unknown; | ||
aliasPermutations?: string[]; | ||
aliasPermutations?: string[] | undefined; | ||
aliases: string[]; | ||
@@ -152,6 +152,6 @@ args: { | ||
}; | ||
deprecateAliases?: boolean; | ||
deprecationOptions?: Deprecation; | ||
description?: string; | ||
examples?: Example[]; | ||
deprecateAliases?: boolean | undefined; | ||
deprecationOptions?: Deprecation | undefined; | ||
description?: string | undefined; | ||
examples?: Example[] | undefined; | ||
flags: { | ||
@@ -164,13 +164,13 @@ [name: string]: Flag.Cached; | ||
id: string; | ||
isESM?: boolean; | ||
permutations?: string[]; | ||
pluginAlias?: string; | ||
pluginName?: string; | ||
pluginType?: string; | ||
relativePath?: string[]; | ||
state?: 'beta' | 'deprecated' | string; | ||
strict?: boolean; | ||
summary?: string; | ||
type?: string; | ||
usage?: string | string[]; | ||
isESM?: boolean | undefined; | ||
permutations?: string[] | undefined; | ||
pluginAlias?: string | undefined; | ||
pluginName?: string | undefined; | ||
pluginType?: string | undefined; | ||
relativePath?: string[] | undefined; | ||
state?: 'beta' | 'deprecated' | string | undefined; | ||
strict?: boolean | undefined; | ||
summary?: string | undefined; | ||
type?: string | undefined; | ||
usage?: string | string[] | undefined; | ||
}; | ||
@@ -180,3 +180,3 @@ type Flag = IFlag<any>; | ||
type Cached = Omit<Flag, 'input' | 'parse'> & (BooleanFlagProps | OptionFlagProps) & { | ||
hasDynamicHelp?: boolean; | ||
hasDynamicHelp?: boolean | undefined; | ||
}; | ||
@@ -183,0 +183,0 @@ type Any = Cached | Flag; |
@@ -42,3 +42,3 @@ "use strict"; | ||
const util_2 = require("./util/util"); | ||
const ux_1 = __importDefault(require("./ux")); | ||
const ux_1 = require("./ux"); | ||
const pjson = cache_1.default.getInstance().get('@oclif/core'); | ||
@@ -172,3 +172,3 @@ /** | ||
try { | ||
ux_1.default.action.stop(ansis_1.default.bold.red('!')); | ||
ux_1.ux.action.stop(ansis_1.default.bold.red('!')); | ||
} | ||
@@ -216,7 +216,7 @@ catch { } | ||
message = typeof message === 'string' ? message : (0, node_util_1.inspect)(message); | ||
ux_1.default.stdout(message, ...args); | ||
ux_1.ux.stdout(message, ...args); | ||
} | ||
} | ||
logJson(json) { | ||
ux_1.default.stdout(ux_1.default.colorizeJson(json, { pretty: true, theme: this.config.theme?.json })); | ||
ux_1.ux.stdout(ux_1.ux.colorizeJson(json, { pretty: true, theme: this.config.theme?.json })); | ||
} | ||
@@ -226,3 +226,3 @@ logToStderr(message = '', ...args) { | ||
message = typeof message === 'string' ? message : (0, node_util_1.inspect)(message); | ||
ux_1.default.stderr(message, ...args); | ||
ux_1.ux.stderr(message, ...args); | ||
} | ||
@@ -229,0 +229,0 @@ } |
import { Command } from '../command'; | ||
import { Hook, Hooks, PJSON, Topic } from '../interfaces'; | ||
import { Configuration, Hook, Hooks, PJSON, S3Templates, Topic, UserPJSON } from '../interfaces'; | ||
import { ArchTypes, Config as IConfig, LoadOptions, PlatformTypes, VersionDetails } from '../interfaces/config'; | ||
@@ -10,4 +10,4 @@ import { Plugin as IPlugin, Options } from '../interfaces/plugin'; | ||
bin: string; | ||
binAliases?: string[]; | ||
binPath?: string; | ||
binAliases?: string[] | undefined; | ||
binPath?: string | undefined; | ||
cacheDir: string; | ||
@@ -22,5 +22,5 @@ channel: string; | ||
name: string; | ||
npmRegistry?: string; | ||
nsisCustomization?: string; | ||
pjson: PJSON.CLI; | ||
npmRegistry?: string | undefined; | ||
nsisCustomization?: string | undefined; | ||
pjson: PJSON; | ||
platform: PlatformTypes; | ||
@@ -30,7 +30,7 @@ plugins: Map<string, IPlugin>; | ||
shell: string; | ||
theme?: Theme; | ||
theme?: Theme | undefined; | ||
topicSeparator: ' ' | ':'; | ||
updateConfig: NonNullable<PJSON.CLI['oclif']['update']>; | ||
updateConfig: NonNullable<Configuration['update']>; | ||
userAgent: string; | ||
userPJSON?: PJSON.User; | ||
userPJSON?: UserPJSON | undefined; | ||
valid: boolean; | ||
@@ -102,3 +102,3 @@ version: string; | ||
runHook<T extends keyof Hooks>(event: T, opts: Hooks[T]['options'], timeout?: number, captureErrors?: boolean): Promise<Hook.Result<Hooks[T]['return']>>; | ||
s3Key(type: keyof PJSON.S3.Templates, ext?: '.tar.gz' | '.tar.xz' | IConfig.s3Key.Options, options?: IConfig.s3Key.Options): string; | ||
s3Key(type: keyof S3Templates, ext?: '.tar.gz' | '.tar.xz' | IConfig.s3Key.Options, options?: IConfig.s3Key.Options): string; | ||
s3Url(key: string): string; | ||
@@ -105,0 +105,0 @@ scopedEnvVar(k: string): string | undefined; |
@@ -45,3 +45,3 @@ "use strict"; | ||
const util_2 = require("../util/util"); | ||
const ux_1 = __importDefault(require("../ux")); | ||
const ux_1 = require("../ux"); | ||
const theme_1 = require("../ux/theme"); | ||
@@ -322,6 +322,5 @@ const plugin_loader_1 = __importDefault(require("./plugin-loader")); | ||
}; | ||
this.isSingleCommandCLI = Boolean(this.pjson.oclif.default || | ||
(typeof this.pjson.oclif.commands !== 'string' && | ||
this.pjson.oclif.commands?.strategy === 'single' && | ||
this.pjson.oclif.commands?.target)); | ||
this.isSingleCommandCLI = Boolean(typeof this.pjson.oclif.commands !== 'string' && | ||
this.pjson.oclif.commands?.strategy === 'single' && | ||
this.pjson.oclif.commands?.target); | ||
this.maybeAdjustDebugSetting(); | ||
@@ -363,8 +362,13 @@ await this.loadPluginsAndCommands(); | ||
return; | ||
const defaultThemeFile = this.pjson.oclif.theme | ||
? (0, node_path_1.resolve)(this.root, this.pjson.oclif.theme) | ||
: this.pjson.oclif.theme; | ||
const userThemeFile = (0, node_path_1.resolve)(this.configDir, 'theme.json'); | ||
const getDefaultTheme = async () => { | ||
if (!this.pjson.oclif.theme) | ||
return; | ||
if (typeof this.pjson.oclif.theme === 'string') { | ||
return (0, fs_1.safeReadJson)((0, node_path_1.resolve)(this.root, this.pjson.oclif.theme)); | ||
} | ||
return this.pjson.oclif.theme; | ||
}; | ||
const [defaultTheme, userTheme] = await Promise.all([ | ||
defaultThemeFile ? await (0, fs_1.safeReadJson)(defaultThemeFile) : undefined, | ||
await getDefaultTheme(), | ||
await (0, fs_1.safeReadJson)(userThemeFile), | ||
@@ -474,3 +478,3 @@ ]); | ||
log(message, ...args) { | ||
ux_1.default.stdout(message, ...args); | ||
ux_1.ux.stdout(message, ...args); | ||
}, | ||
@@ -535,3 +539,3 @@ warn(message) { | ||
options.ext = ext; | ||
const template = this.updateConfig.s3.templates[options.platform ? 'target' : 'vanilla'][type] ?? ''; | ||
const template = this.updateConfig.s3.templates?.[options.platform ? 'target' : 'vanilla'][type] ?? ''; | ||
return ejs.render(template, { ...this, ...options }); | ||
@@ -538,0 +542,0 @@ } |
import { PJSON } from '../interfaces'; | ||
import { Plugin as IPlugin } from '../interfaces/plugin'; | ||
type PluginLoaderOptions = { | ||
plugins?: IPlugin[] | PluginsMap; | ||
plugins?: IPlugin[] | PluginsMap | undefined; | ||
root: string; | ||
@@ -9,6 +9,6 @@ }; | ||
dataDir: string; | ||
devPlugins?: boolean; | ||
force?: boolean; | ||
devPlugins?: boolean | undefined; | ||
force?: boolean | undefined; | ||
rootPlugin: IPlugin; | ||
userPlugins?: boolean; | ||
userPlugins?: boolean | undefined; | ||
pluginAdditions?: { | ||
@@ -18,3 +18,3 @@ core?: string[]; | ||
path?: string; | ||
}; | ||
} | undefined; | ||
}; | ||
@@ -33,3 +33,3 @@ type PluginsMap = Map<string, IPlugin>; | ||
loadRoot({ pjson }: { | ||
pjson?: PJSON.Plugin; | ||
pjson?: PJSON | undefined; | ||
}): Promise<IPlugin>; | ||
@@ -36,0 +36,0 @@ private loadCorePlugins; |
@@ -22,6 +22,6 @@ import { Command } from '../command'; | ||
name: string; | ||
parent: Plugin | undefined; | ||
pjson: PJSON.Plugin; | ||
parent?: Plugin | undefined; | ||
pjson: PJSON; | ||
root: string; | ||
tag?: string; | ||
tag?: string | undefined; | ||
type: string; | ||
@@ -28,0 +28,0 @@ valid: boolean; |
@@ -60,8 +60,5 @@ "use strict"; | ||
} | ||
function determineCommandDiscoveryOptions(commandDiscovery, defaultCmdId) { | ||
function determineCommandDiscoveryOptions(commandDiscovery) { | ||
if (!commandDiscovery) | ||
return; | ||
if (typeof commandDiscovery === 'string' && defaultCmdId) { | ||
return { strategy: 'single', target: commandDiscovery }; | ||
} | ||
if (typeof commandDiscovery === 'string') { | ||
@@ -206,3 +203,3 @@ return { globPatterns: GLOB_PATTERNS, strategy: 'pattern', target: commandDiscovery }; | ||
])); | ||
this.commandDiscoveryOpts = determineCommandDiscoveryOptions(this.pjson.oclif?.commands, this.pjson.oclif?.default); | ||
this.commandDiscoveryOpts = determineCommandDiscoveryOptions(this.pjson.oclif?.commands); | ||
this._debug('command discovery options', this.commandDiscoveryOpts); | ||
@@ -209,0 +206,0 @@ this.manifest = await this._manifest(); |
@@ -9,2 +9,2 @@ import { Plugin, TSConfig } from '../interfaces'; | ||
export declare function tsPath(root: string, orig: string, plugin: Plugin): Promise<string>; | ||
export declare function tsPath(root: string, orig: string | undefined, plugin?: Plugin): Promise<string | undefined>; | ||
export declare function tsPath(root: string, orig: string | undefined, plugin?: Plugin | undefined): Promise<string | undefined>; |
@@ -6,11 +6,11 @@ import { OclifError, PrettyPrintableError } from '../../interfaces/errors'; | ||
export declare function addOclifExitCode(error: Record<string, any>, options?: { | ||
exit?: false | number; | ||
exit?: false | number | undefined; | ||
}): OclifError; | ||
export declare class CLIError extends Error implements OclifError { | ||
code?: string; | ||
code?: string | undefined; | ||
oclif: OclifError['oclif']; | ||
skipOclifErrorHandling?: boolean; | ||
suggestions?: string[]; | ||
skipOclifErrorHandling?: boolean | undefined; | ||
suggestions?: string[] | undefined; | ||
constructor(error: Error | string, options?: { | ||
exit?: false | number; | ||
exit?: false | number | undefined; | ||
} & PrettyPrintableError); | ||
@@ -17,0 +17,0 @@ get bang(): string | undefined; |
import { PrettyPrintableError } from '../../interfaces/errors'; | ||
type CLIErrorDisplayOptions = { | ||
bang?: string; | ||
name?: string; | ||
bang?: string | undefined; | ||
name?: string | undefined; | ||
}; | ||
@@ -6,0 +6,0 @@ export declare function applyPrettyPrintOptions(error: Error, options: PrettyPrintableError): PrettyPrintableError; |
@@ -75,4 +75,4 @@ /// <reference types="node" /> | ||
export declare const integer: FlagDefinition<number, { | ||
max?: number | undefined; | ||
min?: number | undefined; | ||
max?: number; | ||
min?: number; | ||
}, { | ||
@@ -88,3 +88,3 @@ multiple: false; | ||
export declare const directory: FlagDefinition<string, { | ||
exists?: boolean | undefined; | ||
exists?: boolean; | ||
}, { | ||
@@ -100,3 +100,3 @@ multiple: false; | ||
export declare const file: FlagDefinition<string, { | ||
exists?: boolean | undefined; | ||
exists?: boolean; | ||
}, { | ||
@@ -103,0 +103,0 @@ multiple: false; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.flush = void 0; | ||
const errors_1 = require("./errors"); | ||
const error_1 = require("./errors/error"); | ||
function timeout(p, ms) { | ||
@@ -13,3 +13,3 @@ function wait(ms, unref = false) { | ||
} | ||
return Promise.race([p, wait(ms, true).then(() => (0, errors_1.error)('timed out'))]); | ||
return Promise.race([p, wait(ms, true).then(() => (0, error_1.error)('timed out'))]); | ||
} | ||
@@ -16,0 +16,0 @@ async function _flush() { |
@@ -62,5 +62,5 @@ import { Command } from '../command'; | ||
indentation: number; | ||
multiline?: boolean; | ||
spacer?: string; | ||
stripAnsi?: boolean; | ||
multiline?: boolean | undefined; | ||
spacer?: string | undefined; | ||
stripAnsi?: boolean | undefined; | ||
}): string; | ||
@@ -67,0 +67,0 @@ section(header: string, body: [string, string | undefined][] | HelpSection | HelpSectionKeyValueTable | string): string; |
@@ -6,2 +6,3 @@ import { Command } from '../command'; | ||
export { CommandHelp } from './command'; | ||
export { HelpFormatter, type HelpSection, type HelpSectionKeyValueTable, type HelpSectionRenderer } from './formatter'; | ||
export { getHelpFlagAdditions, normalizeArgv, standardizeIDFromArgv } from './util'; | ||
@@ -8,0 +9,0 @@ export declare abstract class HelpBase extends HelpFormatter { |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.loadHelpClass = exports.Help = exports.HelpBase = exports.standardizeIDFromArgv = exports.normalizeArgv = exports.getHelpFlagAdditions = exports.CommandHelp = void 0; | ||
exports.loadHelpClass = exports.Help = exports.HelpBase = exports.standardizeIDFromArgv = exports.normalizeArgv = exports.getHelpFlagAdditions = exports.HelpFormatter = exports.CommandHelp = void 0; | ||
const ansis_1 = __importDefault(require("ansis")); | ||
@@ -16,3 +16,3 @@ const ts_path_1 = require("../config/ts-path"); | ||
const util_1 = require("../util/util"); | ||
const ux_1 = __importDefault(require("../ux")); | ||
const ux_1 = require("../ux"); | ||
const theme_1 = require("../ux/theme"); | ||
@@ -25,2 +25,4 @@ const command_1 = require("./command"); | ||
Object.defineProperty(exports, "CommandHelp", { enumerable: true, get: function () { return command_2.CommandHelp; } }); | ||
var formatter_2 = require("./formatter"); | ||
Object.defineProperty(exports, "HelpFormatter", { enumerable: true, get: function () { return formatter_2.HelpFormatter; } }); | ||
var util_3 = require("./util"); | ||
@@ -150,3 +152,3 @@ Object.defineProperty(exports, "getHelpFlagAdditions", { enumerable: true, get: function () { return util_3.getHelpFlagAdditions; } }); | ||
log(...args) { | ||
this.opts.sendToStderr ? ux_1.default.stderr(args) : ux_1.default.stdout(args); | ||
this.opts.sendToStderr ? ux_1.ux.stderr(args) : ux_1.ux.stdout(args); | ||
} | ||
@@ -321,13 +323,20 @@ async showCommandHelp(command) { | ||
} | ||
function determineLocation(helpClass) { | ||
if (typeof helpClass === 'string') | ||
return { identifier: 'default', target: helpClass }; | ||
if (!helpClass.identifier) | ||
return { ...helpClass, identifier: 'default' }; | ||
return helpClass; | ||
} | ||
async function loadHelpClass(config) { | ||
const { pjson } = config; | ||
const configuredClass = pjson.oclif?.helpClass; | ||
if (configuredClass) { | ||
if (config.pjson.oclif?.helpClass) { | ||
const { identifier, target } = determineLocation(config.pjson.oclif?.helpClass); | ||
try { | ||
const path = (await (0, ts_path_1.tsPath)(config.root, configuredClass)) ?? configuredClass; | ||
const exported = await (0, module_loader_1.load)(config, path); | ||
return extractClass(exported); | ||
const path = (await (0, ts_path_1.tsPath)(config.root, target)) ?? target; | ||
const module = await (0, module_loader_1.load)(config, path); | ||
const helpClass = module[identifier] ?? (identifier === 'default' ? extractClass(module) : undefined); | ||
return extractClass(helpClass); | ||
} | ||
catch (error) { | ||
throw new Error(`Unable to load configured help class "${configuredClass}", failed with message:\n${error.message}`); | ||
throw new Error(`Unable to load configured help class "${target}", failed with message:\n${error.message}`); | ||
} | ||
@@ -334,0 +343,0 @@ } |
@@ -9,6 +9,5 @@ export * as Args from './args'; | ||
export { flush } from './flush'; | ||
export { CommandHelp, Help, HelpBase, loadHelpClass } from './help'; | ||
export { HelpSection, HelpSectionKeyValueTable, HelpSectionRenderer } from './help/formatter'; | ||
export { CommandHelp, Help, HelpBase, type HelpSection, type HelpSectionKeyValueTable, type HelpSectionRenderer, loadHelpClass, } from './help'; | ||
export * as Interfaces from './interfaces'; | ||
export { Hook } from './interfaces/hooks'; | ||
export { type Hook } from './interfaces/hooks'; | ||
export { getLogger } from './logger'; | ||
@@ -19,4 +18,4 @@ export { run } from './main'; | ||
export { Performance } from './performance'; | ||
export { Settings, settings } from './settings'; | ||
export { type Settings, settings } from './settings'; | ||
export { toConfiguredId, toStandardizedId } from './util/ids'; | ||
export { methods as ux } from './ux'; | ||
export { ux } from './ux'; |
@@ -72,2 +72,2 @@ "use strict"; | ||
var ux_1 = require("./ux"); | ||
Object.defineProperty(exports, "ux", { enumerable: true, get: function () { return ux_1.methods; } }); | ||
Object.defineProperty(exports, "ux", { enumerable: true, get: function () { return ux_1.ux; } }); |
/// <reference types="node" /> | ||
import { Command } from '../command'; | ||
import { Hook, Hooks } from './hooks'; | ||
import { PJSON } from './pjson'; | ||
import { Configuration, PJSON, S3Templates } from './pjson'; | ||
import { Options, Plugin } from './plugin'; | ||
@@ -37,4 +37,4 @@ import { Theme } from './theme'; | ||
*/ | ||
readonly binAliases?: string[]; | ||
readonly binPath?: string; | ||
readonly binAliases?: string[] | undefined; | ||
readonly binPath?: string | undefined; | ||
/** | ||
@@ -93,5 +93,5 @@ * cache directory to use for CLI | ||
*/ | ||
readonly npmRegistry?: string; | ||
readonly nsisCustomization?: string; | ||
readonly pjson: PJSON.CLI; | ||
readonly npmRegistry?: string | undefined; | ||
readonly nsisCustomization?: string | undefined; | ||
readonly pjson: PJSON; | ||
/** | ||
@@ -106,3 +106,3 @@ * process.platform | ||
s3Key(type: 'unversioned' | 'versioned', ext: '.tar.gz' | '.tar.xz', options?: Config.s3Key.Options): string; | ||
s3Key(type: keyof PJSON.S3.Templates, options?: Config.s3Key.Options): string; | ||
s3Key(type: keyof S3Templates, options?: Config.s3Key.Options): string; | ||
s3Url(key: string): string; | ||
@@ -117,6 +117,6 @@ scopedEnvVar(key: string): string | undefined; | ||
readonly shell: string; | ||
readonly theme?: Theme; | ||
readonly theme?: Theme | undefined; | ||
topicSeparator: ' ' | ':'; | ||
readonly topics: Topic[]; | ||
readonly updateConfig: NonNullable<PJSON.CLI['oclif']['update']>; | ||
readonly updateConfig: NonNullable<Configuration['update']>; | ||
/** | ||
@@ -123,0 +123,0 @@ * user agent to use for http calls |
@@ -6,3 +6,3 @@ export type CommandError = Error & { | ||
oclif: { | ||
exit?: number; | ||
exit?: number | undefined; | ||
}; | ||
@@ -14,7 +14,7 @@ } | ||
*/ | ||
code?: string; | ||
code?: string | undefined; | ||
/** | ||
* message to display related to the error | ||
*/ | ||
message?: string; | ||
message?: string | undefined; | ||
/** | ||
@@ -24,7 +24,7 @@ * a url to find out more information related to this error | ||
*/ | ||
ref?: string; | ||
ref?: string | undefined; | ||
/** | ||
* a suggestion that may be useful or provide additional context | ||
*/ | ||
suggestions?: string[]; | ||
suggestions?: string[] | undefined; | ||
} |
@@ -11,3 +11,3 @@ export type { AlphabetLowercase, AlphabetUppercase } from './alphabet'; | ||
export type { Arg, BooleanFlag, CustomOptions, Deprecation, Flag, FlagDefinition, OptionFlag } from './parser'; | ||
export type { PJSON } from './pjson'; | ||
export type { Configuration, PJSON, S3, S3Templates, UserPJSON } from './pjson'; | ||
export type { Options, Plugin, PluginOptions } from './plugin'; | ||
@@ -14,0 +14,0 @@ export type { S3Manifest } from './s3-manifest'; |
@@ -11,6 +11,6 @@ import { Command } from '../command'; | ||
parse: { | ||
input?: ParserInput; | ||
output?: ParserOutput; | ||
input?: ParserInput | undefined; | ||
output?: ParserOutput | undefined; | ||
}; | ||
exit?: number; | ||
exit?: number | undefined; | ||
}; | ||
@@ -435,3 +435,3 @@ export type OutputArgs<T extends ParserInput['args']> = { | ||
args?: ArgInput<AFlags>; | ||
strict?: boolean; | ||
strict?: boolean | undefined; | ||
context?: ParserContext; | ||
@@ -446,6 +446,6 @@ '--'?: boolean; | ||
context: ParserContext | undefined; | ||
'--'?: boolean; | ||
'--'?: boolean | undefined; | ||
}; | ||
export type ParserContext = Command & { | ||
token?: FlagToken | ArgToken; | ||
token?: FlagToken | ArgToken | undefined; | ||
}; | ||
@@ -452,0 +452,0 @@ export type FlagInput<T extends FlagOutput = { |
import { HelpOptions } from './help'; | ||
export interface PJSON { | ||
[k: string]: any; | ||
dependencies?: { | ||
[name: string]: string; | ||
}; | ||
devDependencies?: { | ||
[name: string]: string; | ||
}; | ||
oclif: { | ||
bin?: string; | ||
dirname?: string; | ||
hooks?: Record<string, string | string[]>; | ||
plugins?: string[]; | ||
schema?: number; | ||
}; | ||
version: string; | ||
} | ||
import { Theme } from './theme'; | ||
export type CommandDiscovery = { | ||
@@ -99,139 +83,220 @@ /** | ||
}; | ||
export declare namespace PJSON { | ||
interface Plugin extends PJSON { | ||
name: string; | ||
oclif: PJSON['oclif'] & { | ||
additionalHelpFlags?: string[]; | ||
additionalVersionFlags?: string[]; | ||
aliases?: { | ||
[name: string]: null | string; | ||
}; | ||
commands?: string | CommandDiscovery; | ||
/** | ||
* Default command id when no command is found. This is used to support single command CLIs. | ||
* Only supported value is "." | ||
* | ||
* @deprecated Use `commands.strategy: 'single'` instead. | ||
*/ | ||
default?: string; | ||
export type HelpLocationOptions = { | ||
/** | ||
* The file path containing help class. | ||
*/ | ||
target: string; | ||
/** | ||
* The name of the export to use when loading the help class from the `target` file. Defaults to `default`. | ||
*/ | ||
identifier: string; | ||
}; | ||
export type S3Templates = { | ||
baseDir?: string; | ||
manifest?: string; | ||
unversioned?: string; | ||
versioned?: string; | ||
}; | ||
export type S3 = { | ||
acl?: string | undefined; | ||
bucket?: string | undefined; | ||
folder?: string | undefined; | ||
gz?: boolean | undefined; | ||
host?: string | undefined; | ||
templates?: { | ||
target: S3Templates; | ||
vanilla: S3Templates; | ||
} | undefined; | ||
xz?: boolean | undefined; | ||
}; | ||
export type Configuration = { | ||
/** | ||
* Flags in addition to --help that should trigger help output. | ||
*/ | ||
additionalHelpFlags?: string[]; | ||
/** | ||
* Flags in addition to --version that should trigger version output. | ||
*/ | ||
additionalVersionFlags?: string[]; | ||
/** | ||
* Plugin aliases. | ||
*/ | ||
aliases?: { | ||
[name: string]: null | string; | ||
}; | ||
/** | ||
* The name of the executable. | ||
*/ | ||
bin?: string; | ||
/** | ||
* Aliases for the executable. | ||
*/ | ||
binAliases?: string[]; | ||
commands?: string | CommandDiscovery; | ||
/** | ||
* Your CLI's description. Overrides the description in the package.json. | ||
*/ | ||
description?: string | undefined; | ||
/** | ||
* Plugins to load when in development mode. | ||
*/ | ||
devPlugins?: string[]; | ||
/** | ||
* The directory name to use when determining the cache, config, and data directories. | ||
*/ | ||
dirname?: string; | ||
/** | ||
* Example plugin to use in @oclif/plugin-plugin's help output. | ||
*/ | ||
examplePlugin?: string; | ||
/** | ||
* Customize the exit codes for the CLI. | ||
*/ | ||
exitCodes?: { | ||
default?: number; | ||
failedFlagParsing?: number; | ||
failedFlagValidation?: number; | ||
invalidArgsSpec?: number; | ||
nonExistentFlag?: number; | ||
requiredArgs?: number; | ||
unexpectedArgs?: number; | ||
}; | ||
/** | ||
* Enable flexible taxonomy for commands. | ||
*/ | ||
flexibleTaxonomy?: boolean; | ||
/** | ||
* The location of your custom help class. | ||
*/ | ||
helpClass?: string | HelpLocationOptions; | ||
/** | ||
* Options for the help output. | ||
*/ | ||
helpOptions?: HelpOptions; | ||
/** | ||
* Register hooks to run at various points in the CLI lifecycle. | ||
*/ | ||
hooks?: { | ||
[name: string]: string | string[] | HookOptions | HookOptions[]; | ||
}; | ||
/** | ||
* Plugins that can be installed just-in-time. | ||
*/ | ||
jitPlugins?: Record<string, string>; | ||
macos?: { | ||
identifier?: string; | ||
sign?: string; | ||
}; | ||
/** | ||
* Use a private or alternate npm registry. | ||
*/ | ||
npmRegistry?: string; | ||
/** | ||
* Script to run during postinstall on windows. | ||
*/ | ||
nsisCustomization?: string; | ||
/** | ||
* Plugin prefix to use when working with plugins with @oclif/plugin-plugins. | ||
* | ||
* Defaults to `plugin-`. | ||
*/ | ||
pluginPrefix?: string; | ||
/** | ||
* Plugins to load. | ||
*/ | ||
plugins?: string[]; | ||
/** | ||
* Template string used to build links to source code in CLI's README (when using `oclif readme`). | ||
*/ | ||
repositoryPrefix?: string; | ||
schema?: number; | ||
/** | ||
* The namespace to be used for plugins of your CLI, e.g. `@salesforce`. | ||
*/ | ||
scope?: string; | ||
/** | ||
* State of your CLI | ||
* | ||
* - `beta` - will show message to user that command or CLI is in beta | ||
* - `deprecated` - will show message to user that command or CLI is deprecated | ||
*/ | ||
state?: 'beta' | 'deprecated' | string; | ||
/** | ||
* The theme to ship with the CLI. | ||
* | ||
* Can be a path to a JSON file or a Theme object. | ||
*/ | ||
theme?: string | Theme; | ||
/** | ||
* Separator to use for your CLI. Can be `:` or ` `. | ||
*/ | ||
topicSeparator?: ' ' | ':'; | ||
/** | ||
* Customize the topics in the CLI. | ||
*/ | ||
topics?: { | ||
[k: string]: { | ||
description?: string; | ||
devPlugins?: string[]; | ||
exitCodes?: { | ||
default?: number; | ||
failedFlagParsing?: number; | ||
failedFlagValidation?: number; | ||
invalidArgsSpec?: number; | ||
nonExistentFlag?: number; | ||
requiredArgs?: number; | ||
unexpectedArgs?: number; | ||
}; | ||
flexibleTaxonomy?: boolean; | ||
helpClass?: string; | ||
helpOptions?: HelpOptions; | ||
hooks?: { | ||
[name: string]: string | string[] | HookOptions | HookOptions[]; | ||
}; | ||
jitPlugins?: Record<string, string>; | ||
macos?: { | ||
identifier?: string; | ||
sign?: string; | ||
}; | ||
plugins?: string[]; | ||
repositoryPrefix?: string; | ||
schema?: number; | ||
state?: 'beta' | 'deprecated' | string; | ||
theme?: string; | ||
topicSeparator?: ' ' | ':'; | ||
topics?: { | ||
[k: string]: { | ||
description?: string; | ||
hidden?: boolean; | ||
subtopics?: Plugin['oclif']['topics']; | ||
}; | ||
}; | ||
update?: { | ||
autoupdate?: { | ||
debounce?: number; | ||
rollout?: number; | ||
}; | ||
disableNpmLookup?: boolean; | ||
node: { | ||
targets?: string[]; | ||
version?: string; | ||
options?: string | string[]; | ||
}; | ||
s3: S3; | ||
}; | ||
windows?: { | ||
homepage?: string; | ||
keypath?: string; | ||
name?: string; | ||
}; | ||
hidden?: boolean; | ||
subtopics?: Configuration['topics']; | ||
}; | ||
version: string; | ||
} | ||
interface S3 { | ||
acl?: string; | ||
bucket?: string; | ||
folder?: string; | ||
gz?: boolean; | ||
host?: string; | ||
templates: { | ||
target: S3.Templates; | ||
vanilla: S3.Templates; | ||
}; | ||
update?: { | ||
autoupdate?: { | ||
debounce?: number; | ||
rollout?: number; | ||
}; | ||
xz?: boolean; | ||
} | ||
namespace S3 { | ||
interface Templates { | ||
baseDir?: string; | ||
manifest?: string; | ||
unversioned?: string; | ||
versioned?: string; | ||
} | ||
} | ||
interface CLI extends Plugin { | ||
oclif: Plugin['oclif'] & { | ||
bin?: string; | ||
binAliases?: string[]; | ||
dirname?: string; | ||
flexibleTaxonomy?: boolean; | ||
jitPlugins?: Record<string, string>; | ||
npmRegistry?: string; | ||
nsisCustomization?: string; | ||
schema?: number; | ||
scope?: string; | ||
pluginPrefix?: string; | ||
'warn-if-update-available'?: { | ||
authorization: string; | ||
message: string; | ||
registry: string; | ||
timeoutInDays: number; | ||
frequency: number; | ||
frequencyUnit: 'days' | 'hours' | 'minutes' | 'seconds' | 'milliseconds'; | ||
}; | ||
disableNpmLookup?: boolean; | ||
node: { | ||
targets?: string[]; | ||
version?: string; | ||
options?: string | string[]; | ||
}; | ||
} | ||
interface User extends PJSON { | ||
oclif: PJSON['oclif'] & { | ||
plugins?: (PluginTypes.Link | PluginTypes.User | string)[]; | ||
}; | ||
private?: boolean; | ||
} | ||
type PluginTypes = { | ||
root: string; | ||
} | PluginTypes.Link | PluginTypes.User; | ||
namespace PluginTypes { | ||
interface User { | ||
name: string; | ||
tag?: string; | ||
type: 'user'; | ||
url?: string; | ||
} | ||
interface Link { | ||
name: string; | ||
root: string; | ||
type: 'link'; | ||
} | ||
} | ||
} | ||
s3: S3; | ||
}; | ||
'warn-if-update-available'?: { | ||
authorization?: string; | ||
message?: string; | ||
registry?: string; | ||
timeoutInDays?: number; | ||
frequency?: number; | ||
frequencyUnit?: 'days' | 'hours' | 'minutes' | 'seconds' | 'milliseconds'; | ||
}; | ||
windows?: { | ||
homepage?: string; | ||
keypath?: string; | ||
name?: string; | ||
}; | ||
}; | ||
export type UserPlugin = { | ||
name: string; | ||
tag?: string; | ||
type: 'user'; | ||
url?: string; | ||
}; | ||
export type LinkedPlugin = { | ||
name: string; | ||
root: string; | ||
type: 'link'; | ||
}; | ||
export type PluginTypes = { | ||
root: string; | ||
} | UserPlugin | LinkedPlugin; | ||
export type UserPJSON = { | ||
oclif: { | ||
plugins?: PluginTypes[]; | ||
}; | ||
private?: boolean; | ||
}; | ||
export type PJSON = { | ||
[k: string]: any; | ||
dependencies?: { | ||
[name: string]: string; | ||
}; | ||
devDependencies?: { | ||
[name: string]: string; | ||
}; | ||
name: string; | ||
oclif: Configuration; | ||
version: string; | ||
}; |
@@ -6,23 +6,23 @@ import { Command } from '../command'; | ||
export interface PluginOptions { | ||
children?: Plugin[]; | ||
errorOnManifestCreate?: boolean; | ||
flexibleTaxonomy?: boolean; | ||
ignoreManifest?: boolean; | ||
isRoot?: boolean; | ||
name?: string; | ||
parent?: Plugin; | ||
pjson?: PJSON.Plugin; | ||
respectNoCacheDefault?: boolean; | ||
children?: Plugin[] | undefined; | ||
errorOnManifestCreate?: boolean | undefined; | ||
flexibleTaxonomy?: boolean | undefined; | ||
ignoreManifest?: boolean | undefined; | ||
isRoot?: boolean | undefined; | ||
name?: string | undefined; | ||
parent?: Plugin | undefined; | ||
pjson?: PJSON | undefined; | ||
respectNoCacheDefault?: boolean | undefined; | ||
root: string; | ||
tag?: string; | ||
type?: string; | ||
url?: string; | ||
tag?: string | undefined; | ||
type?: string | undefined; | ||
url?: string | undefined; | ||
} | ||
export interface Options extends PluginOptions { | ||
channel?: string; | ||
devPlugins?: boolean; | ||
enablePerf?: boolean; | ||
jitPlugins?: boolean; | ||
logger?: Logger; | ||
pjson?: PJSON.Plugin; | ||
channel?: string | undefined; | ||
devPlugins?: boolean | undefined; | ||
enablePerf?: boolean | undefined; | ||
jitPlugins?: boolean | undefined; | ||
logger?: Logger | undefined; | ||
pjson?: PJSON | undefined; | ||
pluginAdditions?: { | ||
@@ -32,6 +32,6 @@ core?: string[]; | ||
path?: string; | ||
}; | ||
plugins?: Map<string, Plugin>; | ||
userPlugins?: boolean; | ||
version?: string; | ||
} | undefined; | ||
plugins?: Map<string, Plugin> | undefined; | ||
userPlugins?: boolean | undefined; | ||
version?: string | undefined; | ||
} | ||
@@ -74,3 +74,3 @@ export interface Plugin { | ||
readonly options: Options; | ||
parent?: Plugin; | ||
parent?: Plugin | undefined; | ||
/** | ||
@@ -81,3 +81,3 @@ * full package.json | ||
*/ | ||
pjson: PJSON.CLI | PJSON.Plugin; | ||
pjson: PJSON; | ||
/** | ||
@@ -91,3 +91,3 @@ * base path of plugin | ||
*/ | ||
tag?: string; | ||
tag?: string | undefined; | ||
readonly topics: Topic[]; | ||
@@ -94,0 +94,0 @@ /** |
export interface Topic { | ||
description?: string; | ||
hidden?: boolean; | ||
description?: string | undefined; | ||
hidden?: boolean | undefined; | ||
name: string; | ||
} |
@@ -14,3 +14,3 @@ "use strict"; | ||
const symbols_1 = require("./symbols"); | ||
const ux_1 = __importDefault(require("./ux")); | ||
const ux_1 = require("./ux"); | ||
const helpAddition = (argv, config) => { | ||
@@ -73,3 +73,3 @@ if (argv.length === 0 && !config.isSingleCommandCLI) | ||
if ((0, exports.versionAddition)(argv, config)) { | ||
ux_1.default.stdout(config.userAgent); | ||
ux_1.ux.stdout(config.userAgent); | ||
await collectPerf(); | ||
@@ -76,0 +76,0 @@ return; |
@@ -6,3 +6,3 @@ import { CLIError } from '../errors'; | ||
name: string; | ||
reason?: string; | ||
reason?: string | undefined; | ||
status: 'failed' | 'success'; | ||
@@ -9,0 +9,0 @@ validationFn: string; |
@@ -8,3 +8,3 @@ export type Settings = { | ||
*/ | ||
columns?: number; | ||
columns?: number | undefined; | ||
/** | ||
@@ -16,3 +16,3 @@ * Show additional debug output without DEBUG. Mainly shows stackstraces. | ||
*/ | ||
debug?: boolean; | ||
debug?: boolean | undefined; | ||
/** | ||
@@ -22,3 +22,3 @@ * Enable performance tracking. Resulting data is available in the `perf` property of the `Config` class. | ||
*/ | ||
performanceEnabled?: boolean; | ||
performanceEnabled?: boolean | undefined; | ||
/** | ||
@@ -31,3 +31,3 @@ * Try to use ts-node to load typescript source files instead of javascript files. | ||
*/ | ||
tsnodeEnabled?: boolean; | ||
tsnodeEnabled?: boolean | undefined; | ||
/** | ||
@@ -38,4 +38,4 @@ * Enable automatic transpilation of TypeScript files to JavaScript. | ||
*/ | ||
enableAutoTranspile?: boolean; | ||
enableAutoTranspile?: boolean | undefined; | ||
}; | ||
export declare const settings: Settings; |
@@ -1,3 +0,3 @@ | ||
import { Config } from '../interfaces'; | ||
import { type Config } from '../interfaces/config'; | ||
export declare function toStandardizedId(commandID: string, config: Config): string; | ||
export declare function toConfiguredId(commandID: string, config: Config): string; |
@@ -7,2 +7,2 @@ import { PJSON } from '../interfaces'; | ||
*/ | ||
export declare function readPjson(path: string): Promise<PJSON.Plugin>; | ||
export declare function readPjson(path: string): Promise<PJSON>; |
type Options = { | ||
pretty?: boolean; | ||
theme?: Record<string, string>; | ||
pretty?: boolean | undefined; | ||
theme?: Record<string, string> | undefined; | ||
}; | ||
@@ -5,0 +5,0 @@ export declare function tokenize(json?: unknown, options?: Options): { |
@@ -8,3 +8,9 @@ import { error } from '../errors/error'; | ||
import { colorize } from './theme'; | ||
export declare const methods: { | ||
export { error } from '../errors/error'; | ||
export { exit } from '../errors/exit'; | ||
export { warn } from '../errors/warn'; | ||
export { default as colorizeJson } from './colorize-json'; | ||
export { colorize } from './theme'; | ||
export { stderr, stdout } from './write'; | ||
export declare const ux: { | ||
action: Simple | Spinner; | ||
@@ -65,2 +71,1 @@ /** | ||
}; | ||
export default methods; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.methods = void 0; | ||
exports.ux = exports.stdout = exports.stderr = exports.colorize = exports.colorizeJson = exports.warn = exports.exit = exports.error = void 0; | ||
const error_1 = require("../errors/error"); | ||
@@ -16,2 +16,15 @@ const exit_1 = require("../errors/exit"); | ||
const write_1 = require("./write"); | ||
var error_2 = require("../errors/error"); | ||
Object.defineProperty(exports, "error", { enumerable: true, get: function () { return error_2.error; } }); | ||
var exit_2 = require("../errors/exit"); | ||
Object.defineProperty(exports, "exit", { enumerable: true, get: function () { return exit_2.exit; } }); | ||
var warn_2 = require("../errors/warn"); | ||
Object.defineProperty(exports, "warn", { enumerable: true, get: function () { return warn_2.warn; } }); | ||
var colorize_json_2 = require("./colorize-json"); | ||
Object.defineProperty(exports, "colorizeJson", { enumerable: true, get: function () { return __importDefault(colorize_json_2).default; } }); | ||
var theme_2 = require("./theme"); | ||
Object.defineProperty(exports, "colorize", { enumerable: true, get: function () { return theme_2.colorize; } }); | ||
var write_2 = require("./write"); | ||
Object.defineProperty(exports, "stderr", { enumerable: true, get: function () { return write_2.stderr; } }); | ||
Object.defineProperty(exports, "stdout", { enumerable: true, get: function () { return write_2.stdout; } }); | ||
const ACTION_TYPE = (Boolean(process.stderr.isTTY) && | ||
@@ -22,3 +35,3 @@ !process.env.CI && | ||
'simple'; | ||
exports.methods = { | ||
exports.ux = { | ||
action: ACTION_TYPE === 'spinner' ? new spinner_1.default() : new simple_1.default(), | ||
@@ -79,2 +92,1 @@ /** | ||
}; | ||
exports.default = exports.methods; |
{ | ||
"name": "@oclif/core", | ||
"description": "base library for oclif CLIs", | ||
"version": "4.0.0-beta.7", | ||
"version": "4.0.0-beta.8", | ||
"author": "Salesforce", | ||
@@ -69,6 +69,3 @@ "bugs": "https://github.com/oclif/core/issues", | ||
"files": [ | ||
"/lib", | ||
"/flush.js", | ||
"/flush.d.ts", | ||
"/handle.js" | ||
"/lib" | ||
], | ||
@@ -86,3 +83,22 @@ "homepage": "https://github.com/oclif/core", | ||
"license": "MIT", | ||
"main": "./lib/index.js", | ||
"exports": { | ||
".": "./lib/index.js", | ||
"./args": "./lib/args.js", | ||
"./command": "./lib/command.js", | ||
"./config": "./lib/config/index.js", | ||
"./errors": "./lib/errors/index.js", | ||
"./execute": "./lib/execute.js", | ||
"./flags": "./lib/flags.js", | ||
"./flush": "./lib/flush.js", | ||
"./handle": "./lib/errors/handle.js", | ||
"./help": "./lib/help/index.js", | ||
"./hooks": "./lib/interfaces/hooks.js", | ||
"./interfaces": "./lib/interfaces/index.js", | ||
"./logger": "./lib/logger.js", | ||
"./performance": "./lib/performance.js", | ||
"./run": "./lib/main.js", | ||
"./settings": "./lib/settings.js", | ||
"./util/ids": "./lib/util/ids.js", | ||
"./ux": "./lib/ux/index.js" | ||
}, | ||
"repository": "oclif/core", | ||
@@ -89,0 +105,0 @@ "oclif": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
397311
9998
157