fix: use ESM import for mkdirSync instead of require()
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
// server/src/services/notifications.ts
|
// server/src/services/notifications.ts
|
||||||
import { createTransport } from 'nodemailer';
|
import { createTransport } from 'nodemailer';
|
||||||
import { readFileSync, writeFileSync, existsSync } from 'fs';
|
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs';
|
||||||
import { resolve } from 'path';
|
import { resolve } from 'path';
|
||||||
import { randomUUID } from 'crypto';
|
import { randomUUID } from 'crypto';
|
||||||
import type { MonitorUser, Notification, UserRole } from '../types/index.js';
|
import type { MonitorUser, Notification, UserRole } from '../types/index.js';
|
||||||
@@ -11,7 +11,6 @@ const USERS_FILE = resolve(DATA_DIR, 'users.json');
|
|||||||
const NOTIFICATIONS_FILE = resolve(DATA_DIR, 'notifications.json');
|
const NOTIFICATIONS_FILE = resolve(DATA_DIR, 'notifications.json');
|
||||||
|
|
||||||
function ensureDataDir() {
|
function ensureDataDir() {
|
||||||
const { mkdirSync } = require('fs');
|
|
||||||
try { mkdirSync(DATA_DIR, { recursive: true }); } catch {}
|
try { mkdirSync(DATA_DIR, { recursive: true }); } catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user