Deployed the page to Github Pages.
This commit is contained in:
parent
1d79754e93
commit
2c89899458
62797 changed files with 6551425 additions and 15279 deletions
22
node_modules/@inquirer/rawlist/LICENSE
generated
vendored
Normal file
22
node_modules/@inquirer/rawlist/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
Copyright (c) 2023 Simon Boudrias
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
123
node_modules/@inquirer/rawlist/README.md
generated
vendored
Normal file
123
node_modules/@inquirer/rawlist/README.md
generated
vendored
Normal file
|
@ -0,0 +1,123 @@
|
|||
# `@inquirer/rawlist`
|
||||
|
||||
Simple interactive command line prompt to display a raw list of choices (single value select) with minimal interaction.
|
||||
|
||||

|
||||
|
||||
# Installation
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>npm</th>
|
||||
<th>yarn</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
```sh
|
||||
npm install @inquirer/prompts
|
||||
```
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
```sh
|
||||
yarn add @inquirer/prompts
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colSpan="2" align="center">Or</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
```sh
|
||||
npm install @inquirer/rawlist
|
||||
```
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
```sh
|
||||
yarn add @inquirer/rawlist
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
# Usage
|
||||
|
||||
```js
|
||||
import { rawlist } from '@inquirer/prompts';
|
||||
// Or
|
||||
// import rawlist from '@inquirer/rawlist';
|
||||
|
||||
const answer = await rawlist({
|
||||
message: 'Select a package manager',
|
||||
choices: [
|
||||
{ name: 'npm', value: 'npm' },
|
||||
{ name: 'yarn', value: 'yarn' },
|
||||
{ name: 'pnpm', value: 'pnpm' },
|
||||
],
|
||||
});
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
| Property | Type | Required | Description |
|
||||
| -------- | ----------------------- | -------- | ------------------------------ |
|
||||
| message | `string` | yes | The question to ask |
|
||||
| choices | `Choice[]` | yes | List of the available choices. |
|
||||
| theme | [See Theming](#Theming) | no | Customize look of the prompt. |
|
||||
|
||||
`Separator` objects can be used in the `choices` array to render non-selectable lines in the choice list. By default it'll render a line, but you can provide the text as argument (`new Separator('-- Dependencies --')`). This option is often used to add labels to groups within long list of options.
|
||||
|
||||
### `Choice` object
|
||||
|
||||
The `Choice` object is typed as
|
||||
|
||||
```ts
|
||||
type Choice<Value> = {
|
||||
value: Value;
|
||||
name?: string;
|
||||
short?: string;
|
||||
key?: string;
|
||||
};
|
||||
```
|
||||
|
||||
Here's each property:
|
||||
|
||||
- `value`: The value is what will be returned by `await rawlist()`.
|
||||
- `name`: This is the string displayed in the choice list.
|
||||
- `short`: Once the prompt is done (press enter), we'll use `short` if defined to render next to the question. By default we'll use `name`.
|
||||
- `key`: The key of the choice. Displayed as `key) name`.
|
||||
|
||||
`choices` can also be an array of string, in which case the string will be used both as the `value` and the `name`.
|
||||
|
||||
## Theming
|
||||
|
||||
You can theme a prompt by passing a `theme` object option. The theme object only need to includes the keys you wish to modify, we'll fallback on the defaults for the rest.
|
||||
|
||||
```ts
|
||||
type Theme = {
|
||||
prefix: string;
|
||||
spinner: {
|
||||
interval: number;
|
||||
frames: string[];
|
||||
};
|
||||
style: {
|
||||
answer: (text: string) => string;
|
||||
message: (text: string) => string;
|
||||
error: (text: string) => string;
|
||||
highlight: (text: string) => string;
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
# License
|
||||
|
||||
Copyright (c) 2023 Simon Boudrias (twitter: [@vaxilart](https://twitter.com/Vaxilart))<br/>
|
||||
Licensed under the MIT license.
|
98
node_modules/@inquirer/rawlist/dist/cjs/index.js
generated
vendored
Normal file
98
node_modules/@inquirer/rawlist/dist/cjs/index.js
generated
vendored
Normal file
|
@ -0,0 +1,98 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Separator = void 0;
|
||||
const core_1 = require("@inquirer/core");
|
||||
const yoctocolors_cjs_1 = __importDefault(require("yoctocolors-cjs"));
|
||||
const numberRegex = /\d+/;
|
||||
function isSelectableChoice(choice) {
|
||||
return choice != null && !core_1.Separator.isSeparator(choice);
|
||||
}
|
||||
function normalizeChoices(choices) {
|
||||
let index = 0;
|
||||
return choices.map((choice) => {
|
||||
var _a, _b, _c;
|
||||
if (core_1.Separator.isSeparator(choice))
|
||||
return choice;
|
||||
index += 1;
|
||||
if (typeof choice === 'string') {
|
||||
return {
|
||||
value: choice,
|
||||
name: choice,
|
||||
short: choice,
|
||||
key: String(index),
|
||||
};
|
||||
}
|
||||
const name = (_a = choice.name) !== null && _a !== void 0 ? _a : String(choice.value);
|
||||
return {
|
||||
value: choice.value,
|
||||
name,
|
||||
short: (_b = choice.short) !== null && _b !== void 0 ? _b : name,
|
||||
key: (_c = choice.key) !== null && _c !== void 0 ? _c : String(index),
|
||||
};
|
||||
});
|
||||
}
|
||||
exports.default = (0, core_1.createPrompt)((config, done) => {
|
||||
const choices = (0, core_1.useMemo)(() => normalizeChoices(config.choices), [config.choices]);
|
||||
const [status, setStatus] = (0, core_1.useState)('pending');
|
||||
const [value, setValue] = (0, core_1.useState)('');
|
||||
const [errorMsg, setError] = (0, core_1.useState)();
|
||||
const theme = (0, core_1.makeTheme)(config.theme);
|
||||
const prefix = (0, core_1.usePrefix)({ theme });
|
||||
(0, core_1.useKeypress)((key, rl) => {
|
||||
var _a, _b;
|
||||
if ((0, core_1.isEnterKey)(key)) {
|
||||
let selectedChoice;
|
||||
if (numberRegex.test(value)) {
|
||||
const answer = Number.parseInt(value, 10) - 1;
|
||||
selectedChoice = choices.filter(isSelectableChoice)[answer];
|
||||
}
|
||||
else {
|
||||
selectedChoice = choices.find((choice) => isSelectableChoice(choice) && choice.key === value);
|
||||
}
|
||||
if (isSelectableChoice(selectedChoice)) {
|
||||
setValue((_b = (_a = selectedChoice.short) !== null && _a !== void 0 ? _a : selectedChoice.name) !== null && _b !== void 0 ? _b : String(selectedChoice.value));
|
||||
setStatus('done');
|
||||
done(selectedChoice.value);
|
||||
}
|
||||
else if (value === '') {
|
||||
setError('Please input a value');
|
||||
}
|
||||
else {
|
||||
setError(`"${yoctocolors_cjs_1.default.red(value)}" isn't an available option`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
setValue(rl.line);
|
||||
setError(undefined);
|
||||
}
|
||||
});
|
||||
const message = theme.style.message(config.message);
|
||||
if (status === 'done') {
|
||||
return `${prefix} ${message} ${theme.style.answer(value)}`;
|
||||
}
|
||||
const choicesStr = choices
|
||||
.map((choice) => {
|
||||
if (core_1.Separator.isSeparator(choice)) {
|
||||
return ` ${choice.separator}`;
|
||||
}
|
||||
const line = ` ${choice.key}) ${choice.name}`;
|
||||
if (choice.key === value.toLowerCase()) {
|
||||
return theme.style.highlight(line);
|
||||
}
|
||||
return line;
|
||||
})
|
||||
.join('\n');
|
||||
let error = '';
|
||||
if (errorMsg) {
|
||||
error = theme.style.error(errorMsg);
|
||||
}
|
||||
return [
|
||||
`${prefix} ${message} ${value}`,
|
||||
[choicesStr, error].filter(Boolean).join('\n'),
|
||||
];
|
||||
});
|
||||
var core_2 = require("@inquirer/core");
|
||||
Object.defineProperty(exports, "Separator", { enumerable: true, get: function () { return core_2.Separator; } });
|
15
node_modules/@inquirer/rawlist/dist/cjs/types/index.d.ts
generated
vendored
Normal file
15
node_modules/@inquirer/rawlist/dist/cjs/types/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { Separator, type Theme } from '@inquirer/core';
|
||||
import type { PartialDeep } from '@inquirer/type';
|
||||
type Choice<Value> = {
|
||||
value: Value;
|
||||
name?: string;
|
||||
short?: string;
|
||||
key?: string;
|
||||
};
|
||||
declare const _default: <Value>(config: {
|
||||
message: string;
|
||||
choices: readonly (string | Separator)[] | readonly (Separator | Choice<Value>)[];
|
||||
theme?: PartialDeep<Theme> | undefined;
|
||||
}, context?: import("@inquirer/type").Context) => import("@inquirer/type").CancelablePromise<Value>;
|
||||
export default _default;
|
||||
export { Separator } from '@inquirer/core';
|
89
node_modules/@inquirer/rawlist/dist/esm/index.mjs
generated
vendored
Normal file
89
node_modules/@inquirer/rawlist/dist/esm/index.mjs
generated
vendored
Normal file
|
@ -0,0 +1,89 @@
|
|||
import { createPrompt, useMemo, useState, useKeypress, usePrefix, isEnterKey, Separator, makeTheme, } from '@inquirer/core';
|
||||
import colors from 'yoctocolors-cjs';
|
||||
const numberRegex = /\d+/;
|
||||
function isSelectableChoice(choice) {
|
||||
return choice != null && !Separator.isSeparator(choice);
|
||||
}
|
||||
function normalizeChoices(choices) {
|
||||
let index = 0;
|
||||
return choices.map((choice) => {
|
||||
if (Separator.isSeparator(choice))
|
||||
return choice;
|
||||
index += 1;
|
||||
if (typeof choice === 'string') {
|
||||
return {
|
||||
value: choice,
|
||||
name: choice,
|
||||
short: choice,
|
||||
key: String(index),
|
||||
};
|
||||
}
|
||||
const name = choice.name ?? String(choice.value);
|
||||
return {
|
||||
value: choice.value,
|
||||
name,
|
||||
short: choice.short ?? name,
|
||||
key: choice.key ?? String(index),
|
||||
};
|
||||
});
|
||||
}
|
||||
export default createPrompt((config, done) => {
|
||||
const choices = useMemo(() => normalizeChoices(config.choices), [config.choices]);
|
||||
const [status, setStatus] = useState('pending');
|
||||
const [value, setValue] = useState('');
|
||||
const [errorMsg, setError] = useState();
|
||||
const theme = makeTheme(config.theme);
|
||||
const prefix = usePrefix({ theme });
|
||||
useKeypress((key, rl) => {
|
||||
if (isEnterKey(key)) {
|
||||
let selectedChoice;
|
||||
if (numberRegex.test(value)) {
|
||||
const answer = Number.parseInt(value, 10) - 1;
|
||||
selectedChoice = choices.filter(isSelectableChoice)[answer];
|
||||
}
|
||||
else {
|
||||
selectedChoice = choices.find((choice) => isSelectableChoice(choice) && choice.key === value);
|
||||
}
|
||||
if (isSelectableChoice(selectedChoice)) {
|
||||
setValue(selectedChoice.short ?? selectedChoice.name ?? String(selectedChoice.value));
|
||||
setStatus('done');
|
||||
done(selectedChoice.value);
|
||||
}
|
||||
else if (value === '') {
|
||||
setError('Please input a value');
|
||||
}
|
||||
else {
|
||||
setError(`"${colors.red(value)}" isn't an available option`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
setValue(rl.line);
|
||||
setError(undefined);
|
||||
}
|
||||
});
|
||||
const message = theme.style.message(config.message);
|
||||
if (status === 'done') {
|
||||
return `${prefix} ${message} ${theme.style.answer(value)}`;
|
||||
}
|
||||
const choicesStr = choices
|
||||
.map((choice) => {
|
||||
if (Separator.isSeparator(choice)) {
|
||||
return ` ${choice.separator}`;
|
||||
}
|
||||
const line = ` ${choice.key}) ${choice.name}`;
|
||||
if (choice.key === value.toLowerCase()) {
|
||||
return theme.style.highlight(line);
|
||||
}
|
||||
return line;
|
||||
})
|
||||
.join('\n');
|
||||
let error = '';
|
||||
if (errorMsg) {
|
||||
error = theme.style.error(errorMsg);
|
||||
}
|
||||
return [
|
||||
`${prefix} ${message} ${value}`,
|
||||
[choicesStr, error].filter(Boolean).join('\n'),
|
||||
];
|
||||
});
|
||||
export { Separator } from '@inquirer/core';
|
15
node_modules/@inquirer/rawlist/dist/esm/types/index.d.mts
generated
vendored
Normal file
15
node_modules/@inquirer/rawlist/dist/esm/types/index.d.mts
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { Separator, type Theme } from '@inquirer/core';
|
||||
import type { PartialDeep } from '@inquirer/type';
|
||||
type Choice<Value> = {
|
||||
value: Value;
|
||||
name?: string;
|
||||
short?: string;
|
||||
key?: string;
|
||||
};
|
||||
declare const _default: <Value>(config: {
|
||||
message: string;
|
||||
choices: readonly (string | Separator)[] | readonly (Separator | Choice<Value>)[];
|
||||
theme?: PartialDeep<Theme> | undefined;
|
||||
}, context?: import("@inquirer/type").Context) => import("@inquirer/type").CancelablePromise<Value>;
|
||||
export default _default;
|
||||
export { Separator } from '@inquirer/core';
|
14
node_modules/@inquirer/rawlist/dist/types/index.d.ts
generated
vendored
Normal file
14
node_modules/@inquirer/rawlist/dist/types/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { Separator, type Theme } from '@inquirer/core';
|
||||
import type { PartialDeep } from '@inquirer/type';
|
||||
type Choice<Value> = {
|
||||
value: Value;
|
||||
name?: string;
|
||||
key?: string;
|
||||
};
|
||||
declare const _default: <Value>(config: {
|
||||
message: string;
|
||||
choices: readonly (Separator | Choice<Value>)[];
|
||||
theme?: PartialDeep<Theme>;
|
||||
}, context?: import("@inquirer/type").Context) => import("@inquirer/type").CancelablePromise<Value>;
|
||||
export default _default;
|
||||
export { Separator } from '@inquirer/core';
|
90
node_modules/@inquirer/rawlist/package.json
generated
vendored
Normal file
90
node_modules/@inquirer/rawlist/package.json
generated
vendored
Normal file
|
@ -0,0 +1,90 @@
|
|||
{
|
||||
"name": "@inquirer/rawlist",
|
||||
"version": "2.3.0",
|
||||
"description": "Inquirer rawlist prompt",
|
||||
"main": "./dist/cjs/index.js",
|
||||
"typings": "./dist/cjs/types/index.d.ts",
|
||||
"files": [
|
||||
"dist/**/*"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/SBoudrias/Inquirer.js.git"
|
||||
},
|
||||
"keywords": [
|
||||
"answer",
|
||||
"answers",
|
||||
"ask",
|
||||
"base",
|
||||
"cli",
|
||||
"command",
|
||||
"command-line",
|
||||
"confirm",
|
||||
"enquirer",
|
||||
"generate",
|
||||
"generator",
|
||||
"hyper",
|
||||
"input",
|
||||
"inquire",
|
||||
"inquirer",
|
||||
"interface",
|
||||
"iterm",
|
||||
"javascript",
|
||||
"menu",
|
||||
"node",
|
||||
"nodejs",
|
||||
"prompt",
|
||||
"promptly",
|
||||
"prompts",
|
||||
"question",
|
||||
"readline",
|
||||
"scaffold",
|
||||
"scaffolder",
|
||||
"scaffolding",
|
||||
"stdin",
|
||||
"stdout",
|
||||
"terminal",
|
||||
"tty",
|
||||
"ui",
|
||||
"yeoman",
|
||||
"yo",
|
||||
"zsh"
|
||||
],
|
||||
"author": "Simon Boudrias <admin@simonboudrias.com>",
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/SBoudrias/Inquirer.js/blob/main/packages/rawlist/README.md",
|
||||
"dependencies": {
|
||||
"@inquirer/core": "^9.1.0",
|
||||
"@inquirer/type": "^1.5.3",
|
||||
"yoctocolors-cjs": "^2.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@inquirer/testing": "^2.1.32"
|
||||
},
|
||||
"scripts": {
|
||||
"tsc": "yarn run tsc:esm && yarn run tsc:cjs",
|
||||
"tsc:esm": "rm -rf dist/esm && tsc -p ./tsconfig.json",
|
||||
"tsc:cjs": "rm -rf dist/cjs && tsc -p ./tsconfig.cjs.json && node ../../tools/fix-ext.mjs",
|
||||
"attw": "attw --pack"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/esm/types/index.d.mts",
|
||||
"default": "./dist/esm/index.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/cjs/types/index.d.ts",
|
||||
"default": "./dist/cjs/index.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"sideEffects": false,
|
||||
"gitHead": "0c039599ef88fe9eb804fe083ee386ec906a856f"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue