diff --git a/packages/fairy-cli/README.md b/packages/fairy-cli/README.md index fd9f409..1fd945e 100644 --- a/packages/fairy-cli/README.md +++ b/packages/fairy-cli/README.md @@ -87,13 +87,13 @@ Options: -n,--nuxt 删除nuxt构建目录,包括.nuxt、.output目录 (default: false) -d,--dist 删除dist目录 (default: false) -m,--midway 删除midway构建目录 (default: false) + --turbo 删除turbo缓存目录 (default: false) + --vite 删除vite缓存目录 (default: false) + --deps 删除node_modules目录 (default: false) -f,--force 强制删除,默认值:false (default: false) --all 深度删除所有 (default: false) --ignore-tips 忽略提示,直接删除 (default: false) --dry-run 试运行,不做实际删除操作 (default: false) - --turbo 删除turbo缓存目录 (default: false) - --vite 删除vite缓存目录 (default: false) - --deps 删除node_modules目录 (default: false) -h, --help display help for command ``` diff --git a/packages/fairy-cli/package.json b/packages/fairy-cli/package.json index 3e26634..30fd1a7 100644 --- a/packages/fairy-cli/package.json +++ b/packages/fairy-cli/package.json @@ -55,7 +55,6 @@ "dependencies": { "@142vip/release-version": "workspace:*", "@142vip/utils": "workspace:*", - "@inquirer/prompts": "^5.3.8", "commander": "^12.1.0", "del": "^7.1.0", "js-yaml": "^4.1.0", @@ -63,7 +62,6 @@ "turbo": "^2.1.1" }, "devDependencies": { - "@types/inquirer": "^9.0.7", "@types/js-yaml": "^4.0.9" }, "publishConfig": { diff --git a/packages/fairy-cli/src/commands/clean.ts b/packages/fairy-cli/src/commands/clean.ts index 6948fd0..514cc09 100644 --- a/packages/fairy-cli/src/commands/clean.ts +++ b/packages/fairy-cli/src/commands/clean.ts @@ -1,7 +1,7 @@ import * as process from 'node:process' -import confirm from '@inquirer/confirm' import { deleteAsync } from 'del' import type { Command } from 'commander' +import { promptConfirm } from '@142vip/utils' import { CliCommandEnum } from '../shared' /** @@ -67,10 +67,7 @@ async function execCleanUp(args: CleanUpOptions) { // 删除前,对话框确认 if (!args.ignoreTips) { - const deleted = await confirm({ - message: '是否需要删除?', - default: true, - }) + const deleted = await promptConfirm('是否需要删除?', true) if (!deleted) { // 不删除,非0退出 @@ -122,13 +119,13 @@ export async function cleanUpMain(program: Command) { .option('-n,--nuxt', '删除nuxt构建目录,包括.nuxt、.output目录', false) .option('-d,--dist', '删除dist目录', false) .option('-m,--midway', '删除midway构建目录', false) + .option('--turbo', '删除turbo缓存目录', false) + .option('--vite', '删除vite缓存目录', false) + .option('--deps', '删除node_modules目录', false) .option('-f,--force', '强制删除,默认值:false', false) .option('--all', '深度删除所有', false) .option('--ignore-tips', '忽略提示,直接删除', false) .option('--dry-run', '试运行,不做实际删除操作', false) - .option('--turbo', '删除turbo缓存目录', false) - .option('--vite', '删除vite缓存目录', false) - .option('--deps', '删除node_modules目录', false) .action(async (args: CleanUpOptions) => { await execCleanUp(args) }) diff --git a/packages/fairy-cli/src/commands/release.ts b/packages/fairy-cli/src/commands/release.ts index 3b2cabf..6d295bf 100644 --- a/packages/fairy-cli/src/commands/release.ts +++ b/packages/fairy-cli/src/commands/release.ts @@ -2,8 +2,7 @@ import process from 'node:process' import type { VersionBumpOptions } from '@142vip/release-version' import { versionBump } from '@142vip/release-version' import type { Command } from 'commander' -import { confirm, select } from '@inquirer/prompts' -import { vipColor } from '@142vip/utils' +import { promptConfirm, promptList, vipColor } from '@142vip/utils' import { CliCommandEnum, getBranchName, @@ -14,16 +13,6 @@ import { releaseRoot, } from '../shared' -// export interface ReleaseOptions { -// preid: string -// commit?: boolean | string -// tag?: boolean | string -// push?: boolean -// all?: boolean -// execute?: string -// package?: string -// } - interface ReleaseOptions extends Pick { package?: string } @@ -49,7 +38,6 @@ const defaultRepoName = 'main' /** * 版本发布 - * @param args */ async function execNormalRelease(args: ReleaseOptions) { // 指定包 @@ -95,24 +83,14 @@ function execVipRelease(args: VipReleaseExtraOptions) { process.exit(0) } - // 对话框 - select({ - message: `选择需要使用${vipColor.red('Release')}命令发布的模块名称:`, - choices: [ - defaultRepoName, - ...packageNames, - ].map(name => ({ - name, - value: name, - })), - // 不循环滚动 - loop: false, - }) + const choices = [ + defaultRepoName, + ...packageNames, + ] + promptList(choices, `选择需要使用${vipColor.red('Release')}命令发布的模块名称:`) .then(async (packageName) => { // 确认框 - const isRelease = await confirm({ - message: `将对模块${vipColor.green(packageName)}进行版本迭代,是否继续操作?`, - }) + const isRelease = await promptConfirm(`将对模块${vipColor.green(packageName)}进行版本迭代,是否继续操作?`) if (!isRelease) { console.log(vipColor.yellow('用户取消发布操作!!')) @@ -135,7 +113,6 @@ function execVipRelease(args: VipReleaseExtraOptions) { /** * 功能迭代主功能 - * @param program */ export async function releaseMain(program: Command) { program @@ -158,8 +135,6 @@ export async function releaseMain(program: Command) { }, []) .option('--vip', '是否为@142vip组织专用功能', false) .action(async (args: ReleaseOptions & VipReleaseExtraOptions) => { - // console.log(CliCommandEnum.RELEASE, args) - // 发布时校验分支 if (args.branch != null) { const branchName = getBranchName() diff --git a/packages/utils/package.json b/packages/utils/package.json index 50dc591..947cb0f 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -48,5 +48,8 @@ "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org" + }, + "devDependencies": { + "@types/inquirer": "^9.0.7" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0d59385..4d44a53 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -86,7 +86,7 @@ importers: version: 2.0.0-rc.17(@types/node@22.8.1)(jiti@2.3.3)(sass-embedded@1.80.4)(tsx@4.19.2)(typescript@5.6.3)(yaml@2.6.0) vuepress: specifier: 2.0.0-rc.17 - version: 2.0.0-rc.17(@vuepress/bundler-vite@2.0.0-rc.17(@types/node@22.8.1)(jiti@2.3.3)(sass-embedded@1.80.4)(tsx@4.19.2)(typescript@5.6.3)(yaml@2.6.0))(typescript@5.6.3)(vue@3.5.12(typescript@5.6.3)) + version: 2.0.0-rc.17(@vuepress/bundler-vite@2.0.0-rc.17(@types/node@22.8.1)(jiti@2.3.3)(sass-embedded@1.80.4)(tsx@4.19.2)(typescript@5.6.3)(yaml@2.6.0))(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3)) packages/axios: dependencies: @@ -202,9 +202,6 @@ importers: '@142vip/utils': specifier: workspace:* version: link:../utils - '@inquirer/prompts': - specifier: ^5.3.8 - version: 5.5.0 commander: specifier: ^12.1.0 version: 12.1.0 @@ -221,9 +218,6 @@ importers: specifier: ^2.1.1 version: 2.2.3 devDependencies: - '@types/inquirer': - specifier: ^9.0.7 - version: 9.0.7 '@types/js-yaml': specifier: ^4.0.9 version: 4.0.9 @@ -361,6 +355,10 @@ importers: qs: specifier: ^6.13.0 version: 6.13.0 + devDependencies: + '@types/inquirer': + specifier: ^9.0.7 + version: 9.0.7 packages/vitepress: dependencies: @@ -1457,66 +1455,6 @@ packages: '@iconify/types@2.0.0': resolution: {integrity: sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==} - '@inquirer/checkbox@2.5.0': - resolution: {integrity: sha512-sMgdETOfi2dUHT8r7TT1BTKOwNvdDGFDXYWtQ2J69SvlYNntk9I/gJe7r5yvMwwsuKnYbuRs3pNhx4tgNck5aA==} - engines: {node: '>=18'} - - '@inquirer/confirm@3.2.0': - resolution: {integrity: sha512-oOIwPs0Dvq5220Z8lGL/6LHRTEr9TgLHmiI99Rj1PJ1p1czTys+olrgBqZk4E2qC0YTzeHprxSQmoHioVdJ7Lw==} - engines: {node: '>=18'} - - '@inquirer/core@9.2.1': - resolution: {integrity: sha512-F2VBt7W/mwqEU4bL0RnHNZmC/OxzNx9cOYxHqnXX3MP6ruYvZUZAW9imgN9+h/uBT/oP8Gh888J2OZSbjSeWcg==} - engines: {node: '>=18'} - - '@inquirer/editor@2.2.0': - resolution: {integrity: sha512-9KHOpJ+dIL5SZli8lJ6xdaYLPPzB8xB9GZItg39MBybzhxA16vxmszmQFrRwbOA918WA2rvu8xhDEg/p6LXKbw==} - engines: {node: '>=18'} - - '@inquirer/expand@2.3.0': - resolution: {integrity: sha512-qnJsUcOGCSG1e5DTOErmv2BPQqrtT6uzqn1vI/aYGiPKq+FgslGZmtdnXbhuI7IlT7OByDoEEqdnhUnVR2hhLw==} - engines: {node: '>=18'} - - '@inquirer/figures@1.0.7': - resolution: {integrity: sha512-m+Trk77mp54Zma6xLkLuY+mvanPxlE4A7yNKs2HBiyZ4UkVs28Mv5c/pgWrHeInx+USHeX/WEPzjrWrcJiQgjw==} - engines: {node: '>=18'} - - '@inquirer/input@2.3.0': - resolution: {integrity: sha512-XfnpCStx2xgh1LIRqPXrTNEEByqQWoxsWYzNRSEUxJ5c6EQlhMogJ3vHKu8aXuTacebtaZzMAHwEL0kAflKOBw==} - engines: {node: '>=18'} - - '@inquirer/number@1.1.0': - resolution: {integrity: sha512-ilUnia/GZUtfSZy3YEErXLJ2Sljo/mf9fiKc08n18DdwdmDbOzRcTv65H1jjDvlsAuvdFXf4Sa/aL7iw/NanVA==} - engines: {node: '>=18'} - - '@inquirer/password@2.2.0': - resolution: {integrity: sha512-5otqIpgsPYIshqhgtEwSspBQE40etouR8VIxzpJkv9i0dVHIpyhiivbkH9/dGiMLdyamT54YRdGJLfl8TFnLHg==} - engines: {node: '>=18'} - - '@inquirer/prompts@5.5.0': - resolution: {integrity: sha512-BHDeL0catgHdcHbSFFUddNzvx/imzJMft+tWDPwTm3hfu8/tApk1HrooNngB2Mb4qY+KaRWF+iZqoVUPeslEog==} - engines: {node: '>=18'} - - '@inquirer/rawlist@2.3.0': - resolution: {integrity: sha512-zzfNuINhFF7OLAtGHfhwOW2TlYJyli7lOUoJUXw/uyklcwalV6WRXBXtFIicN8rTRK1XTiPWB4UY+YuW8dsnLQ==} - engines: {node: '>=18'} - - '@inquirer/search@1.1.0': - resolution: {integrity: sha512-h+/5LSj51dx7hp5xOn4QFnUaKeARwUCLs6mIhtkJ0JYPBLmEYjdHSYh7I6GrLg9LwpJ3xeX0FZgAG1q0QdCpVQ==} - engines: {node: '>=18'} - - '@inquirer/select@2.5.0': - resolution: {integrity: sha512-YmDobTItPP3WcEI86GvPo+T2sRHkxxOq/kXmsBjHS5BVXUgvgZ5AfJjkvQvZr03T81NnI3KrrRuMzeuYUQRFOA==} - engines: {node: '>=18'} - - '@inquirer/type@1.5.5': - resolution: {integrity: sha512-MzICLu4yS7V8AA61sANROZ9vT1H3ooca5dSmI1FjZkzq7o/koMsRfQSzRtFo+F3Ao4Sf1C0bpLKejpKB/+j6MA==} - engines: {node: '>=18'} - - '@inquirer/type@2.0.0': - resolution: {integrity: sha512-XvJRx+2KR3YXyYtPUUy+qd9i7p+GO9Ko6VIIpWlBrpWwXDv8WLFeHTxz35CfQFUiBMLXlGHhGzys7lqit9gWag==} - engines: {node: '>=18'} - '@ioredis/commands@1.2.0': resolution: {integrity: sha512-Sx1pU8EM64o2BrqNpEO1CNLtKQwyhuXuqyfH7oGKCk+1a33d2r5saW8zNwm3j6BTExtjrv2BxTgzzkMwts6vGg==} @@ -2446,9 +2384,6 @@ packages: '@types/ms@0.7.34': resolution: {integrity: sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==} - '@types/mute-stream@0.0.4': - resolution: {integrity: sha512-CPM9nzrCPPJHQNA9keH9CVkVI+WR5kMa+7XEs5jcGQ0VoAGnLv242w8lIVgwAEfmE4oufJRaTc9PNLQl0ioAow==} - '@types/node@14.18.63': resolution: {integrity: sha512-fAtCfv4jJg+ExtXhvCkCqUKZ+4ok/JQk01qDKhL5BDDoS3AxKXhV5/MAVUZyQnSEd2GT92fkgZl0pz0Q0AzcIQ==} @@ -2518,9 +2453,6 @@ packages: '@types/web-bluetooth@0.0.20': resolution: {integrity: sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==} - '@types/wrap-ansi@3.0.0': - resolution: {integrity: sha512-ltIpx+kM7g/MLRZfkbL7EsCEjfzCcScLpkg37eXEtx5kmrAKBkTJwd1GIAjDSL8wTpM6Hzn5YO4pSb91BEwu1g==} - '@types/yargs-parser@21.0.3': resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==} @@ -3447,10 +3379,6 @@ packages: resolution: {integrity: sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==} engines: {node: '>= 10'} - cli-width@4.1.0: - resolution: {integrity: sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==} - engines: {node: '>= 12'} - cliui@6.0.0: resolution: {integrity: sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==} @@ -5725,10 +5653,6 @@ packages: mute-stream@0.0.8: resolution: {integrity: sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==} - mute-stream@1.0.0: - resolution: {integrity: sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==} - engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} - mysql2@3.11.3: resolution: {integrity: sha512-Qpu2ADfbKzyLdwC/5d4W7+5Yz7yBzCU05YWt5npWzACST37wJsB23wgOSo00qi043urkiRwXtEvJc9UnuLX/MQ==} engines: {node: '>= 8.0'} @@ -7907,10 +7831,6 @@ packages: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} - yoctocolors-cjs@2.1.2: - resolution: {integrity: sha512-cYVsTjKl8b+FrnidjibDWskAv7UKOfcwaVZdp/it9n1s9fU3IkgDbhdIRKCW4JDsAlECJY0ytoVPT3sK6kideA==} - engines: {node: '>=18'} - yoctocolors@2.1.1: resolution: {integrity: sha512-GQHQqAopRhwU8Kt1DDM8NjibDXHC8eoh1erhGAJPEyveY9qqVeXvVikNKrDz69sHowPMorbPUrH/mx8c50eiBQ==} engines: {node: '>=18'} @@ -8732,106 +8652,6 @@ snapshots: '@iconify/types@2.0.0': {} - '@inquirer/checkbox@2.5.0': - dependencies: - '@inquirer/core': 9.2.1 - '@inquirer/figures': 1.0.7 - '@inquirer/type': 1.5.5 - ansi-escapes: 4.3.2 - yoctocolors-cjs: 2.1.2 - - '@inquirer/confirm@3.2.0': - dependencies: - '@inquirer/core': 9.2.1 - '@inquirer/type': 1.5.5 - - '@inquirer/core@9.2.1': - dependencies: - '@inquirer/figures': 1.0.7 - '@inquirer/type': 2.0.0 - '@types/mute-stream': 0.0.4 - '@types/node': 22.8.1 - '@types/wrap-ansi': 3.0.0 - ansi-escapes: 4.3.2 - cli-width: 4.1.0 - mute-stream: 1.0.0 - signal-exit: 4.1.0 - strip-ansi: 6.0.1 - wrap-ansi: 6.2.0 - yoctocolors-cjs: 2.1.2 - - '@inquirer/editor@2.2.0': - dependencies: - '@inquirer/core': 9.2.1 - '@inquirer/type': 1.5.5 - external-editor: 3.1.0 - - '@inquirer/expand@2.3.0': - dependencies: - '@inquirer/core': 9.2.1 - '@inquirer/type': 1.5.5 - yoctocolors-cjs: 2.1.2 - - '@inquirer/figures@1.0.7': {} - - '@inquirer/input@2.3.0': - dependencies: - '@inquirer/core': 9.2.1 - '@inquirer/type': 1.5.5 - - '@inquirer/number@1.1.0': - dependencies: - '@inquirer/core': 9.2.1 - '@inquirer/type': 1.5.5 - - '@inquirer/password@2.2.0': - dependencies: - '@inquirer/core': 9.2.1 - '@inquirer/type': 1.5.5 - ansi-escapes: 4.3.2 - - '@inquirer/prompts@5.5.0': - dependencies: - '@inquirer/checkbox': 2.5.0 - '@inquirer/confirm': 3.2.0 - '@inquirer/editor': 2.2.0 - '@inquirer/expand': 2.3.0 - '@inquirer/input': 2.3.0 - '@inquirer/number': 1.1.0 - '@inquirer/password': 2.2.0 - '@inquirer/rawlist': 2.3.0 - '@inquirer/search': 1.1.0 - '@inquirer/select': 2.5.0 - - '@inquirer/rawlist@2.3.0': - dependencies: - '@inquirer/core': 9.2.1 - '@inquirer/type': 1.5.5 - yoctocolors-cjs: 2.1.2 - - '@inquirer/search@1.1.0': - dependencies: - '@inquirer/core': 9.2.1 - '@inquirer/figures': 1.0.7 - '@inquirer/type': 1.5.5 - yoctocolors-cjs: 2.1.2 - - '@inquirer/select@2.5.0': - dependencies: - '@inquirer/core': 9.2.1 - '@inquirer/figures': 1.0.7 - '@inquirer/type': 1.5.5 - ansi-escapes: 4.3.2 - yoctocolors-cjs: 2.1.2 - - '@inquirer/type@1.5.5': - dependencies: - mute-stream: 1.0.0 - - '@inquirer/type@2.0.0': - dependencies: - mute-stream: 1.0.0 - '@ioredis/commands@1.2.0': {} '@isaacs/cliui@8.0.2': @@ -9802,10 +9622,6 @@ snapshots: '@types/ms@0.7.34': {} - '@types/mute-stream@0.0.4': - dependencies: - '@types/node': 14.18.63 - '@types/node@14.18.63': {} '@types/node@17.0.45': {} @@ -9813,6 +9629,7 @@ snapshots: '@types/node@22.8.1': dependencies: undici-types: 6.19.8 + optional: true '@types/normalize-package-data@2.4.4': {} @@ -9875,8 +9692,6 @@ snapshots: '@types/web-bluetooth@0.0.20': {} - '@types/wrap-ansi@3.0.0': {} - '@types/yargs-parser@21.0.3': {} '@types/yargs@17.0.33': @@ -11257,8 +11072,6 @@ snapshots: cli-width@3.0.0: {} - cli-width@4.1.0: {} - cliui@6.0.0: dependencies: string-width: 4.2.3 @@ -14101,8 +13914,6 @@ snapshots: mute-stream@0.0.8: {} - mute-stream@1.0.0: {} - mysql2@3.11.3: dependencies: aws-ssl-profiles: 1.1.2 @@ -15650,7 +15461,8 @@ snapshots: - supports-color - vue-tsc - undici-types@6.19.8: {} + undici-types@6.19.8: + optional: true undici@6.20.1: {} @@ -16105,6 +15917,21 @@ snapshots: - supports-color - typescript + vuepress@2.0.0-rc.17(@vuepress/bundler-vite@2.0.0-rc.17(@types/node@22.8.1)(jiti@2.3.3)(sass-embedded@1.80.4)(tsx@4.19.2)(typescript@5.6.3)(yaml@2.6.0))(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3)): + dependencies: + '@vuepress/cli': 2.0.0-rc.17(typescript@5.6.3) + '@vuepress/client': 2.0.0-rc.17(typescript@5.6.3) + '@vuepress/core': 2.0.0-rc.17(typescript@5.6.3) + '@vuepress/markdown': 2.0.0-rc.17 + '@vuepress/shared': 2.0.0-rc.17 + '@vuepress/utils': 2.0.0-rc.17 + vue: 3.5.13(typescript@5.6.3) + optionalDependencies: + '@vuepress/bundler-vite': 2.0.0-rc.17(@types/node@22.8.1)(jiti@2.3.3)(sass-embedded@1.80.4)(tsx@4.19.2)(typescript@5.6.3)(yaml@2.6.0) + transitivePeerDependencies: + - supports-color + - typescript + walker@1.0.8: dependencies: makeerror: 1.0.12 @@ -16262,8 +16089,6 @@ snapshots: yocto-queue@0.1.0: {} - yoctocolors-cjs@2.1.2: {} - yoctocolors@2.1.1: {} zwitch@2.0.4: {}