fix production build bugs -- utf-8 encoding and index.html

This commit is contained in:
sawka 2022-11-28 18:38:25 -08:00
parent 9f94da43d1
commit 5aecdffead
4 changed files with 24 additions and 6 deletions

View File

@ -1,5 +1,5 @@
{
"name": "ScriptHaus",
"name": "Prompt",
"version": "1.0.0",
"main": "dist/emain.js",
"license": "Proprietary",

View File

@ -14,6 +14,7 @@ const ScriptHausAppPathVarName = "SCRIPTHAUS_APP_PATH";
let isDev = (process.env.SH_DEV != null);
let scHome = getScHomeDir();
ensureDir(scHome);
let DistDir = (isDev ? "dist-dev" : "dist");
// these are either "darwin/amd64" or "darwin/arm64"
// normalize darwin/x64 to darwin/amd64 for GOARCH compatibility
@ -91,7 +92,7 @@ function ensureDir(dir) {
}
let app = electron.app;
app.setName("ScriptHaus");
app.setName("Prompt");
let lock : File;
try {
@ -144,10 +145,11 @@ function createMainWindow(clientData) {
width: bounds.width,
height: bounds.height,
webPreferences: {
preload: path.join(getAppBasePath(), "dist", "preload.js"),
preload: path.join(getAppBasePath(), DistDir, "preload.js"),
},
});
win.loadFile(path.join(getAppBasePath(), "static", "index.html"));
let indexHtml = (isDev ? "index-dev.html" : "index.html");
win.loadFile(path.join(getAppBasePath(), "static", indexHtml));
win.webContents.on("before-input-event", (e, input) => {
if (input.type != "keyDown") {
return;

15
static/index-dev.html Normal file
View File

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<base href="../">
<script charset="UTF-8" src="dist-dev/sh2.js"></script>
<link rel="stylesheet" href="static/bulma-0.9.4.min.css">
<link rel="stylesheet" href="static/font-awesome.min.css">
<link rel="stylesheet" href="static/xterm.css" />
<link rel="stylesheet" href="dist-dev/sh2.css" />
</head>
<body>
<div id="app"></div>
</body>
</html>

View File

@ -1,12 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<base href="../">
<script src="dist-dev/sh2.js"></script>
<script charset="UTF-8" src="dist/sh2.js"></script>
<link rel="stylesheet" href="static/bulma-0.9.4.min.css">
<link rel="stylesheet" href="static/font-awesome.min.css">
<link rel="stylesheet" href="static/xterm.css" />
<link rel="stylesheet" href="dist-dev/sh2.css" />
<link rel="stylesheet" href="dist/sh2.css" />
</head>
<body>
<div id="app"></div>