#!/usr/bin/env node
import path from "path";
import { globby } from "globby";
import yamlMarkdownToHtml from "../";

const args = process.argv.slice(2);
const renderFolder = path.resolve(process.cwd(), args[2] || "render");

const params = {
  contentFolder: args[0] || "content",
  publicFolder: args[1] || "public",
  renderFile: require(path.join(renderFolder, "render")),
  postRenderFile: false,
};

const markdownFiles = [
  path.join(params.contentFolder, "**/*.md"),
  path.join(params.contentFolder, "**/*.markdown"),
];

async function init() {
  params.files = await globby(markdownFiles, { onlyFiles: true });

  try {
    params.postRenderFile = require(path.join(renderFolder, "post-render"));
  } catch {}

  await yamlMarkdownToHtml(params);
}

init();

@@ -106,16 +106,24 @@
 rom %22../
+index.js
 %22;%0A%0Acons

fix cli import