Refactor generateSite.js to use ES module syntax. Updated import statements and added support for obtaining the current directory name using fileURLToPath. This change aligns with the recent addition of "type": "module" in package.json.

This commit is contained in:
Knight 2024-12-28 10:39:29 -05:00
parent 8b5a39066f
commit ac4cd9cba6

View File

@ -1,6 +1,10 @@
const fs = require('fs').promises;
const path = require('path');
const http = require('http');
import { promises as fs } from 'fs';
import path from 'path';
import http from 'http';
import { fileURLToPath } from 'url';
// Get current directory name in ES modules
const __dirname = path.dirname(fileURLToPath(import.meta.url));
async function generateSite() {
// Read the images data