Skip to content

Commit

Permalink
♻️ Change safeLoad -> load
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Jan 5, 2021
1 parent a5bcee3 commit 21813c4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions post-process.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { readFile, writeFile, copyFile, copy, remove } from "fs-extra";
import { safeLoad } from "js-yaml";
import { load } from "js-yaml";
import { join } from "path";
import { execSync } from "child_process";

Expand All @@ -9,7 +9,7 @@ export const postProcess = async () => {
cname?: string;
baseUrl?: string;
};
} = safeLoad(await readFile(join("..", ".upptimerc.yml"), "utf8")) as any;
} = load(await readFile(join("..", ".upptimerc.yml"), "utf8")) as any;
const baseUrl = (config["status-website"] || {}).baseUrl || "/";

execSync(`sapper export --legacy --basepath ${baseUrl}`, {
Expand Down
6 changes: 3 additions & 3 deletions pre-process.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { readFile, writeJson, ensureDir } from "fs-extra";
import { safeLoad } from "js-yaml";
import { load } from "js-yaml";
import { join } from "path";

export const preProcess = async () => {
const i18n = safeLoad(await readFile(join(".", "i18n.yml"), "utf8")) as {
const i18n = load(await readFile(join(".", "i18n.yml"), "utf8")) as {
[index: string]: string;
};

Expand All @@ -19,7 +19,7 @@ export const preProcess = async () => {
"status-website"?: {
cname?: string;
};
} = safeLoad(await readFile(join("..", ".upptimerc.yml"), "utf8")) as any;
} = load(await readFile(join("..", ".upptimerc.yml"), "utf8")) as any;
if (!config.owner || !config.repo) throw new Error("Owner/repo not set");
config.path = `https://${config.owner}.github.io/${config.repo}`;
if (config["status-website"]?.cname) config.path = `https://${config["status-website"].cname}`;
Expand Down
4 changes: 2 additions & 2 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import compression from "compression";
import fs from "fs-extra";
import polka from "polka";
import sirv from "sirv";
import { safeLoad } from "js-yaml";
import { load } from "js-yaml";
import { join } from "path";

const { PORT, NODE_ENV } = process.env;
const dev = NODE_ENV === "development";

let config = safeLoad(fs.readFileSync(join("..", ".upptimerc.yml"), "utf8"));
let config = load(fs.readFileSync(join("..", ".upptimerc.yml"), "utf8"));
const baseUrl = (config["status-website"] || {}).baseUrl || "/";

polka()
Expand Down

0 comments on commit 21813c4

Please sign in to comment.