shadowfacts.net/lib/generate/copy.ts

20 lines
711 B
TypeScript
Raw Normal View History

2019-01-04 18:36:40 +00:00
import { promises as fs } from "fs";
import * as util from "../util";
2019-09-18 14:50:13 +00:00
import * as path from "path";
2019-01-04 18:36:40 +00:00
export default async function copy() {
util.write("favicon.ico", await fs.readFile("site/favicon.ico"));
util.write("favicon-152.png", await fs.readFile("site/favicon-152.png"));
util.write("shadowfacts.png", await fs.readFile("site/shadowfacts.png"));
2019-03-01 23:42:28 +00:00
util.write("js/comments.js", await fs.readFile("site/js/comments.js"));
2019-09-18 14:50:13 +00:00
// copy images
const dirs = await fs.readdir("site/img");
for (const dir of dirs) {
const imgs = await fs.readdir(path.join("site/img", dir));
for (const img of imgs) {
util.write(path.join("img", dir, img), await fs.readFile(path.join("site/img", dir, img)));
}
}
}