mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-04 23:17:39 +08:00
Merge branch 'feature/ui'
This commit is contained in:
@@ -7,6 +7,56 @@ import transformerDirective from '@unocss/transformer-directives'
|
|||||||
import Replace from 'unplugin-replace/vite'
|
import Replace from 'unplugin-replace/vite'
|
||||||
|
|
||||||
process.env = { ...process.env, ...loadEnv(process.env.NODE_ENV!, process.cwd()) }
|
process.env = { ...process.env, ...loadEnv(process.env.NODE_ENV!, process.cwd()) }
|
||||||
|
const mainPlugins = [
|
||||||
|
externalizeDepsPlugin({
|
||||||
|
exclude: [
|
||||||
|
'@geekgeekrun/utils',
|
||||||
|
'find-chrome-bin',
|
||||||
|
'@geekgeekrun/launch-bosszhipin-login-page-with-preload-extension'
|
||||||
|
]
|
||||||
|
}),
|
||||||
|
Replace({
|
||||||
|
delimiters: ['', ''],
|
||||||
|
sourcemap: true,
|
||||||
|
include: ['**/src/main/utils/gtag/Analytics.ts'],
|
||||||
|
values: [
|
||||||
|
{
|
||||||
|
find: /<measurement_id>/g,
|
||||||
|
replacement: process.env.VITE_APP_GTAG_MEASUREMENT_ID as string
|
||||||
|
},
|
||||||
|
{
|
||||||
|
find: /<api_secret>/g,
|
||||||
|
replacement: process.env.VITE_APP_GTAG_API_SECRET as string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
]
|
||||||
|
const preloadPlugins = [externalizeDepsPlugin()]
|
||||||
|
const rendererPlugins = [
|
||||||
|
vue(),
|
||||||
|
UnoCSS({
|
||||||
|
presets: [presetUno(), presetAttributify(), presetIcons()],
|
||||||
|
transformers: [transformerDirective()]
|
||||||
|
})
|
||||||
|
]
|
||||||
|
if (process.env.NODE_ENV) {
|
||||||
|
;[mainPlugins, preloadPlugins, rendererPlugins].forEach((pluginList) => {
|
||||||
|
pluginList.push(
|
||||||
|
Replace({
|
||||||
|
delimiters: ['', ''],
|
||||||
|
sourcemap: true,
|
||||||
|
include: ['**'],
|
||||||
|
values: [
|
||||||
|
{
|
||||||
|
find: /process.env.NODE_ENV/g,
|
||||||
|
replacement: `'${process.env.NODE_ENV}'` as string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
main: {
|
main: {
|
||||||
build: {
|
build: {
|
||||||
@@ -15,33 +65,10 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
minify: process.env.NODE_ENV === 'development' ? undefined : 'terser'
|
minify: process.env.NODE_ENV === 'development' ? undefined : 'terser'
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: mainPlugins
|
||||||
externalizeDepsPlugin({
|
|
||||||
exclude: [
|
|
||||||
'@geekgeekrun/utils',
|
|
||||||
'find-chrome-bin',
|
|
||||||
'@geekgeekrun/launch-bosszhipin-login-page-with-preload-extension'
|
|
||||||
]
|
|
||||||
}),
|
|
||||||
Replace({
|
|
||||||
delimiters: ['', ''],
|
|
||||||
sourcemap: true,
|
|
||||||
include: ['**/src/main/utils/gtag/Analytics.ts'],
|
|
||||||
values: [
|
|
||||||
{
|
|
||||||
find: /<measurement_id>/g,
|
|
||||||
replacement: process.env.VITE_APP_GTAG_MEASUREMENT_ID as string
|
|
||||||
},
|
|
||||||
{
|
|
||||||
find: /<api_secret>/g,
|
|
||||||
replacement: process.env.VITE_APP_GTAG_API_SECRET as string
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
preload: {
|
preload: {
|
||||||
plugins: [externalizeDepsPlugin()],
|
plugins: preloadPlugins,
|
||||||
build: {
|
build: {
|
||||||
minify: process.env.NODE_ENV === 'development' ? undefined : 'terser'
|
minify: process.env.NODE_ENV === 'development' ? undefined : 'terser'
|
||||||
}
|
}
|
||||||
@@ -52,13 +79,7 @@ export default defineConfig({
|
|||||||
'@renderer': resolve('src/renderer/src')
|
'@renderer': resolve('src/renderer/src')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: rendererPlugins,
|
||||||
vue(),
|
|
||||||
UnoCSS({
|
|
||||||
presets: [presetUno(), presetAttributify(), presetIcons()],
|
|
||||||
transformers: [transformerDirective()]
|
|
||||||
})
|
|
||||||
],
|
|
||||||
build: {
|
build: {
|
||||||
minify: process.env.NODE_ENV === 'development' ? undefined : 'terser'
|
minify: process.env.NODE_ENV === 'development' ? undefined : 'terser'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -373,7 +373,9 @@ export default function initIpc() {
|
|||||||
}
|
}
|
||||||
subProcessOfOpenBossSite = childProcess.spawn(
|
subProcessOfOpenBossSite = childProcess.spawn(
|
||||||
process.argv[0],
|
process.argv[0],
|
||||||
[process.argv[1], `--mode=launchBossSite`],
|
process.env.NODE_ENV === 'development'
|
||||||
|
? [process.argv[1], `--mode=launchBossSite`]
|
||||||
|
: [`--mode=launchBossSite`],
|
||||||
{
|
{
|
||||||
env: subProcessEnv,
|
env: subProcessEnv,
|
||||||
stdio: ['inherit', 'inherit', 'inherit', 'pipe']
|
stdio: ['inherit', 'inherit', 'inherit', 'pipe']
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import {
|
|||||||
import { randomUUID } from 'node:crypto'
|
import { randomUUID } from 'node:crypto'
|
||||||
import { connectToDaemon } from './connect-to-daemon'
|
import { connectToDaemon } from './connect-to-daemon'
|
||||||
|
|
||||||
const isUiDev = process.env.NODE_ENV === 'development'
|
|
||||||
export async function ensureIpcPipeName({ isReset } = {}) {
|
export async function ensureIpcPipeName({ isReset } = {}) {
|
||||||
if (isReset) {
|
if (isReset) {
|
||||||
await writeStorageFile('ipc-pipe-name', '', { isJson: false })
|
await writeStorageFile('ipc-pipe-name', '', { isJson: false })
|
||||||
@@ -29,7 +28,9 @@ export async function launchDaemon() {
|
|||||||
// 添加参数使守护进程在后台运行,不显示 UI
|
// 添加参数使守护进程在后台运行,不显示 UI
|
||||||
daemonProcess = spawn(
|
daemonProcess = spawn(
|
||||||
process.argv[0],
|
process.argv[0],
|
||||||
isUiDev ? [process.argv[1], `--mode=launchDaemon`] : [`--mode=launchDaemon`],
|
process.env.NODE_ENV === 'development'
|
||||||
|
? [process.argv[1], `--mode=launchDaemon`]
|
||||||
|
: [`--mode=launchDaemon`],
|
||||||
{
|
{
|
||||||
stdio: ['ignore', 'pipe', 'pipe', 'pipe'],
|
stdio: ['ignore', 'pipe', 'pipe', 'pipe'],
|
||||||
detached: true,
|
detached: true,
|
||||||
|
|||||||
@@ -1,8 +1,16 @@
|
|||||||
|
import overrideConsole from './utils/overrideConsole'
|
||||||
import minimist from 'minimist'
|
import minimist from 'minimist'
|
||||||
import { runCommon } from './features/run-common'
|
import { runCommon } from './features/run-common'
|
||||||
import { launchDaemon } from './flow/OPEN_SETTING_WINDOW/launch-daemon'
|
import { launchDaemon } from './flow/OPEN_SETTING_WINDOW/launch-daemon'
|
||||||
import { app } from 'electron'
|
import { app } from 'electron'
|
||||||
|
|
||||||
|
const isUiDev = process.env.NODE_ENV === 'development'
|
||||||
|
const enableLogToFile = process.env.GEEKGEEKRUN_ENABLE_LOG_TO_FILE === String(1)
|
||||||
|
if (isUiDev || enableLogToFile) {
|
||||||
|
overrideConsole()
|
||||||
|
}
|
||||||
|
console.log('NODE_ENV:', process.env.NODE_ENV)
|
||||||
|
|
||||||
// 捕获未处理的 EPIPE 错误
|
// 捕获未处理的 EPIPE 错误
|
||||||
process.on('uncaughtException', (err) => {
|
process.on('uncaughtException', (err) => {
|
||||||
if (err?.code === 'EPIPE' || err?.code === 'ERR_STREAM_DESTROYED') {
|
if (err?.code === 'EPIPE' || err?.code === 'ERR_STREAM_DESTROYED') {
|
||||||
@@ -11,9 +19,9 @@ process.on('uncaughtException', (err) => {
|
|||||||
throw err
|
throw err
|
||||||
})
|
})
|
||||||
|
|
||||||
const isUiDev = process.env.NODE_ENV === 'development'
|
console.log('argv:', process.argv)
|
||||||
const commandlineArgs = minimist(isUiDev ? process.argv.slice(2) : process.argv.slice(1))
|
const commandlineArgs = minimist(isUiDev ? process.argv.slice(2) : process.argv.slice(1))
|
||||||
console.log(commandlineArgs)
|
console.log('parsed commandline args:', commandlineArgs)
|
||||||
|
|
||||||
const runMode = commandlineArgs['mode']
|
const runMode = commandlineArgs['mode']
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
import path from 'node:path'
|
||||||
|
import os from 'node:os'
|
||||||
|
import fs from 'node:fs'
|
||||||
|
import dayjs from 'dayjs'
|
||||||
|
|
||||||
|
export default function overrideConsole() {
|
||||||
|
const originConsoleLog = console.log.bind(console)
|
||||||
|
const originConsoleWarn = console.warn.bind(console)
|
||||||
|
const originConsoleError = console.error.bind(console)
|
||||||
|
|
||||||
|
const runtimeFolderPath = path.join(os.homedir(), '.geekgeekrun')
|
||||||
|
const logDirPath = path.join(runtimeFolderPath, 'log')
|
||||||
|
if (!fs.existsSync(logDirPath)) {
|
||||||
|
fs.mkdirSync(logDirPath, { recursive: true })
|
||||||
|
}
|
||||||
|
|
||||||
|
const logFileStream = fs.createWriteStream(path.join(logDirPath, `log.log`), {
|
||||||
|
flags: 'a' // 追加模式
|
||||||
|
})
|
||||||
|
const warnFileStream = fs.createWriteStream(path.join(logDirPath, `warn.log`), {
|
||||||
|
flags: 'a' // 追加模式
|
||||||
|
})
|
||||||
|
const errorFileStream = fs.createWriteStream(path.join(logDirPath, `error.log`), {
|
||||||
|
flags: 'a' // 追加模式
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log = (...args: any[]) => {
|
||||||
|
const lineHead = `${dayjs().format('YYYY-MM-DD HH:mm:ss.SSS')} [log][PID=${process.pid}]`
|
||||||
|
originConsoleLog(lineHead, ...args)
|
||||||
|
logFileStream.write(
|
||||||
|
[
|
||||||
|
lineHead,
|
||||||
|
args.map((arg) => {
|
||||||
|
try {
|
||||||
|
return JSON.stringify(arg)
|
||||||
|
} catch (err) {
|
||||||
|
return `[[${JSON.stringify(err?.toString())}]]`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
].join(' ') + '\n'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
console.warn = (...args: any[]) => {
|
||||||
|
const lineHead = `${dayjs().format('YYYY-MM-DD HH:mm:ss.SSS')} [warn][PID=${process.pid}]`
|
||||||
|
originConsoleWarn(lineHead, ...args)
|
||||||
|
warnFileStream.write(
|
||||||
|
[
|
||||||
|
lineHead,
|
||||||
|
args.map((arg) => {
|
||||||
|
try {
|
||||||
|
return JSON.stringify(arg)
|
||||||
|
} catch (err) {
|
||||||
|
return `[[${JSON.stringify(err?.toString())}]]`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
].join(' ') + '\n'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
console.error = (...args: any[]) => {
|
||||||
|
const lineHead = `${dayjs().format('YYYY-MM-DD HH:mm:ss.SSS')} [warn][PID=${process.pid}]`
|
||||||
|
originConsoleError(lineHead, ...args)
|
||||||
|
errorFileStream.write(
|
||||||
|
[
|
||||||
|
lineHead,
|
||||||
|
args.map((arg) => {
|
||||||
|
try {
|
||||||
|
return JSON.stringify(arg)
|
||||||
|
} catch (err) {
|
||||||
|
return `[[${JSON.stringify(err?.toString())}]]`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
].join(' ') + '\n'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -62,7 +62,9 @@ export function createBrowserDownloadProgressWindow(
|
|||||||
}
|
}
|
||||||
subProcessOfCheckAndDownloadDependencies = childProcess.spawn(
|
subProcessOfCheckAndDownloadDependencies = childProcess.spawn(
|
||||||
process.argv[0],
|
process.argv[0],
|
||||||
[process.argv[1], `--mode=downloadDependenciesForInit`],
|
process.env.NODE_ENV === 'development'
|
||||||
|
? [process.argv[1], `--mode=downloadDependenciesForInit`]
|
||||||
|
: [`--mode=downloadDependenciesForInit`],
|
||||||
{
|
{
|
||||||
stdio: [null, null, null, 'pipe', 'ipc']
|
stdio: [null, null, null, 'pipe', 'ipc']
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,7 +83,9 @@ export function createCookieAssistantWindow(
|
|||||||
}
|
}
|
||||||
subProcessOfBossZhipinLoginPageWithPreloadExtension = childProcess.spawn(
|
subProcessOfBossZhipinLoginPageWithPreloadExtension = childProcess.spawn(
|
||||||
process.argv[0],
|
process.argv[0],
|
||||||
[process.argv[1], `--mode=launchBossZhipinLoginPageWithPreloadExtension`],
|
process.env.NODE_ENV === 'development'
|
||||||
|
? [process.argv[1], `--mode=launchBossZhipinLoginPageWithPreloadExtension`]
|
||||||
|
: [`--mode=launchBossZhipinLoginPageWithPreloadExtension`],
|
||||||
{
|
{
|
||||||
env: subProcessEnv,
|
env: subProcessEnv,
|
||||||
stdio: [null, null, null, 'pipe', 'ipc']
|
stdio: [null, null, null, 'pipe', 'ipc']
|
||||||
|
|||||||
@@ -323,7 +323,8 @@
|
|||||||
><b color-orange>正则表达式</b>,不区分大小写;输入框留空表示不筛选;<span
|
><b color-orange>正则表达式</b>,不区分大小写;输入框留空表示不筛选;<span
|
||||||
color-orange
|
color-orange
|
||||||
>优先级高于上方“期望投递公司”</span
|
>优先级高于上方“期望投递公司”</span
|
||||||
></span
|
><br />请<b color-red>小心验证</b
|
||||||
|
>你编写的正则,填写太过于宽泛的正则(例如`.*`)将导致任何职位都不会开聊</span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<el-dropdown @command="handleBlockCompanyNameRegExpTemplateClicked">
|
<el-dropdown @command="handleBlockCompanyNameRegExpTemplateClicked">
|
||||||
|
|||||||
Reference in New Issue
Block a user