From ba3ca72387af7e4d0198919e67fce84aaeff9e33 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Thu, 14 Sep 2023 10:17:55 +0100 Subject: [PATCH] refactor(nuxt): use built-in consola prompts (#23205) --- packages/nuxt/package.json | 2 -- packages/nuxt/src/core/features.ts | 4 +--- pnpm-lock.yaml | 33 ++++-------------------------- 3 files changed, 5 insertions(+), 34 deletions(-) diff --git a/packages/nuxt/package.json b/packages/nuxt/package.json index 90d62e216d..e24661748f 100644 --- a/packages/nuxt/package.json +++ b/packages/nuxt/package.json @@ -89,7 +89,6 @@ "pathe": "^1.1.1", "perfect-debounce": "^1.0.0", "pkg-types": "^1.0.3", - "prompts": "^2.4.2", "scule": "^1.0.0", "std-env": "^3.4.3", "strip-literal": "^1.3.0", @@ -111,7 +110,6 @@ "@parcel/watcher": "2.3.0", "@types/estree": "1.0.1", "@types/fs-extra": "11.0.1", - "@types/prompts": "2.4.4", "@vitejs/plugin-vue": "4.3.4", "unbuild": "latest", "vite": "4.4.9", diff --git a/packages/nuxt/src/core/features.ts b/packages/nuxt/src/core/features.ts index 882700601c..75048c8ce3 100644 --- a/packages/nuxt/src/core/features.ts +++ b/packages/nuxt/src/core/features.ts @@ -2,7 +2,6 @@ import { addDependency } from 'nypm' import { resolvePackageJSON } from 'pkg-types' import { logger } from '@nuxt/kit' import { isCI } from 'std-env' -import prompts from 'prompts' export async function ensurePackageInstalled (rootDir: string, name: string, searchPaths?: string[]) { if (await resolvePackageJSON(name, { url: searchPaths }).catch(() => null)) { @@ -14,10 +13,9 @@ export async function ensurePackageInstalled (rootDir: string, name: string, sea return false } - const { confirm } = await prompts({ + const confirm = await logger.prompt(`Do you want to install ${name} package?`, { type: 'confirm', name: 'confirm', - message: `Do you want to install ${name} package?`, initial: true }) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ec3072ac88..c4e574586b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -356,9 +356,6 @@ importers: pkg-types: specifier: ^1.0.3 version: 1.0.3 - prompts: - specifier: ^2.4.2 - version: 2.4.2 scule: specifier: ^1.0.0 version: 1.0.0 @@ -417,9 +414,6 @@ importers: '@types/fs-extra': specifier: 11.0.1 version: 11.0.1 - '@types/prompts': - specifier: 2.4.4 - version: 2.4.4 '@vitejs/plugin-vue': specifier: 4.3.4 version: 4.3.4(vite@4.4.9)(vue@3.3.4) @@ -2526,6 +2520,7 @@ packages: dependencies: is-glob: 4.0.3 micromatch: 4.0.5 + napi-wasm: 1.1.0 bundledDependencies: - napi-wasm @@ -2904,13 +2899,6 @@ packages: resolution: {integrity: sha512-UYcJBAqWLyg+eITXGIu9DR7RXJFvSupz+Hf+RqJYHzDJedvDMTsB1JmDV6Qfna2g62VIxUKvoWqTxGHy6U/bLA==} 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: resolution: {integrity: sha512-SnHmG9wN1UVmagJOnyo/qkk0Z7gejYxOYYmaAwr5u2yFYfsupN3sg10kyzN8Hep/2zbHxCnsumxOoRIRMBwKCg==} dev: true @@ -7041,10 +7029,6 @@ packages: promise: 7.3.1 dev: false - /kleur@3.0.3: - resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==} - engines: {node: '>=6'} - /kleur@4.1.5: resolution: {integrity: sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==} engines: {node: '>=6'} @@ -7927,6 +7911,9 @@ packages: engines: {node: ^14 || ^16 || >=18} hasBin: true + /napi-wasm@1.1.0: + resolution: {integrity: sha512-lHwIAJbmLSjF9VDRm9GoVOy9AGp3aIvkjv+Kvz9h16QR3uSVYH78PNQUnT2U4X53mhlnV2M7wrhibQ3GHicDmg==} + /natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} @@ -9047,14 +9034,6 @@ packages: asap: 2.0.6 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: resolution: {integrity: sha512-kma4U7AFCTwpqq5twzC1YVIDXSqg6qQK6JN0smOw8fgRy1OkMi0CYSzFmsy6dnqSenamAtj0CyXMUJ1Mf6oROg==} dev: true @@ -9731,10 +9710,6 @@ packages: mrmime: 1.0.1 totalist: 3.0.1 - /sisteransi@1.0.5: - resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} - dev: false - /slash@3.0.0: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'}