counsel
Version:
the end of boilerplate. automatically bake structure, opinions, and business rules into projects
28 lines • 1.11 kB
JavaScript
;
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs = __importStar(require("fs-extra"));
const common = __importStar(require("./common"));
const stripHeadMatter = (str) => str.replace(/---((.*)\n)*---/g, '').trim();
const autogeneratedWarning = `
<!-- AUTO GENERATED - DO NOT EDIT -->
`.trim();
async function go() {
const [readmeTemplate, docs] = await Promise.all([
fs.readFile(common.README_TEMPLATE_FILENAME).then(buf => buf.toString()),
fs.readFile(common.DOCS_MARKDOWN_FILENAME).then(buf => buf.toString())
]);
const nextReadme = `
${autogeneratedWarning}
${readmeTemplate.replace('{docs}', stripHeadMatter(docs)).replace(/\.\.\/images/g, './img')}
`.trim();
await fs.writeFile(common.README_FILENAME, nextReadme);
}
go();
//# sourceMappingURL=readme.js.map