From fc76e14df444d1dcb1b3e254125a6f1f3261e192 Mon Sep 17 00:00:00 2001 From: haraldox Date: Tue, 20 Feb 2018 13:23:10 +0100 Subject: choose platform with environment variable `FRANZ_PLATFORM` --- .vscode/launch.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to '.vscode') diff --git a/.vscode/launch.json b/.vscode/launch.json index a8300f84f..9bd373a4d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -9,7 +9,8 @@ "program": "${workspaceFolder}/build/index.js", "protocol": "inspector", "env": { - "NODE_ENV": "development" + "NODE_ENV": "development", + "FRANZ_PLATFORM": "win32" } }, { -- cgit v1.2.3-70-g09d2 From 136be27ef9185f48262d3ff0e7f754bb5590de45 Mon Sep 17 00:00:00 2001 From: haraldox Date: Thu, 22 Feb 2018 17:03:33 +0100 Subject: override platform in code and simulate different environment [MINOR] REFACTOR rename `FRANZ_PLATFORM` to `OS_PLATFORM` [MINOR] FIX propTypes for `electron-react-titlebar` --- .vscode/launch.json | 2 +- package.json | 2 +- src/environment.js | 11 ++++++++--- src/index.html | 2 +- src/index.js | 2 +- src/lib/Menu.js | 2 +- 6 files changed, 13 insertions(+), 8 deletions(-) (limited to '.vscode') diff --git a/.vscode/launch.json b/.vscode/launch.json index 9bd373a4d..f6c20b520 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,7 +10,7 @@ "protocol": "inspector", "env": { "NODE_ENV": "development", - "FRANZ_PLATFORM": "win32" + "OS_PLATFORM": "win32" } }, { diff --git a/package.json b/package.json index 60e45f7f6..7922eff03 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "start": "electron ./build", "start:local": "cross-env LOCAL_API=1 yarn start", "start:live": "cross-env LIVE_API=1 yarn start", - "dev": "cross-env NODE_ENV=development FRANZ_PLATFORM=win32 gulp dev", + "dev": "cross-env NODE_ENV=development OS_PLATFORM=win32 gulp dev", "lint": "eslint src", "sign": "gulp sign", "prebuild": "gulp build", diff --git a/src/environment.js b/src/environment.js index e185120c0..4dca0807d 100644 --- a/src/environment.js +++ b/src/environment.js @@ -4,9 +4,14 @@ export const isDevMode = Boolean(process.execPath.match(/[\\/]electron/)); export const useLiveAPI = process.env.LIVE_API; export const useLocalAPI = process.env.LOCAL_API; -export const isMac = process.platform === 'darwin'; -export const isWindows = process.platform === 'win32'; -export const isLinux = process.platform === 'linux'; +let platform = process.platform; +if (process.env.OS_PLATFORM) { + platform = process.env.OS_PLATFORM; +} + +export const isMac = platform === 'darwin'; +export const isWindows = platform === 'win32'; +export const isLinux = platform === 'linux'; export const ctrlKey = isMac ? '⌘' : 'Ctrl'; diff --git a/src/index.html b/src/index.html index bb10d2eaf..6c259e5be 100644 --- a/src/index.html +++ b/src/index.html @@ -11,7 +11,7 @@
DEV MODE