Hitcount is now created by init.initialise()
This commit is contained in:
@@ -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)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user