fix(cli): replace old getAvailableComponentNames to Object.keys

This commit is contained in:
p-sw 2024-06-15 03:40:52 +09:00
parent ecaba351a3
commit ab95442de1

View File

@ -3,7 +3,7 @@ import {loadConfig, validateConfig} from '../helpers/config.js'
import {existsSync} from 'node:fs' import {existsSync} from 'node:fs'
import {mkdir, writeFile} from 'node:fs/promises' import {mkdir, writeFile} from 'node:fs/promises'
import {join} from 'node:path' import {join} from 'node:path'
import {getAvailableComponentNames, getComponentURL, getRegistry} from '../helpers/registry.js' import {getComponentURL, getDirComponentURL, getRegistry} from '../helpers/registry.js'
import ora from 'ora' import ora from 'ora'
import React, {ComponentPropsWithoutRef} from 'react' import React, {ComponentPropsWithoutRef} from 'react'
import {render, Box} from 'ink' import {render, Box} from 'ink'
@ -119,7 +119,7 @@ export default class Add extends Command {
return return
} }
const registry = unsafeRegistry.registry const registry = unsafeRegistry.registry
const componentNames = await getAvailableComponentNames(registry) const componentNames = Object.keys(registry.components)
loadRegistryOra.succeed(`Successfully fetched registry! (${componentNames.length} components)`) loadRegistryOra.succeed(`Successfully fetched registry! (${componentNames.length} components)`)
const searchBoxComponent: {displayName: string; key: string; installed: boolean}[] = [] const searchBoxComponent: {displayName: string; key: string; installed: boolean}[] = []
for await (const name of componentNames) { for await (const name of componentNames) {