mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-05-30 20:50:44 +08:00
change puppeteer import path for ui project - always use the one in home folder
This commit is contained in:
@@ -2,7 +2,6 @@ import * as path from 'node:path'
|
||||
import * as os from 'node:os'
|
||||
import * as fs from 'node:fs'
|
||||
import type { InstalledBrowser } from '@puppeteer/browsers'
|
||||
import { isDev } from '../../runtimeDesidedEnv'
|
||||
|
||||
const expectBuildId = process.env.EXPECT_CHROME_FOR_PUPPETEER_BUILD_ID || '121.0.6167.85'
|
||||
const cacheDir = path.join(
|
||||
@@ -13,15 +12,10 @@ const cacheDir = path.join(
|
||||
)
|
||||
|
||||
const getPuppeteerManagerModule = async () => {
|
||||
if (!isDev) {
|
||||
const runtimeDependencies = await import(
|
||||
path.join(os.homedir(), '.bossgeekgo', 'external-node-runtime-dependencies/index.mjs')
|
||||
)
|
||||
return runtimeDependencies.puppeteerManager
|
||||
} else {
|
||||
const importResult = await import('@puppeteer/browsers')
|
||||
return importResult
|
||||
}
|
||||
const runtimeDependencies = await import(
|
||||
path.join(os.homedir(), '.bossgeekgo', 'external-node-runtime-dependencies/index.mjs')
|
||||
)
|
||||
return runtimeDependencies.puppeteerManager
|
||||
}
|
||||
|
||||
export const getExpectPuppeteerExecutablePath = async () => {
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
export const isDev = process.env.NODE_ENV === 'development'
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
writeConfigFile
|
||||
} from '@bossgeekgo/geek-auto-start-chat-with-boss/runtime-file-utils.mjs'
|
||||
import { ChildProcess } from 'child_process'
|
||||
import { isDev } from '../runtimeDesidedEnv'
|
||||
import { getExpectPuppeteerExecutablePath } from '../flow/CHECK_AND_DOWNLOAD_DEPENDENCIES/check-and-download-puppeteer'
|
||||
let mainWindow: BrowserWindow
|
||||
|
||||
@@ -90,12 +89,8 @@ export function createMainWindow(): void {
|
||||
|
||||
const subProcessEnv = {
|
||||
...process.env,
|
||||
MAIN_BOSSGEEKGO_UI_RUN_MODE: 'geekAutoStartWithBoss'
|
||||
}
|
||||
if (!isDev) {
|
||||
Object.assign(subProcessEnv, {
|
||||
PUPPETEER_EXECUTABLE_PATH: await getExpectPuppeteerExecutablePath()
|
||||
})
|
||||
MAIN_BOSSGEEKGO_UI_RUN_MODE: 'geekAutoStartWithBoss',
|
||||
PUPPETEER_EXECUTABLE_PATH: await getExpectPuppeteerExecutablePath()
|
||||
}
|
||||
subProcessOfPuppeteer = childProcess.spawn(process.argv[0], process.argv.slice(1), {
|
||||
env: subProcessEnv,
|
||||
|
||||
Reference in New Issue
Block a user