diff --git a/src/mdorganizer.ts b/src/mdorganizer.ts index 2b6f2c1..84fda93 100644 --- a/src/mdorganizer.ts +++ b/src/mdorganizer.ts @@ -43,7 +43,6 @@ export class MdOrganizer { async generateAllModules(): Promise { const categoryModules = await this.moduleGenerator.generateAll(); - console.log(categoryModules); for (const categoryModule of categoryModules) { for (const doc of categoryModule.documentModules) { await writeFile( diff --git a/src/modulegen.ts b/src/modulegen.ts index cf2f05f..77a608d 100644 --- a/src/modulegen.ts +++ b/src/modulegen.ts @@ -30,27 +30,26 @@ export class ModuleGenerator { for (const categoryConfig of this.categoryConfigs) { const paths = await glob(categoryConfig.globPattern); // generate modules for each document - const documentModules = await Promise.all( - paths - .map(async (path) => { - try { - return { - rootPath: path, - documentId: `${path - .replace(/\\/g, '/') - .replaceAll('/', '_') - .replace('.md', '')}`, - generatedModuleString: await this.generate( - path, - categoryConfig, - ), - } satisfies DocumentModule; - } catch (e) { - console.log(`Skipping ${path} due to error: ${e.message}`); - return null; - } - }) - .filter((documentModule) => documentModule !== null), + let documentModules = await Promise.all( + paths.map(async (path) => { + try { + return { + rootPath: path, + documentId: `${path + .replace(/\\/g, '/') + .replaceAll('/', '_') + .replace('.md', '')}`, + generatedModuleString: await this.generate(path, categoryConfig), + } satisfies DocumentModule; + } catch (e) { + console.log(`Skipping ${path} due to error: ${e.message}`); + return null; + } + }), + ); + + documentModules = documentModules.filter( + (documentModule) => documentModule !== null, ); console.log(