refactor(cli): simplify getComponentsInstalled
This commit is contained in:
parent
46bdb3df98
commit
4148b903e3
@ -6,7 +6,10 @@ import {RegistryComponent, ResolvedConfig} from '../const.js'
|
||||
|
||||
export async function getComponentsInstalled(components: string[], config: ResolvedConfig) {
|
||||
const componentPath = path.join(process.cwd(), config.paths.components)
|
||||
if (existsSync(componentPath)) {
|
||||
if (!existsSync(componentPath)) {
|
||||
return []
|
||||
}
|
||||
|
||||
const dir = await readdir(componentPath)
|
||||
const dirOnlyContainsComponent = []
|
||||
for (const fileName of dir) {
|
||||
@ -18,9 +21,6 @@ export async function getComponentsInstalled(components: string[], config: Resol
|
||||
return dirOnlyContainsComponent
|
||||
}
|
||||
|
||||
return []
|
||||
}
|
||||
|
||||
export async function getDirComponentRequiredFiles<T extends RegistryComponent & {type: 'dir'}>(
|
||||
componentObject: T,
|
||||
config: ResolvedConfig,
|
||||
|
Loading…
x
Reference in New Issue
Block a user