{"_id":"@bernankez/prompt","_rev":"3-68018b57eaf953b6aebec2b93408fd65","name":"@bernankez/prompt","dist-tags":{"latest":"0.1.3"},"versions":{"0.1.0":{"name":"@bernankez/prompt","type":"module","version":"0.1.0","packageManager":"pnpm@8.6.5","description":"Effortlessly build beautiful command-line apps","author":{"name":"Cole","email":"bernankeic@gmail.com"},"license":"MIT","homepage":"https://github.com/bernankez/prompt#readme","repository":{"type":"git","url":"git+https://github.com/bernankez/prompt.git"},"bugs":{"url":"https://github.com/bernankez/prompt/issues"},"keywords":["clack","command-line","cli","prompt"],"sideEffects":false,"exports":{".":{"types":"./dist/index.d.ts","require":"./dist/index.cjs","import":"./dist/index.mjs"}},"main":"./dist/index.mjs","module":"./dist/index.mjs","types":"./dist/index.d.ts","typesVersions":{"*":{"*":["./dist/*","./dist/index.d.ts"]}},"dependencies":{"@clack/core":"^0.3.2","picocolors":"^1.0.0","sisteransi":"^1.0.5","is-unicode-supported":"*"},"devDependencies":{"@bernankez/eslint-config":"^0.7.0","@types/node":"^20.3.3","bumpp":"^9.1.1","eslint":"^8.44.0","is-unicode-supported":"^1.3.0","lint-staged":"^13.2.3","rimraf":"^5.0.1","simple-git-hooks":"^2.8.1","tsx":"^3.12.7","typescript":"^5.1.6","unbuild":"^1.2.1","vite":"^4.3.9","vitest":"^0.32.2"},"simple-git-hooks":{"pre-commit":"pnpm lint-staged"},"lint-staged":{"*":"eslint --fix"},"publishConfig":{"access":"public"},"scripts":{"preinstall":"npx only-allow pnpm","postinstall":"simple-git-hooks","build":"unbuild","dev":"unbuild --stub","release":"bumpp && pnpm publish","start":"tsx src/index.ts","watch":"tsx --watch src/index.ts","test":"vitest run","test:watch":"vitest","typecheck":"tsc --noEmit","lint":"eslint .","fix":"eslint . --fix"},"bundleDependencies":["is-unicode-supported"],"_id":"@bernankez/prompt@0.1.0","_integrity":"sha512-aS3kYJZVaqsxlwrowzSy1xu8HG3bGH5Xa9sYw5j7iIXct1fAwB3UWpXQgvcgfCVzesm4055c9Z486LI0O+Ovjw==","_resolved":"/private/var/folders/6m/rmyrz0596_d4l4bxr52k9bmm0000gn/T/35e81aafa5cc7170493dad8bb31d68ea/bernankez-prompt-0.1.0.tgz","_from":"file:bernankez-prompt-0.1.0.tgz","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-aS3kYJZVaqsxlwrowzSy1xu8HG3bGH5Xa9sYw5j7iIXct1fAwB3UWpXQgvcgfCVzesm4055c9Z486LI0O+Ovjw==","shasum":"7ca29f8b3a8c7cb305c2d6a2718e3dcfe9149587","tarball":"https://registry.npmjs.org/@bernankez/prompt/-/prompt-0.1.0.tgz","fileCount":12,"unpackedSize":49504,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDM1Kt1QqGMz8Ak3HSZEuAsbncr0EY/uo/K+6E/QglnjgIgfr+Xc7fLNR/eiYnKVwhwnTWax2qph6RXlop10lXc2jM="}]},"_npmUser":{"name":"bernankez","email":"bernankeic@gmail.com"},"directories":{},"maintainers":[{"name":"bernankez","email":"bernankeic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/prompt_0.1.0_1688372105887_0.8847925029985639"},"_hasShrinkwrap":false},"0.1.1":{"name":"@bernankez/prompt","type":"module","version":"0.1.1","packageManager":"pnpm@8.6.5","description":"Effortlessly build beautiful command-line apps","author":{"name":"Cole","email":"bernankeic@gmail.com"},"license":"MIT","homepage":"https://github.com/bernankez/prompt#readme","repository":{"type":"git","url":"git+https://github.com/bernankez/prompt.git"},"bugs":{"url":"https://github.com/bernankez/prompt/issues"},"keywords":["clack","command-line","cli","prompt"],"sideEffects":false,"exports":{".":{"types":"./dist/index.d.ts","require":"./dist/index.cjs","import":"./dist/index.mjs"}},"main":"./dist/index.mjs","module":"./dist/index.mjs","types":"./dist/index.d.ts","typesVersions":{"*":{"*":["./dist/*","./dist/index.d.ts"]}},"dependencies":{"@clack/core":"^0.3.2","picocolors":"^1.0.0","sisteransi":"^1.0.5","is-unicode-supported":"*"},"devDependencies":{"@bernankez/eslint-config":"^0.7.0","@types/node":"^20.3.3","bumpp":"^9.1.1","eslint":"^8.44.0","is-unicode-supported":"^1.3.0","lint-staged":"^13.2.3","rimraf":"^5.0.1","simple-git-hooks":"^2.8.1","tsx":"^3.12.7","typescript":"^5.1.6","unbuild":"^1.2.1","vite":"^4.3.9","vitest":"^0.32.2"},"simple-git-hooks":{"pre-commit":"pnpm lint-staged"},"lint-staged":{"*":"eslint --fix"},"publishConfig":{"access":"public"},"scripts":{"preinstall":"npx only-allow pnpm","postinstall":"simple-git-hooks","build":"unbuild","dev":"unbuild --stub","release":"bumpp && pnpm publish","start":"tsx src/index.ts","watch":"tsx --watch src/index.ts","test":"vitest run","test:watch":"vitest","typecheck":"tsc --noEmit","lint":"eslint .","fix":"eslint . --fix"},"bundleDependencies":["is-unicode-supported"],"_id":"@bernankez/prompt@0.1.1","_integrity":"sha512-cf/wZNOKxMVzDkR0SJecZVQzjjItmKdvDDbOxQZh/ru5bAY3cS183jTzhq0CcTutrswsRFtqj3MAVTcUcrcXKg==","_resolved":"/private/var/folders/6m/rmyrz0596_d4l4bxr52k9bmm0000gn/T/897adec19b2625cc6932c58b365f1368/bernankez-prompt-0.1.1.tgz","_from":"file:bernankez-prompt-0.1.1.tgz","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-cf/wZNOKxMVzDkR0SJecZVQzjjItmKdvDDbOxQZh/ru5bAY3cS183jTzhq0CcTutrswsRFtqj3MAVTcUcrcXKg==","shasum":"052ea2e2bffc3b09bd9c634b028df0642b08bd52","tarball":"https://registry.npmjs.org/@bernankez/prompt/-/prompt-0.1.1.tgz","fileCount":12,"unpackedSize":49343,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFtb+vX1mEEICp1PtiKZAOZvpVk+PRBFd3NgDDebgd7mAiB5/QO11vy9fUvSiv77QtMceSmYpIveV81PkqkZNS/VFw=="}]},"_npmUser":{"name":"bernankez","email":"bernankeic@gmail.com"},"directories":{},"maintainers":[{"name":"bernankez","email":"bernankeic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/prompt_0.1.1_1688377830291_0.47460199829786287"},"_hasShrinkwrap":false},"0.1.2":{"name":"@bernankez/prompt","type":"module","version":"0.1.2","packageManager":"pnpm@8.6.5","description":"Effortlessly build beautiful command-line apps","author":{"name":"Cole","email":"bernankeic@gmail.com"},"license":"MIT","homepage":"https://github.com/bernankez/prompt#readme","repository":{"type":"git","url":"git+https://github.com/bernankez/prompt.git"},"bugs":{"url":"https://github.com/bernankez/prompt/issues"},"keywords":["clack","command-line","cli","prompt"],"sideEffects":false,"exports":{".":{"types":"./dist/index.d.ts","require":"./dist/index.cjs","import":"./dist/index.mjs"}},"main":"./dist/index.mjs","module":"./dist/index.mjs","types":"./dist/index.d.ts","typesVersions":{"*":{"*":["./dist/*","./dist/index.d.ts"]}},"dependencies":{"@clack/core":"^0.3.2","picocolors":"^1.0.0","sisteransi":"^1.0.5","is-unicode-supported":"*"},"devDependencies":{"@bernankez/eslint-config":"^0.7.0","@types/node":"^20.3.3","bumpp":"^9.1.1","eslint":"^8.44.0","is-unicode-supported":"^1.3.0","lint-staged":"^13.2.3","rimraf":"^5.0.1","simple-git-hooks":"^2.8.1","tsx":"^3.12.7","typescript":"^5.1.6","unbuild":"^1.2.1","vite":"^4.3.9","vitest":"^0.32.2"},"simple-git-hooks":{"pre-commit":"pnpm lint-staged"},"lint-staged":{"*":"eslint --fix"},"publishConfig":{"access":"public"},"scripts":{"preinstall":"npx only-allow pnpm","build":"unbuild","dev":"unbuild --stub","release":"bumpp && pnpm publish","start":"tsx src/index.ts","watch":"tsx --watch src/index.ts","test":"vitest run","test:watch":"vitest","typecheck":"tsc --noEmit","lint":"eslint .","fix":"eslint . --fix"},"bundleDependencies":["is-unicode-supported"],"_id":"@bernankez/prompt@0.1.2","_integrity":"sha512-lBP/Vyz4qMxLV9vmkMpnNxtD+m8pEQE3LexjVsxiPjCRPXKcLN7UonYqbCJd7N9ls84P7sPHZvo6AcPwsyXv/A==","_resolved":"/private/var/folders/sl/3rnnt50s1496rt43gbf7v0080000gn/T/91e93e62f6b46f0a9d25f255644c1609/bernankez-prompt-0.1.2.tgz","_from":"file:bernankez-prompt-0.1.2.tgz","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-lBP/Vyz4qMxLV9vmkMpnNxtD+m8pEQE3LexjVsxiPjCRPXKcLN7UonYqbCJd7N9ls84P7sPHZvo6AcPwsyXv/A==","shasum":"34904d67f3951f57cddbf73dc2a893b3c38afe34","tarball":"https://registry.npmjs.org/@bernankez/prompt/-/prompt-0.1.2.tgz","fileCount":12,"unpackedSize":49304,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDPYN4PJOuibWXhEWWS4t4gIQExh9Fb/FSK1Adu0l4wUwIhAKdZty5DpKn1adzTcUoNRI0lxBYb2zJ7Q5IX2GWm6rxD"}]},"_npmUser":{"name":"bernankez","email":"bernankeic@gmail.com"},"directories":{},"maintainers":[{"name":"bernankez","email":"bernankeic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/prompt_0.1.2_1688402683724_0.14477026579223096"},"_hasShrinkwrap":false},"0.1.3":{"name":"@bernankez/prompt","type":"module","version":"0.1.3","packageManager":"pnpm@8.6.5","description":"Effortlessly build beautiful command-line apps","author":{"name":"Cole","email":"bernankeic@gmail.com"},"license":"MIT","homepage":"https://github.com/bernankez/prompt#readme","repository":{"type":"git","url":"git+https://github.com/bernankez/prompt.git"},"bugs":{"url":"https://github.com/bernankez/prompt/issues"},"keywords":["clack","command-line","cli","prompt"],"sideEffects":false,"exports":{".":{"types":"./dist/index.d.ts","require":"./dist/index.cjs","import":"./dist/index.mjs"}},"main":"./dist/index.mjs","module":"./dist/index.mjs","types":"./dist/index.d.ts","typesVersions":{"*":{"*":["./dist/*","./dist/index.d.ts"]}},"dependencies":{"@clack/core":"^0.3.2","picocolors":"^1.0.0","sisteransi":"^1.0.5","is-unicode-supported":"*"},"devDependencies":{"@bernankez/eslint-config":"^0.7.0","@types/node":"^20.3.3","bumpp":"^9.1.1","eslint":"^8.44.0","is-unicode-supported":"^1.3.0","lint-staged":"^13.2.3","rimraf":"^5.0.1","simple-git-hooks":"^2.8.1","tsx":"^3.12.7","typescript":"^5.1.6","unbuild":"^1.2.1","vite":"^4.3.9","vitest":"^0.32.2"},"simple-git-hooks":{"pre-commit":"pnpm lint-staged"},"lint-staged":{"*":"eslint --fix"},"publishConfig":{"access":"public"},"scripts":{"preinstall":"npx only-allow pnpm","build":"unbuild","dev":"unbuild --stub","release":"bumpp && pnpm publish","start":"tsx src/index.ts","watch":"tsx --watch src/index.ts","test":"vitest run","test:watch":"vitest","typecheck":"tsc --noEmit","lint":"eslint .","fix":"eslint . --fix"},"bundleDependencies":["is-unicode-supported"],"_id":"@bernankez/prompt@0.1.3","_integrity":"sha512-vDswvqkOZT5dUQ2V6DYKB/zFUO9mAXWUisozfDi0H7uY4w8/ZIss6N3dY4t7Cgd+6Rsv1wU3FgjCrwcX7vzDUg==","_resolved":"/private/var/folders/6m/rmyrz0596_d4l4bxr52k9bmm0000gn/T/8a6db6d27a6294b68132e53cf6f760c8/bernankez-prompt-0.1.3.tgz","_from":"file:bernankez-prompt-0.1.3.tgz","_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-vDswvqkOZT5dUQ2V6DYKB/zFUO9mAXWUisozfDi0H7uY4w8/ZIss6N3dY4t7Cgd+6Rsv1wU3FgjCrwcX7vzDUg==","shasum":"abf093bf0fa594f9aa0498188aa0ca9d6d0c9bc6","tarball":"https://registry.npmjs.org/@bernankez/prompt/-/prompt-0.1.3.tgz","fileCount":12,"unpackedSize":53795,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDeKW6jEqxi5Gr/qIQx3iAd46EiEbmchD+67zzkHkl2/AIhAN4+m/LdQt65Dn+2PMnxCYid/XIoE/7Hmze0iCSHRT1M"}]},"_npmUser":{"name":"bernankez","email":"bernankeic@gmail.com"},"directories":{},"maintainers":[{"name":"bernankez","email":"bernankeic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/prompt_0.1.3_1705025506864_0.6722621332848215"},"_hasShrinkwrap":false}},"time":{"created":"2023-07-03T08:15:05.828Z","0.1.0":"2023-07-03T08:15:06.140Z","modified":"2024-01-12T02:11:47.268Z","0.1.1":"2023-07-03T09:50:30.447Z","0.1.2":"2023-07-03T16:44:43.927Z","0.1.3":"2024-01-12T02:11:47.069Z"},"maintainers":[{"name":"bernankez","email":"bernankeic@gmail.com"}],"description":"Effortlessly build beautiful command-line apps","homepage":"https://github.com/bernankez/prompt#readme","keywords":["clack","command-line","cli","prompt"],"repository":{"type":"git","url":"git+https://github.com/bernankez/prompt.git"},"author":{"name":"Cole","email":"bernankeic@gmail.com"},"bugs":{"url":"https://github.com/bernankez/prompt/issues"},"license":"MIT","readme":"# @bernankez/prompt\n\n[![npm](https://img.shields.io/npm/v/@bernankez/prompt?color=red&label=npm)](https://www.npmjs.com/package/@bernankez/prompt)\n[![CI](https://github.com/Bernankez/prompt/workflows/CI/badge.svg)](https://github.com/Bernankez/prompt/actions)\n\nForked from [@clack/prompts@0.6.3](https://github.com/natemoo-re/clack/tree/main/packages/prompts)\n\n### Install\n\n```sh\n$ pnpm add @bernankez/prompt\n```\n\n#### Changes in this fork\n- Improved type hints.\n- Add `format` option.\n```ts\nconst options = {\n  format(value: Value) {\n    return formatValue(value);\n  }\n};\n```\n- Call `onCancel` callback on every prompt if `onCancel` is registered.\n```ts\nonCancel((value) => {\n  if (isCancel(value)) {\n    cancel(\"Operation canceled\");\n    process.exit(0);\n  }\n});\n```\n- Exclude `symbol` from return type. If `onCancel` is not registered, you need to handle `isCancel` in `format` for every prompt. Or else, program will exit.\n```ts\nconst options = {\n  format(value: Value) {\n    if (isCancel(value)) {\n      // ...\n    }\n    return value;\n  }\n};\n```\n- Enhanced log parameter types\n```\nlog.message(619); // message can be a number\n```\n\n---\n\n# `@clack/prompts`\n\nEffortlessly build beautiful command-line apps 🪄 [Try the demo](https://stackblitz.com/edit/clack-prompts?file=index.js)\n\n![clack-prompt](https://github.com/natemoo-re/clack/blob/main/.github/assets/clack-demo.gif)\n\n---\n\n`@clack/prompts` is an opinionated, pre-styled wrapper around [`@clack/core`](https://www.npmjs.com/package/@clack/core).\n\n- 🤏 80% smaller than other options\n- 💎 Beautiful, minimal UI\n- ✅ Simple API\n- 🧱 Comes with `text`, `confirm`, `select`, `multiselect`, and `spinner` components\n\n## Basics\n\n### Setup\n\nThe `intro` and `outro` functions will print a message to begin or end a prompt session, respectively.\n\n```js\nimport { intro, outro } from \"@clack/prompts\";\n\nintro(\"create-my-app\");\n// Do stuff\noutro(\"You're all set!\");\n```\n\n### Cancellation\n\nThe `isCancel` function is a guard that detects when a user cancels a question with `CTRL + C`. You should handle this situation for each prompt, optionally providing a nice cancellation message with the `cancel` utility.\n\n```js\nimport { cancel, isCancel, text } from \"@clack/prompts\";\n\nconst value = await text(/* TODO */);\n\nif (isCancel(value)) {\n  cancel(\"Operation cancelled.\");\n  process.exit(0);\n}\n```\n\n## Components\n\n### Text\n\nThe text component accepts a single line of text.\n\n```js\nimport { text } from \"@clack/prompts\";\n\nconst meaning = await text({\n  message: \"What is the meaning of life?\",\n  placeholder: \"Not sure\",\n  initialValue: \"42\",\n  validate(value) {\n    if (value.length === 0) { return \"Value is required!\"; }\n  },\n});\n```\n\n### Confirm\n\nThe confirm component accepts a yes or no answer. The result is a boolean value of `true` or `false`.\n\n```js\nimport { confirm } from \"@clack/prompts\";\n\nconst shouldContinue = await confirm({\n  message: \"Do you want to continue?\",\n});\n```\n\n### Select\n\nThe select component allows a user to choose one value from a list of options. The result is the `value` prop of a given option.\n\n```js\nimport { select } from \"@clack/prompts\";\n\nconst projectType = await select({\n  message: \"Pick a project type.\",\n  options: [\n    { value: \"ts\", label: \"TypeScript\" },\n    { value: \"js\", label: \"JavaScript\" },\n    { value: \"coffee\", label: \"CoffeeScript\", hint: \"oh no\" },\n  ],\n});\n```\n\n### Multi-Select\n\nThe `multiselect` component allows a user to choose many values from a list of options. The result is an array with all selected `value` props.\n\n```js\nimport { multiselect } from \"@clack/prompts\";\n\nconst additionalTools = await multiselect({\n  message: \"Select additional tools.\",\n  options: [\n    { value: \"eslint\", label: \"ESLint\", hint: \"recommended\" },\n    { value: \"prettier\", label: \"Prettier\" },\n    { value: \"gh-action\", label: \"GitHub Action\" },\n  ],\n  required: false,\n});\n```\n\n### Spinner\n\nThe spinner component surfaces a pending action, such as a long-running download or dependency installation.\n\n```js\nimport { spinner } from \"@clack/prompts\";\n\nconst s = spinner();\ns.start(\"Installing via npm\");\n// Do installation\ns.stop(\"Installed via npm\");\n```\n\n## Utilities\n\n### Grouping\n\nGrouping prompts together is a great way to keep your code organized. This accepts a JSON object with a name that can be used to reference the group later. The second argument is an optional but has a `onCancel` callback that will be called if the user cancels one of the prompts in the group.\n\n```js\nimport * as p from \"@clack/prompts\";\n\nconst group = await p.group(\n  {\n    name: () => p.text({ message: \"What is your name?\" }),\n    age: () => p.text({ message: \"What is your age?\" }),\n    color: ({ results }) =>\n      p.multiselect({\n        message: `What is your favorite color ${results.name}?`,\n        options: [\n          { value: \"red\", label: \"Red\" },\n          { value: \"green\", label: \"Green\" },\n          { value: \"blue\", label: \"Blue\" },\n        ],\n      }),\n  },\n  {\n    // On Cancel callback that wraps the group\n    // So if the user cancels one of the prompts in the group this function will be called\n    onCancel: ({ results }) => {\n      p.cancel(\"Operation cancelled.\");\n      process.exit(0);\n    },\n  }\n);\n\nconsole.log(group.name, group.age, group.color);\n```","readmeFilename":"README.md"}