diff --git a/.prettierrc.toml b/.prettierrc.toml new file mode 100644 index 0000000..0e18e31 --- /dev/null +++ b/.prettierrc.toml @@ -0,0 +1 @@ +tabWidth = 4 \ No newline at end of file diff --git a/src/index.js b/src/index.js index afe75f0..9c7feb7 100644 --- a/src/index.js +++ b/src/index.js @@ -1,39 +1,48 @@ -import express from 'express' -import yaml from 'js-yaml' -import fs from 'node:fs' -import * as dotenv from 'dotenv' +import express from "express"; +import yaml from "js-yaml"; +import fs from "node:fs"; +import * as dotenv from "dotenv"; -console.log('🔧 Configuring socialtree...') +console.log("🔧 Configuring socialtree..."); -dotenv.config() -const app = express() -const port = process.env.PORT || 3000 -const engine = 'ejs' +dotenv.config(); +const app = express(); +const port = process.env.PORT || 3000; +const engine = "ejs"; -const customMainPartialThemes = [ // Array of themes that require a custom main partial - '98' -] +const customMainPartialThemes = [ + // Array of themes that require a custom main partial + "98", +]; -app.set('view engine', engine) -app.set('views', './src/views') -app.use(express.static('src/dist')) -app.use(express.static('assets')) +app.set("view engine", engine); +app.set("views", "./src/views"); +app.use(express.static("src/dist")); +app.use(express.static("assets")); -app.get('/', (req, res) => { - let config = yaml.load(fs.readFileSync('assets/config/config.yml'), 'utf8') - res.render('index', { +app.get("/", (req, res) => { + let config = yaml.load(fs.readFileSync("assets/config/config.yml"), "utf8"); + res.render("index", { name: config.name, url: config.url, - filenameProfilePic: config.profilePic ? config.profilePic : 'profilepic.jpg', - summaryText: config.summaryText ? config.summaryText: '', + filenameProfilePic: config.profilePic + ? config.profilePic + : "profilepic.jpg", + summaryText: config.summaryText ? config.summaryText : "", links: config.links, smallLinks: config.smallLinks, theme: config.theme, roundPB: config.roundPB, customMainPartialThemes: customMainPartialThemes, - metaDescription: config.summaryText ? config.summaryText: config.links.map(link => link.text).join(' | '), - siteName: config.siteName ? config.siteName : "SocialTree" - }) -}) + metaDescription: config.summaryText + ? config.summaryText + : config.links.map((link) => link.text).join(" | "), + siteName: config.siteName ? config.siteName : "SocialTree", + }); +}); -app.listen(port, () => console.log(`🚀 Socialtree started on port ${port}, with view engine ${engine}`)) +app.listen(port, () => + console.log( + `🚀 Socialtree started on port ${port}, with view engine ${engine}` + ) +);