-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.js
47 lines (40 loc) · 1.31 KB
/
build.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const GetGoogleFonts = require("get-google-fonts");
const fs = require("fs");
const path = require("path");
const util = require("util");
const streamPipeline = util.promisify(require("stream").pipeline);
process.on("unhandledRejection", function (err) {
console.error(err);
process.exit(1);
});
(async () => {
try {
await fs.promises.stat("vendor");
} catch (err) {
await fs.promises.mkdir("vendor");
}
const ggf = new GetGoogleFonts({
outputDir: "./vendor/",
verbose: true,
});
await Promise.all([
// download google fonts
ggf.download([
{
Rubik: [400, 500],
},
]),
fs.promises.copyFile("node_modules/jspanel4/dist/jspanel.min.css", "vendor/jspanel.min.css"),
fs.promises.copyFile("node_modules/systemjs/dist/s.min.js", "vendor/s.min.js"),
// get windows XP wallpaper
(async () => {
const res = await fetch("https://i.imgur.com/uGRFZEs.jpg");
if (res.ok) {
return streamPipeline(res.body, fs.createWriteStream("./vendor/windows-xp.jpg"));
} else {
throw new Error(`Could not download assets: ${res.statusText}`);
}
})(),
]);
console.log("Finished preparing vendor assets");
})();