Skip to content

Commit

Permalink
improve preventWrongTerminalSize() fn
Browse files Browse the repository at this point in the history
  • Loading branch information
blefnk committed Jan 22, 2025
1 parent 008471b commit c6ee772
Show file tree
Hide file tree
Showing 22 changed files with 34 additions and 28 deletions.
Binary file modified bun.lockb
Binary file not shown.
12 changes: 9 additions & 3 deletions cspell.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
{
"version": "1.4.9",
"version": "1.4.10",
"language": "en",
"import": ["@cspell/dict-npm/cspell-ext.json"],
"ignorePaths": ["examples/deprecated", "dist-jsr", "dist-npm"],
"import": [
"@cspell/dict-npm/cspell-ext.json"
],
"ignorePaths": [
"examples/deprecated",
"dist-jsr",
"dist-npm"
],
"words": [
"alacritty",
"alcalzone",
Expand Down
4 changes: 2 additions & 2 deletions examples/src/prompts.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { re } from "@reliverse/relico";
import { msg } from "@reliverse/relinka";
import { detect } from "detect-package-manager";
import { emojify } from "node-emoji";
import { re } from "@reliverse/relico";

import { anykeyPrompt, spinnerTaskPrompt } from "~/main.js";
import { multiselectPrompt } from "~/main.js";
Expand Down Expand Up @@ -36,7 +36,7 @@ const pkg = packageJson;

// const pkg = {
// name: "@reliverse/prompts",
// version: "1.4.9",
// version: "1.4.10",
// description:
// "@reliverse/prompts is a powerful library that enables seamless, typesafe, and resilient prompts for command-line applications. Crafted with simplicity and elegance, it provides developers with an intuitive and robust way to build interactive CLIs.",
// };
Expand Down
2 changes: 1 addition & 1 deletion examples/src/simple/input.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as url from "node:url";
import { re } from "@reliverse/relico";
import * as url from "node:url";

import { input } from "~/prompts/index.js";

Expand Down
2 changes: 1 addition & 1 deletion jsr.jsonc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reliverse/prompts",
"version": "1.4.9",
"version": "1.4.10",
"author": "blefnk",
"license": "MIT",
"exports": "./dist-jsr/main.ts",
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reliverse/prompts",
"version": "1.4.9",
"version": "1.4.10",
"author": "blefnk",
"type": "module",
"description": "@reliverse/prompts is a powerful library that enables seamless, typesafe, and resilient prompts for command-line applications. Crafted with simplicity and elegance, it provides developers with an intuitive and robust way to build interactive CLIs.",
Expand Down Expand Up @@ -58,7 +58,7 @@
"@alcalzone/ansi-tokenize": "^0.1.3",
"@figliolia/chalk-animation": "^1.0.4",
"@reliverse/relico": "^1.0.0",
"@reliverse/relinka": "^1.2.8",
"@reliverse/relinka": "^1.2.9",
"@sinclair/typebox": "^0.34.14",
"ansi-diff-stream": "^1.2.1",
"ansi-escapes": "^7.0.0",
Expand Down Expand Up @@ -140,9 +140,9 @@
"eslint-plugin-perfectionist": "^4.7.0",
"execa": "^9.5.2",
"jiti": "^2.4.2",
"knip": "^5.42.3",
"knip": "^5.43.1",
"mock-stdin": "^1.0.0",
"p-queue": "^8.0.1",
"p-queue": "^8.1.0",
"printj": "^1.3.1",
"sentencer": "^0.2.1",
"strip-comments": "^2.0.1",
Expand Down
2 changes: 1 addition & 1 deletion src/checkbox/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ansiEscapes from "ansi-escapes";
import { re } from "@reliverse/relico";
import ansiEscapes from "ansi-escapes";

import type { PartialDeep } from "~/types/utils.js";

Expand Down
2 changes: 1 addition & 1 deletion src/confirm/confirm-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import type {
} from "@reliverse/relinka";
import type { VariantName } from "@reliverse/relinka";

import { re } from "@reliverse/relico";
import { bar, msg } from "@reliverse/relinka";
import { deleteLastLine } from "@reliverse/relinka";
import { stdin as input, stdout as output } from "node:process";
import readline from "node:readline/promises";
import { re } from "@reliverse/relico";

import { colorize } from "~/main.js";
import { completePrompt } from "~/utils/prompt-end.js";
Expand Down
2 changes: 1 addition & 1 deletion src/date/date.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { ColorName } from "@reliverse/relinka";

import { re } from "@reliverse/relico";
import {
deleteLastLine,
fmt,
Expand All @@ -12,7 +13,6 @@ import { Type, type TSchema } from "@sinclair/typebox";
import { Value } from "@sinclair/typebox/value";
import { stdin as input, stdout as output } from "node:process";
import readline from "node:readline/promises";
import { re } from "@reliverse/relico";
import {
buildRegExp,
digit,
Expand Down
2 changes: 1 addition & 1 deletion src/input/input-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type {
import type { TSchema } from "@sinclair/typebox";
import type { Interface } from "node:readline/promises";

import { re } from "@reliverse/relico";
import {
bar,
deleteLastLine,
Expand All @@ -18,7 +19,6 @@ import {
} from "@reliverse/relinka";
import { Value } from "@sinclair/typebox/value";
import readline from "node:readline/promises";
import { re } from "@reliverse/relico";

import type { PromptOptions } from "~/main.js";

Expand Down
2 changes: 1 addition & 1 deletion src/multiselect/multiselect-main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { BorderColorName, VariantName } from "@reliverse/relinka";

import { re } from "@reliverse/relico";
import {
deleteLastLine,
msg,
Expand All @@ -9,7 +10,6 @@ import {
} from "@reliverse/relinka";
import { stdin as input, stdout as output } from "node:process";
import readline from "node:readline";
import { re } from "@reliverse/relico";
import terminalSize from "terminal-size";

import { completePrompt } from "~/utils/prompt-end.js";
Expand Down
2 changes: 1 addition & 1 deletion src/multiselect/num-multi-select.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { re } from "@reliverse/relico";
import {
bar,
countLines,
Expand All @@ -9,7 +10,6 @@ import {
import { Value } from "@sinclair/typebox/value";
import { stdin as input, stdout as output } from "node:process";
import readline from "node:readline/promises";
import { re } from "@reliverse/relico";

import type { PromptOptions } from "~/types/general.js";

Expand Down
2 changes: 1 addition & 1 deletion src/range/range.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Writable } from "stream";

import { re } from "@reliverse/relico";
import Differ from "ansi-diff-stream";
import esc from "ansi-escapes";
import ui from "cli-styles";
import { EventEmitter } from "events";
import { re } from "@reliverse/relico";
import precision from "precision";
import stringWidth from "string-width";
import windowSize from "window-size";
Expand Down
2 changes: 1 addition & 1 deletion src/select/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ansiEscapes from "ansi-escapes";
import { re } from "@reliverse/relico";
import ansiEscapes from "ansi-escapes";

import type { PartialDeep } from "~/types/utils.js";

Expand Down
2 changes: 1 addition & 1 deletion src/select/select-main.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { BorderColorName, VariantName } from "@reliverse/relinka";

import { re } from "@reliverse/relico";
import { deleteLastLine, symbols } from "@reliverse/relinka";
import { msg, type ColorName, type TypographyName } from "@reliverse/relinka";
import { stdin as input, stdout as output } from "node:process";
import readline from "node:readline";
import { re } from "@reliverse/relico";
import terminalSize from "terminal-size";

import { completePrompt } from "~/utils/prompt-end.js";
Expand Down
2 changes: 1 addition & 1 deletion src/select/select-two.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Key } from "node:readline";

import { re } from "@reliverse/relico";
import { Value } from "@sinclair/typebox/value";
import { stdout } from "node:process";
import { re } from "@reliverse/relico";

import type { PromptOptions } from "~/types/general.js";

Expand Down
2 changes: 1 addition & 1 deletion src/task/spinner.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { re } from "@reliverse/relico";
import { msg } from "@reliverse/relinka";
import { type SpinnerName } from "cli-spinners";
import process from "node:process";
import ora from "ora";
import { re } from "@reliverse/relico";
import { cursor, erase } from "sisteransi";

type SimpleSpinnerType = "default" | "dottedCircle" | "boxSpinner";
Expand Down
2 changes: 1 addition & 1 deletion src/task/task.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { Options } from "p-map";

import { re } from "@reliverse/relico";
import { msg } from "@reliverse/relinka";
import { EventEmitter } from "node:events";
import process from "node:process";
import ora from "ora";
import pMap from "p-map";
import { re } from "@reliverse/relico";
import { cursor, erase } from "sisteransi";

import type { ProgressBar } from "~/task/types.js";
Expand Down
2 changes: 1 addition & 1 deletion src/toggle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import type {
} from "@reliverse/relinka";
import type { VariantName } from "@reliverse/relinka";

import { re } from "@reliverse/relico";
import { deleteLastLine, msg } from "@reliverse/relinka";
import { stdin as input, stdout as output } from "node:process";
import readline from "node:readline";
import { re } from "@reliverse/relico";

import { completePrompt } from "~/utils/prompt-end.js";

Expand Down
4 changes: 2 additions & 2 deletions src/utils/prevent.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { re } from "@reliverse/relico";
import {
getExactTerminalWidth,
getTerminalWidth,
msg,
} from "@reliverse/relinka";
import { re } from "@reliverse/relico";
import terminalSize from "terminal-size";

export type PreventWrongTerminalSizeOptions = {
Expand All @@ -17,7 +17,7 @@ export type PreventWrongTerminalSizeOptions = {
export async function preventWrongTerminalSize({
isDev = false,
shouldExit = true,
minWidth = 85,
minWidth = 80,
minHeight = 12,
sizeErrorDescription = "Please increase the terminal size to run the application",
}: PreventWrongTerminalSizeOptions) {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/prompt-end.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { BorderColorName, VariantName } from "@reliverse/relinka";

import { re } from "@reliverse/relico";
import {
getExactTerminalWidth,
msg,
symbols,
type ColorName,
type TypographyName,
} from "@reliverse/relinka";
import { re } from "@reliverse/relico";

/**
* Ends the prompt by optionally displaying an end message and running the action if confirmed.
Expand Down
2 changes: 1 addition & 1 deletion src/utils/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const pm = await detect();
export const pmv = await getNpmVersion(pm);
export const pkg = {
name: "@reliverse/prompts",
version: "1.4.9",
version: "1.4.10",
description:
"@reliverse/prompts is a powerful library that enables seamless, typesafe, and resilient prompts for command-line applications. Crafted with simplicity and elegance, it provides developers with an intuitive and robust way to build interactive CLIs.",
};

0 comments on commit c6ee772

Please sign in to comment.