Skip to content

Commit

Permalink
feat(cli): prompt for destination
Browse files Browse the repository at this point in the history
  • Loading branch information
vicary committed May 16, 2023
1 parent 21337b3 commit 621f8f7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/cli/src/commands/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ export const addCommand = (command: Command) => {
config.javascriptOutput = !(await promptTypescript(
!config.javascriptOutput
));

config.destination ??= await promptTarget(
config.javascriptOutput ? 'gqty/index.js' : 'gqty/index.ts'
);
}

config.destination ??= config.javascriptOutput
Expand Down Expand Up @@ -261,6 +265,17 @@ const promptEndpoints = async () => {
.filter(Boolean);
};

const promptTarget = async (defaultTarget: string) => {
const { target } = await inquirer.prompt<{ target: string }>({
name: 'target',
type: 'input',
message: 'Where should the client be generated?',
default: defaultTarget,
});

return target;
};

const promptReact = async (defaultValue: boolean) => {
const { react } = await inquirer.prompt<{ react: boolean }>({
name: 'react',
Expand Down

0 comments on commit 621f8f7

Please sign in to comment.