inquirerer 2.0.8 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/commander.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Opts, ParsedArgs } from 'minimist';
3
2
  import { Readable, Writable } from 'stream';
4
3
  import { Inquirerer } from './prompt';
package/esm/prompt.js CHANGED
@@ -1,4 +1,4 @@
1
- import chalk from 'chalk';
1
+ import { red, whiteBright, yellow, gray, dim, green, cyan, white, blue } from 'yanse';
2
2
  import readline from 'readline';
3
3
  import { KEY_CODES, TerminalKeypress } from './keypress';
4
4
  export function reorderQuestionsByDeps(questions) {
@@ -34,15 +34,15 @@ const validationMessage = (question, ctx) => {
34
34
  return ''; // No message if first attempt or validation was successful
35
35
  }
36
36
  if (ctx.validation.reason) {
37
- return chalk.red(`The field "${question.name}" is invalid: ${ctx.validation.reason}\n`);
37
+ return red(`The field "${question.name}" is invalid: ${ctx.validation.reason}\n`);
38
38
  }
39
39
  switch (ctx.validation.type) {
40
40
  case 'required':
41
- return chalk.red(`The field "${question.name}" is required. Please provide a value.\n`);
41
+ return red(`The field "${question.name}" is required. Please provide a value.\n`);
42
42
  case 'pattern':
43
- return chalk.red(`The field "${question.name}" does not match the pattern: ${question.pattern}.\n`);
43
+ return red(`The field "${question.name}" does not match the pattern: ${question.pattern}.\n`);
44
44
  default:
45
- return chalk.red(`The field "${question.name}" is invalid. Please try again.\n`);
45
+ return red(`The field "${question.name}" is invalid. Please try again.\n`);
46
46
  }
47
47
  };
