refactoring, split webpack configs + get rid of electron-webpack

This commit is contained in:
Roman committed 2020-06-12 22:23:15 +03:00
1 parent a4d66fffda
commit 9aa815bc14
18 files changed
+407 -1329

No files matched your search

+4
View File
@@ -18,6 +18,7 @@ import { shellSync } from "./shell-sync"
import { getFreePort } from "./port"
import { mangleProxyEnv } from "./proxy-env"
import { findMainWebContents } from "./webcontents"
import { registerStaticProtocol } from "../common/register-static";
import { isDevelopment, isMac } from "../common/vars";
mangleProxyEnv()
@@ -41,12 +42,15 @@ async function main() {
updater.start();
tracker.event("app", "start");
registerStaticProtocol();
protocol.registerFileProtocol('store', (request, callback) => {
const url = request.url.substr(8)
callback(path.normalize(`${app.getPath("userData")}/${url}`))
}, (error) => {
if (error) console.error('Failed to register protocol')
})
let port: number = null
// find free port
try {
+4 -3
View File
@@ -1,5 +1,6 @@
import http from "http"
import path from "path"
import { readFile } from "fs"
import { Cluster } from "./cluster"
import { configRoute } from "./routes/config"
import { helmApi } from "./helm-api"
@@ -8,7 +9,7 @@ import { kubeconfigRoute } from "./routes/kubeconfig"
import { metricsRoute } from "./routes/metrics"
import { watchRoute } from "./routes/watch"
import { portForwardRoute } from "./routes/port-forward"
import { readFile } from "fs"
import { getStaticPath } from "../common/register-static";
// eslint-disable-next-line @typescript-eslint/no-var-requires
const Call = require('@hapi/call');
@@ -84,8 +85,8 @@ export class Router {
return request
}
protected handleStaticFile(file: string, response: http.ServerResponse) {
const asset = path.join(__static, file)
protected handleStaticFile(filePath: string, response: http.ServerResponse) {
const asset = getStaticPath(filePath);
readFile(asset, (err, data) => {
if (err) {
// default to index.html so that react routes work when page is refreshed
+2 -2
View File
@@ -1,9 +1,9 @@
import path from "path"
import { BrowserWindow, shell } from "electron"
import { PromiseIpc } from "electron-promise-ipc"
import windowStateKeeper from "electron-window-state"
import { tracker } from "./tracker";
import { isDevelopment } from "../common/vars";
import { getStaticUrl } from "../common/register-static";
export class WindowManager {
public mainWindow: BrowserWindow = null;
@@ -32,7 +32,7 @@ export class WindowManager {
}
})
if (showSplash) {
this.splashWindow.loadFile(path.join(__static, "/splash.html"))
this.splashWindow.loadFile(getStaticUrl("splash.html"))
this.splashWindow.show()
}