mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-07-08 07:41:26 +08:00
set puppeteer dependencies as external; check if the puppeteer installed before run.
This commit is contained in:
@@ -4,7 +4,16 @@ import vue from '@vitejs/plugin-vue'
|
||||
|
||||
export default defineConfig({
|
||||
main: {
|
||||
plugins: [externalizeDepsPlugin({ exclude: ['@bossgeekgo/geek-auto-start-chat-with-boss', '@bossgeekgo/dingtalk-plugin'] })]
|
||||
build: {
|
||||
rollupOptions: {
|
||||
external: ['puppeteer', 'puppeteer-extra', 'puppeteer-extra-plugin-stealth']
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
externalizeDepsPlugin({
|
||||
exclude: ['@bossgeekgo/geek-auto-start-chat-with-boss', '@bossgeekgo/dingtalk-plugin']
|
||||
})
|
||||
]
|
||||
},
|
||||
preload: {
|
||||
plugins: [externalizeDepsPlugin()]
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import DingtalkPlugin from '@bossgeekgo/dingtalk-plugin/index.mjs'
|
||||
import { mainLoop } from '@bossgeekgo/geek-auto-start-chat-with-boss/index.mjs'
|
||||
import {
|
||||
SyncHook,
|
||||
AsyncSeriesHook
|
||||
@@ -12,6 +11,13 @@ const initPlugins = (hooks) => {
|
||||
}
|
||||
|
||||
export const runAutoChat = async () => {
|
||||
let mainLoop
|
||||
try {
|
||||
mainLoop = (await import('@bossgeekgo/geek-auto-start-chat-with-boss/index.mjs')).mainLoop
|
||||
} catch {
|
||||
console.error(new Error('PUPPETEER_MAY_NOT_INSTALLED'))
|
||||
process.exit(1)
|
||||
}
|
||||
const hooks = {
|
||||
puppeteerLaunched: new SyncHook(),
|
||||
pageLoaded: new SyncHook(),
|
||||
|
||||
@@ -85,6 +85,12 @@ export function createMainWindow(): void {
|
||||
if (subProcessOfPuppeteer) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
await import('@bossgeekgo/geek-auto-start-chat-with-boss/index.mjs')
|
||||
} catch (err){
|
||||
console.log(err) // TODO: what's the error?
|
||||
throw new Error('PUPPETEER_MAY_NOT_INSTALLED')
|
||||
}
|
||||
console.log(process)
|
||||
subProcessOfPuppeteer = childProcess.spawn(process.argv[0], process.argv.slice(1), {
|
||||
env: {
|
||||
|
||||
@@ -78,7 +78,12 @@ const formRef = ref<InstanceType<typeof ElForm>>()
|
||||
const handleSubmit = async () => {
|
||||
await formRef.value!.validate()
|
||||
await electron.ipcRenderer.invoke('save-config-file-from-ui', JSON.stringify(formContent.value))
|
||||
await electron.ipcRenderer.invoke('run-geek-auto-start-chat-with-boss', JSON.stringify(formContent.value))
|
||||
try {
|
||||
await electron.ipcRenderer.invoke('run-geek-auto-start-chat-with-boss', JSON.stringify(formContent.value))
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
return
|
||||
}
|
||||
router.replace('/geekAutoStartChatWithBoss/runningStatus')
|
||||
}
|
||||
const handleSave = async () => {
|
||||
|
||||
Reference in New Issue
Block a user