diff --git a/examples/index.html b/examples/index.html
index c36312b4..ebcb864e 100644
--- a/examples/index.html
+++ b/examples/index.html
@@ -1,4 +1,4 @@
-
+
Consola
diff --git a/examples/index.legacy.html b/examples/index.legacy.html
index 31f0b736..04335c82 100644
--- a/examples/index.legacy.html
+++ b/examples/index.legacy.html
@@ -1,4 +1,4 @@
-
+
Consola
diff --git a/examples/special.ts b/examples/special.ts
index 3325c77b..d5c07d3f 100755
--- a/examples/special.ts
+++ b/examples/special.ts
@@ -19,7 +19,7 @@ consola.error(undefined, null, false, true, Number.NaN);
consola.log("We can `monospace` keyword using grave accent charachter!");
consola.log(
- "We can also _underline_ words but not_this or this should_not_be_underlined!"
+ "We can also _underline_ words but not_this or this should_not_be_underlined!",
);
// Nonstandard error
diff --git a/examples/utils/index.ts b/examples/utils/index.ts
index 5e4e8eb7..92e4b3bd 100644
--- a/examples/utils/index.ts
+++ b/examples/utils/index.ts
@@ -2,7 +2,7 @@ import { ConsolaOptions, createConsola } from "../../src";
import { randomSentence } from "./sentence";
export function reporterDemo(
- opts: Partial
+ opts: Partial,
) {
const consola = createConsola({
...opts,
diff --git a/package.json b/package.json
index 56e7ebc8..c9f6ac31 100644
--- a/package.json
+++ b/package.json
@@ -85,7 +85,7 @@
"is-unicode-supported": "^1.3.0",
"jiti": "^1.18.2",
"lodash": "^4.17.21",
- "prettier": "^2.8.8",
+ "prettier": "^3.0.0",
"sentencer": "^0.2.1",
"sisteransi": "^1.0.5",
"std-env": "^3.3.3",
@@ -98,4 +98,4 @@
"node": "^14.18.0 || >=16.10.0"
},
"packageManager": "pnpm@8.6.5"
-}
\ No newline at end of file
+}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 005b9856..016f1f53 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -36,8 +36,8 @@ devDependencies:
specifier: ^4.17.21
version: 4.17.21
prettier:
- specifier: ^2.8.8
- version: 2.8.8
+ specifier: ^3.0.0
+ version: 3.0.0
sentencer:
specifier: ^0.2.1
version: 0.2.1
@@ -3169,9 +3169,9 @@ packages:
engines: {node: '>= 0.8.0'}
dev: true
- /prettier@2.8.8:
- resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==}
- engines: {node: '>=10.13.0'}
+ /prettier@3.0.0:
+ resolution: {integrity: sha512-zBf5eHpwHOGPC47h0zrPyNn+eAEIdEzfywMoYn2XPi0P44Zp0tSq64rq0xAREh4auw2cJZHo9QUob+NqCQky4g==}
+ engines: {node: '>=14'}
hasBin: true
dev: true
diff --git a/src/basic.ts b/src/basic.ts
index e5ccfa05..5b19882e 100644
--- a/src/basic.ts
+++ b/src/basic.ts
@@ -6,7 +6,7 @@ import { ConsolaInstance, createConsola as _createConsola } from "./consola";
export * from "./shared";
export function createConsola(
- options: Partial = {}
+ options: Partial = {},
): ConsolaInstance {
// Log level
let level: LogLevel = LogLevels.info;
diff --git a/src/consola.ts b/src/consola.ts
index e33c7fc4..1f1f2fc1 100644
--- a/src/consola.ts
+++ b/src/consola.ts
@@ -44,7 +44,7 @@ export class Consola {
colors: false,
compact: true,
},
- }
+ },
);
// Create logger functions for current instance
@@ -60,7 +60,7 @@ export class Consola {
// @ts-expect-error
(this as unknown as ConsolaInstance)[type].raw = this._wrapLogFn(
defaults,
- true
+ true,
);
}
@@ -81,7 +81,7 @@ export class Consola {
this.options.level = _normalizeLogLevel(
level,
this.options.types,
- this.options.level
+ this.options.level,
);
}
@@ -347,7 +347,7 @@ export class Consola {
// Auto-resolve when throttle is timed out
this._lastLog.timeout = setTimeout(
resolveLog,
- this.options.throttle
+ this.options.throttle,
);
return; // SPAM!
}
@@ -372,7 +372,7 @@ export class Consola {
function _normalizeLogLevel(
input: LogLevel | LogType | undefined,
types: any = {},
- defaultLevel = 3
+ defaultLevel = 3,
) {
if (input === undefined) {
return defaultLevel;
@@ -409,7 +409,7 @@ Consola.prototype.pause = Consola.prototype.pauseLogs;
Consola.prototype.resume = Consola.prototype.resumeLogs;
export function createConsola(
- options: Partial = {}
+ options: Partial = {},
): ConsolaInstance {
return new Consola(options) as ConsolaInstance;
}
diff --git a/src/index.ts b/src/index.ts
index d617185a..084bc28f 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -8,7 +8,7 @@ import { ConsolaInstance, createConsola as _createConsola } from "./consola";
export * from "./shared";
export function createConsola(
- options: Partial = {}
+ options: Partial = {},
): ConsolaInstance {
// Log level
let level = _getDefaultLogLevel();
diff --git a/src/prompt.ts b/src/prompt.ts
index f8546140..7e330bbc 100644
--- a/src/prompt.ts
+++ b/src/prompt.ts
@@ -50,10 +50,10 @@ type inferPromptReturnType = T extends TextOptions
export async function prompt<
_ = any,
__ = any,
- T extends PromptOptions = TextOptions
+ T extends PromptOptions = TextOptions,
>(
message: string,
- opts: PromptOptions = {}
+ opts: PromptOptions = {},
): Promise> {
if (!opts.type || opts.type === "text") {
return (await text({
@@ -75,7 +75,7 @@ export async function prompt<
return (await select({
message,
options: opts.options.map((o) =>
- typeof o === "string" ? { value: o, label: o } : o
+ typeof o === "string" ? { value: o, label: o } : o,
),
})) as any;
}
@@ -84,7 +84,7 @@ export async function prompt<
return (await multiselect({
message,
options: opts.options.map((o) =>
- typeof o === "string" ? { value: o, label: o } : o
+ typeof o === "string" ? { value: o, label: o } : o,
),
required: opts.required,
})) as any;
diff --git a/src/reporters/basic.ts b/src/reporters/basic.ts
index 9bba4124..7f74351d 100644
--- a/src/reporters/basic.ts
+++ b/src/reporters/basic.ts
@@ -71,7 +71,7 @@ export class BasicReporter implements ConsolaReporter {
line + "\n",
logObj.level < 2
? ctx.options.stderr || process.stderr
- : ctx.options.stdout || process.stdout
+ : ctx.options.stdout || process.stdout,
);
}
}
diff --git a/src/reporters/browser.ts b/src/reporters/browser.ts
index 145f3856..62d53595 100644
--- a/src/reporters/browser.ts
+++ b/src/reporters/browser.ts
@@ -61,7 +61,7 @@ export class BrowserReporter {
style,
// Empty string as style resets to default console style
"",
- ...logObj.args.slice(1)
+ ...logObj.args.slice(1),
);
} else {
consoleLogFn(badge, style, ...logObj.args);
diff --git a/src/reporters/fancy.ts b/src/reporters/fancy.ts
index 9a60642c..a023da39 100644
--- a/src/reporters/fancy.ts
+++ b/src/reporters/fancy.ts
@@ -55,7 +55,7 @@ export class FancyReporter extends BasicReporter {
" " +
line
.replace(/^at +/, (m) => colors.gray(m))
- .replace(/\((.+)\)/, (_, m) => `(${colors.cyan(m)})`)
+ .replace(/\((.+)\)/, (_, m) => `(${colors.cyan(m)})`),
)
.join("\n")
);
@@ -69,7 +69,7 @@ export class FancyReporter extends BasicReporter {
if (isBadge) {
return getBgColor(typeColor)(
- colors.black(` ${logObj.type.toUpperCase()} `)
+ colors.black(` ${logObj.type.toUpperCase()} `),
);
}
@@ -83,20 +83,20 @@ export class FancyReporter extends BasicReporter {
formatLogObj(logObj: LogObject, opts: FormatOptions) {
const [message, ...additional] = this.formatArgs(logObj.args, opts).split(
- "\n"
+ "\n",
);
if (logObj.type === "box") {
return box(
characterFormat(
- message + (additional.length > 0 ? "\n" + additional.join("\n") : "")
+ message + (additional.length > 0 ? "\n" + additional.join("\n") : ""),
),
{
title: logObj.title
? characterFormat(logObj.title as string)
: undefined,
style: logObj.style as BoxOpts["style"],
- }
+ },
);
}
@@ -120,7 +120,7 @@ export class FancyReporter extends BasicReporter {
: (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
line += characterFormat(
- additional.length > 0 ? "\n" + additional.join("\n") : ""
+ additional.length > 0 ? "\n" + additional.join("\n") : "",
);
if (logObj.type === "trace") {
diff --git a/src/types.ts b/src/types.ts
index 4e5bdf85..62b907fd 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -49,6 +49,6 @@ export interface ConsolaReporter {
logObj: LogObject,
ctx: {
options: ConsolaOptions;
- }
+ },
) => void;
}
diff --git a/src/utils/box.ts b/src/utils/box.ts
index ddf9db14..4c06b3ce 100644
--- a/src/utils/box.ts
+++ b/src/utils/box.ts
@@ -237,7 +237,7 @@ export function box(text: string, _opts: BoxOpts = {}) {
if (_color) {
for (const key in borderStyle) {
borderStyle[key as keyof typeof borderStyle] = _color(
- borderStyle[key as keyof typeof borderStyle]
+ borderStyle[key as keyof typeof borderStyle],
);
}
}
@@ -260,22 +260,22 @@ export function box(text: string, _opts: BoxOpts = {}) {
// Include the title if it exists with borders
if (opts.title) {
const left = borderStyle.h.repeat(
- Math.floor((width - stripAnsi(opts.title).length) / 2)
+ Math.floor((width - stripAnsi(opts.title).length) / 2),
);
const right = borderStyle.h.repeat(
width -
stripAnsi(opts.title).length -
stripAnsi(left).length +
- paddingOffset
+ paddingOffset,
);
boxLines.push(
- `${leftSpace}${borderStyle.tl}${left}${opts.title}${right}${borderStyle.tr}`
+ `${leftSpace}${borderStyle.tl}${left}${opts.title}${right}${borderStyle.tr}`,
);
} else {
boxLines.push(
`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${
borderStyle.tr
- }`
+ }`,
);
}
@@ -291,7 +291,9 @@ export function box(text: string, _opts: BoxOpts = {}) {
if (i < valignOffset || i >= valignOffset + textLines.length) {
// Empty line
boxLines.push(
- `${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`
+ `${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${
+ borderStyle.v
+ }`,
);
} else {
// Text line
@@ -299,7 +301,7 @@ export function box(text: string, _opts: BoxOpts = {}) {
const left = " ".repeat(paddingOffset);
const right = " ".repeat(width - stripAnsi(line).length);
boxLines.push(
- `${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`
+ `${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`,
);
}
}
@@ -308,7 +310,7 @@ export function box(text: string, _opts: BoxOpts = {}) {
boxLines.push(
`${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${
borderStyle.br
- }`
+ }`,
);
if (opts.style.marginBottom > 0) {
boxLines.push("".repeat(opts.style.marginBottom));
diff --git a/src/utils/color.ts b/src/utils/color.ts
index 352c37e4..bbc0c6b9 100644
--- a/src/utils/color.ts
+++ b/src/utils/color.ts
@@ -32,7 +32,7 @@ function replaceClose(
replace: string,
head = string.slice(0, Math.max(0, index)) + replace,
tail = string.slice(Math.max(0, index + close.length)),
- next = tail.indexOf(close)
+ next = tail.indexOf(close),
): string {
return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
}
@@ -42,7 +42,7 @@ function clearBleed(
string: string,
open: string,
close: string,
- replace: string
+ replace: string,
) {
return index < 0
? open + string + close
@@ -53,7 +53,7 @@ function filterEmpty(
open: string,
close: string,
replace = open,
- at = open.length + 1
+ at = open.length + 1,
) {
return (string: string) =>
string || !(string === "" || string === undefined)
@@ -62,7 +62,7 @@ function filterEmpty(
string,
open,
close,
- replace
+ replace,
)
: "";
}
@@ -128,7 +128,7 @@ export const colors = createColors() as Record;
export function getColor(
color: ColorName,
- fallback: ColorName = "reset"
+ fallback: ColorName = "reset",
): ColorFunction {
return colors[color] || colors[fallback];
}
diff --git a/src/utils/format.ts b/src/utils/format.ts
index 27e33efb..cedbacbf 100644
--- a/src/utils/format.ts
+++ b/src/utils/format.ts
@@ -20,7 +20,7 @@ export function compileFormat(format: string) {
for (const arg of FORMAT_ARGS) {
_format = _format.replace(
new RegExp("([%-])" + arg[0], "g"),
- "$1" + arg[1]
+ "$1" + arg[1],
);
}
diff --git a/src/utils/prompt.ts b/src/utils/prompt.ts
index 339cbc59..bec4f592 100644
--- a/src/utils/prompt.ts
+++ b/src/utils/prompt.ts
@@ -97,24 +97,24 @@ export const text = (opts: TextOptions) => {
switch (this.state) {
case "error": {
return `${title.trim()}\n${color.yellow(
- S_BAR
+ S_BAR,
)} ${value}\n${color.yellow(S_BAR_END)} ${color.yellow(
- this.error
+ this.error,
)}\n`;
}
case "submit": {
return `${title}${color.gray(S_BAR)} ${color.dim(
- this.value || opts.placeholder
+ this.value || opts.placeholder,
)}`;
}
case "cancel": {
return `${title}${color.gray(S_BAR)} ${color.strikethrough(
- color.dim(this.value ?? "")
+ color.dim(this.value ?? ""),
)}${this.value?.trim() ? "\n" + color.gray(S_BAR) : ""}`;
}
default: {
return `${title}${color.cyan(S_BAR)} ${value}\n${color.cyan(
- S_BAR_END
+ S_BAR_END,
)}\n`;
}
}
@@ -141,9 +141,9 @@ export const password = (opts: PasswordOptions) => {
switch (this.state) {
case "error": {
return `${title.trim()}\n${color.yellow(
- S_BAR
+ S_BAR,
)} ${masked}\n${color.yellow(S_BAR_END)} ${color.yellow(
- this.error
+ this.error,
)}\n`;
}
case "submit": {
@@ -151,12 +151,12 @@ export const password = (opts: PasswordOptions) => {
}
case "cancel": {
return `${title}${color.gray(S_BAR)} ${color.strikethrough(
- color.dim(masked ?? "")
+ color.dim(masked ?? ""),
)}${masked ? "\n" + color.gray(S_BAR) : ""}`;
}
default: {
return `${title}${color.cyan(S_BAR)} ${value}\n${color.cyan(
- S_BAR_END
+ S_BAR_END,
)}\n`;
}
}
@@ -189,7 +189,7 @@ export const confirm = (opts: ConfirmOptions) => {
}
case "cancel": {
return `${title}${color.gray(S_BAR)} ${color.strikethrough(
- color.dim(value)
+ color.dim(value),
)}\n${color.gray(S_BAR)}`;
}
default: {
@@ -221,11 +221,11 @@ export interface SelectOptions[], Value> {
}
export const select = [], Value>(
- opts: SelectOptions
+ opts: SelectOptions,
) => {
const opt = (
option: Option,
- state: "inactive" | "active" | "selected" | "cancelled"
+ state: "inactive" | "active" | "selected" | "cancelled",
) => {
const label = option.label ?? String(option.value);
switch (state) {
@@ -257,19 +257,19 @@ export const select = [], Value>(
case "submit": {
return `${title}${color.gray(S_BAR)} ${opt(
this.options[this.cursor],
- "selected"
+ "selected",
)}`;
}
case "cancel": {
return `${title}${color.gray(S_BAR)} ${opt(
this.options[this.cursor],
- "cancelled"
+ "cancelled",
)}\n${color.gray(S_BAR)}`;
}
default: {
return `${title}${color.cyan(S_BAR)} ${this.options
.map((option, i) =>
- opt(option, i === this.cursor ? "active" : "inactive")
+ opt(option, i === this.cursor ? "active" : "inactive"),
)
.join(`\n${color.cyan(S_BAR)} `)}\n${color.cyan(S_BAR_END)}\n`;
}
@@ -280,13 +280,13 @@ export const select = [], Value>(
export const selectKey = <
Options extends Option[],
- Value extends string
+ Value extends string,
>(
- opts: SelectOptions
+ opts: SelectOptions,
) => {
const opt = (
option: Option,
- state: "inactive" | "active" | "selected" | "cancelled" = "inactive"
+ state: "inactive" | "active" | "selected" | "cancelled" = "inactive",
) => {
const label = option.label ?? String(option.value);
switch (state) {
@@ -304,7 +304,7 @@ export const selectKey = <
// No default
}
return `${color.gray(
- color.bgWhite(color.inverse(` ${option.value} `))
+ color.bgWhite(color.inverse(` ${option.value} `)),
)} ${label} ${option.hint ? color.dim(`(${option.hint})`) : ""}`;
};
@@ -321,19 +321,19 @@ export const selectKey = <
return `${title}${color.gray(S_BAR)} ${opt(
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
this.options.find((opt) => opt.value === this.value)!,
- "selected"
+ "selected",
)}`;
}
case "cancel": {
return `${title}${color.gray(S_BAR)} ${opt(
this.options[0],
- "cancelled"
+ "cancelled",
)}\n${color.gray(S_BAR)}`;
}
default: {
return `${title}${color.cyan(S_BAR)} ${this.options
.map((option, i) =>
- opt(option, i === this.cursor ? "active" : "inactive")
+ opt(option, i === this.cursor ? "active" : "inactive"),
)
.join(`\n${color.cyan(S_BAR)} `)}\n${color.cyan(S_BAR_END)}\n`;
}
@@ -350,7 +350,7 @@ export interface MultiSelectOptions[], Value> {
cursorAt?: Value;
}
export const multiselect = [], Value>(
- opts: MultiSelectOptions
+ opts: MultiSelectOptions,
) => {
const opt = (
option: Option,
@@ -360,7 +360,7 @@ export const multiselect = [], Value>(
| "selected"
| "active-selected"
| "submitted"
- | "cancelled"
+ | "cancelled",
) => {
const label = option.label ?? String(option.value);
switch (state) {
@@ -398,11 +398,11 @@ export const multiselect = [], Value>(
return `Please select at least one option.\n${color.reset(
color.dim(
`Press ${color.gray(
- color.bgWhite(color.inverse(" space "))
+ color.bgWhite(color.inverse(" space ")),
)} to select, ${color.gray(
- color.bgWhite(color.inverse(" enter "))
- )} to submit`
- )
+ color.bgWhite(color.inverse(" enter ")),
+ )} to submit`,
+ ),
)}`;
}
},
@@ -435,7 +435,7 @@ export const multiselect = [], Value>(
.map((ln, i) =>
i === 0
? `${color.yellow(S_BAR_END)} ${color.yellow(ln)}`
- : ` ${ln}`
+ : ` ${ln}`,
)
.join("\n");
return (
@@ -482,7 +482,7 @@ export const multiselect = [], Value>(
export interface GroupMultiSelectOptions<
Options extends Option[],
- Value
+ Value,
> {
message: string;
options: Record;
@@ -491,7 +491,7 @@ export interface GroupMultiSelectOptions<
cursorAt?: Value;
}
export const groupMultiselect = [], Value>(
- opts: GroupMultiSelectOptions
+ opts: GroupMultiSelectOptions,
) => {
const opt = (
option: Option,
@@ -504,7 +504,7 @@ export const groupMultiselect = [], Value>(
| "group-active-selected"
| "submitted"
| "cancelled",
- options: Option[] = []
+ options: Option[] = [],
) => {
const label = option.label ?? String(option.value);
const isItem = typeof (option as any).group === "string";
@@ -524,12 +524,12 @@ export const groupMultiselect = [], Value>(
}
case "group-active-selected": {
return `${prefix}${color.green(S_CHECKBOX_SELECTED)} ${color.dim(
- label
+ label,
)}`;
}
case "selected": {
return `${color.dim(prefix)}${color.green(
- S_CHECKBOX_SELECTED
+ S_CHECKBOX_SELECTED,
)} ${color.dim(label)}`;
}
case "cancelled": {
@@ -537,7 +537,7 @@ export const groupMultiselect = [], Value>(
}
case "active-selected": {
return `${color.dim(prefix)}${color.green(
- S_CHECKBOX_SELECTED
+ S_CHECKBOX_SELECTED,
)} ${label} ${option.hint ? color.dim(`(${option.hint})`) : ""}`;
}
case "submitted": {
@@ -546,7 +546,7 @@ export const groupMultiselect = [], Value>(
// No default
}
return `${color.dim(prefix)}${color.dim(S_CHECKBOX_INACTIVE)} ${color.dim(
- label
+ label,
)}`;
};
@@ -560,11 +560,11 @@ export const groupMultiselect = [], Value>(
return `Please select at least one option.\n${color.reset(
color.dim(
`Press ${color.gray(
- color.bgWhite(color.inverse(" space "))
+ color.bgWhite(color.inverse(" space ")),
)} to select, ${color.gray(
- color.bgWhite(color.inverse(" enter "))
- )} to submit`
- )
+ color.bgWhite(color.inverse(" enter ")),
+ )} to submit`,
+ ),
)}`;
}
},
@@ -595,7 +595,7 @@ export const groupMultiselect = [], Value>(
.map((ln, i) =>
i === 0
? `${color.yellow(S_BAR_END)} ${color.yellow(ln)}`
- : ` ${ln}`
+ : ` ${ln}`,
)
.join("\n");
return `${title}${color.yellow(S_BAR)} ${this.options
@@ -613,7 +613,7 @@ export const groupMultiselect = [], Value>(
return opt(
option,
selected ? "group-active-selected" : "group-active",
- options
+ options,
);
}
if (active && selected) {
@@ -642,7 +642,7 @@ export const groupMultiselect = [], Value>(
return opt(
option,
selected ? "group-active-selected" : "group-active",
- options
+ options,
);
}
if (active && selected) {
@@ -670,24 +670,24 @@ export const note = (message = "", title = "") => {
ln = strip(ln);
return ln.length > sum ? ln.length : sum;
}, 0),
- strip(title).length
+ strip(title).length,
) + 2;
const msg = lines
.map(
(ln) =>
`${color.gray(S_BAR)} ${color.dim(ln)}${" ".repeat(
- len - strip(ln).length
- )}${color.gray(S_BAR)}`
+ len - strip(ln).length,
+ )}${color.gray(S_BAR)}`,
)
.join("\n");
process.stdout.write(
`${color.gray(S_BAR)}\n${color.green(S_STEP_SUBMIT)} ${color.reset(
- title
+ title,
)} ${color.gray(
- S_BAR_H.repeat(Math.max(len - title.length - 1, 1)) + S_CORNER_TOP_RIGHT
+ S_BAR_H.repeat(Math.max(len - title.length - 1, 1)) + S_CORNER_TOP_RIGHT,
)}\n${msg}\n${color.gray(
- S_CONNECT_LEFT + S_BAR_H.repeat(len + 2) + S_CORNER_BOTTOM_RIGHT
- )}\n`
+ S_CONNECT_LEFT + S_BAR_H.repeat(len + 2) + S_CORNER_BOTTOM_RIGHT,
+ )}\n`,
);
};
@@ -701,7 +701,7 @@ export const intro = (title = "") => {
export const outro = (message = "") => {
process.stdout.write(
- `${color.gray(S_BAR)}\n${color.gray(S_BAR_END)} ${message}\n\n`
+ `${color.gray(S_BAR)}\n${color.gray(S_BAR_END)} ${message}\n\n`,
);
};
@@ -711,14 +711,14 @@ export type LogMessageOptions = {
export const log = {
message: (
message = "",
- { symbol = color.gray(S_BAR) }: LogMessageOptions = {}
+ { symbol = color.gray(S_BAR) }: LogMessageOptions = {},
) => {
const parts = [`${color.gray(S_BAR)}`];
if (message) {
const [firstLine, ...lines] = message.split("\n");
parts.push(
`${symbol} ${firstLine}`,
- ...lines.map((ln) => `${color.gray(S_BAR)} ${ln}`)
+ ...lines.map((ln) => `${color.gray(S_BAR)} ${ln}`),
);
}
process.stdout.write(`${parts.join("\n")}\n`);
@@ -755,7 +755,7 @@ export const spinner = () => {
message = message.replace(/\.?\.?\.$/, "");
unblock = block();
process.stdout.write(
- `${color.gray(S_BAR)}\n${color.magenta("○")} ${message}\n`
+ `${color.gray(S_BAR)}\n${color.magenta("○")} ${message}\n`,
);
let i = 0;
let dot = 0;
@@ -765,7 +765,7 @@ export const spinner = () => {
process.stdout.write(
`${color.magenta(frame)} ${message}${
Math.floor(dot) >= 1 ? ".".repeat(Math.floor(dot)).slice(0, 3) : ""
- } \n`
+ } \n`,
);
i = i === frames.length - 1 ? 0 : i + 1;
dot = dot === frames.length ? 0 : dot + 0.125;
@@ -776,7 +776,7 @@ export const spinner = () => {
process.stdout.write(erase.down(2));
clearInterval(loop);
process.stdout.write(
- `${color.gray(S_BAR)}\n${color.green(S_STEP_SUBMIT)} ${message}\n`
+ `${color.gray(S_BAR)}\n${color.green(S_STEP_SUBMIT)} ${message}\n`,
);
unblock();
},
@@ -825,7 +825,7 @@ export type PromptGroup = {
*/
export const group = async (
prompts: PromptGroup,
- opts?: PromptGroupOptions
+ opts?: PromptGroupOptions,
): Promise>> => {
const results = {} as any;
const promptNames = Object.keys(prompts);
diff --git a/src/utils/string.ts b/src/utils/string.ts
index 1d3ffce7..f8d1ce33 100644
--- a/src/utils/string.ts
+++ b/src/utils/string.ts
@@ -45,7 +45,7 @@ export function align(
alignment: "left" | "right" | "center",
str: string,
len: number,
- space = " "
+ space = " ",
) {
switch (alignment) {
case "left": {