@clack/prompts
Advanced tools
Comparing version 0.4.1 to 0.4.2
# @clack/prompts | ||
## 0.4.2 | ||
### Patch Changes | ||
- Update README | ||
## 0.4.1 | ||
@@ -4,0 +10,0 @@ |
@@ -27,3 +27,3 @@ export { isCancel } from '@clack/core'; | ||
options: Options; | ||
initialValue?: Options[number]["value"]; | ||
initialValue?: Options[number]['value']; | ||
} | ||
@@ -35,3 +35,3 @@ interface MultiSelectOptions<Options extends Option<Value>[], Value extends Primitive> { | ||
required?: boolean; | ||
cursorAt?: Options[number]["value"]; | ||
cursorAt?: Options[number]['value']; | ||
} | ||
@@ -38,0 +38,0 @@ declare const select: <Options extends Option<Value>[], Value extends Primitive>(opts: SelectOptions<Options, Value>) => Promise<symbol | Options[number]["value"]>; |
{ | ||
"name": "@clack/prompts", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.cjs", |
@@ -5,3 +5,3 @@ # `@clack/prompts` | ||
![clack-prompt](https://user-images.githubusercontent.com/7118177/218462018-bb41eff4-5335-4abe-9eeb-31e8c8402713.gif) | ||
![clack-prompt](https://github.com/natemoo-re/clack/blob/main/.github/assets/clack-demo.gif) | ||
@@ -12,6 +12,6 @@ --- | ||
- 🤏 Only 4 kB gzip (80% smaller than `prompts`) | ||
- 🤏 80% smaller than other options | ||
- 💎 Beautiful, minimal UI | ||
- ✅ Simple API | ||
- 🧱 Comes with `text`, `confirm`, `select`, and `spinner` components | ||
- 🧱 Comes with `text`, `confirm`, `select`, `multiselect`, and `spinner` components | ||
@@ -25,3 +25,3 @@ ## Basics | ||
```js | ||
import { intro, outro } from "@clack/prompts"; | ||
import { intro, outro } from '@clack/prompts'; | ||
@@ -38,3 +38,3 @@ intro(`create-my-app`); | ||
```js | ||
import { isCancel, cancel, text } from "@clack/prompts"; | ||
import { isCancel, cancel, text } from '@clack/prompts'; | ||
@@ -44,3 +44,3 @@ const value = await text(/* TODO */); | ||
if (isCancel(value)) { | ||
cancel("Operation cancelled."); | ||
cancel('Operation cancelled.'); | ||
process.exit(0); | ||
@@ -57,8 +57,8 @@ } | ||
```js | ||
import { text } from "@clack/prompts"; | ||
import { text } from '@clack/prompts'; | ||
const meaning = await text({ | ||
message: "What is the meaning of life?", | ||
placeholder: "Not sure", | ||
initialValue: "42", | ||
message: 'What is the meaning of life?', | ||
placeholder: 'Not sure', | ||
initialValue: '42', | ||
validate(value) { | ||
@@ -75,6 +75,6 @@ if (value.length === 0) return `Value is required!`; | ||
```js | ||
import { confirm } from "@clack/prompts"; | ||
import { confirm } from '@clack/prompts'; | ||
const shouldContinue = await confirm({ | ||
message: "Do you want to continue?", | ||
message: 'Do you want to continue?', | ||
}); | ||
@@ -88,10 +88,10 @@ ``` | ||
```js | ||
import { select } from "@clack/prompts"; | ||
import { select } from '@clack/prompts'; | ||
const projectType = await select({ | ||
message: "Pick a project type.", | ||
message: 'Pick a project type.', | ||
options: [ | ||
{ value: "ts", label: "TypeScript" }, | ||
{ value: "js", label: "JavaScript" }, | ||
{ value: "coffee", label: "CoffeeScript", hint: "oh no" }, | ||
{ value: 'ts', label: 'TypeScript' }, | ||
{ value: 'js', label: 'JavaScript' }, | ||
{ value: 'coffee', label: 'CoffeeScript', hint: 'oh no' }, | ||
], | ||
@@ -106,10 +106,10 @@ }); | ||
```js | ||
import { multiselect } from "@clack/prompts"; | ||
import { multiselect } from '@clack/prompts'; | ||
const additionalTools = await multiselect({ | ||
message: "Select additional tools.", | ||
message: 'Select additional tools.', | ||
options: [ | ||
{ value: "eslint", label: "ESLint", hint: "recommended" }, | ||
{ value: "prettier", label: "Prettier" }, | ||
{ value: "gh-action", label: "GitHub Action" }, | ||
{ value: 'eslint', label: 'ESLint', hint: 'recommended' }, | ||
{ value: 'prettier', label: 'Prettier' }, | ||
{ value: 'gh-action', label: 'GitHub Action' }, | ||
], | ||
@@ -125,8 +125,8 @@ required: false, | ||
```js | ||
import { spinner } from "@clack/prompts"; | ||
import { spinner } from '@clack/prompts'; | ||
const s = spinner(); | ||
s.start("Installing via npm"); | ||
s.start('Installing via npm'); | ||
// Do installation | ||
s.stop("Installed via npm"); | ||
s.stop('Installed via npm'); | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
29657