-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.ts
64 lines (58 loc) · 1.51 KB
/
main.ts
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import * as fs from "std/fs";
import * as path from "std/path";
import alacritty from "./dot/alacritty.ts";
import bat from "./dot/bat.ts";
import chromiumFlags from "./dot/chromium.ts";
import curl from "./dot/curl.ts";
import git from "./dot/git.ts";
import glazewm from "./dot/glazewm.ts";
import goneovim from "./dot/goneovim.ts";
import hyprland from "./dot/hyprland.ts";
import lazygit from "./dot/lazygit.ts";
import neovim from "./dot/neovim.ts";
import paru from "./dot/paru.ts";
import { cargo, rustup } from "./dot/rust.ts";
import wofi from "./dot/wofi.ts";
import xremap from "./dot/xremap.ts";
const configs = [
alacritty,
bat,
cargo,
chromiumFlags,
curl,
git,
glazewm,
goneovim,
hyprland,
lazygit,
neovim,
paru,
rustup,
wofi,
xremap,
];
async function main() {
const hashListFile = path.join(Deno.cwd(), "hash_list.txt");
if (!await fs.exists(hashListFile)) {
await Deno.writeTextFile(hashListFile, "");
}
const oldHashList = await Deno.readTextFile(hashListFile);
const newHashList = [];
for (const config of configs) {
if (config.enabled && !(await Promise.resolve(config.enabled()))) {
continue;
}
for (const file of await Promise.resolve(config.files())) {
const hash = await file.hash();
newHashList.push(hash);
if (!oldHashList.includes(hash)) {
await file.write();
console.log(file.doneMsg());
}
}
}
await Deno.writeTextFile(hashListFile, newHashList.join("\n"));
}
if (import.meta.main) {
await main();
}