From 182a6cbe00025530f8f6b81b0834a253a311797c Mon Sep 17 00:00:00 2001 From: Roberto Hernandez Date: Mon, 4 Dec 2023 13:56:19 -0600 Subject: [PATCH] feat: move and rename type to StructureHandlerResponse --- src/types/_variant.d.ts | 10 ---------- src/types/handlers.d.ts | 4 ++++ src/util/project/generateComponent.ts | 5 +++-- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/types/_variant.d.ts b/src/types/_variant.d.ts index f821abb..1c826e6 100644 --- a/src/types/_variant.d.ts +++ b/src/types/_variant.d.ts @@ -90,16 +90,6 @@ export type Files = { description?: string; }[]; -/** - * Represents the response structure obtained from user input, typically through Inquirer - */ -export type StructureResponse = { - /** - * Name or identifier of the selected structure - */ - structure: string; -}; - export interface EmulsifyVariant { platform: Platform; structureImplementations: StructureImplementations; diff --git a/src/types/handlers.d.ts b/src/types/handlers.d.ts index 37d80d4..5de4f3d 100644 --- a/src/types/handlers.d.ts +++ b/src/types/handlers.d.ts @@ -24,4 +24,8 @@ declare module '@emulsify-cli/handlers' { export type CreateComponentHandlerOptions = { directory?: string; }; + + export type StructureHandlerResponse = { + structure: string; + }; } diff --git a/src/util/project/generateComponent.ts b/src/util/project/generateComponent.ts index be79d9c..161fe57 100644 --- a/src/util/project/generateComponent.ts +++ b/src/util/project/generateComponent.ts @@ -1,11 +1,12 @@ import * as fs from 'fs'; import { pathExists } from 'fs-extra'; -import type { EmulsifyVariant, StructureResponse } from '@emulsify-cli/config'; +import type { EmulsifyVariant } from '@emulsify-cli/config'; import { join, dirname } from 'path'; import { EMULSIFY_PROJECT_CONFIG_FILE } from '../../lib/constants'; import findFileInCurrentPath from '../fs/findFileInCurrentPath'; import log from '../../lib/log'; import inquirer, { QuestionCollection } from 'inquirer'; +import { StructureHandlerResponse } from '@emulsify-cli/handlers'; const storiesTemplate = ( componentName: string, @@ -91,7 +92,7 @@ export default async function generateComponent( choices: variant.structureImplementations, }; - const response = await inquirer.prompt( + const response = await inquirer.prompt( structureSelector ); directory = response.structure;