Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
fix(cli): ensure output dir (#288)
Browse files Browse the repository at this point in the history
Co-authored-by: Rico Kahler <[email protected]>
  • Loading branch information
ricokahler and Rico Kahler authored Feb 10, 2023
1 parent 019a7da commit c7f61ec
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/cli/src/commands/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ export default class GroqCodegen extends Command {
flags.output || config?.output || 'sanity-codegen.d.ts',
);

const outputDir = path.dirname(output);

if (!fs.existsSync(outputDir)) {
await fs.promises.mkdir(outputDir, { recursive: true });
}

logger.verbose('Writing query types output…');
await fs.promises.writeFile(output, result);
logger.success(`Wrote types to: ${path.relative(root, output)}`);
Expand Down

1 comment on commit c7f61ec

@vercel
Copy link

@vercel vercel bot commented on c7f61ec Feb 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.