Hitcount is now created by init.initialise()

This commit is contained in:
2025-08-09 13:00:07 +01:00
parent 49c7fc7cdf
commit 44a060508b

View File

@@ -11,14 +11,14 @@ export function initialise() {
}
catch (error) {
console.log("Creating users file")
fs.writeFileSync(`../data/users.json`, `{\n"users": []\n}`)
fs.writeFileSync(`../data/users.json`, `[]`)
}
try {
const posts = require("../data/posts.json");
}
catch (error) {
console.log("Creating posts file")
fs.writeFileSync(`../data/posts.json`, `{\n"posts": []\n}`)
fs.writeFileSync(`../data/posts.json`, `[]`)
}
try {
const comments = require("../data/comments.json");
@@ -37,6 +37,15 @@ export function initialise() {
console.log("Error copying file")
})
}
try {
fs.readFileSync("../data/hitcount.txt")
}
catch (error) {
console.log("Creating hitcount file")
fs.writeFileSync("../data/hitcount.txt", "0", (err) => {
console.log("Error creating hitcount.txt")
})
}
console.log("Successfully initialised")
process.exit(0)
}