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:
Ulas
2026-04-03 23:11:20 +02:00
parent 2f6127911e
commit b139eea623
24 changed files with 113 additions and 154 deletions
+5 -7
View File
@@ -11,14 +11,12 @@
* google_last_sync - ISO-8601-Timestamp des letzten erfolgreichen Syncs
*/
'use strict';
const { createLogger } = require('../logger');
import { createLogger } from '../logger.js';
const log = createLogger('Google');
const { google } = require('googleapis');
const crypto = require('crypto');
const db = require('../db');
import { google } from 'googleapis';
import crypto from 'crypto';
import * as db from '../db.js';
const GOOGLE_COLOR = '#4285F4';
@@ -334,4 +332,4 @@ function localEventToGoogle(event) {
return gEvent;
}
module.exports = { getAuthUrl, handleCallback, getStatus, disconnect, sync };
export { getAuthUrl, handleCallback, getStatus, disconnect, sync };