- 更新 CI/CD 子域名反向代理配置 - 调整 Nginx 静态文件服务器配置 - 更新 CONTEXT.md 领域共享语言文档 - 添加 CLAUDE.md 代理工作指南 - 更新 Playwright E2E 测试配置
31 lines
934 B
JavaScript
31 lines
934 B
JavaScript
import path from 'node:path';
|
|
import { resolveProjectRoot } from './context.mjs';
|
|
import { parseTargetPath } from './lib/target-args.mjs';
|
|
|
|
export function resolveLiveTarget(cwd = process.cwd(), args = []) {
|
|
const originalCwd = path.resolve(cwd);
|
|
let targetPath = null;
|
|
try {
|
|
targetPath = parseTargetPath(args, { strict: true });
|
|
} catch (err) {
|
|
if (err?.name === 'TargetArgError') {
|
|
process.stderr.write(`${err.message}\n`);
|
|
process.exit(1);
|
|
}
|
|
throw err;
|
|
}
|
|
const absoluteTargetPath = targetPath
|
|
? path.isAbsolute(targetPath) ? targetPath : path.resolve(originalCwd, targetPath)
|
|
: null;
|
|
const projectRoot = targetPath
|
|
? resolveProjectRoot(originalCwd, { targetPath: absoluteTargetPath })
|
|
: originalCwd;
|
|
return {
|
|
originalCwd,
|
|
projectRoot,
|
|
targetPath,
|
|
absoluteTargetPath,
|
|
targetOptions: absoluteTargetPath ? { targetPath: absoluteTargetPath } : {},
|
|
};
|
|
}
|