inputFiles.forEach(file => { const result = app.convert(app.expandInputFiles([file])); fs.writeFileSync(`${fixturesDir}/${path.basename(file)}.json`, JSON.stringify(result, replacer)); console.log(`[typedoc-plugin-markdown(task:fixtures)] writing ${path.basename(file)}.json fixture`); });
projects.forEach(({ name, docsPath, outputDir }) => { const tmpDir = path.join(outputDir, 'tmp'); const project = app.convert(app.expandInputFiles([docsPath])); if (project) { app.generateDocs(project, tmpDir); if (fs.existsSync(tmpDir)) { const [tmpFileName] = fs.readdirSync(tmpDir); const pathArr = tmpDir.split('/'); pathArr.splice(-1, 1); const out = path.join(...pathArr); const currentPath = path.join(out, `${name}.md`); fs.copyFileSync(path.join(tmpDir, tmpFileName), currentPath); fs.removeSync(tmpDir); } } else { console.error(`Error while generating '${name}' docs`); } });