Skip to content

Commit

Permalink
#830 Create output folder if it does not exist yet
Browse files Browse the repository at this point in the history
  • Loading branch information
Polleps committed Feb 12, 2024
1 parent 4ff0912 commit aebf8d1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions browser/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ This changelog covers all three packages, as they are (for now) updated as a who

- [#837](https://github.com/atomicdata-dev/atomic-server/issues/837) Fix timestamp is mapped to string instead of number.
- [#831](https://github.com/atomicdata-dev/atomic-server/issues/831) Give clear error when trying to generate types from a non ontology resource
- [#830](https://github.com/atomicdata-dev/atomic-server/issues/830) Create output folder if it doesn't exist
- Use type import in generated files.

## v0.37.0
Expand Down
8 changes: 8 additions & 0 deletions browser/cli/src/commands/ontologies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export const ontologiesCommand = async (_args: string[]) => {
return;
}

checkOrCreateFolder(atomicConfig.outputFolder);

for (const subject of atomicConfig.ontologies) {
await write(await generateOntology(subject, propertyRecord));
}
Expand Down Expand Up @@ -79,3 +81,9 @@ const write = async ({

console.log(chalk.blue('Wrote to'), chalk.cyan(filePath));
};

const checkOrCreateFolder = (relativePath: string): void => {
const fullPath = path.join(process.cwd(), relativePath);

fs.mkdirSync(fullPath, { recursive: true });
};

0 comments on commit aebf8d1

Please sign in to comment.