Skip to content

Commit

Permalink
fix(Netlify): Ensure dist dir available
Browse files Browse the repository at this point in the history
Netlify will occasionally fail rebuilds because compile directory is not
there
  • Loading branch information
cblanc committed May 15, 2019
1 parent 853d2bd commit 96c9064
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions netlify.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#! /usr/bin/env node

const marked = require("marked");
const { readFileSync, writeFileSync } = require("fs");
const { join } = require("path");
const { readFileSync, writeFileSync, existsSync, mkdirSync } = require("fs");

const path = "dist";
const file = "index.html";
const readme = readFileSync("./README.md", { encoding: "utf8" });

const html = `
Expand Down Expand Up @@ -36,6 +39,10 @@ const html = `
</html>
`;

const outFile = "./dist/index.html";
const outFile = join(__dirname, path, file);

// Create dist dir if it does not exist
existsSync(path) || mkdirSync(path);

// Write landing page to file
writeFileSync(outFile, html, { encoding: "utf8" });

0 comments on commit 96c9064

Please sign in to comment.