Skip to content

Commit

Permalink
🐛 Ensure that required dirs exist
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Nov 18, 2020
1 parent aa7b4b2 commit 53ce1d0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/graphs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { readFile } from "fs-extra";
import { mkdirp, readFile } from "fs-extra";
import { safeLoad } from "js-yaml";
import { join } from "path";
import { exec } from "shelljs";
Expand All @@ -7,6 +7,8 @@ import { UpptimeConfig } from "./interfaces";
import { tempFixes } from "./temp";

export const generateGraphs = async () => {
await mkdirp("graphs");
await mkdirp("api");
const config = safeLoad(await readFile(join(".", ".upptimerc.yml"), "utf8")) as UpptimeConfig;
exec("npx @upptime/graphs");
exec("npx imagemin-cli graphs/* --out-dir=graphs");
Expand Down
3 changes: 2 additions & 1 deletion src/summary.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { Octokit } from "@octokit/rest";
import slugify from "@sindresorhus/slugify";
import { readFile, writeFile } from "fs-extra";
import { mkdirp, readFile, writeFile } from "fs-extra";
import { safeLoad } from "js-yaml";
import { join } from "path";
import { commit, push } from "./git";
import { format } from "prettier";
import { UpptimeConfig } from "./interfaces";

export const generateSummary = async () => {
await mkdirp("history");
const config = safeLoad(await readFile(join(".", ".upptimerc.yml"), "utf8")) as UpptimeConfig;
let [owner, repo] = (process.env.GITHUB_REPOSITORY || "").split("/");

Expand Down
3 changes: 2 additions & 1 deletion src/update.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Octokit } from "@octokit/rest";
import slugify from "@sindresorhus/slugify";
import { readFile, writeFile } from "fs-extra";
import { mkdirp, readFile, writeFile } from "fs-extra";
import { safeLoad } from "js-yaml";
import { Curl, CurlFeature } from "node-libcurl";
import { join } from "path";
Expand All @@ -10,6 +10,7 @@ import { sendNotification } from "./notifications";
import { generateSummary } from "./summary";

export const update = async (shouldCommit = false) => {
await mkdirp("history");
const config = safeLoad(await readFile(join(".", ".upptimerc.yml"), "utf8")) as UpptimeConfig;
let [owner, repo] = (process.env.GITHUB_REPOSITORY || "").split("/");

Expand Down

0 comments on commit 53ce1d0

Please sign in to comment.