From 144c276bc9ebab705d49ddf78201d9d1c3dbbfd2 Mon Sep 17 00:00:00 2001 From: DeaDvey Date: Sat, 9 Aug 2025 12:48:25 +0100 Subject: [PATCH] Fixed init.initialise() checking for .js files as opposed to .json files --- src/initialise.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/initialise.js b/src/initialise.js index ffaa7d7..4c0c598 100644 --- a/src/initialise.js +++ b/src/initialise.js @@ -1,5 +1,5 @@ -import·{·createRequire·}·from·'module'; -const·require·=·createRequire(import.meta.url) +import { createRequire } from 'module'; +const require = createRequire(import.meta.url) // Initialise the program by creating users.js, comments.js, posts.js and config.js // All require default content in them to start off with // Then exit successfully @@ -7,7 +7,7 @@ const·require·=·createRequire(import.meta.url) export function initialise() { const fs = require("fs"); try { - const users = require("../data/users.js"); + const users = require("../data/users.json"); } catch (error) { console.log("Creating users file") @@ -28,12 +28,12 @@ export function initialise() { fs.writeFileSync(`../data/comments.json`, `{\n"comments": [],\n"counter": 0}`) } try { - const config = require("../data/config.js"); + const config = require("../data/config.json"); } catch (error) { console.log("Copying the example config to config.js") console.log("!!! PLEASE MODIFY config.js TO YOUR NEEDS !!!") - fs.copyFile('example-config.js', 'config.js', (err) => { + fs.copyFile('example-config.json', 'config.json', (err) => { console.log("Error copying file") }) }