Compare commits
1 Commits
feature/ds
...
prebuild
| Author | SHA1 | Date | |
|---|---|---|---|
| 8f4aa89249 |
16
.claude/settings.local.json
Normal file
16
.claude/settings.local.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"Bash(npm run:*)",
|
||||
"Bash(npm install:*)",
|
||||
"Bash(NODE_OPTIONS='--loader ts-node/esm' npm run make -- --platform=darwin)",
|
||||
"Bash(ELECTRON_FORGE_CLI_SCRIPT='tsx' npm run make -- --platform=darwin)",
|
||||
"Bash(DEBUG='*' npm run make -- --platform=darwin)",
|
||||
"Bash(grep -r \"forge.config\" /Users/brother7/Documents/AI/zn-ai/node_modules/@electron-forge/core/dist/*.js)",
|
||||
"Bash(node -e ':*)",
|
||||
"Bash(JITI_DEBUG=1 npm run make -- --platform=darwin)",
|
||||
"Bash(JITI_FS_CACHE=false npm run make -- --platform=darwin)",
|
||||
"Bash(JITI_DEBUG=1 JITI_FS_CACHE=false npm run make -- --platform=darwin)"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,8 @@ import { MakerDMG } from '@electron-forge/maker-dmg';
|
||||
import { VitePlugin } from '@electron-forge/plugin-vite';
|
||||
import { FusesPlugin } from '@electron-forge/plugin-fuses';
|
||||
import { FuseV1Options, FuseVersion } from '@electron/fuses';
|
||||
// import MakerWix from '@electron-forge/maker-wix';
|
||||
import * as fs from 'fs-extra';
|
||||
import * as path from 'path';
|
||||
import * as esbuild from 'esbuild';
|
||||
|
||||
const config: ForgeConfig = {
|
||||
packagerConfig: {
|
||||
@@ -23,32 +21,25 @@ const config: ForgeConfig = {
|
||||
rebuildConfig: {},
|
||||
makers: [
|
||||
new MakerSquirrel({
|
||||
iconUrl: path.join(__dirname, 'public/logo.ico'), // 快捷方式的图标,需要在线的地址
|
||||
iconUrl: path.join(__dirname, 'public/logo.ico'),
|
||||
setupIcon: path.join(__dirname, 'public/logo.ico'),
|
||||
setupExe: 'NianXX.exe',
|
||||
// loadingGif: path.join(__dirname, 'public/loading.gif'), // 修改默认安装图片
|
||||
}),
|
||||
new MakerZIP({}, ['darwin']),
|
||||
new MakerRpm({}),
|
||||
new MakerDeb({}),
|
||||
new MakerDMG({
|
||||
name: 'NianXX',
|
||||
icon: path.join(__dirname, 'public/logo.icns'),
|
||||
}),
|
||||
// new MakerWix({
|
||||
// language: 2052,
|
||||
// ui: {
|
||||
// chooseDirectory: true,
|
||||
// }
|
||||
// }),
|
||||
new MakerDMG(
|
||||
(arch: string) => ({
|
||||
name: `NianXX-${arch}`,
|
||||
icon: path.join(__dirname, 'public/logo.icns'),
|
||||
appPath: '',
|
||||
} as any)
|
||||
),
|
||||
],
|
||||
plugins: [
|
||||
new VitePlugin({
|
||||
// `build` can specify multiple entry builds, which can be Main process, Preload scripts, Worker process, etc.
|
||||
// If you are familiar with Vite configuration, it will look really familiar.
|
||||
build: [
|
||||
{
|
||||
// `entry` is just an alias for `build.lib.entry` in the corresponding file of `config`.
|
||||
entry: 'src/main/main.ts',
|
||||
config: 'vite.main.config.ts',
|
||||
target: 'main',
|
||||
@@ -66,8 +57,6 @@ const config: ForgeConfig = {
|
||||
},
|
||||
],
|
||||
}),
|
||||
// Fuses are used to enable/disable various Electron functionality
|
||||
// at package time, before code signing the application
|
||||
new FusesPlugin({
|
||||
version: FuseVersion.V1,
|
||||
[FuseV1Options.RunAsNode]: false,
|
||||
@@ -84,17 +73,20 @@ const config: ForgeConfig = {
|
||||
const dest = path.join(buildPath, '.vite', 'build', 'scripts');
|
||||
await fs.ensureDir(dest);
|
||||
|
||||
// Bundle mjs scripts using esbuild
|
||||
// 动态导入esbuild
|
||||
const esbuildModule = await import('esbuild');
|
||||
const esbuildBuild = esbuildModule.build;
|
||||
|
||||
const files = await fs.readdir(src);
|
||||
for (const file of files) {
|
||||
if (file.endsWith('.js')) {
|
||||
await esbuild.build({
|
||||
await esbuildBuild({
|
||||
entryPoints: [path.join(src, file)],
|
||||
outfile: path.join(dest, file),
|
||||
bundle: true,
|
||||
platform: 'node',
|
||||
target: 'node24', // Adjust based on Electron version
|
||||
external: [ 'electron' ], // Exclude electron and playwright dependencies from bundling
|
||||
target: 'node24',
|
||||
external: [ 'electron' ],
|
||||
format: 'cjs',
|
||||
});
|
||||
} else {
|
||||
@@ -102,7 +94,6 @@ const config: ForgeConfig = {
|
||||
}
|
||||
}
|
||||
|
||||
// Force playwright into the packaged node_modules since Forge Vite plugin ignores it
|
||||
const playwrightSrc = path.join(__dirname, 'node_modules', 'playwright');
|
||||
const playwrightDest = path.join(buildPath, 'node_modules', 'playwright');
|
||||
if (await fs.pathExists(playwrightSrc)) {
|
||||
@@ -124,7 +115,6 @@ const config: ForgeConfig = {
|
||||
await fs.copy(chromiumBidiSrc, chromiumBidiDest);
|
||||
}
|
||||
|
||||
// Force bytenode into the packaged node_modules since Forge Vite plugin ignores it
|
||||
const bytenodeSrc = path.join(__dirname, 'node_modules', 'bytenode');
|
||||
const bytenodeDest = path.join(buildPath, 'node_modules', 'bytenode');
|
||||
|
||||
@@ -145,6 +135,7 @@ const config: ForgeConfig = {
|
||||
},
|
||||
|
||||
async postPackage(_forgeConfig, options) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const electronVersion = require('electron/package.json').version;
|
||||
const nodeVersion = process.version;
|
||||
const versionData = {
|
||||
@@ -170,6 +161,7 @@ const config: ForgeConfig = {
|
||||
},
|
||||
|
||||
async postMake(_forgeConfig, outputs) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const electronVersion = require('electron/package.json').version;
|
||||
const nodeVersion = process.version;
|
||||
const versionData = {
|
||||
|
||||
3728
package-lock.json
generated
3728
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
21
package.json
21
package.json
@@ -8,6 +8,8 @@
|
||||
"start": "dotenv -e .env -- electron-forge start",
|
||||
"package": "electron-forge package",
|
||||
"make": "electron-forge make",
|
||||
"make:mac": "electron-forge make --platform=darwin --arch=arm64,x64",
|
||||
"make:mac-arm64": "electron-forge make --platform=darwin --arch=arm64",
|
||||
"publish": "electron-forge publish",
|
||||
"lint": "eslint --ext .ts,.tsx .",
|
||||
"generate-prod-entry": "node build/scripts/generateProdEntry.js",
|
||||
@@ -22,16 +24,16 @@
|
||||
},
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@electron-forge/cli": "^7.8.3",
|
||||
"@electron-forge/maker-deb": "^7.10.2",
|
||||
"@electron-forge/maker-dmg": "^7.11.1",
|
||||
"@electron-forge/maker-rpm": "^7.10.2",
|
||||
"@electron-forge/maker-squirrel": "^7.10.2",
|
||||
"@electron-forge/cli": "^7.6.0",
|
||||
"@electron-forge/maker-deb": "^7.6.0",
|
||||
"@electron-forge/maker-dmg": "^7.6.0",
|
||||
"@electron-forge/maker-rpm": "^7.6.0",
|
||||
"@electron-forge/maker-squirrel": "^7.6.0",
|
||||
"@electron-forge/maker-wix": "^7.11.1",
|
||||
"@electron-forge/maker-zip": "^7.10.2",
|
||||
"@electron-forge/maker-zip": "^7.6.0",
|
||||
"@electron-forge/plugin-auto-unpack-natives": "^7.10.2",
|
||||
"@electron-forge/plugin-fuses": "^7.10.2",
|
||||
"@electron-forge/plugin-vite": "^7.10.2",
|
||||
"@electron-forge/plugin-fuses": "^7.6.0",
|
||||
"@electron-forge/plugin-vite": "^7.6.0",
|
||||
"@electron/fuses": "^1.8.0",
|
||||
"@tailwindcss/typography": "^0.5.19",
|
||||
"@tailwindcss/vite": "^4.1.17",
|
||||
@@ -44,9 +46,10 @@
|
||||
"esbuild": "^0.27.4",
|
||||
"openapi-ts-request": "^1.10.1",
|
||||
"tailwindcss": "^4.1.11",
|
||||
"tsx": "^4.21.0",
|
||||
"typescript": "^5.8.3",
|
||||
"unplugin-auto-import": "^20.3.0",
|
||||
"vite": "^7.1.9"
|
||||
"vite": "^5.4.11"
|
||||
},
|
||||
"dependencies": {
|
||||
"@iconify-json/material-symbols": "^1.2.50",
|
||||
|
||||
@@ -64,6 +64,9 @@
|
||||
|
||||
<!-- 任务中心(仅在引导页显示) -->
|
||||
<TaskCenter v-if="isGuidePage" />
|
||||
|
||||
<!-- 任务操作弹窗 -->
|
||||
<TaskOperationDialog ref="taskOperationDialogRef" />
|
||||
</div>
|
||||
|
||||
</template>
|
||||
@@ -83,6 +86,9 @@ import ChatNameTime from './components/ChatNameTime.vue';
|
||||
import ChatAttach from './components/ChatAttach.vue';
|
||||
import ChatInputArea from './components/ChatInputArea.vue';
|
||||
import TaskCenter from './TaskCenter.vue';
|
||||
import TaskOperationDialog from './components/TaskOperationDialog.vue';
|
||||
import emitter from '@utils/emitter';
|
||||
import { taskCenterItem } from '@constant/taskCenterList';
|
||||
|
||||
import { Session } from '../../utils/storage';
|
||||
|
||||
@@ -147,6 +153,16 @@ const isSessionActive = ref(false);
|
||||
/// 指令通用消息类型
|
||||
let commonTypeMessage: string = "";
|
||||
|
||||
// 任务操作弹窗ref
|
||||
const taskOperationDialogRef = ref<InstanceType<typeof TaskOperationDialog> | null>(null);
|
||||
|
||||
// 打开任务操作弹窗
|
||||
const openTaskOperationDialog = (item: taskCenterItem) => {
|
||||
if (taskOperationDialogRef.value) {
|
||||
taskOperationDialogRef.value.open(item);
|
||||
}
|
||||
};
|
||||
|
||||
// WebSocket 相关
|
||||
let webSocketManager: WebSocketManager | null = null;
|
||||
/// 使用统一的连接状态判断函数,避免状态不同步
|
||||
@@ -272,6 +288,8 @@ onMounted(() => {
|
||||
try {
|
||||
// 有token时,加载最近会话、最近消息、初始化socket
|
||||
initHandler();
|
||||
// 监听任务操作事件
|
||||
emitter.on('OPERATION_CHANNEL', openTaskOperationDialog);
|
||||
} catch (error) {
|
||||
console.error("初始化错误:", error);
|
||||
}
|
||||
@@ -822,6 +840,8 @@ const stopRequest = async () => {
|
||||
onUnmounted(() => {
|
||||
console.log("组件销毁");
|
||||
resetConfig();
|
||||
// 移除事件监听
|
||||
emitter.off('OPERATION_CHANNEL', openTaskOperationDialog);
|
||||
});
|
||||
|
||||
const resetConfig = () => {
|
||||
|
||||
@@ -3,14 +3,15 @@
|
||||
"composite": true,
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.config.tsbuildinfo",
|
||||
"skipLibCheck": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true,
|
||||
"noEmit": true
|
||||
},
|
||||
"include": [
|
||||
"**.config.ts",
|
||||
"**/*.ts",
|
||||
"**/*.ts"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -17,6 +17,10 @@ export default defineConfig(async () => {
|
||||
transformer: 'lightningcss' as CSSOptions['transformer'],
|
||||
},
|
||||
|
||||
build: {
|
||||
target: 'es2022',
|
||||
},
|
||||
|
||||
resolve: {
|
||||
alias: {
|
||||
"@renderer": resolve(__dirname, "./src/renderer"),
|
||||
|
||||
Reference in New Issue
Block a user