-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
47 lines (35 loc) · 981 Bytes
/
index.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 fs = require('fs')
const fsPromises = fs.promises;
const homeDir = require('os').homedir();
const NVIM = `${homeDir}/.config/nvim/`;
const ALACRITTY = `${homeDir}/.config/alacritty`
const TMUX = `${homeDir}/.tmux.conf`;
const ZSHRC = `${homeDir}/.zshrc`;
const OPTIONS = {recursive: true, }
async function copy(source,dest,options){
try {
if(!fs.existsSync(dest)){
fs.mkdirSync(dest);
}
await fsPromises.cp(source,dest,options)
console.log('Successfully linked ',dest)
}
catch(e){
console.log(e);
}
}
async function write(source,data='',options){
try {
await fsPromises.writeFile(source,data,options)
console.log('Successfully written ',source)
}
catch(e){
console.log(e);
}
}
write(ZSHRC)
write(TMUX)
copy(`${process.cwd()}/nvim/`,NVIM, OPTIONS )
copy(`${process.cwd()}/alacritty/`,ALACRITTY, OPTIONS )
copy(`${process.cwd()}/tmux/.tmux.conf`,TMUX, )
copy(`${process.cwd()}/zshell/.zshrc`,ZSHRC, )