Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/mini-main' into opt_dep
Browse files Browse the repository at this point in the history
  • Loading branch information
umbrella22 committed Nov 29, 2024
2 parents 9e0d8b9 + 6ca8f1c commit f8fe9ba
Show file tree
Hide file tree
Showing 5 changed files with 3,410 additions and 2,283 deletions.
6 changes: 4 additions & 2 deletions .electron-vite/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ import { getArgv } from "./utils";
const { clean = false, target = "client" } = getArgv();
const mainOpt = rollupOptions(process.env.NODE_ENV, "main");
const preloadOpt = rollupOptions(process.env.NODE_ENV, "preload");

const { clean = false, target = "client" } = getArgv();
const isCI = process.env.CI || false;

if (target === "web") web();
else unionBuild();

async function cleanBuid() {
async function cleanBuild() {
await deleteAsync([
"dist/electron/main/*",
"dist/electron/renderer/*",
Expand All @@ -35,7 +37,7 @@ async function cleanBuid() {

async function unionBuild() {
greeting();
await cleanBuid();
await cleanBuild();

const tasksLister = new Listr(
[
Expand Down
16 changes: 13 additions & 3 deletions .electron-vite/dev-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type { ChildProcess } from "child_process";
import rollupOptions from "./rollup.config";
import { electronLog, getArgv, logStats, removeJunk } from "./utils";

const { controlledRestart = false, target = "client" } = getArgv();
const { target = "client", controlledRestart = false } = getArgv();

const mainOpt = rollupOptions(process.env.NODE_ENV, "main");
const preloadOpt = rollupOptions(process.env.NODE_ENV, "preload");
Expand Down Expand Up @@ -56,7 +56,7 @@ const shortcutList: Shortcut[] = [
];

async function startRenderer(): Promise<void> {
Portfinder.basePort = config.dev.port || 9988;
Portfinder.basePort = config.dev.port || 9080;
const port = await Portfinder.getPortPromise();
const { createServer } = await import("vite");
const server = await createServer({
Expand Down Expand Up @@ -145,6 +145,17 @@ function startPreload(): Promise<void> {
} else if (event.code === "ERROR") {
reject(event.error);
}
if (controlledRestart) {
process.stdout.write("\x1B[2J\x1B[3J");
logStats(
"cli tips",
`${
config.dev.chineseLog
? "受控重启已启用,请手动输入r + 回车重启"
: "Controlled restart is enabled, please manually enter r + Enter to restart"
}`
);
}
});
});
}
Expand Down Expand Up @@ -260,7 +271,6 @@ async function init() {
return;
}
greeting();

try {
await startRenderer();
await startMain();
Expand Down
Loading

0 comments on commit f8fe9ba

Please sign in to comment.