Files
memind_adm/server/lib-path.mjs
T
John 9ecfa73831 Add embedded Express admin API and unified dev workflow.
Move admin backend into this repo (Express + MySQL on :8085) so npm run dev starts both API and Vite, with updated env defaults and Caddy config for gadm.tkmind.cn.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-16 16:29:06 -07:00

29 lines
826 B
JavaScript

import fs from 'node:fs';
import path from 'node:path';
import { pathToFileURL } from 'node:url';
import { projectRoot } from './load-env.mjs';
export function resolveMemindLib() {
const candidates = [
process.env.MEMIND_LIB_ROOT?.trim(),
path.join(projectRoot, '../Memind'),
path.join(projectRoot, '../tkmind_go/ui/h5'),
].filter(Boolean);
for (const dir of candidates) {
if (fs.existsSync(path.join(dir, 'user-auth.mjs'))) {
return path.resolve(dir);
}
}
throw new Error(
'未找到 Memind 业务模块目录(user-auth.mjs)。请设置 MEMIND_LIB_ROOT 或保持 ../Memind 存在。',
);
}
export async function importMemind(subpath) {
const libRoot = resolveMemindLib();
const modulePath = path.join(libRoot, subpath);
return import(pathToFileURL(modulePath).href);
}