Comparing version 7.0.0-beta6 to 7.0.0-beta7
{ | ||
"name": "titanium", | ||
"version": "7.0.0-beta6", | ||
"version": "7.0.0-beta7", | ||
"author": "TiDev, Inc. <npm@tidev.io>", | ||
@@ -5,0 +5,0 @@ "description": "Command line interface for building Titanium SDK apps", |
@@ -52,3 +52,2 @@ import chalk from 'chalk'; | ||
* set it on the `CLI` instance. | ||
* @deprecated | ||
*/ | ||
@@ -269,3 +268,3 @@ class GracefulShutdown extends Error {} | ||
createHook(name, ctx, fn) { | ||
let dataPayload = {}; | ||
let dataPayload; | ||
@@ -280,4 +279,7 @@ if (typeof ctx === 'function') { | ||
const hookType = typeof fn === 'function' ? 'function' : 'event'; | ||
this.debugLogger.trace(`Creating ${hookType} hook "${name}"`); | ||
return (...args) => { | ||
let data = Object.assign(dataPayload, { | ||
let data = Object.assign(dataPayload || {}, { | ||
type: name, | ||
@@ -292,2 +294,4 @@ args, | ||
this.debugLogger.trace(`Firing ${hookType} hook "${name}" pres=${pres.length}, posts=${posts.length}`); | ||
(async () => { | ||
@@ -531,3 +535,3 @@ // call all pre filters | ||
this.resetCommander(program); | ||
await this.initKnownOptionBranches(); | ||
this.initKnownOptionBranches(); | ||
await this.initBuildPlatform(); | ||
@@ -776,3 +780,5 @@ this.validateHooks(); | ||
// if `--project-dir` was not set, default to the current working directory | ||
const cwd = expand(this.argv['project-dir'] || '.'); | ||
this.argv['project-dir'] = cwd; | ||
@@ -817,11 +823,11 @@ // load hooks | ||
// that changes the available flags/options | ||
const skipRegExp = /^flags|options|args|subcommands$/; | ||
const skipRegExp = /^(flags|options|args|subcommands)$/; | ||
const optionBranches = Object.keys(conf) | ||
.filter(name => conf.options && conf.options[name] && !skipRegExp.test(name)) | ||
.filter(name => conf.options?.[name] && !skipRegExp.test(name)) | ||
.sort((a, b) => { | ||
// if we have multiple option groups, then try to process them in order | ||
if (!conf.options[a] || !conf.options[a].order) { | ||
if (!conf.options[a]?.order) { | ||
return 1; | ||
} | ||
if (!conf.options[b] || !conf.options[b].order) { | ||
if (!conf.options[b]?.order) { | ||
return -1; | ||
@@ -916,3 +922,3 @@ } | ||
// `ti create` hacks | ||
// `ti create` hack | ||
if (cmdName === 'create') { | ||
@@ -925,10 +931,10 @@ // if `--alloy` is not defined, define it | ||
} | ||
} | ||
// if we have a `--platforms` option branch, override the help | ||
if (conf.platforms) { | ||
this.debugLogger.trace(`Detected conf.platforms loading "${cmdName}", overriding createHelp()`); | ||
this.command.createHelp = () => { | ||
return Object.assign(new TiHelp(this, conf.platforms), this.command.configureHelp()); | ||
}; | ||
} | ||
// if we have a `--platforms` option branch, override the help | ||
if (conf.platforms) { | ||
this.debugLogger.trace(`Detected conf.platforms loading "${cmdName}", overriding createHelp()`); | ||
this.command.createHelp = () => { | ||
return Object.assign(new TiHelp(this, conf.platforms), this.command.configureHelp()); | ||
}; | ||
} | ||
@@ -1341,3 +1347,3 @@ | ||
// check if the option is required | ||
if (opt.required || (opt.conf && opt.conf.required)) { | ||
if (opt.required || opt.conf?.required) { | ||
// ok, we have a required option, but it's possible that this option | ||
@@ -1395,4 +1401,6 @@ // replaces some legacy option in which case we need to check if the | ||
opt.validated = true; | ||
var val = opt.callback(this.argv[name] || ''); | ||
val !== undefined && (this.argv[name] = val); | ||
const val = opt.callback(this.argv[name] || ''); | ||
if (val !== undefined) { | ||
this.argv[name] = val; | ||
} | ||
delete opt.callback; | ||
@@ -1399,0 +1407,0 @@ } |
@@ -19,2 +19,3 @@ import { Command, Help } from 'commander'; | ||
cmd.helpOption(false); | ||
applyCommandConfig(cli, name, cmd, conf); | ||
this.platformCmds[conf.title] = cmd; | ||
@@ -21,0 +22,0 @@ } |
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
197507
5849