refactor(esm): migrate server and tests from CommonJS to ESM
Convert all server/, test, and setup files from require()/module.exports to import/export syntax. Activate ESM globally via "type": "module" in package.json and load dotenv via --import dotenv/config in npm scripts.
This commit is contained in:
@@ -5,14 +5,10 @@
|
||||
* Abhängigkeiten: server/db.js, bcrypt, dotenv
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
require('dotenv').config();
|
||||
const readline = require('node:readline');
|
||||
const bcrypt = require('bcrypt');
|
||||
const db = require('./server/db');
|
||||
|
||||
const os = require('node:os');
|
||||
import readline from 'node:readline';
|
||||
import bcrypt from 'bcrypt';
|
||||
import * as db from './server/db.js';
|
||||
import os from 'node:os';
|
||||
|
||||
function getLocalIP() {
|
||||
const interfaces = os.networkInterfaces();
|
||||
@@ -67,9 +63,6 @@ function promptPassword(question) {
|
||||
async function main() {
|
||||
console.log('\n=== Oikos Setup ===\n');
|
||||
|
||||
// Datenbank initialisieren
|
||||
db.init();
|
||||
|
||||
// Prüfen ob bereits Admin vorhanden
|
||||
const existingAdmin = db.get()
|
||||
.prepare("SELECT id FROM users WHERE role = 'admin' LIMIT 1")
|
||||
|
||||
Reference in New Issue
Block a user