Skip to content

Commit

Permalink
Merge pull request #29 from SlimeVR/fix/firmware-protocol-debugger/esm
Browse files Browse the repository at this point in the history
fix(firmware-protocol-debugger,firmware-protocol-debugger-gui): doesn't start with the ESM changes
  • Loading branch information
TheDevMinerTV authored Jun 6, 2024
2 parents 16bbb17 + fa0f33c commit b403e83
Show file tree
Hide file tree
Showing 15 changed files with 1,138 additions and 365 deletions.
6 changes: 6 additions & 0 deletions .changeset/eighty-bats-hunt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'slimevr-firmware-protocol-debugger-gui': patch
'@slimevr/firmware-protocol-debugger': patch
---

fixed startup
13 changes: 8 additions & 5 deletions apps/firmware-protocol-debugger-gui/backend/src/electron/main.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { SerializedTracker, ServerStatus } from '@slimevr/firmware-protocol-debugger-shared';
import { BrowserWindow, app, ipcMain } from 'electron';
import { join } from 'node:path';
import merge from 'ts-deepmerge';
import { Server } from '../Server';
import { merge } from 'ts-deepmerge';
import { Server } from '../Server.js';

let mainWindow: BrowserWindow | null;

Expand Down Expand Up @@ -74,11 +74,13 @@ const createWindow = async () => {
height: 600,
width: 800,
webPreferences: {
preload: join(__dirname, 'preload.js')
preload: join(import.meta.dirname, 'preload.mjs')
}
});

const url = app.isPackaged ? `file://${__dirname}/../../index.html` : (process.env.ELECTRON_START_URL as string);
const url = app.isPackaged
? `file://${import.meta.dirname}/../../index.html`
: (process.env.ELECTRON_START_URL as string);

console.log(url);

Expand All @@ -93,10 +95,11 @@ const createWindow = async () => {
// .default(devtoolsInstaller.REDUX_DEVTOOLS)
// .then((name) => console.log(`Added Extension: ${name}`))
// .catch((err) => console.log('An error occurred: ', err));

mainWindow.webContents.openDevTools();
}

mainWindow.loadURL(url);
mainWindow.webContents.openDevTools();
};

app.on('ready', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SerializedTracker, ServerStatus } from '@slimevr/firmware-protocol-debugger-shared';
import { type SerializedTracker, type ServerStatus } from '@slimevr/firmware-protocol-debugger-shared';
import { contextBridge, ipcRenderer } from 'electron';

