Skip to content

Commit

Permalink
rename @reliverse/prompts to @reliverse/relinka
Browse files Browse the repository at this point in the history
  • Loading branch information
blefnk committed Nov 19, 2024
1 parent d4b70e0 commit 1d73760
Show file tree
Hide file tree
Showing 75 changed files with 1,116 additions and 844 deletions.
1 change: 0 additions & 1 deletion .cursorignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ package-lock.json
pnpm-lock.yaml
examples/astro/
examples/clack/
examples/consola/
examples/cronvel/
examples/inquirer/
examples/terkelg/
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Reliverse Prompts

[**Docs**](https://docs.reliverse.org/prompts) | [**npmjs.com**](https://npmjs.com/package/@reliverse/prompts) | [**GitHub**](https://github.com/reliverse/prompts)
[**Docs**](https://docs.reliverse.org/prompts) | [**npmjs.com**](https://npmjs.com/package/@reliverse/relinka) | [**GitHub**](https://github.com/reliverse/prompts)

[![Separator](./public/split.png)](https://docs.reliverse.org/prompts)

@reliverse/prompts is a powerful library that enables seamless, type-safe, 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.
@reliverse/relinka is a powerful library that enables seamless, type-safe, 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.

[![CLI Example](./public/example.png)](https://docs.reliverse.org/prompts)

Expand All @@ -13,7 +13,7 @@
Install with your preferred package manager:

```sh
bun add @reliverse/prompts # Replace 'bun' with npm, pnpm, or yarn if desired (deno and jsr support coming soon)
bun add @reliverse/relinka # Replace 'bun' with npm, pnpm, or yarn if desired (deno and jsr support coming soon)
```

## Key Features
Expand Down Expand Up @@ -46,7 +46,7 @@ All prompts support custom validation logic, providing immediate feedback to use

## Contributing

@reliverse/prompts is a work in progress. We welcome feedback and contributions to help make it the best library it can be. Thank you!
@reliverse/relinka is a work in progress. We welcome feedback and contributions to help make it the best library it can be. Thank you!

Here is how to install the library for development:

Expand All @@ -58,11 +58,11 @@ bun i

## Playground

Run `bun dev` to launch the [examples/run-example.ts](./examples/run-example.ts) CLI, where you can dive into and explore any of the examples listed below. Experiment with @reliverse/prompts by running examples locally or reviewing the linked code:
Run `bun dev` to launch the [examples/run-example.ts](./examples/run-example.ts) CLI, where you can dive into and explore any of the examples listed below. Experiment with @reliverse/relinka by running examples locally or reviewing the linked code:

1. **[1-main-example.ts](./examples/1-main-example.ts)**: A comprehensive example of a CLI application featuring a well styled UI config. This example showcases all available prompt components, with code organized into separate functions and files for better readability and clarity.
2. **[2-mono-example.ts](./examples/2-mono-example.ts)**: A quiz game example inspired by Fireship's [video](https://youtube.com/watch?v=_oHByo8tiEY). It demonstrates the dynamic capabilities of @reliverse/prompts by using a prompt() that includes all prompt components, so you don't need to import each component separately.
3. **[3-basic-example.ts](./examples/3-basic-example.ts)**: A simple example highlighting the core functionalities of @reliverse/prompts. The entire implementation is contained within a single file for easy understanding.
2. **[2-mono-example.ts](./examples/2-mono-example.ts)**: A quiz game example inspired by Fireship's [video](https://youtube.com/watch?v=_oHByo8tiEY). It demonstrates the dynamic capabilities of @reliverse/relinka by using a prompt() that includes all prompt components, so you don't need to import each component separately.
3. **[3-basic-example.ts](./examples/3-basic-example.ts)**: A simple example highlighting the core functionalities of @reliverse/relinka. The entire implementation is contained within a single file for easy understanding.

## Prompts Library Comparison

Expand All @@ -75,9 +75,10 @@ Run `bun dev` to launch the [examples/run-example.ts](./examples/run-example.ts)
- 🔵: Partially supported
- 🔴: Not supported

| **Feature** | **@reliverse/prompts** | **@inquirer/prompts** | **@clack/prompts** | **@terkelg/prompts** | **@cronvel/terminal-kit** | **@unjs/consola** |
| **Feature** | **@reliverse/relinka** | **@inquirer/prompts** | **@clack/prompts** | **@terkelg/prompts** | **@cronvel/terminal-kit** | **@unjs/consola** |
|-----------------------------------------------|----------------------------------------------------|------------------------|---------------------|------------------------------|-----------------------------|-------------------|
| **Full Node.js Modules Support** | 🟢 ESM-only | 🟡 | 🟡 | 🔴 CJS-only | 🔴 CJS-only | 🟡 |
| **Both terminal and browser support** | 🟢 | 🟡 | 🟡 | 🟡 | 🟡 | 🟢 |
| **Codebase typesafety with intellisense** | 🔵 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
| **Runtime typesafety with schema validation** | 🟢 TypeBox & Custom | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
| **Usage Examples** | 🟢 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
Expand All @@ -99,7 +100,7 @@ Run `bun dev` to launch the [examples/run-example.ts](./examples/run-example.ts)
| **Ease of Setup** | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
| **Crash Resilience** | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
| **General DX** | 🔵 Clean and understandable TypeScript code | 🟡 | 🟡 | 🔴 JS-only | 🔴 JS-only | 🟡 |
| **DX: Classes** | 🟢 Zero classes | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
| **DX: Classes** | 🟢 Minimal number of classes as possible | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
| **Documentation** | 🟡 | 🟡 | 🟡 | 🔵 | 🟢 | 🟡 |
| **Designed With UX in Mind** | 🔵 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |

Expand All @@ -113,7 +114,7 @@ This project wouldn’t exist without the amazing work of the following projects

## Wrap-Up

@reliverse/prompts is a versatile library designed to accelerate CLI development by providing customizable prompt components. Integrated into the [Reliverse CLI](https://github.com/blefnk/reliverse#readme), @reliverse/prompts enables you to create a unique design aligned with your CLI app’s aesthetics, similar to how @shadcn/ui supports customizable web UI components. Quickly get started by copying configurations from the [Reliverse Docs](https://docs.reliverse.org/prompts) and using components that fit your project, making it faster to bring your CLI app to life. You’re free to customize each component as desired, with default designs provided to ensure an attractive interface from the start.
@reliverse/relinka is a versatile library designed to accelerate CLI development by providing customizable prompt components. Integrated into the [Reliverse CLI](https://github.com/blefnk/reliverse#readme), @reliverse/relinka enables you to create a unique design aligned with your CLI app’s aesthetics, similar to how @shadcn/ui supports customizable web UI components. Quickly get started by copying configurations from the [Reliverse Docs](https://docs.reliverse.org/prompts) and using components that fit your project, making it faster to bring your CLI app to life. You’re free to customize each component as desired, with default designs provided to ensure an attractive interface from the start.

**Example Configuration:**

Expand Down
9 changes: 7 additions & 2 deletions cspell.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"version": "0.2",
"language": "en",
"import": ["@cspell/dict-npm/cspell-ext.json"],
"ignorePaths": ["examples/external/cronvel"],
"import": [
"@cspell/dict-npm/cspell-ext.json"
],
"ignorePaths": [
"examples/external/cronvel"
],
"words": [
"alacritty",
"Approximative",
Expand Down Expand Up @@ -52,6 +56,7 @@
"pageup",
"printj",
"redrun",
"relinka",
"reliverse",
"Rivia",
"sbuf",
Expand Down
21 changes: 18 additions & 3 deletions examples/1-main-example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
showConfirmPrompt,
showDatePrompt,
showEndPrompt,
showMultiselectPrompt,
// showMultiSelectPrompt,
showNextStepsPrompt,
showNumberPrompt,
showNumSelectPrompt,
Expand All @@ -19,18 +19,33 @@ import {
showTextPrompt,
} from "@/reliverse/main-prompts";
import { type UserInput } from "@/reliverse/main-schema";
import { errorHandler } from "~/utils/helpers/errors";

import { multiSelectPrompt } from "~/components/multi-select";
import { selectPrompt } from "~/components/select";
import { errorHandler } from "~/utils/errors";

export async function detailedExample() {
await showStartPrompt();
await showAnyKeyPrompt("privacy");

const selectOptions = ["Option 1", "Option 2", "Option 3", "Option 4"];
const multiSelectOptions = ["Option 1", "Option 2", "Option 3", "Option 4"];

const selectedOption = await selectPrompt(selectOptions);
console.log(`You selected: ${selectedOption}`);

const selectedOptions = await multiSelectPrompt(multiSelectOptions);
console.log("You selected:");
selectedOptions.forEach((option) => console.log(option));

const username = await showTextPrompt();
const dir = await askDir(username);
const age = await showNumberPrompt();
const color = await showNumSelectPrompt();
const password = await showPasswordPrompt();
const birthday = await showDatePrompt();
const features = await showMultiselectPrompt();
// const features = await showMultiSelectPrompt();
const features = ["Feature 1", "Feature 2", "Feature 3"];
const deps = await showConfirmPrompt(username);
const userInput = {
username,
Expand Down
26 changes: 18 additions & 8 deletions examples/2-mono-example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

import { createAsciiArt } from "~/components/ascii-art";
import { prompt } from "~/components/mono";
import { spinnerPrompts } from "~/components/spinner";
import { colorize } from "~/utils/colorize";
import { errorHandler } from "~/utils/helpers/errors";

import { handleAnswer } from "./reliverse/experiments/state/utils/handleAnswer";
import { errorHandler } from "~/utils/errors";

async function main() {
await prompt({
Expand Down Expand Up @@ -43,11 +42,22 @@ async function main() {
{ title: "Dec 17, 1996", id: "Dec 17, 1996" },
],
});
await handleAnswer(
answer === "Dec 4th, 1995",
`Nice work ${playerName}. That's a legit answer!`,
`🫠 Game over, ${playerName}! You lose!`,
);

await spinnerPrompts({
initialMessage: "Checking answer...",
successMessage: "Answer checked successfully.",
spinnerSolution: "ora",
spinnerType: "arc",
action: async (updateMessage) => {
await new Promise((resolve) => setTimeout(resolve, 2000));
updateMessage(
answer === "Dec 4th, 1995"
? `Nice work ${playerName}. That's a legit answer!`
: `🫠 Game over, ${playerName}! You lose!`,
);
await new Promise((resolve) => setTimeout(resolve, 1000));
},
});

const message = `Congrats !\n $ 1 , 0 0 0 , 0 0 0`;

Expand Down
6 changes: 3 additions & 3 deletions examples/3-basic-example.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// 3-basic-example.ts: A basic example demonstrating core functionalities of @reliverse/prompts. Everything in a single file.
// 3-basic-example.ts: A basic example demonstrating core functionalities of @reliverse/relinka. Everything in a single file.

import { showSpinner } from "@/reliverse/main-prompts";

import type { OptionalPromptOptions } from "~/types/prod";

import { numberPrompt, textPrompt } from "~/main";
import { errorHandler } from "~/utils/helpers/errors";
import { errorHandler } from "~/utils/errors";

export const basicConfig = {
titleColor: "cyanBright",
Expand All @@ -23,7 +23,7 @@ async function main() {
await textPrompt({
id: "start",
title: "Hello, Reliverse Community! 👋",
content: "You are testing the basic example of @reliverse/prompts",
content: "You are testing the basic example of @reliverse/relinka",
...extendedConfig,
titleVariant: "box",
contentVariant: "underline",
Expand Down
Loading

0 comments on commit 1d73760

Please sign in to comment.