Compare commits
5 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
425cf520bc | ||
|
|
cdd0f6c072 | ||
|
|
c918249897 | ||
|
|
1e622d68b6 | ||
|
|
80e5943c88 |
10 changed files with 368 additions and 677 deletions
11
.github/workflows/benchmark.yml
vendored
11
.github/workflows/benchmark.yml
vendored
|
|
@ -13,17 +13,17 @@ jobs:
|
||||||
(
|
(
|
||||||
github.event_name == 'issue_comment' &&
|
github.event_name == 'issue_comment' &&
|
||||||
github.event.issue.pull_request != '' &&
|
github.event.issue.pull_request != '' &&
|
||||||
contains(github.event.comment.body, '/benchmark')
|
(startsWith(github.event.comment.body, '/benchmark'))
|
||||||
)
|
)
|
||||||
permissions:
|
permissions:
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
steps:
|
steps:
|
||||||
- run: lscpu
|
- run: lscpu
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
# with:
|
- name: Setup pnpm
|
||||||
# ref: refs/pull/${{ github.event.issue.number }}/head
|
uses: pnpm/action-setup@v4
|
||||||
- run: npm i -g pnpm@9.0.4
|
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 18
|
||||||
|
|
@ -33,8 +33,10 @@ jobs:
|
||||||
jq '.dependencies.cypress = .optionalDependencies.cypress | del(.optionalDependencies.cypress)' package.json > package.json.tmp
|
jq '.dependencies.cypress = .optionalDependencies.cypress | del(.optionalDependencies.cypress)' package.json > package.json.tmp
|
||||||
mv package.json.tmp package.json
|
mv package.json.tmp package.json
|
||||||
- run: pnpm install --no-frozen-lockfile
|
- run: pnpm install --no-frozen-lockfile
|
||||||
|
|
||||||
- run: pnpm build
|
- run: pnpm build
|
||||||
- run: nohup pnpm prod-start &
|
- run: nohup pnpm prod-start &
|
||||||
|
|
||||||
- run: pnpm test:benchmark
|
- run: pnpm test:benchmark
|
||||||
id: benchmark
|
id: benchmark
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
@ -49,6 +51,7 @@ jobs:
|
||||||
else
|
else
|
||||||
echo "BENCHMARK_RESULT=Benchmark failed to run or produce results" >> $GITHUB_ENV
|
echo "BENCHMARK_RESULT=Benchmark failed to run or produce results" >> $GITHUB_ENV
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- uses: mshick/add-pr-comment@v2
|
- uses: mshick/add-pr-comment@v2
|
||||||
with:
|
with:
|
||||||
allow-repeats: true
|
allow-repeats: true
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,10 @@ After forking the repository, run the following commands to get started:
|
||||||
4. Let us know if you are working on something and be sure to open a PR if you got any changes. Happy coding!
|
4. Let us know if you are working on something and be sure to open a PR if you got any changes. Happy coding!
|
||||||
|
|
||||||
*(1): If you are getting `Cannot find matching keyid` update corepack to the latest version with `npm i -g corepack`.
|
*(1): If you are getting `Cannot find matching keyid` update corepack to the latest version with `npm i -g corepack`.
|
||||||
|
|
||||||
*(2): If still something doesn't work ensure you have the right nodejs version with `node -v` (tested on 22.x)
|
*(2): If still something doesn't work ensure you have the right nodejs version with `node -v` (tested on 22.x)
|
||||||
*(3): For GitHub codespaces (cloud ide): Run `pnpm i @rsbuild/core@1.2.4 @rsbuild/plugin-node-polyfill@1.3.0 @rsbuild/plugin-react@1.1.0 @rsbuild/plugin-typed-css-modules@1.0.2` command to avoid crashes because of limited ram
|
|
||||||
|
<!-- *(3): For GitHub codespaces (cloud ide): Run `pnpm i @rsbuild/core@1.2.4 @rsbuild/plugin-node-polyfill@1.3.0 @rsbuild/plugin-react@1.1.0 @rsbuild/plugin-typed-css-modules@1.0.2` command to avoid crashes because of limited ram -->
|
||||||
|
|
||||||
## Project Structure
|
## Project Structure
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ FROM node:18-alpine AS build
|
||||||
RUN apk add git
|
RUN apk add git
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . /app
|
COPY . /app
|
||||||
# install pnpm
|
# install pnpm with corepack
|
||||||
RUN npm i -g pnpm@9.0.4
|
RUN corepack enable
|
||||||
# Build arguments
|
# Build arguments
|
||||||
ARG DOWNLOAD_SOUNDS=false
|
ARG DOWNLOAD_SOUNDS=false
|
||||||
ARG DISABLE_SERVICE_WORKER=false
|
ARG DISABLE_SERVICE_WORKER=false
|
||||||
|
|
@ -35,7 +35,7 @@ WORKDIR /app
|
||||||
COPY --from=build /app/dist /app/dist
|
COPY --from=build /app/dist /app/dist
|
||||||
COPY server.js /app/server.js
|
COPY server.js /app/server.js
|
||||||
# Install express
|
# Install express
|
||||||
RUN npm i -g pnpm@9.0.4
|
RUN npm corepack enable
|
||||||
RUN npm init -yp
|
RUN npm init -yp
|
||||||
RUN pnpm i express github:zardoy/prismarinejs-net-browserify compression cors
|
RUN pnpm i express github:zardoy/prismarinejs-net-browserify compression cors
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
|
||||||
34
package.json
34
package.json
|
|
@ -81,13 +81,13 @@
|
||||||
"google-drive-browserfs": "github:zardoy/browserfs#google-drive",
|
"google-drive-browserfs": "github:zardoy/browserfs#google-drive",
|
||||||
"jszip": "^3.10.1",
|
"jszip": "^3.10.1",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
|
"mcraft-fun-mineflayer": "^0.1.14",
|
||||||
"minecraft-data": "3.83.1",
|
"minecraft-data": "3.83.1",
|
||||||
"minecraft-protocol": "github:PrismarineJS/node-minecraft-protocol#master",
|
"minecraft-protocol": "github:PrismarineJS/node-minecraft-protocol#master",
|
||||||
"mineflayer-item-map-downloader": "github:zardoy/mineflayer-item-map-downloader",
|
"mineflayer-item-map-downloader": "github:zardoy/mineflayer-item-map-downloader",
|
||||||
"mojangson": "^2.0.4",
|
"mojangson": "^2.0.4",
|
||||||
"net-browserify": "github:zardoy/prismarinejs-net-browserify",
|
"net-browserify": "github:zardoy/prismarinejs-net-browserify",
|
||||||
"node-gzip": "^1.1.2",
|
"node-gzip": "^1.1.2",
|
||||||
"mcraft-fun-mineflayer": "^0.1.14",
|
|
||||||
"peerjs": "^1.5.0",
|
"peerjs": "^1.5.0",
|
||||||
"pixelarticons": "^1.8.1",
|
"pixelarticons": "^1.8.1",
|
||||||
"pretty-bytes": "^6.1.1",
|
"pretty-bytes": "^6.1.1",
|
||||||
|
|
@ -119,11 +119,11 @@
|
||||||
"workbox-build": "^7.0.0"
|
"workbox-build": "^7.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rsbuild/core": "1.0.1-beta.9",
|
"@rsbuild/core": "1.3.5",
|
||||||
"@rsbuild/plugin-node-polyfill": "1.0.3",
|
"@rsbuild/plugin-node-polyfill": "1.3.0",
|
||||||
"@rsbuild/plugin-react": "1.0.1-beta.9",
|
"@rsbuild/plugin-react": "1.2.0",
|
||||||
"@rsbuild/plugin-type-check": "1.0.1-beta.9",
|
"@rsbuild/plugin-type-check": "1.2.1",
|
||||||
"@rsbuild/plugin-typed-css-modules": "1.0.1",
|
"@rsbuild/plugin-typed-css-modules": "1.0.2",
|
||||||
"@storybook/addon-essentials": "^7.4.6",
|
"@storybook/addon-essentials": "^7.4.6",
|
||||||
"@storybook/addon-links": "^7.4.6",
|
"@storybook/addon-links": "^7.4.6",
|
||||||
"@storybook/blocks": "^7.4.6",
|
"@storybook/blocks": "^7.4.6",
|
||||||
|
|
@ -152,16 +152,16 @@
|
||||||
"http-server": "^14.1.1",
|
"http-server": "^14.1.1",
|
||||||
"https-browserify": "^1.0.0",
|
"https-browserify": "^1.0.0",
|
||||||
"mc-assets": "^0.2.52",
|
"mc-assets": "^0.2.52",
|
||||||
"mineflayer-mouse": "^0.1.7",
|
|
||||||
"minecraft-inventory-gui": "github:zardoy/minecraft-inventory-gui#next",
|
"minecraft-inventory-gui": "github:zardoy/minecraft-inventory-gui#next",
|
||||||
"mineflayer": "github:GenerelSchwerz/mineflayer",
|
"mineflayer": "github:GenerelSchwerz/mineflayer",
|
||||||
|
"mineflayer-mouse": "^0.1.7",
|
||||||
"mineflayer-pathfinder": "^2.4.4",
|
"mineflayer-pathfinder": "^2.4.4",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
"os-browserify": "^0.3.0",
|
"os-browserify": "^0.3.0",
|
||||||
"path-browserify": "^1.0.1",
|
"path-browserify": "^1.0.1",
|
||||||
"path-exists-cli": "^2.0.0",
|
"path-exists-cli": "^2.0.0",
|
||||||
"renderer": "link:renderer",
|
|
||||||
"process": "github:PrismarineJS/node-process",
|
"process": "github:PrismarineJS/node-process",
|
||||||
|
"renderer": "link:renderer",
|
||||||
"rimraf": "^5.0.1",
|
"rimraf": "^5.0.1",
|
||||||
"storybook": "^7.4.6",
|
"storybook": "^7.4.6",
|
||||||
"stream-browserify": "^3.0.0",
|
"stream-browserify": "^3.0.0",
|
||||||
|
|
@ -214,11 +214,21 @@
|
||||||
"ignoreDependencies": []
|
"ignoreDependencies": []
|
||||||
},
|
},
|
||||||
"patchedDependencies": {
|
"patchedDependencies": {
|
||||||
"three@0.154.0": "patches/three@0.154.0.patch",
|
|
||||||
"pixelarticons@1.8.1": "patches/pixelarticons@1.8.1.patch",
|
"pixelarticons@1.8.1": "patches/pixelarticons@1.8.1.patch",
|
||||||
"mineflayer-item-map-downloader@1.2.0": "patches/mineflayer-item-map-downloader@1.2.0.patch",
|
"mineflayer-item-map-downloader@1.2.0": "patches/mineflayer-item-map-downloader@1.2.0.patch",
|
||||||
"minecraft-protocol@1.54.0": "patches/minecraft-protocol@1.54.0.patch"
|
"minecraft-protocol": "patches/minecraft-protocol.patch"
|
||||||
}
|
},
|
||||||
|
"ignoredBuiltDependencies": [
|
||||||
|
"canvas",
|
||||||
|
"core-js",
|
||||||
|
"gl",
|
||||||
|
"sharp"
|
||||||
|
],
|
||||||
|
"onlyBuiltDependencies": [
|
||||||
|
"cypress",
|
||||||
|
"esbuild",
|
||||||
|
"fsevents"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@9.0.4"
|
"packageManager": "pnpm@10.8.0+sha512.0e82714d1b5b43c74610193cb20734897c1d00de89d0e18420aebc5977fa13d780a9cb05734624e81ebd81cc876cd464794850641c48b9544326b5622ca29971"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
diff --git a/examples/jsm/webxr/VRButton.js b/examples/jsm/webxr/VRButton.js
|
|
||||||
index 6856a21b17aa45d7922bbf776fd2d7e63c7a9b4e..0925b706f7629bd52f0bb5af469536af8f5fce2c 100644
|
|
||||||
--- a/examples/jsm/webxr/VRButton.js
|
|
||||||
+++ b/examples/jsm/webxr/VRButton.js
|
|
||||||
@@ -62,7 +62,10 @@ class VRButton {
|
|
||||||
// ('local' is always available for immersive sessions and doesn't need to
|
|
||||||
// be requested separately.)
|
|
||||||
|
|
||||||
- const sessionInit = { optionalFeatures: [ 'local-floor', 'bounded-floor', 'hand-tracking', 'layers' ] };
|
|
||||||
+ const sessionInit = {
|
|
||||||
+ optionalFeatures: ['local-floor', 'bounded-floor', 'layers'],
|
|
||||||
+ domOverlay: { root: document.body },
|
|
||||||
+ };
|
|
||||||
navigator.xr.requestSession( 'immersive-vr', sessionInit ).then( onSessionStarted );
|
|
||||||
|
|
||||||
} else {
|
|
||||||
958
pnpm-lock.yaml
generated
958
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
|
|
@ -2,6 +2,7 @@ import { defineConfig, ModifyRspackConfigUtils } from '@rsbuild/core';
|
||||||
import { pluginNodePolyfill } from '@rsbuild/plugin-node-polyfill';
|
import { pluginNodePolyfill } from '@rsbuild/plugin-node-polyfill';
|
||||||
import { pluginReact } from '@rsbuild/plugin-react';
|
import { pluginReact } from '@rsbuild/plugin-react';
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
import fs from 'fs'
|
||||||
|
|
||||||
export const appAndRendererSharedConfig = () => defineConfig({
|
export const appAndRendererSharedConfig = () => defineConfig({
|
||||||
dev: {
|
dev: {
|
||||||
|
|
@ -60,6 +61,12 @@ export const appAndRendererSharedConfig = () => defineConfig({
|
||||||
],
|
],
|
||||||
tools: {
|
tools: {
|
||||||
rspack (config, helpers) {
|
rspack (config, helpers) {
|
||||||
|
const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, '../package.json'), 'utf8'))
|
||||||
|
const hasFileProtocol = Object.values(packageJson.pnpm.overrides).some((dep) => (dep as string).startsWith('file:'))
|
||||||
|
if (hasFileProtocol) {
|
||||||
|
// enable node_modules watching
|
||||||
|
config.watchOptions.ignored = /\.git/
|
||||||
|
}
|
||||||
rspackViewerConfig(config, helpers)
|
rspackViewerConfig(config, helpers)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ const fixtures: Record<string, BenchmarkFixture> = {
|
||||||
|
|
||||||
Error.stackTraceLimit = Error.stackTraceLimit < 30 ? 30 : Error.stackTraceLimit
|
Error.stackTraceLimit = Error.stackTraceLimit < 30 ? 30 : Error.stackTraceLimit
|
||||||
|
|
||||||
|
const SESSION_STORAGE_BACKUP_KEY = 'benchmark-backup'
|
||||||
export const openBenchmark = async (renderDistance = DEFAULT_RENDER_DISTANCE) => {
|
export const openBenchmark = async (renderDistance = DEFAULT_RENDER_DISTANCE) => {
|
||||||
let fixtureNameOpen = appQueryParams.openBenchmark
|
let fixtureNameOpen = appQueryParams.openBenchmark
|
||||||
if (!fixtureNameOpen || fixtureNameOpen === '1' || fixtureNameOpen === 'true' || fixtureNameOpen === 'zip') {
|
if (!fixtureNameOpen || fixtureNameOpen === '1' || fixtureNameOpen === 'true' || fixtureNameOpen === 'zip') {
|
||||||
|
|
@ -41,7 +42,6 @@ export const openBenchmark = async (renderDistance = DEFAULT_RENDER_DISTANCE) =>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const SESSION_STORAGE_BACKUP_KEY = 'benchmark-backup'
|
|
||||||
if (sessionStorage.getItem(SESSION_STORAGE_BACKUP_KEY)) {
|
if (sessionStorage.getItem(SESSION_STORAGE_BACKUP_KEY)) {
|
||||||
const backup = JSON.stringify(JSON.parse(sessionStorage.getItem(SESSION_STORAGE_BACKUP_KEY)!), null, 2)
|
const backup = JSON.stringify(JSON.parse(sessionStorage.getItem(SESSION_STORAGE_BACKUP_KEY)!), null, 2)
|
||||||
setLoadingScreenStatus('Either other tab with benchmark is open or page crashed. Last data backup is downloaded. Reload page to retry.')
|
setLoadingScreenStatus('Either other tab with benchmark is open or page crashed. Last data backup is downloaded. Reload page to retry.')
|
||||||
|
|
@ -103,6 +103,7 @@ export const openBenchmark = async (renderDistance = DEFAULT_RENDER_DISTANCE) =>
|
||||||
if (fixture.spawn) {
|
if (fixture.spawn) {
|
||||||
fixtureName += ` - ${fixture.spawn.join(' ')}`
|
fixtureName += ` - ${fixture.spawn.join(' ')}`
|
||||||
}
|
}
|
||||||
|
|
||||||
fixtureName += ` - ${renderDistance}`
|
fixtureName += ` - ${renderDistance}`
|
||||||
if (process.env.NODE_ENV !== 'development') { // do not delay
|
if (process.env.NODE_ENV !== 'development') { // do not delay
|
||||||
setLoadingScreenStatus('Benchmark requested... Getting screen refresh rate')
|
setLoadingScreenStatus('Benchmark requested... Getting screen refresh rate')
|
||||||
|
|
@ -212,6 +213,7 @@ export const openBenchmark = async (renderDistance = DEFAULT_RENDER_DISTANCE) =>
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
document.addEventListener('cypress-world-ready', () => {
|
document.addEventListener('cypress-world-ready', () => {
|
||||||
clearInterval(saveBackupInterval)
|
clearInterval(saveBackupInterval)
|
||||||
sessionStorage.removeItem(SESSION_STORAGE_BACKUP_KEY)
|
sessionStorage.removeItem(SESSION_STORAGE_BACKUP_KEY)
|
||||||
|
|
@ -271,6 +273,12 @@ export const openBenchmark = async (renderDistance = DEFAULT_RENDER_DISTANCE) =>
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add before unload
|
||||||
|
window.addEventListener('beforeunload', () => {
|
||||||
|
// remove sessionStorage backup
|
||||||
|
sessionStorage.removeItem(SESSION_STORAGE_BACKUP_KEY)
|
||||||
|
})
|
||||||
|
|
||||||
document.addEventListener('pointerlockchange', (e) => {
|
document.addEventListener('pointerlockchange', (e) => {
|
||||||
const panel = document.querySelector<HTMLDivElement>('#benchmark-panel')
|
const panel = document.querySelector<HTMLDivElement>('#benchmark-panel')
|
||||||
if (panel) {
|
if (panel) {
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,7 @@ export async function getScreenRefreshRate (): Promise<number> {
|
||||||
window.setTimeout(() => {
|
window.setTimeout(() => {
|
||||||
window.cancelAnimationFrame(requestId!)
|
window.cancelAnimationFrame(requestId!)
|
||||||
requestId = null
|
requestId = null
|
||||||
|
resolve(0)
|
||||||
}, 500)
|
}, 500)
|
||||||
|
|
||||||
return new Promise(_resolve => {
|
return new Promise(_resolve => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue