speedrun-cli 2.7.3 → 2.7.5

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/utils.js +9 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speedrun-cli",
3
- "version": "2.7.3",
3
+ "version": "2.7.5",
4
4
  "description": "CLI tool to scaffold a production-ready NestJS authentication system with JWT, refresh tokens, and RBAC",
5
5
  "keywords": [
6
6
  "nestjs",
package/src/utils.js CHANGED
@@ -115,9 +115,13 @@ function registerStrictConfirmPrompt(inquirerInstance = require('inquirer')) {
115
115
  class StrictConfirmPrompt extends InputPrompt {
116
116
  constructor(questions, rl, answers) {
117
117
  super(questions, rl, answers);
118
- if (this.opt.default === undefined) {
119
- this.opt.default = true;
120
- }
118
+ this.defaultBool = this.opt.default !== false;
119
+ }
120
+
121
+ getQuestion() {
122
+ let message = super.getQuestion();
123
+ // Remove auto-appended (true) or (false) text from InputPrompt
124
+ return message.replace(/\s*\((true|false)\)\s*/g, ' ');
121
125
  }
122
126
 
123
127
  render(answer) {
@@ -126,7 +130,7 @@ function registerStrictConfirmPrompt(inquirerInstance = require('inquirer')) {
126
130
  if (this.status === 'answered') {
127
131
  message += chalk.cyan(answer !== undefined ? (answer ? 'Yes' : 'No') : (this.answer ? 'Yes' : 'No'));
128
132
  } else {
129
- message += chalk.dim(this.opt.default ? ' (Y/n)' : ' (y/N)');
133
+ message += chalk.dim(this.defaultBool ? ' (Y/n)' : ' (y/N)');
130
134
  }
131
135
 
132
136
  let bottomContent = '';
@@ -150,7 +154,7 @@ function registerStrictConfirmPrompt(inquirerInstance = require('inquirer')) {
150
154
 
151
155
  filterInput(input) {
152
156
  if (input === undefined || input === null || input.toString().trim() === '') {
153
- return this.opt.default !== false;
157
+ return this.defaultBool;
154
158
  }
155
159
  const val = input.toString().trim().toLowerCase();
156
160
  return ['y', 'yes'].includes(val);