chore(deps-dev): bump inquirer from 9 to 10 (#49764)

This commit is contained in:
lijianan 2024-07-08 10:02:17 +08:00 committed by GitHub
parent 0c2ff77b41
commit 2cf4984b81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 59 additions and 78 deletions

View File

@ -163,6 +163,7 @@
"@emotion/react": "^11.11.4",
"@emotion/server": "^11.11.0",
"@ianvs/prettier-plugin-sort-imports": "^4.2.1",
"@inquirer/prompts": "^5.1.2",
"@madccc/duplicate-package-checker-webpack-plugin": "^1.0.0",
"@microflash/rehype-figure": "^2.1.0",
"@npmcli/run-script": "^8.1.0",
@ -180,7 +181,6 @@
"@types/fs-extra": "^11.0.4",
"@types/gtag.js": "^0.0.20",
"@types/http-server": "^0.12.4",
"@types/inquirer": "^9.0.7",
"@types/isomorphic-fetch": "^0.0.39",
"@types/jest": "^29.5.12",
"@types/jest-axe": "^3.5.9",
@ -250,7 +250,6 @@
"husky": "^9.0.11",
"identity-obj-proxy": "^3.0.0",
"immer": "^10.1.1",
"inquirer": "^9.2.23",
"is-ci": "^3.0.1",
"isomorphic-fetch": "^3.0.0",
"jest": "^29.7.0",

View File

@ -1,9 +1,10 @@
/* eslint-disable import/no-extraneous-dependencies */
/* eslint-disable no-console */
import { execSync, spawnSync } from 'child_process';
import { confirm, select } from '@inquirer/prompts';
import chalk from 'chalk';
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
import inquirer from 'inquirer';
import fetch from 'isomorphic-fetch';
import ora from 'ora';
import semver from 'semver';
@ -106,39 +107,31 @@ const SAFE_DAYS_DIFF = 1000 * 60 * 60 * 24 * 3; // 3 days not update seems to be
defaultVersion = distTags[CONCH_TAG];
}
// Selection
let { conchVersion } = await inquirer.prompt([
{
type: 'list',
name: 'conchVersion',
default: defaultVersion,
message: 'Please select Conch Version:',
choices: latestVersions.map((info) => {
const { value, publishTime, depreciated } = info;
const desc = dayjs(publishTime).fromNow();
//
return {
...info,
name: [
// Warning
depreciated ? '🚨' : '✅',
// Version
value,
// Date Diff
`(${desc})`,
// Default Mark
value === defaultVersion ? '(default)' : '',
// Current Mark
value === distTags[CONCH_TAG] ? chalk.gray('- current') : '',
]
.filter((str) => String(str).trim())
.join(' '),
};
}),
},
]);
let conchVersion = await select({
default: defaultVersion,
message: 'Please select Conch Version:',
choices: latestVersions.map((info) => {
const { value, publishTime, depreciated } = info;
const desc = dayjs(publishTime).fromNow();
return {
value,
name: [
// Warning
depreciated ? '🚨' : '✅',
// Version
value,
// Date Diff
`(${desc})`,
// Default Mark
value === defaultVersion ? '(default)' : '',
// Current Mark
value === distTags[CONCH_TAG] ? chalk.gray('- current') : '',
]
.filter((str) => Boolean(String(str).trim()))
.join(' '),
};
}),
});
// Make sure it's not deprecated version
const deprecatedObj = matchDeprecated(conchVersion);
@ -150,17 +143,13 @@ const SAFE_DAYS_DIFF = 1000 * 60 * 60 * 24 * 3; // 3 days not update seems to be
});
console.log('\n');
const { conchConfirm } = await inquirer.prompt([
{
type: 'confirm',
name: 'conchVersion',
default: false,
message: 'SURE to continue?!!',
},
]);
const conchConfirm = await confirm({
default: false,
message: 'SURE to continue ?!!',
});
if (!conchConfirm) {
conchVersion = null;
conchVersion = '';
}
}

View File

@ -1,9 +1,10 @@
/* eslint-disable import/no-extraneous-dependencies */
/* eslint-disable no-await-in-loop, no-console */
import { spawn } from 'child_process';
import path from 'path';
import { input, select } from '@inquirer/prompts';
import chalk from 'chalk';
import fs from 'fs-extra';
import inquirer from 'inquirer';
import fetch from 'isomorphic-fetch';
import jQuery from 'jquery';
import jsdom from 'jsdom';
@ -72,40 +73,32 @@ const getDescription = (entity?: Line): string => {
async function printLog() {
const tags = await git.tags();
const { fromVersion } = await inquirer.prompt([
{
type: 'list',
name: 'fromVersion',
message: '🏷 Please choose tag to compare with current branch:',
choices: tags.all
.filter((item) => !item.includes('experimental'))
.filter((item) => !item.includes('alpha'))
.filter((item) => !item.includes('resource'))
.reverse()
.slice(0, 50),
},
]);
let { toVersion } = await inquirer.prompt([
{
type: 'list',
name: 'toVersion',
message: `🔀 Please choose branch to compare with ${chalk.magenta(fromVersion)}:`,
choices: ['master', '4.x-stable', '3.x-stable', 'feature', 'custom input ⌨️'],
},
]);
const fromVersion = await select({
message: '🏷 Please choose tag to compare with current branch:',
choices: tags.all
.filter((item) => !item.includes('experimental'))
.filter((item) => !item.includes('alpha'))
.filter((item) => !item.includes('resource'))
.reverse()
.slice(0, 50)
.map((item) => ({ name: item, value: item })),
});
let toVersion = await select({
message: `🔀 Please choose branch to compare with ${chalk.magenta(fromVersion)}:`,
choices: ['master', '4.x-stable', '3.x-stable', 'feature', 'custom input ⌨️'].map((i) => ({
name: i,
value: i,
})),
});
if (toVersion.startsWith('custom input')) {
const result = await inquirer.prompt([
{
type: 'input',
name: 'toVersion',
message: `🔀 Please input custom git hash id or branch name to compare with ${chalk.magenta(
fromVersion,
)}:`,
default: 'master',
},
]);
toVersion = result.toVersion;
toVersion = await input({
default: 'master',
message: `🔀 Please input custom git hash id or branch name to compare with ${chalk.magenta(
fromVersion,
)}:`,
});
}
if (!/\d+\.\d+\.\d+/.test(fromVersion)) {