chore(desktop): clean up build artifacts and unused code
- Add dist-electron and release to .gitignore - Remove tracked dist-electron build outputs from git - Remove unused createRequire import in electron/main.ts Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
d7d2861a79
commit
6cc3a375e7
4 changed files with 2 additions and 69 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -8,6 +8,8 @@ dist
|
|||
out
|
||||
.turbo
|
||||
build
|
||||
dist-electron
|
||||
release
|
||||
*.tsbuildinfo
|
||||
|
||||
# env
|
||||
|
|
|
|||
|
|
@ -1,45 +0,0 @@
|
|||
import { app, BrowserWindow } from "electron";
|
||||
import { createRequire } from "node:module";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import path from "node:path";
|
||||
createRequire(import.meta.url);
|
||||
const __dirname$1 = path.dirname(fileURLToPath(import.meta.url));
|
||||
process.env.APP_ROOT = path.join(__dirname$1, "..");
|
||||
const VITE_DEV_SERVER_URL = process.env["VITE_DEV_SERVER_URL"];
|
||||
const MAIN_DIST = path.join(process.env.APP_ROOT, "dist-electron");
|
||||
const RENDERER_DIST = path.join(process.env.APP_ROOT, "dist");
|
||||
process.env.VITE_PUBLIC = VITE_DEV_SERVER_URL ? path.join(process.env.APP_ROOT, "public") : RENDERER_DIST;
|
||||
let win;
|
||||
function createWindow() {
|
||||
win = new BrowserWindow({
|
||||
icon: path.join(process.env.VITE_PUBLIC, "electron-vite.svg"),
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname$1, "preload.mjs")
|
||||
}
|
||||
});
|
||||
win.webContents.on("did-finish-load", () => {
|
||||
win == null ? void 0 : win.webContents.send("main-process-message", (/* @__PURE__ */ new Date()).toLocaleString());
|
||||
});
|
||||
if (VITE_DEV_SERVER_URL) {
|
||||
win.loadURL(VITE_DEV_SERVER_URL);
|
||||
} else {
|
||||
win.loadFile(path.join(RENDERER_DIST, "index.html"));
|
||||
}
|
||||
}
|
||||
app.on("window-all-closed", () => {
|
||||
if (process.platform !== "darwin") {
|
||||
app.quit();
|
||||
win = null;
|
||||
}
|
||||
});
|
||||
app.on("activate", () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow();
|
||||
}
|
||||
});
|
||||
app.whenReady().then(createWindow);
|
||||
export {
|
||||
MAIN_DIST,
|
||||
RENDERER_DIST,
|
||||
VITE_DEV_SERVER_URL
|
||||
};
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
"use strict";
|
||||
const electron = require("electron");
|
||||
electron.contextBridge.exposeInMainWorld("ipcRenderer", {
|
||||
on(...args) {
|
||||
const [channel, listener] = args;
|
||||
return electron.ipcRenderer.on(channel, (event, ...args2) => listener(event, ...args2));
|
||||
},
|
||||
off(...args) {
|
||||
const [channel, ...omit] = args;
|
||||
return electron.ipcRenderer.off(channel, ...omit);
|
||||
},
|
||||
send(...args) {
|
||||
const [channel, ...omit] = args;
|
||||
return electron.ipcRenderer.send(channel, ...omit);
|
||||
},
|
||||
invoke(...args) {
|
||||
const [channel, ...omit] = args;
|
||||
return electron.ipcRenderer.invoke(channel, ...omit);
|
||||
}
|
||||
// You can expose other APTs you need here.
|
||||
// ...
|
||||
});
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
import { app, BrowserWindow } from 'electron'
|
||||
import { createRequire } from 'node:module'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import path from 'node:path'
|
||||
|
||||
const require = createRequire(import.meta.url)
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
// The built directory structure
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue