mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-07 16:37:06 +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({
|
export default defineConfig({
|
||||||
main: {
|
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: {
|
preload: {
|
||||||
plugins: [externalizeDepsPlugin()]
|
plugins: [externalizeDepsPlugin()]
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import DingtalkPlugin from '@bossgeekgo/dingtalk-plugin/index.mjs'
|
import DingtalkPlugin from '@bossgeekgo/dingtalk-plugin/index.mjs'
|
||||||
import { mainLoop } from '@bossgeekgo/geek-auto-start-chat-with-boss/index.mjs'
|
|
||||||
import {
|
import {
|
||||||
SyncHook,
|
SyncHook,
|
||||||
AsyncSeriesHook
|
AsyncSeriesHook
|
||||||
@@ -12,6 +11,13 @@ const initPlugins = (hooks) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const runAutoChat = async () => {
|
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 = {
|
const hooks = {
|
||||||
puppeteerLaunched: new SyncHook(),
|
puppeteerLaunched: new SyncHook(),
|
||||||
pageLoaded: new SyncHook(),
|
pageLoaded: new SyncHook(),
|
||||||
|
|||||||
@@ -85,6 +85,12 @@ export function createMainWindow(): void {
|
|||||||
if (subProcessOfPuppeteer) {
|
if (subProcessOfPuppeteer) {
|
||||||
return
|
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)
|
console.log(process)
|
||||||
subProcessOfPuppeteer = childProcess.spawn(process.argv[0], process.argv.slice(1), {
|
subProcessOfPuppeteer = childProcess.spawn(process.argv[0], process.argv.slice(1), {
|
||||||
env: {
|
env: {
|
||||||
|
|||||||
@@ -78,7 +78,12 @@ const formRef = ref<InstanceType<typeof ElForm>>()
|
|||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
await formRef.value!.validate()
|
await formRef.value!.validate()
|
||||||
await electron.ipcRenderer.invoke('save-config-file-from-ui', JSON.stringify(formContent.value))
|
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')
|
router.replace('/geekAutoStartChatWithBoss/runningStatus')
|
||||||
}
|
}
|
||||||
const handleSave = async () => {
|
const handleSave = async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user