Extract memind_adm admin server, add local dev tooling, and remove image-generation.
Split platform admin and ops APIs into standalone admin-server.mjs with network guards; simplify billing to RMB token pricing, refactor user auth, and add rsync deploy plus local-test scripts and docs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -21,22 +21,6 @@ const plazaPublicBase = (
|
||||
).replace(/\/$/, '');
|
||||
const portalUrl = `http://127.0.0.1:${portalPort}`;
|
||||
const skipBuild = process.argv.includes('--skip-build');
|
||||
const noPortal = process.argv.includes('--no-portal');
|
||||
|
||||
function resolveNpmBin() {
|
||||
const candidates = [
|
||||
process.env.NPM_BIN,
|
||||
'/opt/homebrew/opt/node@22/bin/npm',
|
||||
'/opt/homebrew/bin/npm',
|
||||
'/usr/local/bin/npm',
|
||||
].filter(Boolean);
|
||||
for (const candidate of candidates) {
|
||||
if (fs.existsSync(candidate)) return candidate;
|
||||
}
|
||||
return 'npm';
|
||||
}
|
||||
|
||||
const npmBin = resolveNpmBin();
|
||||
|
||||
function loadEnvFile(filePath) {
|
||||
if (!fs.existsSync(filePath)) return;
|
||||
@@ -143,9 +127,6 @@ freePort(plazaPort);
|
||||
|
||||
try {
|
||||
if (!(await portOpen(portalPort))) {
|
||||
if (noPortal) {
|
||||
throw new Error(`Portal 未运行 (${portalUrl}),请先启动 cn.tkmind.memind-portal`);
|
||||
}
|
||||
console.log(`==> 启动 Portal @ ${portalUrl}`);
|
||||
portal = spawnChild('node', ['server.mjs'], 'portal');
|
||||
await waitFor(() => portOpen(portalPort), 'Portal');
|
||||
@@ -155,14 +136,14 @@ try {
|
||||
|
||||
if (!skipBuild) {
|
||||
console.log('==> 构建 Plaza Next.js(生产)…');
|
||||
execSync(`"${npmBin}" run build`, { cwd: plazaDir, stdio: 'inherit', env: { ...process.env, ...plazaEnv }, shell: true });
|
||||
execSync('npm run build', { cwd: plazaDir, stdio: 'inherit', env: { ...process.env, ...plazaEnv } });
|
||||
} else {
|
||||
console.log('==> 跳过 next build(--skip-build)');
|
||||
}
|
||||
|
||||
console.log(`==> 启动 Plaza Next.js 正式服务 (0.0.0.0:${plazaPort})`);
|
||||
plaza = spawnChild(
|
||||
npmBin,
|
||||
'npm',
|
||||
['run', 'start', '--', '-H', '0.0.0.0', '-p', String(plazaPort)],
|
||||
'plaza',
|
||||
plazaDir,
|
||||
|
||||
Reference in New Issue
Block a user