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) { catch (error) {
console.log("Creating users file") console.log("Creating users file")
fs.writeFileSync(`../data/users.json`, `{\n"users": []\n}`) fs.writeFileSync(`../data/users.json`, `[]`)
} }
try { try {
const posts = require("../data/posts.json"); const posts = require("../data/posts.json");
} }
catch (error) { catch (error) {
console.log("Creating posts file") console.log("Creating posts file")
fs.writeFileSync(`../data/posts.json`, `{\n"posts": []\n}`) fs.writeFileSync(`../data/posts.json`, `[]`)
} }
try { try {
const comments = require("../data/comments.json"); const comments = require("../data/comments.json");
@@ -37,6 +37,15 @@ export function initialise() {
console.log("Error copying file") 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") console.log("Successfully initialised")
process.exit(0) process.exit(0)
} }