-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
watch.ts
32 lines (30 loc) · 844 Bytes
/
watch.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
/*
* watch.ts
* material-board
*
* Created by Fatih Balsoy on 5/31/23
* Copyright © 2023 Fatih Balsoy. All rights reserved.
*/
const fs = require("fs")
const { exec } = require("child_process")
const directories = [
"src/",
"src/assets/",
"src/languages/",
"src/settings/",
"src/settings/options/",
]
console.log("Listening for file changes at:")
for (const i in directories) {
const directory = directories[i]
console.log("- ", directory)
fs.watch(directory, function (event, filename) {
const date = Date()
console.log(`[${date}] Source file changed:`, filename)
if (directory == 'src/languages/') {
exec('zsh scripts/compile_languages.sh')
} else {
exec('zsh scripts/copy_files.sh') // , (err, stdout, stderr) => { }
}
})
}