feat: 将发布预检移入内置浏览器
This commit is contained in:
@@ -753,3 +753,26 @@ if (gotTheLock) {
|
||||
|
||||
// Export for testing
|
||||
export { mainWindow, opencodeManager, opencodeProjectStore };
|
||||
|
||||
export async function runLocalPreviewPreflightE2E(url: string): Promise<{ ok: true }> {
|
||||
if (!isE2EMode || !agentBrowser) throw new Error('E2E local preview preflight is unavailable');
|
||||
const projectPath = join(app.getPath('temp'), 'makelore-local-preview-preflight-e2e');
|
||||
await agentBrowser.open({
|
||||
projectId: 'local-preview-preflight-e2e',
|
||||
projectPath,
|
||||
url,
|
||||
visible: false,
|
||||
});
|
||||
try {
|
||||
return await agentBrowser.preflightCurrentProject(projectPath);
|
||||
} finally {
|
||||
await agentBrowser.close(projectPath).catch(() => undefined);
|
||||
await agentBrowser.resetProfile(projectPath).catch(() => undefined);
|
||||
}
|
||||
}
|
||||
|
||||
if (isE2EMode) {
|
||||
(globalThis as typeof globalThis & {
|
||||
__niancodeRunLocalPreviewPreflightE2E?: typeof runLocalPreviewPreflightE2E;
|
||||
}).__niancodeRunLocalPreviewPreflightE2E = runLocalPreviewPreflightE2E;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user