dev: add emulator prod deployment

This commit is contained in:
KernelDeimos 2024-09-18 16:20:11 -04:00
parent dfb2523bd6
commit 6ec3c8b653
2 changed files with 11 additions and 3 deletions

View File

@ -1,5 +1,9 @@
"use strict"; "use strict";
console.log(`emulator running in mode: ${MODE}`)
const PATH_V86 = MODE === 'dev' ? '/vendor/v86' : './vendor/v86';
const { XDocumentPTT } = require("../../phoenix/src/pty/XDocumentPTT"); const { XDocumentPTT } = require("../../phoenix/src/pty/XDocumentPTT");
const { const {
NewWispPacketStream, NewWispPacketStream,
@ -132,15 +136,15 @@ window.onload = async function()
); );
const arrayBuffer = await resp.arrayBuffer(); const arrayBuffer = await resp.arrayBuffer();
var emulator = window.emulator = new V86({ var emulator = window.emulator = new V86({
wasm_path: "/vendor/v86/v86.wasm", wasm_path: PATH_V86 + "/v86.wasm",
memory_size: 512 * 1024 * 1024, memory_size: 512 * 1024 * 1024,
vga_memory_size: 2 * 1024 * 1024, vga_memory_size: 2 * 1024 * 1024,
screen_container: document.getElementById("screen_container"), screen_container: document.getElementById("screen_container"),
bios: { bios: {
url: "/vendor/v86/bios/seabios.bin", url: PATH_V86 + "/bios/seabios.bin",
}, },
vga_bios: { vga_bios: {
url: "/vendor/v86/bios/vgabios.bin", url: PATH_V86 + "/bios/vgabios.bin",
}, },
initrd: { initrd: {

View File

@ -1,4 +1,5 @@
const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin');
const DefinePlugin = require('webpack').DefinePlugin;
module.exports = { module.exports = {
entry: [ entry: [
@ -8,5 +9,8 @@ module.exports = {
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: 'assets/template.html' template: 'assets/template.html'
}), }),
new DefinePlugin({
MODE: JSON.stringify(process.env.MODE ?? 'dev')
}),
] ]
}; };