electron build

This commit is contained in:
Olivier Gagnon 2021-09-15 12:22:36 -04:00
parent bd26e2f9ca
commit ac80be1b40
7 changed files with 2447 additions and 53 deletions

5
.gitignore vendored

@ -1,3 +1,4 @@
.DS_Store
.vscode
Changelog.txt
Netburner.txt
@ -9,5 +10,9 @@ Netburner.txt
/test/*.css
.cypress
# tmp folder for electron
.package
.build
# editor files
.vscode

BIN
electron/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

19
electron/main.js Normal file

@ -0,0 +1,19 @@
const { app, BrowserWindow, Menu } = require("electron");
Menu.setApplicationMenu(false);
function createWindow() {
const win = new BrowserWindow({
show: false,
webPreferences: {
devTools: false,
},
});
win.removeMenu();
win.maximize();
win.loadFile("index.html");
win.show();
}
app.whenReady().then(() => {
createWindow();
});

7
electron/package.json Executable file

@ -0,0 +1,7 @@
{
"name": "bitburner",
"version": "1.0.0",
"description": "A cyberpunk-themed programming incremental game",
"main": "main.js",
"author": "Daniel Xie"
}

2437
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -1,4 +1,9 @@
{
"name": "bitburner",
"license": "SEE LICENSE IN license.txt",
"version": "0.53.0",
"main": "electron-main.js",
"author": {
"name": "Daniel Xie"
},
@ -114,14 +119,14 @@
"webpack-cli": "^3.3.12",
"webpack-dev-middleware": "^3.7.3",
"webpack-dev-server": "^3.11.2",
"worker-loader": "^2.0.0"
"worker-loader": "^2.0.0",
"electron": "^14.0.1",
"electron-packager": "^15.4.0"
},
"engines": {
"node": ">=8 || <=9"
},
"homepage": "https://github.com/danielyxie/bitburner",
"license": "SEE LICENSE IN license.txt",
"name": "bitburner",
"repository": {
"type": "git",
"url": "git+https://github.com/danielyxie/bitburner.git"
@ -135,7 +140,6 @@
"start": "http-server -p 8000",
"start:dev": "webpack-dev-server --progress --env.devServer --mode development",
"start:container": "webpack-dev-server --progress --env.devServer --mode development --env.runInContainer",
"build": "webpack --mode production",
"build:dev": "webpack --mode development",
"lint": "npm run lint:jsts & npm run lint:style",
"lint:jsts": "eslint --fix . --ext js,jsx,ts,tsx",
@ -144,7 +148,7 @@
"test": "jest",
"test:watch": "jest --watch",
"watch": "webpack --watch --mode production",
"watch:dev": "webpack --watch --mode development"
},
"version": "0.53.0"
"watch:dev": "webpack --watch --mode development",
"package-electron": "electron-packager .package bitburner --all --out .build --overwrite --icon .package/icon.png"
}
}

14
package.sh Executable file

@ -0,0 +1,14 @@
# npm install electron --save-dev
# npm install electron-packager --save-dev
mkdir -p .package/dist || true
cp index.html .package
cp electron/* .package
cp dist/engine.bundle.js .package/dist
cp dist/engineStyle.css .package/dist
cp dist/vendor.css .package/dist
cp dist/engineStyle.bundle.js .package/dist
cp dist/vendor.bundle.js .package/dist
npm run package-electron