@@ -13,7 +13,6 @@ import { box, cancel, confirm, intro, isCancel, outro, S_BAR, select, spinner, t
1313import { defineCommand , showUsage } from 'citty'
1414import { downloadTemplate , startShell } from 'giget'
1515import { detectPackageManager } from 'nypm'
16- import { $fetch } from 'ofetch'
1716import { basename , join , relative , resolve } from 'pathe'
1817import colors from 'picocolors'
1918import { findFile , readPackageJSON , writePackageJSON } from 'pkg-types'
@@ -22,6 +21,7 @@ import { x } from 'tinyexec'
2221
2322import { runCommandDef as runCommand } from '../run-command'
2423import { nuxtIcon , themeColor } from '../utils/ascii'
24+ import { fetchJson } from '../utils/fetch'
2525import { createInstallLog , resolvePackageManagerDescriptor , runInstall , takeUnreportedIgnoredBuilds } from '../utils/install'
2626import { debug , logger } from '../utils/logger'
2727import { classifyNetworkError , describeNetworkError , logNetworkError , probeNetworkError } from '../utils/network'
@@ -429,7 +429,7 @@ export default defineCommand({
429429 const nightlySpinner = spinner ( )
430430 nightlySpinner . start ( 'Fetching nightly version info' )
431431
432- const response = await $fetch < { 'dist-tags' : Record < string , string > } > ( NIGHTLY_DIST_TAGS_URL ) . catch ( ( err ) => {
432+ const response = await fetchJson < { 'dist-tags' : Record < string , string > } > ( NIGHTLY_DIST_TAGS_URL ) . catch ( ( err ) => {
433433 nightlySpinner . error ( 'Failed to fetch nightly version info' )
434434 logNetworkError ( err , { url : NIGHTLY_DIST_TAGS_URL } )
435435 process . exit ( 1 )
@@ -772,7 +772,7 @@ export default defineCommand({
772772async function getModuleDependencies ( moduleName : string ) {
773773 const url = `https://registry.npmjs.org/${ moduleName } /latest`
774774 try {
775- const response = await $fetch ( url )
775+ const response = await fetchJson < { dependencies ?: Record < string , string > } > ( url )
776776 const dependencies = response . dependencies || { }
777777 return Object . keys ( dependencies )
778778 }
0 commit comments