Skip to content

Commit 7b59959

Browse files
committed
feat: moved process specific code to dedicated folder
1 parent 1b2bf1b commit 7b59959

File tree

3 files changed

+33
-8
lines changed

3 files changed

+33
-8
lines changed

src/main/env.d.ts

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* The electron-vite plugin exposes environment variables from .env file
3+
* to the main, preload, and renderer processes based on prefixes.
4+
* The default prefixes are `MAIN_VITE_`, `RENDERER_VITE_`, and `PRELOAD_VITE_`.
5+
*
6+
* You access the variables in code via `import.meta.env.{key}`.
7+
* For typescript support, define the keys in this interface.
8+
*
9+
* https://electron-vite.org/guide/env-and-mode.html
10+
*/
11+
interface ImportMetaEnv {
12+
readonly MAIN_VITE_SENTRY_DSN: string;
13+
readonly MAIN_VITE_SENTRY_CRASH_REPORT_DSN: string;
14+
}
15+
16+
interface ImportMeta {
17+
readonly env: ImportMetaEnv;
18+
}

src/main/platform/platform.utils.ts

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* Utilities to check what platform the electron app is running on.
3+
*/
4+
5+
export function isWindows(): boolean {
6+
return process.platform === 'win32';
7+
}
8+
9+
export function isMacOS(): boolean {
10+
return process.platform === 'darwin';
11+
}
12+
13+
export function isLinux(): boolean {
14+
return process.platform === 'linux';
15+
}

src/renderer/src/env.d.ts

-8
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,6 @@
1111
* https://electron-vite.org/guide/env-and-mode.html
1212
*/
1313
interface ImportMetaEnv {
14-
/**
15-
* MAIN
16-
*/
17-
readonly MAIN_VITE_SENTRY_DSN: string;
18-
readonly MAIN_VITE_SENTRY_CRASH_REPORT_DSN: string;
19-
/**
20-
* RENDERER
21-
*/
2214
readonly RENDERER_VITE_SENTRY_DSN: string;
2315
readonly RENDERER_VITE_SENTRY_CRASH_REPORT_DSN: string;
2416
}

0 commit comments

Comments
 (0)