speckeeper 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -196,7 +196,9 @@ async function buildCommand(options) {
196
196
  }
197
197
  for (const exporter of exporters) {
198
198
  const outputDir = exporter.outputDir ? join(cwd, config.docsDir, exporter.outputDir) : join(cwd, config.docsDir);
199
- ensureDir(outputDir);
199
+ if (exporter.single) {
200
+ ensureDir(outputDir);
201
+ }
200
202
  if (exporter.single) {
201
203
  for (const spec of modelSpecs) {
202
204
  const content = exporter.single(spec);
@@ -209,8 +211,12 @@ async function buildCommand(options) {
209
211
  }
210
212
  if (exporter.index) {
211
213
  const indexContent = exporter.index(modelSpecs);
214
+ const indexPath = exporter.outputFile ? join(cwd, config.docsDir, exporter.outputFile) : join(outputDir, "index.md");
215
+ if (!exporter.outputFile) {
216
+ ensureDir(outputDir);
217
+ }
212
218
  files.push({
213
- path: join(outputDir, "index.md"),
219
+ path: indexPath,
214
220
  content: indexContent
215
221
  });
216
222
  }
@@ -351,7 +357,7 @@ async function driftCommand(options) {
351
357
  }
352
358
  }
353
359
  if (exporter.index) {
354
- const indexPath = join(outputDir, "index.md");
360
+ const indexPath = exporter.outputFile ? join(cwd, config.docsDir, exporter.outputFile) : join(outputDir, "index.md");
355
361
  if (!existsSync(indexPath)) {
356
362
  results.push({ file: indexPath, status: "missing" });
357
363
  } else {