Compare commits

...
Sign in to create a new pull request.

5 commits

Author SHA1 Message Date
Vitaly Turovsky
425cf520bc strict comment check 2025-04-10 18:52:50 +03:00
Vitaly Turovsky
cdd0f6c072 add builds 2025-04-10 18:45:50 +03:00
Vitaly Turovsky
c918249897 file protocol support 2025-04-10 18:38:33 +03:00
Vitaly Turovsky
1e622d68b6 bench clean 2025-04-10 18:26:06 +03:00
Vitaly Turovsky
80e5943c88 fix: update rsbuild and pnpm to latest version to resolve long-standing annoying issues and fix critical code loss issue!
closes #264
2025-04-10 18:25:56 +03:00
10 changed files with 368 additions and 677 deletions

View file

@ -13,17 +13,17 @@ jobs:
(
github.event_name == 'issue_comment' &&
github.event.issue.pull_request != '' &&
contains(github.event.comment.body, '/benchmark')
(startsWith(github.event.comment.body, '/benchmark'))
)
permissions:
pull-requests: write
steps:
- run: lscpu
- name: Checkout
uses: actions/checkout@v2
# with:
# ref: refs/pull/${{ github.event.issue.number }}/head
- run: npm i -g pnpm@9.0.4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 18
@ -33,8 +33,10 @@ jobs:
jq '.dependencies.cypress = .optionalDependencies.cypress | del(.optionalDependencies.cypress)' package.json > package.json.tmp
mv package.json.tmp package.json
- run: pnpm install --no-frozen-lockfile
- run: pnpm build
- run: nohup pnpm prod-start &
- run: pnpm test:benchmark
id: benchmark
continue-on-error: true
@ -49,6 +51,7 @@ jobs:
else
echo "BENCHMARK_RESULT=Benchmark failed to run or produce results" >> $GITHUB_ENV
fi
- uses: mshick/add-pr-comment@v2
with:
allow-repeats: true

View file

@ -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!
*(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)
*(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

View file

@ -4,8 +4,8 @@ FROM node:18-alpine AS build
RUN apk add git
WORKDIR /app
COPY . /app
# install pnpm
RUN npm i -g pnpm@9.0.4
# install pnpm with corepack
RUN corepack enable
# Build arguments
ARG DOWNLOAD_SOUNDS=false
ARG DISABLE_SERVICE_WORKER=false
@ -35,7 +35,7 @@ WORKDIR /app
COPY --from=build /app/dist /app/dist
COPY server.js /app/server.js
# Install express
RUN npm i -g pnpm@9.0.4
RUN npm corepack enable
RUN npm init -yp
RUN pnpm i express github:zardoy/prismarinejs-net-browserify compression cors
EXPOSE 8080

View file

@ -81,13 +81,13 @@
"google-drive-browserfs": "github:zardoy/browserfs#google-drive",
"jszip": "^3.10.1",
"lodash-es": "^4.17.21",
"mcraft-fun-mineflayer": "^0.1.14",
"minecraft-data": "3.83.1",
"minecraft-protocol": "github:PrismarineJS/node-minecraft-protocol#master",
"mineflayer-item-map-downloader": "github:zardoy/mineflayer-item-map-downloader",
"mojangson": "^2.0.4",
"net-browserify": "github:zardoy/prismarinejs-net-browserify",
"node-gzip": "^1.1.2",
"mcraft-fun-mineflayer": "^0.1.14",
"peerjs": "^1.5.0",
"pixelarticons": "^1.8.1",
"pretty-bytes": "^6.1.1",
@ -119,11 +119,11 @@
"workbox-build": "^7.0.0"
},
"devDependencies": {
"@rsbuild/core": "1.0.1-beta.9",
"@rsbuild/plugin-node-polyfill": "1.0.3",
"@rsbuild/plugin-react": "1.0.1-beta.9",
"@rsbuild/plugin-type-check": "1.0.1-beta.9",
"@rsbuild/plugin-typed-css-modules": "1.0.1",
"@rsbuild/core": "1.3.5",
"@rsbuild/plugin-node-polyfill": "1.3.0",
"@rsbuild/plugin-react": "1.2.0",
"@rsbuild/plugin-type-check": "1.2.1",
"@rsbuild/plugin-typed-css-modules": "1.0.2",
"@storybook/addon-essentials": "^7.4.6",
"@storybook/addon-links": "^7.4.6",
"@storybook/blocks": "^7.4.6",
@ -152,16 +152,16 @@
"http-server": "^14.1.1",
"https-browserify": "^1.0.0",
"mc-assets": "^0.2.52",
"mineflayer-mouse": "^0.1.7",
"minecraft-inventory-gui": "github:zardoy/minecraft-inventory-gui#next",
"mineflayer": "github:GenerelSchwerz/mineflayer",
"mineflayer-mouse": "^0.1.7",
"mineflayer-pathfinder": "^2.4.4",
"npm-run-all": "^4.1.5",
"os-browserify": "^0.3.0",
"path-browserify": "^1.0.1",
"path-exists-cli": "^2.0.0",
"renderer": "link:renderer",
"process": "github:PrismarineJS/node-process",
"renderer": "link:renderer",
"rimraf": "^5.0.1",
"storybook": "^7.4.6",
"stream-browserify": "^3.0.0",
@ -214,11 +214,21 @@
"ignoreDependencies": []
},
"patchedDependencies": {
"three@0.154.0": "patches/three@0.154.0.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",
"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"
}

View file

@ -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

File diff suppressed because it is too large Load diff

View file

@ -2,6 +2,7 @@ import { defineConfig, ModifyRspackConfigUtils } from '@rsbuild/core';
import { pluginNodePolyfill } from '@rsbuild/plugin-node-polyfill';
import { pluginReact } from '@rsbuild/plugin-react';
import path from 'path'
import fs from 'fs'
export const appAndRendererSharedConfig = () => defineConfig({
dev: {
@ -60,6 +61,12 @@ export const appAndRendererSharedConfig = () => defineConfig({
],
tools: {
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)
}
},

View file

@ -34,6 +34,7 @@ const fixtures: Record<string, BenchmarkFixture> = {
Error.stackTraceLimit = Error.stackTraceLimit < 30 ? 30 : Error.stackTraceLimit
const SESSION_STORAGE_BACKUP_KEY = 'benchmark-backup'
export const openBenchmark = async (renderDistance = DEFAULT_RENDER_DISTANCE) => {
let fixtureNameOpen = appQueryParams.openBenchmark
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)) {
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.')
@ -103,6 +103,7 @@ export const openBenchmark = async (renderDistance = DEFAULT_RENDER_DISTANCE) =>
if (fixture.spawn) {
fixtureName += ` - ${fixture.spawn.join(' ')}`
}
fixtureName += ` - ${renderDistance}`
if (process.env.NODE_ENV !== 'development') { // do not delay
setLoadingScreenStatus('Benchmark requested... Getting screen refresh rate')
@ -212,6 +213,7 @@ export const openBenchmark = async (renderDistance = DEFAULT_RENDER_DISTANCE) =>
},
}
})
document.addEventListener('cypress-world-ready', () => {
clearInterval(saveBackupInterval)
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) => {
const panel = document.querySelector<HTMLDivElement>('#benchmark-panel')
if (panel) {

View file

@ -103,6 +103,7 @@ export async function getScreenRefreshRate (): Promise<number> {
window.setTimeout(() => {
window.cancelAnimationFrame(requestId!)
requestId = null
resolve(0)
}, 500)
return new Promise(_resolve => {