8af8676ad5
统一共享用户/计费/空间额度能力,新增 Ops 与套餐同步,并以 release-prod.sh 作为唯一生产发布入口。 Co-authored-by: Cursor <cursoragent@cursor.com>
31 lines
956 B
JavaScript
31 lines
956 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, '../test-memind'),
|
|
path.join(projectRoot, '../memind'),
|
|
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,或保持 ../test-memind、../memind、../Memind 其中之一存在。',
|
|
);
|
|
}
|
|
|
|
export async function importMemind(subpath) {
|
|
const libRoot = resolveMemindLib();
|
|
const modulePath = path.join(libRoot, subpath);
|
|
return import(pathToFileURL(modulePath).href);
|
|
}
|