Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Converted the main EP to typescript.
Extended the base tsconfig to cover the new main.ts entry point. Added a new build:desktop script to build the main.ts entry point to JS. Added the aforementioned script to the dev and build scripts so the file is rebuilt before the app is launched.
- Loading branch information
1 parent
12c3b22
commit 973bc96
Showing
5 changed files
with
56 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,5 @@ build | |
dist | ||
.env | ||
.vscode | ||
|
||
.idea |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { initRemix } from "remix-electron"; | ||
import { app, BrowserWindow, dialog } from "electron"; | ||
import { join } from "node:path"; | ||
|
||
/** @type {BrowserWindow | undefined} */ | ||
let win | ||
|
||
/** @param {string} url */ | ||
async function createWindow(url: string) { | ||
win = new BrowserWindow({ show: false }) | ||
await win.loadURL(url) | ||
win.show() | ||
} | ||
|
||
app.on("ready", async () => { | ||
try { | ||
const url = await initRemix({ serverBuild: join(__dirname, "build") }) | ||
await createWindow(url) | ||
} catch (error) { | ||
dialog.showErrorBox("Error", getErrorStack(error)) | ||
console.error(error) | ||
} | ||
}) | ||
|
||
/** @param {unknown} error */ | ||
function getErrorStack(error: any) { | ||
return error instanceof Error ? error.stack || error.message : String(error) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"lib": ["DOM", "DOM.Iterable", "ES5"], | ||
"isolatedModules": true, | ||
"esModuleInterop": true, | ||
"jsx": "react-jsx", | ||
"moduleResolution": "node", | ||
"resolveJsonModule": true, | ||
"target": "ES3", | ||
"strict": true, | ||
"noEmit": false, | ||
"allowJs": true, | ||
"checkJs": true, | ||
"skipLibCheck": true | ||
}, | ||
"include": [ | ||
"desktop/main.ts" | ||
], | ||
"exclude": ["desktop/build", "public/build", ".cache"] | ||
} |