@boost/cli
Advanced tools
Comparing version 2.3.0 to 2.4.0
@@ -6,2 +6,18 @@ # Change Log | ||
## 2.4.0 - 2020-10-18 | ||
#### 🚀 Updates | ||
- Pass the logger to all middleware. ([0a28bb2](https://github.com/milesj/boost/commit/0a28bb2)) | ||
#### 🐞 Fixes | ||
- Dont swallow non-primitive values when console logging. ([f91f432](https://github.com/milesj/boost/commit/f91f432)) | ||
**Note:** Version bump only for package @boost/cli | ||
## 2.3.0 - 2020-10-15 | ||
@@ -8,0 +24,0 @@ |
@@ -1280,4 +1280,21 @@ 'use strict'; | ||
CONSOLE_METHODS[this.type].forEach(method => { | ||
const original = console[method]; | ||
console[method] = logger[method]; | ||
const original = console[method]; // The Node.js console API does not match our logger API, | ||
// so if a consumer is trying to debug actual objects, | ||
// arrays, or complex values, they will be swallowed | ||
// unless we use the util interpolation syntax. | ||
console[method] = (...args) => { | ||
const msgs = []; | ||
args.forEach(arg => { | ||
if (typeof arg === 'object') { | ||
msgs.push('%O'); | ||
} else if (typeof arg === 'number') { | ||
msgs.push('%d'); | ||
} else { | ||
msgs.push('%s'); | ||
} | ||
}); | ||
logger[method](msgs.join('\n'), args); | ||
}; | ||
this.unwrappers.push(() => { | ||
@@ -1620,3 +1637,3 @@ console[method] = original; | ||
if (middleware) { | ||
return middleware(nextArgv, next); | ||
return middleware(nextArgv, next, this.logger); | ||
} // Otherwise all middleware have ran, so parse the final list | ||
@@ -1868,3 +1885,3 @@ | ||
function checkNodeRequirement(range, throws = false) { | ||
return (argv, parse) => { | ||
return (argv, parse, logger) => { | ||
const { | ||
@@ -1880,4 +1897,3 @@ version | ||
} else { | ||
// eslint-disable-next-line no-console | ||
console.error(message); | ||
logger.error(message); | ||
} | ||
@@ -1912,8 +1928,7 @@ } | ||
function checkPackageOutdated(name, version) { | ||
return async (argv, parse) => { | ||
return async (argv, parse, logger) => { | ||
const latestVersion = await fetchPackageLatestVersion(name); | ||
if (latestVersion && !semver__default['default'].satisfies(version, `>=${latestVersion}`)) { | ||
// eslint-disable-next-line no-console | ||
console.info(`Your version of ${name} is out of date.`, `Latest version is ${latestVersion}, while you're using ${version}.`); | ||
logger.info(`Your version of ${name} is out of date.`, `Latest version is ${latestVersion}, while you're using ${version}.`); | ||
} | ||
@@ -1920,0 +1935,0 @@ |
/// <reference types="node" /> | ||
import React from 'react'; | ||
import { ArgList, Arguments, Argv, Category, Command as BaseCommandConfig, Flag, ListType, MapOptionConfig, MapParamConfig, MultipleOption, Option, OptionConfig, OptionConfigMap, Param, ParamConfig, ParamConfigList, ParserOptions, PrimitiveType, ScalarType, SingleOption, ValueType, UnknownOptionMap } from '@boost/args'; | ||
import { LoggerFunction } from '@boost/log'; | ||
import { Loggable, LoggerFunction } from '@boost/log'; | ||
export { ArgList, Arguments, Argv, Category, Flag, ListType, MultipleOption, Option, OptionConfig, OptionConfigMap, Param, ParamConfig, ParamConfigList, ParserOptions, PrimitiveType, ScalarType, SingleOption, UnknownOptionMap, ValueType, }; | ||
@@ -87,3 +87,3 @@ export declare type PartialConfig<T> = Omit<T, 'default' | 'description' | 'multiple' | 'path' | 'type'>; | ||
export declare type MiddlewareCallback = (argv: Argv) => MiddlewareArguments | Promise<MiddlewareArguments>; | ||
export declare type Middleware = (argv: Argv, parse: MiddlewareCallback) => MiddlewareArguments | Promise<MiddlewareArguments>; | ||
export declare type Middleware = (argv: Argv, parse: MiddlewareCallback, logger: Loggable) => MiddlewareArguments | Promise<MiddlewareArguments>; | ||
export declare type StyleType = 'default' | 'inverted' | 'failure' | 'muted' | 'success' | 'warning'; | ||
@@ -90,0 +90,0 @@ export declare type ThemePalette = { |
{ | ||
"name": "@boost/cli", | ||
"version": "2.3.0", | ||
"version": "2.4.0", | ||
"release": "1594765247526", | ||
@@ -47,3 +47,3 @@ "description": "An interactive command line program builder, powered by React and Ink.", | ||
}, | ||
"gitHead": "d62e9f07d8ba7d6b195a9bfdc0945eb12d0222ed" | ||
"gitHead": "53f84959caeb24284f5a08bf7a303e7f951dcea9" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
133239
2555