48
48
  class PromptContext {
@@ -84,7 +84,7 @@ function generatePromptMessageSuccinct(question, ctx) {
84
84
  const { message, name, type, default: def, options = [] } = question;
85
85
  const lines = [];
86
86
  // 1. Main prompt label
87
- lines.push(chalk.whiteBright.bold(message || `${name}?`));
87
+ lines.push(whiteBright.bold(message || `${name}?`));
88
88
  // 2. Validation message if applicable
89
89
  const validation = validationMessage(question, ctx);
90
90
  if (validation) {
@@ -96,13 +96,13 @@ function generatePromptMessageSuccinct(question, ctx) {
96
96
  case 'confirm':
97
97
  inline = '(y/n)';
98
98
  if (def !== undefined) {
99
- inline += ` ${chalk.yellow(`[${def ? 'y' : 'n'}]`)}`;
99
+ inline += ` ${yellow(`[${def ? 'y' : 'n'}]`)}`;
100
100
  }
101
101
  break;
102
102
  case 'text':
103
103
  case 'number':
104
104
  if (def !== undefined) {
105
- inline += `${chalk.yellow(`[${def}]`)}`;
105
+ inline += `${yellow(`[${def}]`)}`;
106
106
  }
107
107
  break;
108
108
  case 'autocomplete':
@@ -110,8 +110,8 @@ function generatePromptMessageSuccinct(question, ctx) {
110
110
  case 'checkbox':
111
111
  if (def !== undefined) {
112
112
  const defaults = Array.isArray(def) ? def : [def];
113
- const rendered = defaults.map(d => chalk.yellow(d)).join(chalk.gray(', '));
114
- inline += `${chalk.yellow(`[${rendered}]`)}`;
113
+ const rendered = defaults.map(d => yellow(d)).join(gray(', '));
114
+ inline += `${yellow(`[${rendered}]`)}`;
115
115
  }
116
116
  break;
117
117
  }
@@ -126,10 +126,10 @@ function generatePromptMessage(question, ctx) {
126
126
  const { message, name, type, default: def, options = [], description } = question;
127
127
  const lines = [];
128
128
  // 1. Title Message
129
- lines.push(chalk.whiteBright.bold(message || `${name}?`));
129
+ lines.push(whiteBright.bold(message || `${name}?`));
130
130
  // 2. Optional description below title
131
131
  if (description) {
132
- lines.push(chalk.dim(description));
132
+ lines.push(dim(description));
133
133
  }
134
134
  // 3. Validation warning (if failed before)
135
135
  const validation = validationMessage(question, ctx);
@@ -137,20 +137,20 @@ function generatePromptMessage(question, ctx) {
137
137
  lines.push(validation); // already red-colored
138
138
  }
139
139
  // 4. Metadata (name/type)
140
- lines.push(`${chalk.dim('Argument')} ${chalk.green(`--${name}`)} ${chalk.dim('type')} ${chalk.cyan(`[${type}]`)}`);
140
+ lines.push(`${dim('Argument')} ${green(`--${name}`)} ${dim('type')} ${cyan(`[${type}]`)}`);
141
141
  // 5. Default value or guidance
142
142
  let guidance = '';
143
143
  switch (type) {
144
144
  case 'confirm':
145
145
  guidance = '(y/n)';
146
146
  if (def !== undefined) {
147
- guidance += ` ${chalk.yellow(`[default: ${def ? 'y' : 'n'}]`)}`;
147
+ guidance += ` ${yellow(`[default: ${def ? 'y' : 'n'}]`)}`;
148
148
  }
149
149
  break;
150
150
  case 'text':
151
151
  case 'number':
152
152
  if (def !== undefined) {
153
- guidance = chalk.yellow(`[default: ${def}]`);
153
+ guidance = yellow(`[default: ${def}]`);
154
154
  }
155
155
  break;
156
156
  case 'autocomplete':
@@ -158,8 +158,8 @@ function generatePromptMessage(question, ctx) {
158
158
  case 'checkbox':
159
159
  if (def !== undefined) {
160
160
  const defaults = Array.isArray(def) ? def : [def];
161
- const rendered = defaults.map(d => chalk.yellow(d)).join(chalk.gray(', '));
162
- guidance += `${chalk.yellow(`[default: ${rendered}]`)}`;
161
+ const rendered = defaults.map(d => yellow(d)).join(gray(', '));
162
+ guidance += `${yellow(`[default: ${rendered}]`)}`;
163
163
  }
164
164
  break;
165
165
  }
@@ -167,7 +167,7 @@ function generatePromptMessage(question, ctx) {
167
167
  lines.push(guidance);
168
168
  }
169
169
  // 6. Final input prompt
170
- lines.push(chalk.white('> ') + chalk.dim('Your input:'));
170
+ lines.push(white('> ') + dim('Your input:'));
171
171
  return lines.join('\n') + '\n';
172
172
  }
173
173
  export class Inquirerer {
@@ -211,7 +211,7 @@ export class Inquirerer {
211
211
  this.output.write(message + '\n');
212
212
  }
213
213
  getInput(input) {
214
- return `${chalk.white.bold('$')} ${input}`;
214
+ return `${white.bold('$')} ${input}`;
215
215
  }
216
216
  getPrompt(question, ctx, input) {
217
217
  const promptMessage = generatePromptMessage(question, ctx);
@@ -222,48 +222,48 @@ export class Inquirerer {
222
222
  this.log(prompt);
223
223
  }
224
224
  generateManPage(opts) {
225
- let manPage = `${chalk.white('NAME')}\n\t${chalk.white(opts.commandName)} ${opts.description ?? ''}\n\n`;
225
+ let manPage = `${white('NAME')}\n\t${white(opts.commandName)} ${opts.description ?? ''}\n\n`;
226
226
  // Constructing the SYNOPSIS section with required and optional arguments
227
227
  let requiredArgs = '';
228
228
  let optionalArgs = '';
229
229
  opts.questions.forEach(question => {
230
230
  if (question.required) {
231
- requiredArgs += ` ${chalk.white('--' + question.name)} <${chalk.gray(question.name)}>`;
231
+ requiredArgs += ` ${white('--' + question.name)} <${gray(question.name)}>`;
232
232
  }
233
233
  else {
234
- optionalArgs += ` [${chalk.white('--' + question.name)}${question.default ? `=${chalk.gray(String(question.default))}` : ''}]`;
234
+ optionalArgs += ` [${white('--' + question.name)}${question.default ? `=${gray(String(question.default))}` : ''}]`;
235
235
  }
236
236
  });
237
- manPage += `${chalk.white('SYNOPSIS')}\n\t${chalk.white(opts.commandName)}${chalk.gray(requiredArgs)}${chalk.gray(optionalArgs)}\n\n`;
238
- manPage += `${chalk.white('DESCRIPTION')}\n\tUse this command to interact with the application. It supports the following options:\n\n`;
237
+ manPage += `${white('SYNOPSIS')}\n\t${white(opts.commandName)}${gray(requiredArgs)}${gray(optionalArgs)}\n\n`;
238
+ manPage += `${white('DESCRIPTION')}\n\tUse this command to interact with the application. It supports the following options:\n\n`;
239
239
  opts.questions.forEach(question => {
240
- manPage += `${chalk.white(question.name.toUpperCase())}\n`;
241
- manPage += `\t${chalk.white('Type:')} ${chalk.gray(question.type)}\n`;
240
+ manPage += `${white(question.name.toUpperCase())}\n`;
241
+ manPage += `\t${white('Type:')} ${gray(question.type)}\n`;
242
242
  if (question.message) {
243
- manPage += `\t${chalk.white('Summary:')} ${chalk.gray(question.message)}\n`;
243
+ manPage += `\t${white('Summary:')} ${gray(question.message)}\n`;
244
244
  }
245
245
  if (question.description) {
246
- manPage += `\t${chalk.white('Description:')} ${chalk.gray(question.description)}\n`;
246
+ manPage += `\t${white('Description:')} ${gray(question.description)}\n`;
247
247
  }
248
248
  if ('options' in question) {
249
249
  const optionsList = Array.isArray(question.options)
250
- ? question.options.map(opt => typeof opt === 'string' ? chalk.gray(opt) : `${chalk.gray(opt.name)} (${chalk.gray(opt.value)})`).join(', ')
250
+ ? question.options.map(opt => typeof opt === 'string' ? gray(opt) : `${gray(opt.name)} (${gray(opt.value)})`).join(', ')
251
251
  : '';
252
- manPage += `\t${chalk.white('Options:')} ${chalk.gray(optionsList)}\n`;
252
+ manPage += `\t${white('Options:')} ${gray(optionsList)}\n`;
253
253
  }
254
254
  if (question.default !== undefined) {
255
- manPage += `\t${chalk.white('Default:')} ${chalk.gray(JSON.stringify(question.default))}\n`;
255
+ manPage += `\t${white('Default:')} ${gray(JSON.stringify(question.default))}\n`;
256
256
  }
257
257
  if (question.required) {
258
- manPage += `\t${chalk.white('Required:')} ${chalk.gray('Yes')}\n`;
258
+ manPage += `\t${white('Required:')} ${gray('Yes')}\n`;
259
259
  }
260
260
  else {
261
- manPage += `\t${chalk.white('Required:')} ${chalk.gray('No')}\n`;
261
+ manPage += `\t${white('Required:')} ${gray('No')}\n`;
262
262
  }
263
263
  manPage += '\n';
264
264
  });
265
- manPage += `${chalk.white('EXAMPLES')}\n\tExample usage of \`${chalk.white(opts.commandName)}\`.\n\t$ ${chalk.white(opts.commandName)}${chalk.gray(requiredArgs)}${chalk.gray(optionalArgs)}\n\n`;
266
- manPage += opts.author ? `${chalk.white('AUTHOR')}\n\t${chalk.white(opts.author)}\n` : '';
265
+ manPage += `${white('EXAMPLES')}\n\tExample usage of \`${white(opts.commandName)}\`.\n\t$ ${white(opts.commandName)}${gray(requiredArgs)}${gray(optionalArgs)}\n\n`;
266
+ manPage += opts.author ? `${white('AUTHOR')}\n\t${white(opts.author)}\n` : '';
267
267
  return manPage;
268
268
  }
269
269
  isValidatableAnswer(answer) {
@@ -640,7 +640,7 @@ export class Inquirerer {
640
640
  if (index >= 0) {
641
641
  const isChecked = selections[index] ? '◉' : '○'; // Use the original index in options
642
642
  const line = `${marker} ${isChecked} ${option.name}`;
643
- this.log(isSelected ? chalk.blue(line) : line);
643
+ this.log(isSelected ? blue(line) : line);
644
644
  }
645
645
  else {
646
646
  this.log('No options'); // sometimes user searches and there are no options...
@@ -745,7 +745,7 @@ export class Inquirerer {
745
745
  this.log('No options'); // sometimes user searches and there are no options...
746
746
  }
747
747
  else if (i === selectedIndex) {
748
- this.log(chalk.blue('> ' + option.name)); // Highlight the selected option with chalk
748
+ this.log(blue('> ' + option.name)); // Highlight the selected option with yanse
749
749
  }
750
750
  else {
751
751
  this.log(' ' + option.name);
@@ -835,7 +835,7 @@ export class Inquirerer {
835
835
  this.log('No options'); // sometimes user searches and there are no options...
836
836
  }
837
837
  else if (i === selectedIndex) {
838
- this.log(chalk.blue('> ' + option.name)); // Highlight the selected option with chalk
838
+ this.log(blue('> ' + option.name)); // Highlight the selected option with yanse
839
839
  }
840
840
  else {
841
841
  this.log(' ' + option.name);
package/esm/utils.js CHANGED
@@ -1,10 +1,10 @@
1
- import chalk from 'chalk';
1
+ import { green, blue } from 'yanse';
2
2
  import { readAndParsePackageJson } from "./package";
3
3
  // Function to display the version information
4
4
  export function displayVersion() {
5
5
  const pkg = readAndParsePackageJson();
6
- console.log(chalk.green(`Name: ${pkg.name}`));
7
- console.log(chalk.blue(`Version: ${pkg.version}`));
6
+ console.log(green(`Name: ${pkg.name}`));
7
+ console.log(blue(`Version: ${pkg.version}`));
8
8
  }
9
9
  export function getVersion() {
10
10
  const pkg = readAndParsePackageJson();
package/keypress.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Readable } from 'stream';
3
2
  type KeyHandler = () => void;
4
3
  interface ProcessWrapper {
package/package.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.readAndParsePackageJson = void 0;
3
+ exports.readAndParsePackageJson = readAndParsePackageJson;
4
4
  const fs_1 = require("fs");
5
5
  const path_1 = require("path");
6
6
  // need to search due to the dist/ folder and src/, etc.
@@ -27,4 +27,3 @@ function readAndParsePackageJson() {
27
27
  const pkg = JSON.parse(str);
28
28
  return pkg;
29
29
  }
30
- exports.readAndParsePackageJson = readAndParsePackageJson;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "inquirerer",
3
- "version": "2.0.8",
3
+ "version": "2.1.1",
4
4
  "author": "Dan Lynch <pyramation@gmail.com>",
5
5
  "description": "inquirerer",
6
6
  "main": "index.js",
7
7
  "module": "esm/index.js",
8
8
  "types": "index.d.ts",
9
- "homepage": "https://github.com/pyramation/inquirerer",
9
+ "homepage": "https://github.com/hyperweb-io/dev-utils",
10
10
  "license": "SEE LICENSE IN LICENSE",
11
11
  "publishConfig": {
12
12
  "access": "public",
@@ -14,26 +14,29 @@
14
14
  },
15
15
  "repository": {
16
16
  "type": "git",
17
- "url": "https://github.com/pyramation/inquirerer"
17
+ "url": "https://github.com/hyperweb-io/dev-utils"
18
18
  },
19
19
  "bugs": {
20
- "url": "https://github.com/pyramation/inquirerer/issues"
20
+ "url": "https://github.com/hyperweb-io/dev-utils/issues"
21
21
  },
22
22
  "scripts": {
23
- "copy": "copyfiles -f ../../LICENSE README.md package.json dist",
24
- "clean": "del dist/**",
25
- "prepare": "npm run build",
23
+ "copy": "cpy ../../LICENSE README.md package.json dist --flat",
24
+ "clean": "rimraf dist/**",
25
+ "prepublishOnly": "npm run build",
26
26
  "build": "npm run clean; tsc; tsc -p tsconfig.esm.json; npm run copy",
27
27
  "dev": "ts-node dev/index",
28
28
  "test": "jest",
29
29
  "test:watch": "jest --watch"
30
30
  },
31
31
  "dependencies": {
32
- "chalk": "^4.1.0",
33
32
  "deepmerge": "^4.3.1",
34
33
  "js-yaml": "^4.1.0",
35
- "minimist": "^1.2.8"
34
+ "minimist": "^1.2.8",
35
+ "yanse": "0.1.2"
36
36
  },
37
37
  "keywords": [],
38
- "gitHead": "4758990c48fa15f34a10078b765004eb6abc4ca7"
38
+ "devDependencies": {
39
+ "@types/minimist": "^1.2.5"
40
+ },
41
+ "gitHead": "31b9119fbfdfd71873d2e1be7f9a9313dd077554"
39
42
  }
package/prompt.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Readable, Writable } from 'stream';
3
2
  import { AutocompleteQuestion, CheckboxQuestion, ConfirmQuestion, ListQuestion, NumberQuestion, OptionValue, Question, TextQuestion, Validation } from './question';
4
3
  export interface ManPageInfo {
package/prompt.js CHANGED
@@ -3,8 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Inquirerer = exports.reorderQuestionsByDeps = void 0;
7
- const chalk_1 = __importDefault(require("chalk"));
6
+ exports.Inquirerer = void 0;
7
+ exports.reorderQuestionsByDeps = reorderQuestionsByDeps;
8
+ const yanse_1 = require("yanse");
8
9
  const readline_1 = __importDefault(require("readline"));
9
10
  const keypress_1 = require("./keypress");
10
11
  function reorderQuestionsByDeps(questions) {
@@ -35,21 +36,20 @@ function reorderQuestionsByDeps(questions) {
35
36
  }
36
37
  return result;
37
38
  }
38
- exports.reorderQuestionsByDeps = reorderQuestionsByDeps;
39
39
  const validationMessage = (question, ctx) => {
40
40
  if (ctx.numTries === 0 || ctx.validation.success) {
41
41
  return ''; // No message if first attempt or validation was successful
42
42
  }
43
43
  if (ctx.validation.reason) {
44
- return chalk_1.default.red(`The field "${question.name}" is invalid: ${ctx.validation.reason}\n`);
44
+ return (0, yanse_1.red)(`The field "${question.name}" is invalid: ${ctx.validation.reason}\n`);
45
45
  }
46
46
  switch (ctx.validation.type) {
47
47
  case 'required':
48
- return chalk_1.default.red(`The field "${question.name}" is required. Please provide a value.\n`);
48
+ return (0, yanse_1.red)(`The field "${question.name}" is required. Please provide a value.\n`);
49
49
  case 'pattern':
50
- return chalk_1.default.red(`The field "${question.name}" does not match the pattern: ${question.pattern}.\n`);
50
+ return (0, yanse_1.red)(`The field "${question.name}" does not match the pattern: ${question.pattern}.\n`);
51
51
  default:
52
- return chalk_1.default.red(`The field "${question.name}" is invalid. Please try again.\n`);
52
+ return (0, yanse_1.red)(`The field "${question.name}" is invalid. Please try again.\n`);
53
53
  }
54
54
  };
55
55
  class PromptContext {
@@ -91,7 +91,7 @@ function generatePromptMessageSuccinct(question, ctx) {
91
91
  const { message, name, type, default: def, options = [] } = question;
92
92
  const lines = [];
93
93
  // 1. Main prompt label
94
- lines.push(chalk_1.default.whiteBright.bold(message || `${name}?`));
94
+ lines.push(yanse_1.whiteBright.bold(message || `${name}?`));
95
95
  // 2. Validation message if applicable
96
96
  const validation = validationMessage(question, ctx);
97
97
  if (validation) {
@@ -103,13 +103,13 @@ function generatePromptMessageSuccinct(question, ctx) {
103
103
  case 'confirm':
104
104
  inline = '(y/n)';
105
105
  if (def !== undefined) {
106
- inline += ` ${chalk_1.default.yellow(`[${def ? 'y' : 'n'}]`)}`;
106
+ inline += ` ${(0, yanse_1.yellow)(`[${def ? 'y' : 'n'}]`)}`;
107
107
  }
108
108
  break;
109
109
  case 'text':
110
110
  case 'number':
111
111
  if (def !== undefined) {
112
- inline += `${chalk_1.default.yellow(`[${def}]`)}`;
112
+ inline += `${(0, yanse_1.yellow)(`[${def}]`)}`;
113
113
  }
114
114
  break;
115
115
  case 'autocomplete':
@@ -117,8 +117,8 @@ function generatePromptMessageSuccinct(question, ctx) {
117
117
  case 'checkbox':
118
118
  if (def !== undefined) {
119
119
  const defaults = Array.isArray(def) ? def : [def];
120
- const rendered = defaults.map(d => chalk_1.default.yellow(d)).join(chalk_1.default.gray(', '));
121
- inline += `${chalk_1.default.yellow(`[${rendered}]`)}`;
120
+ const rendered = defaults.map(d => (0, yanse_1.yellow)(d)).join((0, yanse_1.gray)(', '));
121
+ inline += `${(0, yanse_1.yellow)(`[${rendered}]`)}`;
122
122
  }
123
123
  break;
124
124
  }
@@ -133,10 +133,10 @@ function generatePromptMessage(question, ctx) {
133
133
  const { message, name, type, default: def, options = [], description } = question;
134
134
  const lines = [];
135
135
  // 1. Title Message
136
- lines.push(chalk_1.default.whiteBright.bold(message || `${name}?`));
136
+ lines.push(yanse_1.whiteBright.bold(message || `${name}?`));
137
137
  // 2. Optional description below title
138
138
  if (description) {
139
- lines.push(chalk_1.default.dim(description));
139
+ lines.push((0, yanse_1.dim)(description));
140
140
  }
141
141
  // 3. Validation warning (if failed before)
142
142
  const validation = validationMessage(question, ctx);
@@ -144,20 +144,20 @@ function generatePromptMessage(question, ctx) {
144
144
  lines.push(validation); // already red-colored
145
145
  }
146
146
  // 4. Metadata (name/type)
147
- lines.push(`${chalk_1.default.dim('Argument')} ${chalk_1.default.green(`--${name}`)} ${chalk_1.default.dim('type')} ${chalk_1.default.cyan(`[${type}]`)}`);
147
+ lines.push(`${(0, yanse_1.dim)('Argument')} ${(0, yanse_1.green)(`--${name}`)} ${(0, yanse_1.dim)('type')} ${(0, yanse_1.cyan)(`[${type}]`)}`);
148
148
  // 5. Default value or guidance
149
149
  let guidance = '';
150
150
  switch (type) {
151
151
  case 'confirm':
152
152
  guidance = '(y/n)';
153
153
  if (def !== undefined) {
154
- guidance += ` ${chalk_1.default.yellow(`[default: ${def ? 'y' : 'n'}]`)}`;
154
+ guidance += ` ${(0, yanse_1.yellow)(`[default: ${def ? 'y' : 'n'}]`)}`;
155
155
  }
156
156
  break;
157
157
  case 'text':
158
158
  case 'number':
159
159
  if (def !== undefined) {
160
- guidance = chalk_1.default.yellow(`[default: ${def}]`);
160
+ guidance = (0, yanse_1.yellow)(`[default: ${def}]`);
161
161
  }
162
162
  break;
163
163
  case 'autocomplete':
@@ -165,8 +165,8 @@ function generatePromptMessage(question, ctx) {
165
165
  case 'checkbox':
166
166
  if (def !== undefined) {
167
167
  const defaults = Array.isArray(def) ? def : [def];
168
- const rendered = defaults.map(d => chalk_1.default.yellow(d)).join(chalk_1.default.gray(', '));
169
- guidance += `${chalk_1.default.yellow(`[default: ${rendered}]`)}`;
168
+ const rendered = defaults.map(d => (0, yanse_1.yellow)(d)).join((0, yanse_1.gray)(', '));
169
+ guidance += `${(0, yanse_1.yellow)(`[default: ${rendered}]`)}`;
170
170
  }
171
171
  break;
172
172
  }
@@ -174,7 +174,7 @@ function generatePromptMessage(question, ctx) {
174
174
  lines.push(guidance);
175
175
  }
176
176
  // 6. Final input prompt
177
- lines.push(chalk_1.default.white('> ') + chalk_1.default.dim('Your input:'));
177
+ lines.push((0, yanse_1.white)('> ') + (0, yanse_1.dim)('Your input:'));
178
178
  return lines.join('\n') + '\n';
179
179
  }
180
180
  class Inquirerer {
@@ -218,7 +218,7 @@ class Inquirerer {
218
218
  this.output.write(message + '\n');
219
219
  }
220
220
  getInput(input) {
221
- return `${chalk_1.default.white.bold('$')} ${input}`;
221
+ return `${yanse_1.white.bold('$')} ${input}`;
222
222
  }
223
223
  getPrompt(question, ctx, input) {
224
224
  const promptMessage = generatePromptMessage(question, ctx);
@@ -229,48 +229,48 @@ class Inquirerer {
229
229
  this.log(prompt);
230
230
  }
231
231
  generateManPage(opts) {
232
- let manPage = `${chalk_1.default.white('NAME')}\n\t${chalk_1.default.white(opts.commandName)} ${opts.description ?? ''}\n\n`;
232
+ let manPage = `${(0, yanse_1.white)('NAME')}\n\t${(0, yanse_1.white)(opts.commandName)} ${opts.description ?? ''}\n\n`;
233
233
  // Constructing the SYNOPSIS section with required and optional arguments
234
234
  let requiredArgs = '';
235
235
  let optionalArgs = '';
236
236
  opts.questions.forEach(question => {
237
237
  if (question.required) {
238
- requiredArgs += ` ${chalk_1.default.white('--' + question.name)} <${chalk_1.default.gray(question.name)}>`;
238
+ requiredArgs += ` ${(0, yanse_1.white)('--' + question.name)} <${(0, yanse_1.gray)(question.name)}>`;
239
239
  }
240
240
  else {
241
- optionalArgs += ` [${chalk_1.default.white('--' + question.name)}${question.default ? `=${chalk_1.default.gray(String(question.default))}` : ''}]`;
241
+ optionalArgs += ` [${(0, yanse_1.white)('--' + question.name)}${question.default ? `=${(0, yanse_1.gray)(String(question.default))}` : ''}]`;
242
242
  }
243
243
  });
244
- manPage += `${chalk_1.default.white('SYNOPSIS')}\n\t${chalk_1.default.white(opts.commandName)}${chalk_1.default.gray(requiredArgs)}${chalk_1.default.gray(optionalArgs)}\n\n`;
245
- manPage += `${chalk_1.default.white('DESCRIPTION')}\n\tUse this command to interact with the application. It supports the following options:\n\n`;
244
+ manPage += `${(0, yanse_1.white)('SYNOPSIS')}\n\t${(0, yanse_1.white)(opts.commandName)}${(0, yanse_1.gray)(requiredArgs)}${(0, yanse_1.gray)(optionalArgs)}\n\n`;
245
+ manPage += `${(0, yanse_1.white)('DESCRIPTION')}\n\tUse this command to interact with the application. It supports the following options:\n\n`;
246
246
  opts.questions.forEach(question => {
247
- manPage += `${chalk_1.default.white(question.name.toUpperCase())}\n`;
248
- manPage += `\t${chalk_1.default.white('Type:')} ${chalk_1.default.gray(question.type)}\n`;
247
+ manPage += `${(0, yanse_1.white)(question.name.toUpperCase())}\n`;
248
+ manPage += `\t${(0, yanse_1.white)('Type:')} ${(0, yanse_1.gray)(question.type)}\n`;
249
249
  if (question.message) {
250
- manPage += `\t${chalk_1.default.white('Summary:')} ${chalk_1.default.gray(question.message)}\n`;
250
+ manPage += `\t${(0, yanse_1.white)('Summary:')} ${(0, yanse_1.gray)(question.message)}\n`;
251
251
  }
252
252
  if (question.description) {
253
- manPage += `\t${chalk_1.default.white('Description:')} ${chalk_1.default.gray(question.description)}\n`;
253
+ manPage += `\t${(0, yanse_1.white)('Description:')} ${(0, yanse_1.gray)(question.description)}\n`;
254
254
  }
255
255
  if ('options' in question) {
256
256
  const optionsList = Array.isArray(question.options)
257
- ? question.options.map(opt => typeof opt === 'string' ? chalk_1.default.gray(opt) : `${chalk_1.default.gray(opt.name)} (${chalk_1.default.gray(opt.value)})`).join(', ')
257
+ ? question.options.map(opt => typeof opt === 'string' ? (0, yanse_1.gray)(opt) : `${(0, yanse_1.gray)(opt.name)} (${(0, yanse_1.gray)(opt.value)})`).join(', ')
258
258
  : '';
259
- manPage += `\t${chalk_1.default.white('Options:')} ${chalk_1.default.gray(optionsList)}\n`;
259
+ manPage += `\t${(0, yanse_1.white)('Options:')} ${(0, yanse_1.gray)(optionsList)}\n`;
260
260
  }
261
261
  if (question.default !== undefined) {
262
- manPage += `\t${chalk_1.default.white('Default:')} ${chalk_1.default.gray(JSON.stringify(question.default))}\n`;
262
+ manPage += `\t${(0, yanse_1.white)('Default:')} ${(0, yanse_1.gray)(JSON.stringify(question.default))}\n`;
263
263
  }
264
264
  if (question.required) {
265
- manPage += `\t${chalk_1.default.white('Required:')} ${chalk_1.default.gray('Yes')}\n`;
265
+ manPage += `\t${(0, yanse_1.white)('Required:')} ${(0, yanse_1.gray)('Yes')}\n`;
266
266
  }
267
267
  else {
268
- manPage += `\t${chalk_1.default.white('Required:')} ${chalk_1.default.gray('No')}\n`;
268
+ manPage += `\t${(0, yanse_1.white)('Required:')} ${(0, yanse_1.gray)('No')}\n`;
269
269
  }
270
270
  manPage += '\n';
271
271
  });
272
- manPage += `${chalk_1.default.white('EXAMPLES')}\n\tExample usage of \`${chalk_1.default.white(opts.commandName)}\`.\n\t$ ${chalk_1.default.white(opts.commandName)}${chalk_1.default.gray(requiredArgs)}${chalk_1.default.gray(optionalArgs)}\n\n`;
273
- manPage += opts.author ? `${chalk_1.default.white('AUTHOR')}\n\t${chalk_1.default.white(opts.author)}\n` : '';
272
+ manPage += `${(0, yanse_1.white)('EXAMPLES')}\n\tExample usage of \`${(0, yanse_1.white)(opts.commandName)}\`.\n\t$ ${(0, yanse_1.white)(opts.commandName)}${(0, yanse_1.gray)(requiredArgs)}${(0, yanse_1.gray)(optionalArgs)}\n\n`;
273
+ manPage += opts.author ? `${(0, yanse_1.white)('AUTHOR')}\n\t${(0, yanse_1.white)(opts.author)}\n` : '';
274
274
  return manPage;
275
275
  }
276
276
  isValidatableAnswer(answer) {
@@ -647,7 +647,7 @@ class Inquirerer {
647
647
  if (index >= 0) {
648
648
  const isChecked = selections[index] ? '◉' : '○'; // Use the original index in options
649
649
  const line = `${marker} ${isChecked} ${option.name}`;
650
- this.log(isSelected ? chalk_1.default.blue(line) : line);
650
+ this.log(isSelected ? (0, yanse_1.blue)(line) : line);
651
651
  }
652
652
  else {
653
653
  this.log('No options'); // sometimes user searches and there are no options...
@@ -752,7 +752,7 @@ class Inquirerer {
752
752
  this.log('No options'); // sometimes user searches and there are no options...
753
753
  }
754
754
  else if (i === selectedIndex) {
755
- this.log(chalk_1.default.blue('> ' + option.name)); // Highlight the selected option with chalk
755
+ this.log((0, yanse_1.blue)('> ' + option.name)); // Highlight the selected option with yanse
756
756
  }
757
757
  else {
758
758
  this.log(' ' + option.name);
@@ -842,7 +842,7 @@ class Inquirerer {
842
842
  this.log('No options'); // sometimes user searches and there are no options...
843
843
  }
844
844
  else if (i === selectedIndex) {
845
- this.log(chalk_1.default.blue('> ' + option.name)); // Highlight the selected option with chalk
845
+ this.log((0, yanse_1.blue)('> ' + option.name)); // Highlight the selected option with yanse
846
846
  }
847
847
  else {
848
848
  this.log(' ' + option.name);
package/utils.js CHANGED
@@ -1,20 +1,16 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getVersion = exports.displayVersion = void 0;
7
- const chalk_1 = __importDefault(require("chalk"));
3
+ exports.displayVersion = displayVersion;
4
+ exports.getVersion = getVersion;
5
+ const yanse_1 = require("yanse");
8
6
  const package_1 = require("./package");
9
7
  // Function to display the version information
10
8
  function displayVersion() {
11
9
  const pkg = (0, package_1.readAndParsePackageJson)();
12
- console.log(chalk_1.default.green(`Name: ${pkg.name}`));
13
- console.log(chalk_1.default.blue(`Version: ${pkg.version}`));
10
+ console.log((0, yanse_1.green)(`Name: ${pkg.name}`));
11
+ console.log((0, yanse_1.blue)(`Version: ${pkg.version}`));
14
12
  }
15
- exports.displayVersion = displayVersion;
16
13
  function getVersion() {
17
14
  const pkg = (0, package_1.readAndParsePackageJson)();
18
15
  return pkg.version;
19
16
  }
20
- exports.getVersion = getVersion;