File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 33import publicGenerators from './generators/index.mjs' ;
44import astJs from './generators/ast-js/index.mjs' ;
55import oramaDb from './generators/orama-db/index.mjs' ;
6+ import { mkdirSync , statSync } from 'node:fs' ;
67
78const availableGenerators = {
89 ...publicGenerators ,
@@ -51,6 +52,16 @@ const createGenerator = markdownInput => {
5152 * @param {import('./generators/types.d.ts').GeneratorOptions } options The options for the generator runtime
5253 */
5354 const runGenerators = async ( { generators, ...extra } ) => {
55+ try {
56+ if ( ! statSync ( extra . output ) . isDirectory ( ) ) {
57+ throw new Error ( 'Output is not a directory' ) ;
58+ }
59+ } catch ( err ) {
60+ if ( err . code === 'ENOENT' ) {
61+ mkdirSync ( extra . output , { recursive : true } ) ;
62+ }
63+ }
64+
5465 // Note that this method is blocking, and will only execute one generator per-time
5566 // but it ensures all dependencies are resolved, and that multiple bottom-level generators
5667 // can reuse the already parsed content from the top-level/dependency generators
You can’t perform that action at this time.
0 commit comments