contextBridge.exposeInMainWorld('api', {
Expand Down
9 changes: 6 additions & 3 deletions apps/firmware-protocol-debugger-gui/backend/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"extends": "@slimevr/tsconfig/electron.json",
"include": ["src/**/*.ts"],
"exclude": ["dist", "build", "node_modules"],
"exclude": ["dist", "build", "node_modules", "src/electron/preload.mts"],
"compilerOptions": {
"target": "ES2022",
"outDir": "../build/backend"
"target": "ESNext",
"module": "NodeNext",
"esModuleInterop": true,
"outDir": "../build/backend",
"moduleResolution": "NodeNext"
}
}
12 changes: 12 additions & 0 deletions apps/firmware-protocol-debugger-gui/backend/tsconfig.preload.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "@slimevr/tsconfig/electron.json",
"include": ["src/electron/preload.mts"],
"exclude": ["dist", "build", "node_modules"],
"compilerOptions": {
"target": "ESNext",
"module": "CommonJS",
"esModuleInterop": true,
"outDir": "../build/backend/electron",
"moduleResolution": "Node"
}
}
52 changes: 28 additions & 24 deletions apps/firmware-protocol-debugger-gui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"main": "build/backend/electron/main.js",
"license": "(MIT OR Apache-2.0)",
"private": true,
"type": "module",
"homepage": ".",
"author": {
"name": "DevMiner",
Expand All @@ -17,43 +18,46 @@
"url": "https://github.com/SlimeVR/slimevr-node/issues"
},
"dependencies": {
"@react-three/fiber": "^8.13.6",
"@react-three/fiber": "^8.16.8",
"@slimevr/common": "workspace:*",
"@slimevr/firmware-protocol": "workspace:*",
"@slimevr/firmware-protocol-debugger-utils": "workspace:*",
"@slimevr/firmware-protocol-debugger-shared": "workspace:*",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"@slimevr/firmware-protocol-debugger-utils": "workspace:*",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"strict-event-emitter-types": "^2.0.0",
"three": "^0.155.0",
"ts-deepmerge": "^6.2.0",
"zustand": "^4.4.0"
"three": "^0.165.0",
"ts-deepmerge": "^7.0.0",
"zustand": "^4.5.2"
},
"devDependencies": {
"@slimevr/tsconfig": "workspace:*",
"@types/node": "^18.17.2",
"@types/react": "^18.2.18",
"@types/react-dom": "^18.2.7",
"@types/three": "^0.155.0",
"@vitejs/plugin-react": "^4.0.4",
"autoprefixer": "10.4.14",
"concurrently": "^8.2.0",
"@types/node": "^20.14.2",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@types/three": "^0.165.0",
"@vitejs/plugin-react": "^4.3.0",
"autoprefixer": "10.4.19",
"concurrently": "^8.2.2",
"cross-env": "^7.0.3",
"electron": "^25.4.0",
"electron-builder": "^24.6.3",
"electron": "^30.1.0",
"electron-builder": "^24.13.3",
"electron-devtools-installer": "^3.2.0",
"eslint-plugin-react": "^7.33.1",
"postcss": "8.4.27",
"tailwindcss": "^3.3.3",
"typescript": "^5.1.6",
"wait-for-it": "1.0.0",
"vite": "4.4.8"
"eslint-plugin-react": "^7.34.2",
"postcss": "8.4.38",
"tailwindcss": "^3.4.4",
"vite": "5.2.12",
"wait-for-it": "1.0.0"
},
"scripts": {
"postinstall": "electron-builder install-app-deps",
"dev": "concurrently --names 'be-tsc,fe,be-electron' \"tsc -w -p backend/tsconfig.json\" \"vite\" \"npm run dev:electron\"",
"dev": "concurrently --names 'be-tsc,pr-tsc,fe,be-electron' \"pnpm run build:backend -w\" \"pnpm run build:preload -w\" \"vite\" \"npm run dev:electron\"",
"dev:electron": "cross-env ELECTRON_START_URL=http://localhost:5173 electron .",
"build": "vite build && tsc -p backend/tsconfig.json && electron-builder --publish never",
"build": "pnpm run build:frontend && pnpm run build:backend && pnpm run build:preload && pnpm run build:electron",
"build:frontend": "vite build",
"build:backend": "tsc -p backend/tsconfig.json",
"build:preload": "tsc -p backend/tsconfig.preload.json",
"build:electron": "electron-builder --publish never",
"dist": "electron-builder",
"pack": "electron-builder --dir",
"clean": "rimraf dist build"
Expand Down
2 changes: 1 addition & 1 deletion apps/firmware-protocol-debugger-gui/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
plugins: {
tailwindcss: {},
autoprefixer: {}
Expand Down
2 changes: 1 addition & 1 deletion apps/firmware-protocol-debugger-gui/src/store.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SerializedTracker, ServerStatus } from '@slimevr/firmware-protocol-debugger-shared';
import create from 'zustand';
import { create } from 'zustand';
import { devtools } from 'zustand/middleware';

export type Store = {
Expand Down
4 changes: 3 additions & 1 deletion apps/firmware-protocol-debugger-gui/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
const config = {
content: ['./src/components/**/*.{ts,tsx}'],
theme: {
extend: {
Expand All @@ -25,3 +25,5 @@ module.exports = {
},
plugins: []
};

export default config;
2 changes: 2 additions & 0 deletions apps/firmware-protocol-debugger-gui/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"exclude": ["dist", "build", "node_modules"],
"compilerOptions": {
"target": "ES2017",
"module": "ESNext",
"moduleResolution": "Bundler",
"outDir": "build"
}
}
2 changes: 1 addition & 1 deletion apps/firmware-protocol-debugger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.2.10",
"main": "dist/index.js",
"license": "(MIT OR Apache-2.0)",
"homepage": ".",
"type": "module",
"author": {
"name": "DevMiner",
"email": "devminer@devminer.xyz"
Expand Down
2 changes: 1 addition & 1 deletion apps/firmware-protocol-debugger/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Server } from './Server';
import { Server } from './Server.js';

const server = new Server();

Expand Down
1 change: 1 addition & 0 deletions apps/firmware-protocol-debugger/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"exclude": ["dist", "build", "node_modules"],
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"outDir": "./dist"
}
}
3 changes: 2 additions & 1 deletion packages/tsconfig/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Default",
"compilerOptions": {
"target": "ES2020",
"composite": false,
"declaration": true,
"declarationMap": true,
Expand All @@ -14,7 +15,7 @@
"noUnusedParameters": false,
"preserveWatchOutput": true,
"skipLibCheck": true,
"strict": true
"strict": true,
},
"exclude": ["node_modules"]
}
Loading

0 comments on commit b403e83

Please sign in to comment.