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/expand/LICENSE
generated
vendored
Normal file
22
node_modules/@inquirer/expand/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.
|
141
node_modules/@inquirer/expand/README.md
generated
vendored
Normal file
141
node_modules/@inquirer/expand/README.md
generated
vendored
Normal file
|
@ -0,0 +1,141 @@
|
|||
# `@inquirer/expand`
|
||||
|
||||
Compact single select prompt. Every option is assigned a shortcut key, and selecting `h` will expand all the choices and their descriptions.
|
||||
|
||||

|
||||

|
||||
|
||||
# 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/expand
|
||||
```
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
```sh
|
||||
yarn add @inquirer/expand
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
# Usage
|
||||
|
||||
```js
|
||||
import { expand } from '@inquirer/prompts';
|
||||
// Or
|
||||
// import expand from '@inquirer/expand';
|
||||
|
||||
const answer = await expand({
|
||||
message: 'Conflict on file.js',
|
||||
default: 'y',
|
||||
choices: [
|
||||
{
|
||||
key: 'y',
|
||||
name: 'Overwrite',
|
||||
value: 'overwrite',
|
||||
},
|
||||
{
|
||||
key: 'a',
|
||||
name: 'Overwrite this one and all next',
|
||||
value: 'overwrite_all',
|
||||
},
|
||||
{
|
||||
key: 'd',
|
||||
name: 'Show diff',
|
||||
value: 'diff',
|
||||
},
|
||||
{
|
||||
key: 'x',
|
||||
name: 'Abort',
|
||||
value: 'abort',
|
||||
},
|
||||
],
|
||||
});
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
| Property | Type | Required | Description |
|
||||
| -------- | ----------------------- | -------- | ----------------------------------------------------------------------------------------- |
|
||||
| message | `string` | yes | The question to ask |
|
||||
| choices | `Choice[]` | yes | Array of the different allowed choices. The `h`/help option is always provided by default |
|
||||
| default | `string` | no | Default choices to be selected. (value must be one of the choices `key`) |
|
||||
| expanded | `boolean` | no | Expand the choices by default |
|
||||
| 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;
|
||||
key: string;
|
||||
};
|
||||
```
|
||||
|
||||
Here's each property:
|
||||
|
||||
- `value`: The value is what will be returned by `await expand()`.
|
||||
- `name`: The string displayed in the choice list. It'll default to the stringify `value`.
|
||||
- `key`: The input the use must provide to select the choice. Must be a lowercase single alpha-numeric character string.
|
||||
|
||||
## 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;
|
||||
defaultAnswer: (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.
|
116
node_modules/@inquirer/expand/dist/cjs/index.js
generated
vendored
Normal file
116
node_modules/@inquirer/expand/dist/cjs/index.js
generated
vendored
Normal file
|
@ -0,0 +1,116 @@
|
|||
"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"));
|
||||
function normalizeChoices(choices) {
|
||||
return choices.map((choice) => {
|
||||
if (core_1.Separator.isSeparator(choice)) {
|
||||
return choice;
|
||||
}
|
||||
const name = 'name' in choice ? choice.name : String(choice.value);
|
||||
const value = 'value' in choice ? choice.value : name;
|
||||
return {
|
||||
value: value,
|
||||
name,
|
||||
key: choice.key.toLowerCase(),
|
||||
};
|
||||
});
|
||||
}
|
||||
const helpChoice = {
|
||||
key: 'h',
|
||||
name: 'Help, list all options',
|
||||
value: undefined,
|
||||
};
|
||||
exports.default = (0, core_1.createPrompt)((config, done) => {
|
||||
var _a;
|
||||
const { default: defaultKey = 'h' } = config;
|
||||
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 [expanded, setExpanded] = (0, core_1.useState)((_a = config.expanded) !== null && _a !== void 0 ? _a : false);
|
||||
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)((event, rl) => {
|
||||
if ((0, core_1.isEnterKey)(event)) {
|
||||
const answer = (value || defaultKey).toLowerCase();
|
||||
if (answer === 'h' && !expanded) {
|
||||
setExpanded(true);
|
||||
}
|
||||
else {
|
||||
const selectedChoice = choices.find((choice) => !core_1.Separator.isSeparator(choice) && choice.key === answer);
|
||||
if (selectedChoice) {
|
||||
setStatus('done');
|
||||
// Set the value as we might've selected the default one.
|
||||
setValue(answer);
|
||||
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') {
|
||||
// If the prompt is done, it's safe to assume there is a selected value.
|
||||
const selectedChoice = choices.find((choice) => !core_1.Separator.isSeparator(choice) && choice.key === value.toLowerCase());
|
||||
return `${prefix} ${message} ${theme.style.answer(selectedChoice.name)}`;
|
||||
}
|
||||
const allChoices = expanded ? choices : [...choices, helpChoice];
|
||||
// Collapsed display style
|
||||
let longChoices = '';
|
||||
let shortChoices = allChoices
|
||||
.map((choice) => {
|
||||
if (core_1.Separator.isSeparator(choice))
|
||||
return '';
|
||||
if (choice.key === defaultKey) {
|
||||
return choice.key.toUpperCase();
|
||||
}
|
||||
return choice.key;
|
||||
})
|
||||
.join('');
|
||||
shortChoices = ` ${theme.style.defaultAnswer(shortChoices)}`;
|
||||
// Expanded display style
|
||||
if (expanded) {
|
||||
shortChoices = '';
|
||||
longChoices = allChoices
|
||||
.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 helpTip = '';
|
||||
const currentOption = choices.find((choice) => !core_1.Separator.isSeparator(choice) && choice.key === value.toLowerCase());
|
||||
if (currentOption) {
|
||||
helpTip = `${yoctocolors_cjs_1.default.cyan('>>')} ${currentOption.name}`;
|
||||
}
|
||||
let error = '';
|
||||
if (errorMsg) {
|
||||
error = theme.style.error(errorMsg);
|
||||
}
|
||||
return [
|
||||
`${prefix} ${message}${shortChoices} ${value}`,
|
||||
[longChoices, helpTip, error].filter(Boolean).join('\n'),
|
||||
];
|
||||
});
|
||||
var core_2 = require("@inquirer/core");
|
||||
Object.defineProperty(exports, "Separator", { enumerable: true, get: function () { return core_2.Separator; } });
|
23
node_modules/@inquirer/expand/dist/cjs/types/index.d.ts
generated
vendored
Normal file
23
node_modules/@inquirer/expand/dist/cjs/types/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
import { Separator, type Theme } from '@inquirer/core';
|
||||
import type { PartialDeep } from '@inquirer/type';
|
||||
type Key = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
|
||||
type Choice<Value> = {
|
||||
key: Key;
|
||||
value: Value;
|
||||
} | {
|
||||
key: Key;
|
||||
name: string;
|
||||
value: Value;
|
||||
};
|
||||
declare const _default: <Value>(config: {
|
||||
message: string;
|
||||
choices: readonly {
|
||||
key: Key;
|
||||
name: string;
|
||||
}[] | readonly (Separator | Choice<Value>)[];
|
||||
default?: (Key | "h") | undefined;
|
||||
expanded?: boolean | undefined;
|
||||
theme?: PartialDeep<Theme> | undefined;
|
||||
}, context?: import("@inquirer/type").Context) => import("@inquirer/type").CancelablePromise<Value>;
|
||||
export default _default;
|
||||
export { Separator } from '@inquirer/core';
|
108
node_modules/@inquirer/expand/dist/esm/index.mjs
generated
vendored
Normal file
108
node_modules/@inquirer/expand/dist/esm/index.mjs
generated
vendored
Normal file
|
@ -0,0 +1,108 @@
|
|||
import { createPrompt, useMemo, useState, useKeypress, usePrefix, isEnterKey, makeTheme, Separator, } from '@inquirer/core';
|
||||
import colors from 'yoctocolors-cjs';
|
||||
function normalizeChoices(choices) {
|
||||
return choices.map((choice) => {
|
||||
if (Separator.isSeparator(choice)) {
|
||||
return choice;
|
||||
}
|
||||
const name = 'name' in choice ? choice.name : String(choice.value);
|
||||
const value = 'value' in choice ? choice.value : name;
|
||||
return {
|
||||
value: value,
|
||||
name,
|
||||
key: choice.key.toLowerCase(),
|
||||
};
|
||||
});
|
||||
}
|
||||
const helpChoice = {
|
||||
key: 'h',
|
||||
name: 'Help, list all options',
|
||||
value: undefined,
|
||||
};
|
||||
export default createPrompt((config, done) => {
|
||||
const { default: defaultKey = 'h' } = config;
|
||||
const choices = useMemo(() => normalizeChoices(config.choices), [config.choices]);
|
||||
const [status, setStatus] = useState('pending');
|
||||
const [value, setValue] = useState('');
|
||||
const [expanded, setExpanded] = useState(config.expanded ?? false);
|
||||
const [errorMsg, setError] = useState();
|
||||
const theme = makeTheme(config.theme);
|
||||
const prefix = usePrefix({ theme });
|
||||
useKeypress((event, rl) => {
|
||||
if (isEnterKey(event)) {
|
||||
const answer = (value || defaultKey).toLowerCase();
|
||||
if (answer === 'h' && !expanded) {
|
||||
setExpanded(true);
|
||||
}
|
||||
else {
|
||||
const selectedChoice = choices.find((choice) => !Separator.isSeparator(choice) && choice.key === answer);
|
||||
if (selectedChoice) {
|
||||
setStatus('done');
|
||||
// Set the value as we might've selected the default one.
|
||||
setValue(answer);
|
||||
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') {
|
||||
// If the prompt is done, it's safe to assume there is a selected value.
|
||||
const selectedChoice = choices.find((choice) => !Separator.isSeparator(choice) && choice.key === value.toLowerCase());
|
||||
return `${prefix} ${message} ${theme.style.answer(selectedChoice.name)}`;
|
||||
}
|
||||
const allChoices = expanded ? choices : [...choices, helpChoice];
|
||||
// Collapsed display style
|
||||
let longChoices = '';
|
||||
let shortChoices = allChoices
|
||||
.map((choice) => {
|
||||
if (Separator.isSeparator(choice))
|
||||
return '';
|
||||
if (choice.key === defaultKey) {
|
||||
return choice.key.toUpperCase();
|
||||
}
|
||||
return choice.key;
|
||||
})
|
||||
.join('');
|
||||
shortChoices = ` ${theme.style.defaultAnswer(shortChoices)}`;
|
||||
// Expanded display style
|
||||
if (expanded) {
|
||||
shortChoices = '';
|
||||
longChoices = allChoices
|
||||
.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 helpTip = '';
|
||||
const currentOption = choices.find((choice) => !Separator.isSeparator(choice) && choice.key === value.toLowerCase());
|
||||
if (currentOption) {
|
||||
helpTip = `${colors.cyan('>>')} ${currentOption.name}`;
|
||||
}
|
||||
let error = '';
|
||||
if (errorMsg) {
|
||||
error = theme.style.error(errorMsg);
|
||||
}
|
||||
return [
|
||||
`${prefix} ${message}${shortChoices} ${value}`,
|
||||
[longChoices, helpTip, error].filter(Boolean).join('\n'),
|
||||
];
|
||||
});
|
||||
export { Separator } from '@inquirer/core';
|
23
node_modules/@inquirer/expand/dist/esm/types/index.d.mts
generated
vendored
Normal file
23
node_modules/@inquirer/expand/dist/esm/types/index.d.mts
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
import { Separator, type Theme } from '@inquirer/core';
|
||||
import type { PartialDeep } from '@inquirer/type';
|
||||
type Key = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
|
||||
type Choice<Value> = {
|
||||
key: Key;
|
||||
value: Value;
|
||||
} | {
|
||||
key: Key;
|
||||
name: string;
|
||||
value: Value;
|
||||
};
|
||||
declare const _default: <Value>(config: {
|
||||
message: string;
|
||||
choices: readonly {
|
||||
key: Key;
|
||||
name: string;
|
||||
}[] | readonly (Separator | Choice<Value>)[];
|
||||
default?: (Key | "h") | undefined;
|
||||
expanded?: boolean | undefined;
|
||||
theme?: PartialDeep<Theme> | undefined;
|
||||
}, context?: import("@inquirer/type").Context) => import("@inquirer/type").CancelablePromise<Value>;
|
||||
export default _default;
|
||||
export { Separator } from '@inquirer/core';
|
22
node_modules/@inquirer/expand/dist/types/index.d.ts
generated
vendored
Normal file
22
node_modules/@inquirer/expand/dist/types/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
import { type Theme } from '@inquirer/core';
|
||||
import type { PartialDeep } from '@inquirer/type';
|
||||
type ExpandChoice = {
|
||||
key: string;
|
||||
name: string;
|
||||
} | {
|
||||
key: string;
|
||||
value: string;
|
||||
} | {
|
||||
key: string;
|
||||
name: string;
|
||||
value: string;
|
||||
};
|
||||
type ExpandConfig = {
|
||||
message: string;
|
||||
choices: ReadonlyArray<ExpandChoice>;
|
||||
default?: string;
|
||||
expanded?: boolean;
|
||||
theme?: PartialDeep<Theme>;
|
||||
};
|
||||
declare const _default: import("@inquirer/type").Prompt<string, ExpandConfig>;
|
||||
export default _default;
|
90
node_modules/@inquirer/expand/package.json
generated
vendored
Normal file
90
node_modules/@inquirer/expand/package.json
generated
vendored
Normal file
|
@ -0,0 +1,90 @@
|
|||
{
|
||||
"name": "@inquirer/expand",
|
||||
"version": "2.3.0",
|
||||
"description": "Inquirer checkbox 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/expand/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": "4937ea3a74152b59bf4198dbaa803119ed4ef8e2"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue