refactor(nuxt): use built-in consola prompts (#23205)

This commit is contained in:
Daniel Roe 2023-09-14 10:17:55 +01:00 committed by GitHub
parent e729406805
commit ba3ca72387
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 34 deletions

View File

@ -89,7 +89,6 @@
"pathe": "^1.1.1", "pathe": "^1.1.1",
"perfect-debounce": "^1.0.0", "perfect-debounce": "^1.0.0",
"pkg-types": "^1.0.3", "pkg-types": "^1.0.3",
"prompts": "^2.4.2",
"scule": "^1.0.0", "scule": "^1.0.0",
"std-env": "^3.4.3", "std-env": "^3.4.3",
"strip-literal": "^1.3.0", "strip-literal": "^1.3.0",
@ -111,7 +110,6 @@
"@parcel/watcher": "2.3.0", "@parcel/watcher": "2.3.0",
"@types/estree": "1.0.1", "@types/estree": "1.0.1",
"@types/fs-extra": "11.0.1", "@types/fs-extra": "11.0.1",
"@types/prompts": "2.4.4",
"@vitejs/plugin-vue": "4.3.4", "@vitejs/plugin-vue": "4.3.4",
"unbuild": "latest", "unbuild": "latest",
"vite": "4.4.9", "vite": "4.4.9",

View File

@ -2,7 +2,6 @@ import { addDependency } from 'nypm'
import { resolvePackageJSON } from 'pkg-types' import { resolvePackageJSON } from 'pkg-types'
import { logger } from '@nuxt/kit' import { logger } from '@nuxt/kit'
import { isCI } from 'std-env' import { isCI } from 'std-env'
import prompts from 'prompts'
export async function ensurePackageInstalled (rootDir: string, name: string, searchPaths?: string[]) { export async function ensurePackageInstalled (rootDir: string, name: string, searchPaths?: string[]) {
if (await resolvePackageJSON(name, { url: searchPaths }).catch(() => null)) { if (await resolvePackageJSON(name, { url: searchPaths }).catch(() => null)) {
@ -14,10 +13,9 @@ export async function ensurePackageInstalled (rootDir: string, name: string, sea
return false return false
} }
const { confirm } = await prompts({ const confirm = await logger.prompt(`Do you want to install ${name} package?`, {
type: 'confirm', type: 'confirm',
name: 'confirm', name: 'confirm',
message: `Do you want to install ${name} package?`,
initial: true initial: true
}) })

View File

@ -356,9 +356,6 @@ importers:
pkg-types: pkg-types:
specifier: ^1.0.3 specifier: ^1.0.3
version: 1.0.3 version: 1.0.3
prompts:
specifier: ^2.4.2
version: 2.4.2
scule: scule:
specifier: ^1.0.0 specifier: ^1.0.0
version: 1.0.0 version: 1.0.0
@ -417,9 +414,6 @@ importers:
'@types/fs-extra': '@types/fs-extra':
specifier: 11.0.1 specifier: 11.0.1
version: 11.0.1 version: 11.0.1
'@types/prompts':
specifier: 2.4.4
version: 2.4.4
'@vitejs/plugin-vue': '@vitejs/plugin-vue':
specifier: 4.3.4 specifier: 4.3.4
version: 4.3.4(vite@4.4.9)(vue@3.3.4) version: 4.3.4(vite@4.4.9)(vue@3.3.4)
@ -2526,6 +2520,7 @@ packages:
dependencies: dependencies:
is-glob: 4.0.3 is-glob: 4.0.3
micromatch: 4.0.5 micromatch: 4.0.5
napi-wasm: 1.1.0
bundledDependencies: bundledDependencies:
- napi-wasm - napi-wasm
@ -2904,13 +2899,6 @@ packages:
resolution: {integrity: sha512-UYcJBAqWLyg+eITXGIu9DR7RXJFvSupz+Hf+RqJYHzDJedvDMTsB1JmDV6Qfna2g62VIxUKvoWqTxGHy6U/bLA==} resolution: {integrity: sha512-UYcJBAqWLyg+eITXGIu9DR7RXJFvSupz+Hf+RqJYHzDJedvDMTsB1JmDV6Qfna2g62VIxUKvoWqTxGHy6U/bLA==}
dev: true dev: true
/@types/prompts@2.4.4:
resolution: {integrity: sha512-p5N9uoTH76lLvSAaYSZtBCdEXzpOOufsRjnhjVSrZGXikVGHX9+cc9ERtHRV4hvBKHyZb1bg4K+56Bd2TqUn4A==}
dependencies:
'@types/node': 18.17.15
kleur: 3.0.3
dev: true
/@types/pug@2.0.6: /@types/pug@2.0.6:
resolution: {integrity: sha512-SnHmG9wN1UVmagJOnyo/qkk0Z7gejYxOYYmaAwr5u2yFYfsupN3sg10kyzN8Hep/2zbHxCnsumxOoRIRMBwKCg==} resolution: {integrity: sha512-SnHmG9wN1UVmagJOnyo/qkk0Z7gejYxOYYmaAwr5u2yFYfsupN3sg10kyzN8Hep/2zbHxCnsumxOoRIRMBwKCg==}
dev: true dev: true
@ -7041,10 +7029,6 @@ packages:
promise: 7.3.1 promise: 7.3.1
dev: false dev: false
/kleur@3.0.3:
resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==}
engines: {node: '>=6'}
/kleur@4.1.5: /kleur@4.1.5:
resolution: {integrity: sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==} resolution: {integrity: sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==}
engines: {node: '>=6'} engines: {node: '>=6'}
@ -7927,6 +7911,9 @@ packages:
engines: {node: ^14 || ^16 || >=18} engines: {node: ^14 || ^16 || >=18}
hasBin: true hasBin: true
/napi-wasm@1.1.0:
resolution: {integrity: sha512-lHwIAJbmLSjF9VDRm9GoVOy9AGp3aIvkjv+Kvz9h16QR3uSVYH78PNQUnT2U4X53mhlnV2M7wrhibQ3GHicDmg==}
/natural-compare@1.4.0: /natural-compare@1.4.0:
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
@ -9047,14 +9034,6 @@ packages:
asap: 2.0.6 asap: 2.0.6
dev: false dev: false
/prompts@2.4.2:
resolution: {integrity: sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==}
engines: {node: '>= 6'}
dependencies:
kleur: 3.0.3
sisteransi: 1.0.5
dev: false
/property-information@6.2.0: /property-information@6.2.0:
resolution: {integrity: sha512-kma4U7AFCTwpqq5twzC1YVIDXSqg6qQK6JN0smOw8fgRy1OkMi0CYSzFmsy6dnqSenamAtj0CyXMUJ1Mf6oROg==} resolution: {integrity: sha512-kma4U7AFCTwpqq5twzC1YVIDXSqg6qQK6JN0smOw8fgRy1OkMi0CYSzFmsy6dnqSenamAtj0CyXMUJ1Mf6oROg==}
dev: true dev: true
@ -9731,10 +9710,6 @@ packages:
mrmime: 1.0.1 mrmime: 1.0.1
totalist: 3.0.1 totalist: 3.0.1
/sisteransi@1.0.5:
resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==}
dev: false
/slash@3.0.0: /slash@3.0.0:
resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==}
engines: {node: '>=8'} engines: {node: '>=8'}