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:
@@ -12,12 +12,10 @@
|
||||
* apple_last_sync - ISO-8601-Timestamp des letzten Syncs
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const { createLogger } = require('../logger');
|
||||
import { createLogger } from '../logger.js';
|
||||
const log = createLogger('Apple');
|
||||
|
||||
const db = require('../db');
|
||||
import * as db from '../db.js';
|
||||
|
||||
const APPLE_COLOR = '#FC3C44';
|
||||
|
||||
@@ -407,4 +405,4 @@ async function sync() {
|
||||
log.info(`Sync abgeschlossen - ${totalObjects} Objekte aus ${syncCalendars.length} Kalendern inbound, ${localEvents.length} lokal → iCloud.`);
|
||||
}
|
||||
|
||||
module.exports = { sync, getStatus, saveCredentials, clearCredentials, testConnection };
|
||||
export { sync, getStatus, saveCredentials, clearCredentials, testConnection };
|
||||
|
||||
@@ -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 };
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
* Abhängigkeiten: keine
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const DAY_MAP = { MO: 1, TU: 2, WE: 3, TH: 4, FR: 5, SA: 6, SU: 0 };
|
||||
|
||||
/**
|
||||
@@ -107,4 +105,4 @@ function nextOccurrence(baseDateStr, rrule) {
|
||||
return next.toISOString().slice(0, 10); // YYYY-MM-DD
|
||||
}
|
||||
|
||||
module.exports = { parseRRule, nextOccurrence };
|
||||
export { parseRRule, nextOccurrence };
|
||||
|
||||
Reference in New Issue
Block a user