Skip to content

Commit

Permalink
feat: move and rename type to StructureHandlerResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
robherba committed Dec 4, 2023
1 parent 264aff6 commit 182a6cb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
10 changes: 0 additions & 10 deletions src/types/_variant.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions src/types/handlers.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@ declare module '@emulsify-cli/handlers' {
export type CreateComponentHandlerOptions = {
directory?: string;
};

export type StructureHandlerResponse = {
structure: string;
};
}
5 changes: 3 additions & 2 deletions src/util/project/generateComponent.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -91,7 +92,7 @@ export default async function generateComponent(
choices: variant.structureImplementations,
};

const response = await inquirer.prompt<StructureResponse>(
const response = await inquirer.prompt<StructureHandlerResponse>(
structureSelector
);
directory = response.structure;
Expand Down

0 comments on commit 182a6cb

Please sign in to comment.