Skip to content

Commit

Permalink
πŸ“ˆ add draft of bossfight telemetry viewer (#258)
Browse files Browse the repository at this point in the history
* πŸŽ‰ add boilerplate electron app for telemetry
https://www.electronjs.org/docs/latest/tutorial/quick-start#scaffold-the-project

* βž• add esbuild for bundling

* πŸ”§ disable yarn pnp
- it just causes problems man

* βž• convert telemetry app to typescript

* πŸ”¨ convert esbuild to watch script

* ✨ decode bossfight root tag

* ✨ decode bossfight events

* πŸ”¨ add rebuild log

* 🚚 rename `telemetry` -> `telemetry-old`

* πŸŽ‰ add boilerplate electron-vite app
- too many frameworks dawg

* πŸ’„ update app logo

* ✨ render event time ticks

* πŸ’„ add dynamic heights to timestamps

* πŸ’„ fix multiple timelines on same row
- and increase width between ticks

* ✨ show event datapoints and convert tick rate to be regular interval

* ✨ add inspect on event click
- just shows a rect for now

* ✨ add inspect toggle

* πŸ’„ adjust position of inspect box
- top left corner of inspect is centered on event point

* ✨ add data object and name on hover to inspect boxes

* ♻️ convert remove toggle check to guard clause

* ✨ add color schema for events

* ✨ add character icons for events

* ✨ add name on hover for event points

* 🚸 disable opening empty inspect boxes

* πŸ’„ add stop event icons
- win
- death
- missing

* πŸ’„ add more event icons

* ✨ add horizontal zoom in/out

* πŸ”₯ delete old telemetry dir

* πŸ’„ update window title

* ⚰️ remove redundant eslintignore entry

* πŸ’š fix root linter not ignoring telemetry dir
- it should have its own linting (eventually?)
  • Loading branch information
TheAfroOfDoom authored Nov 1, 2024
1 parent 9d732e8 commit b4ebb25
Show file tree
Hide file tree
Showing 45 changed files with 6,890 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Ignore datapack/resourcepack
datapacks
resourcepack

telemetry
5 changes: 0 additions & 5 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/.yarn/** linguist-vendored
/.yarn/releases/* binary
/.yarn/plugins/**/* binary
/.pnp.* binary linguist-generated

datapacks/gu/** linguist-vendored

*.ajblueprint linguist-language=JSON
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# yarn dependencies
.yarn
.pnp*
node_modules

# auto-ajexport related
**/last_exported_hashes.json
Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Ignore datapack/resourcepack
datapacks
resourcepack

telemetry
7 changes: 2 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"search.exclude": {
"**/.yarn": true,
"**/.pnp.*": true
},
"eslint.nodePath": ".yarn/sdks",
"prettier.prettierPath": ".yarn/sdks/prettier/index.cjs"
"**/.yarn": true
}
}
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# save exact npm package by default when running `yarn add`
defaultSemverRangePrefix: ''
nodeLinker: node-modules
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ Since then I've gained a lot of skills both in Minecraft map development and in
1. Install [`Node.js >= 16.10`](https://nodejs.org/en/download)
2. Install [`Yarn 3.6.3`](https://v3.yarnpkg.com/getting-started/install) by running `corepack enable`
3. Initialize the repo by running `yarn`
4. Enable Yarn's Plug'n'Play with VSCode by running `yarn dlx @yarnpkg/sdks vscode`
5. Copy-paste `.env.EXAMPLE` and rename it to `.env`
4. Copy-paste `.env.EXAMPLE` and rename it to `.env`

1. Replace all the paths in your new `.env` with paths on your local machine -- e.g. replacing `afro` with `<YOUR_USERNAME>`.

Expand All @@ -48,7 +47,7 @@ Since then I've gained a lot of skills both in Minecraft map development and in

1. **Make sure to point to the doubly nested folder** -- e.g. `.../versions/1.21/1.21`

6. Run `yarn down` to extract the Minecraft world to your local Minecraft's `saves` directory (so you can open the world in-game)
5. Run `yarn down` to extract the Minecraft world to your local Minecraft's `saves` directory (so you can open the world in-game)

</details>

Expand Down
4 changes: 3 additions & 1 deletion omegaflowey.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@
],
"gitmoji.showEmojiCode": true,

"terminal.integrated.cwd": "."
"terminal.integrated.cwd": ".",

"typescript.enablePromptUseWorkspaceTsdk": true
}
}
3 changes: 3 additions & 0 deletions package-scripts/run-linting-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ const main = () => {
let errorCount = 0;
const excludePatterns = exclude?.split(',') ?? [];
excludePatterns.push('build/**');
excludePatterns.push('**/node_modules/**');
excludePatterns.push('tmp/**');
excludePatterns.push('telemetry/**');
const paths = globSync(include, { ignore: excludePatterns });
const files = paths.filter((path) => lstatSync(path).isFile());

Expand Down
9 changes: 9 additions & 0 deletions telemetry/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
4 changes: 4 additions & 0 deletions telemetry/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
out
.gitignore
23 changes: 23 additions & 0 deletions telemetry/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
parserOptions: {
extraFileExtensions: ['.svelte']
},
extends: [
'eslint:recommended',
'plugin:svelte/recommended',
'@electron-toolkit/eslint-config-ts/recommended',
'@electron-toolkit/eslint-config-prettier'
],
overrides: [
{
files: ['*.svelte'],
parser: 'svelte-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser'
}
}
],
rules: {
'svelte/no-unused-svelte-ignore': 'off'
}
}
5 changes: 5 additions & 0 deletions telemetry/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
dist
out
.DS_Store
*.log*
6 changes: 6 additions & 0 deletions telemetry/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
out
dist
pnpm-lock.yaml
LICENSE.md
tsconfig.json
tsconfig.*.json
10 changes: 10 additions & 0 deletions telemetry/.prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
singleQuote: true
semi: false
printWidth: 100
trailingComma: none
plugins:
- prettier-plugin-svelte
overrides:
- files: '*.svelte'
options:
parser: svelte
3 changes: 3 additions & 0 deletions telemetry/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["dbaeumer.vscode-eslint"]
}
39 changes: 39 additions & 0 deletions telemetry/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Main Process",
"type": "node",
"request": "launch",
"cwd": "${workspaceRoot}",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron-vite",
"windows": {
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron-vite.cmd"
},
"runtimeArgs": ["--sourcemap"],
"env": {
"REMOTE_DEBUGGING_PORT": "9222"
}
},
{
"name": "Debug Renderer Process",
"port": 9222,
"request": "attach",
"type": "chrome",
"webRoot": "${workspaceFolder}/src/renderer",
"timeout": 60000,
"presentation": {
"hidden": true
}
}
],
"compounds": [
{
"name": "Debug All",
"configurations": ["Debug Main Process", "Debug Renderer Process"],
"presentation": {
"order": 1
}
}
]
}
20 changes: 20 additions & 0 deletions telemetry/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[svelte]": {
"editor.defaultFormatter": "svelte.svelte-vscode"
},
"svelte.enable-ts-plugin": true,
"eslint.validate": [
"javascript",
"javascriptreact",
"svelte"
]
}
34 changes: 34 additions & 0 deletions telemetry/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# telemetry

