Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ Target.create "Clean" (fun _ ->

Target.create "DotnetRestore" (fun _ ->
DotNet.restore
(DotNet.Options.withWorkingDirectory __SOURCE_DIRECTORY__)
(DotNet.Options.withWorkingDirectory __SOURCE_DIRECTORY__
>> fun args -> {
args with
MSBuildParams = { args.MSBuildParams with DisableInternalBinLog = true }
})
"fable-elmish-electron-demo.sln"
)

Expand Down
5 changes: 5 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"sdk": {
"version": "6.0.428"
}
}
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.41",
"autosuggest-highlight": "^3.1",
"electron-extension-installer": "^1.2.0",
"match-sorter": "^4.0",
"mdi-material-ui": "^6.11.0",
"react": "^16.12.0",
Expand All @@ -35,18 +36,19 @@
"devDependencies": {
"@babel/core": "^7.8.4",
"bufferutil": "^4.0",
"devtron": "^1.4",
"electron": "^22.3.25",
"electron-builder": "^24.13.3",
"electron-devtools-installer": "^2.2",
"electron-webpack": "^2.8",
"electron-window-state": "^5.0",
"fable-compiler": "^2.4.13",
"fable-loader": "^2.1",
"html-webpack-plugin": "^4.3.0",
"node-sass": "^9.0.0",
"remotedev": "^0.2",
"sass-loader": "^8.0.2",
"sass-loader": "^10",
"utf-8-validate": "^5.0",
"webpack": "^5.94.0"
"webpack": "^4",
"webpack-cli": "^3",
"webpack-dev-server": "^3"
}
}
7 changes: 3 additions & 4 deletions src/Main/DevTools.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ open Fable.Core.JsInterop
open Electron

let private installDevTools (extensionRef: obj) (forceDownload: bool) : JS.Promise<string> =
importDefault "electron-devtools-installer"
importDefault "electron-extension-installer"

let private REACT_DEVELOPER_TOOLS : obj =
import "REACT_DEVELOPER_TOOLS" "electron-devtools-installer"
import "REACT_DEVELOPER_TOOLS" "electron-extension-installer"

let private REDUX_DEVTOOLS : obj =
import "REDUX_DEVTOOLS" "electron-devtools-installer"
import "REDUX_DEVTOOLS" "electron-extension-installer"

let private installDevTool extensionRef =
promise {
Expand All @@ -24,7 +24,6 @@ let private installDevTool extensionRef =
let installAllDevTools (win: BrowserWindow) =
installDevTool REACT_DEVELOPER_TOOLS
installDevTool REDUX_DEVTOOLS
win.webContents.executeJavaScript("require('devtron').install()")

let uninstallAllDevTools (win: BrowserWindow) =
main.BrowserWindow.removeDevToolsExtension("React Developer Tools")
Expand Down
1 change: 1 addition & 0 deletions src/Main/Main.fs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ let createMainWindow () =
o.autoHideMenuBar <- true
o.webPreferences <- jsOptions<WebPreferences>(fun w ->
w.nodeIntegration <- true
w.contextIsolation <- false
)
o.show <- false
))
Expand Down
13 changes: 7 additions & 6 deletions src/Renderer/App.fs
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,13 @@ let RootView = FunctionComponent.Of((fun (model, dispatch) ->
), "RootView", memoEqualsButFunctions)

let updateSystemTheme dispatch =
let dispatchCurrentMode () =
if renderer.remote.nativeTheme.shouldUseDarkColors
then dispatch (SetSystemThemeMode Dark)
else dispatch (SetSystemThemeMode Light)
renderer.remote.nativeTheme.onUpdated(fun _ -> dispatchCurrentMode ()) |> ignore
dispatchCurrentMode ()
dispatch (SetSystemThemeMode Light)
// let dispatchCurrentMode () =
// if renderer.remote.nativeTheme.shouldUseDarkColors
// then dispatch (SetSystemThemeMode Dark)
// else dispatch (SetSystemThemeMode Light)
// renderer.remote.nativeTheme.onUpdated(fun _ -> dispatchCurrentMode ()) |> ignore
// dispatchCurrentMode ()

let init () =
let m =
Expand Down
9 changes: 9 additions & 0 deletions static/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<div id="app"></div>
</body>
</html>
8 changes: 7 additions & 1 deletion webpack.additions.renderer.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
var path = require("path");
var HtmlWebpackPlugin = require('html-webpack-plugin');

function resolve(filePath) {
return path.join(__dirname, filePath)
}

module.exports = {
entry: [resolve("src/Renderer/Renderer.fsproj"), resolve("src/Renderer/scss/main.scss")],
entry: [resolve("src/Renderer/Renderer.fsproj"), resolve("src/Renderer/scss/main.scss"), resolve('static/index.html')],
output: {
filename: "renderer.js"
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'static/index.html')
})
],
module: {
rules: [
{
Expand Down