Skip to content

Commit

Permalink
🐛 Use root config in post-process
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Oct 13, 2020
1 parent 5dc3047 commit 3c3df6f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions post-process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,20 @@ import { safeLoad } from "js-yaml";
import { join } from "path";

export const preProcess = async () => {
const config = safeLoad(await readFile(join(".", ".upptimerc.yml"), "utf8")) as {
let config: {
"status-website"?: {
cname?: string;
};
};
} = safeLoad(await readFile(join(".", ".upptimerc.yml"), "utf8")) as any;

try {
const file = await readFile(join("..", "..", ".upptimerc.yml"), "utf8");
if (file) {
config = safeLoad(file) as any;
console.log("Using root config instead");
}
} catch (error) {}

if (config["status-website"]?.cname)
await writeFile(join(".", "__sapper__", "export", "CNAME"), config["status-website"]?.cname);
await copyFile(
Expand Down

0 comments on commit 3c3df6f

Please sign in to comment.