An Electron application with Svelte and TypeScript

## Recommended IDE Setup

- [VSCode](https://code.visualstudio.com/) + [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) + [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) + [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode)

## Project Setup

### Install

```bash
$ yarn
```

### Development

```bash
$ yarn dev
```

### Build

```bash
# For windows
$ yarn build:win

# For macOS
$ yarn build:mac

# For Linux
$ yarn build:linux
```
43 changes: 43 additions & 0 deletions telemetry/electron-builder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
appId: com.electron.app
productName: telemetry
directories:
buildResources: build
files:
- '!**/.vscode/*'
- '!src/*'
- '!electron.vite.config.{js,ts,mjs,cjs}'
- '!{.eslintignore,.eslintrc.cjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}'
- '!{.env,.env.*,.npmrc,pnpm-lock.yaml}'
- '!{tsconfig.json,tsconfig.node.json,tsconfig.web.json}'
asarUnpack:
- resources/**
win:
executableName: telemetry
nsis:
artifactName: ${name}-${version}-setup.${ext}
shortcutName: ${productName}
uninstallDisplayName: ${productName}
createDesktopShortcut: always
mac:
entitlementsInherit: build/entitlements.mac.plist
extendInfo:
- NSCameraUsageDescription: Application requests access to the device's camera.
- NSMicrophoneUsageDescription: Application requests access to the device's microphone.
- NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder.
- NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
notarize: false
dmg:
artifactName: ${name}-${version}.${ext}
linux:
target:
- AppImage
- snap
- deb
maintainer: electronjs.org
category: Utility
appImage:
artifactName: ${name}-${version}.${ext}
npmRebuild: false
publish:
provider: generic
url: https://example.com/auto-updates
14 changes: 14 additions & 0 deletions telemetry/electron.vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'

export default defineConfig({
main: {
plugins: [externalizeDepsPlugin()]
},
preload: {
plugins: [externalizeDepsPlugin()]
},
renderer: {
plugins: [svelte()]
}
})
50 changes: 50 additions & 0 deletions telemetry/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "telemetry",
"version": "1.0.0",
"description": "An Electron application with Svelte and TypeScript",
"main": "./out/main/index.js",
"author": "example.com",
"homepage": "https://electron-vite.org",
"scripts": {
"format": "prettier --plugin prettier-plugin-svelte --write .",
"lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix",
"typecheck:node": "tsc --noEmit -p tsconfig.node.json --composite false",
"svelte-check": "svelte-check --tsconfig ./tsconfig.json",
"typecheck": "npm run typecheck:node && npm run svelte-check",
"start": "electron-vite preview",
"dev": "electron-vite dev",
"build": "npm run typecheck && electron-vite build",
"postinstall": "electron-builder install-app-deps",
"build:unpack": "npm run build && electron-builder --dir",
"build:win": "npm run build && electron-builder --win",
"build:mac": "npm run build && electron-builder --mac",
"build:linux": "npm run build && electron-builder --linux"
},
"dependencies": {
"@electron-toolkit/preload": "^3.0.1",
"@electron-toolkit/utils": "^3.0.0",
"d3": "7.9.0",
"json5": "2.2.3"
},
"devDependencies": {
"@electron-toolkit/eslint-config-prettier": "^2.0.0",
"@electron-toolkit/eslint-config-ts": "^2.0.0",
"@electron-toolkit/tsconfig": "^1.0.1",
"@sveltejs/vite-plugin-svelte": "^3.1.1",
"@types/d3": "7.4.3",
"@types/json5": "2.2.0",
"@types/node": "^20.14.8",
"electron": "^31.0.2",
"electron-builder": "^24.13.3",
"electron-vite": "2.3.0",
"eslint": "^8.57.0",
"eslint-plugin-svelte": "^2.41.0",
"prettier": "^3.3.2",
"prettier-plugin-svelte": "^3.2.5",
"svelte": "^4.2.18",
"svelte-check": "^3.8.2",
"tslib": "^2.6.3",
"typescript": "^5.5.2",
"vite": "^5.3.1"
}
}
Binary file added telemetry/resources/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit b4ebb25

Please sign in to comment.