feat: migrate from inquirer to @inquirer/prompts for interactive prompts
- Replaced inquirer with @inquirer/prompts in various command files for improved prompt handling. - Updated confirmation and input prompts in commands such as app, config, deploy, login, and others. - Added a new command 'cc' for switching between Claude code models with appropriate configurations. - Enhanced user experience by ensuring prompts are more streamlined and consistent across the application.
This commit is contained in:
@@ -5,7 +5,7 @@ import { spawn } from 'child_process';
|
||||
import { fileIsExist } from '@/uitls/file.ts';
|
||||
import { getConfig } from '@/module/get-config.ts';
|
||||
import fs from 'fs';
|
||||
import inquirer from 'inquirer';
|
||||
import { select, confirm } from '@inquirer/prompts';
|
||||
import { checkPnpm } from '@/uitls/npm.ts';
|
||||
const parseIfJson = (str: string) => {
|
||||
try {
|
||||
@@ -21,10 +21,8 @@ const publish = new Command('publish')
|
||||
.option('-t, --tag', 'tag')
|
||||
.description('publish npm')
|
||||
.action(async (registry, options) => {
|
||||
const answer = await inquirer.prompt([
|
||||
{
|
||||
type: 'list',
|
||||
name: 'publish',
|
||||
if (!registry) {
|
||||
registry = await select({
|
||||
message: 'Select the registry to publish',
|
||||
choices: [
|
||||
{
|
||||
@@ -36,10 +34,8 @@ const publish = new Command('publish')
|
||||
value: 'npm',
|
||||
},
|
||||
],
|
||||
when: !registry,
|
||||
},
|
||||
]);
|
||||
registry = registry || answer.publish;
|
||||
});
|
||||
}
|
||||
const config = getConfig();
|
||||
let cmd = '';
|
||||
const execPath = process.cwd();
|
||||
@@ -149,15 +145,11 @@ const npmrc = new Command('set')
|
||||
if (options.force) {
|
||||
writeFlag = true;
|
||||
} else {
|
||||
const answer = await inquirer.prompt([
|
||||
{
|
||||
type: 'confirm',
|
||||
name: 'confirm',
|
||||
message: `Are you sure you want to overwrite the .npmrc file?`,
|
||||
default: false,
|
||||
},
|
||||
]);
|
||||
if (answer.confirm) {
|
||||
const confirmed = await confirm({
|
||||
message: `Are you sure you want to overwrite the .npmrc file?`,
|
||||
default: false,
|
||||
});
|
||||
if (confirmed) {
|
||||
writeFlag = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user