mirror of
https://github.com/PrismarineJS/prismarine-web-client.git
synced 2025-08-28 21:28:44 -04:00
some basic type-checking change start script
This commit is contained in:
parent
b77f00bc6d
commit
e1b1938210
4 changed files with 27 additions and 1 deletions
9
globals.d.ts
vendored
Normal file
9
globals.d.ts
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
declare const THREE: any;
|
||||||
|
|
||||||
|
declare interface Document {
|
||||||
|
getElementById(id): any
|
||||||
|
}
|
||||||
|
|
||||||
|
declare interface Window extends Record<string, any> {
|
||||||
|
|
||||||
|
}
|
5
index.js
5
index.js
|
@ -1,3 +1,4 @@
|
||||||
|
//@ts-check
|
||||||
/* global THREE */
|
/* global THREE */
|
||||||
require('./lib/chat')
|
require('./lib/chat')
|
||||||
|
|
||||||
|
@ -29,6 +30,7 @@ const mineflayer = require('mineflayer')
|
||||||
const { WorldView, Viewer } = require('prismarine-viewer/viewer')
|
const { WorldView, Viewer } = require('prismarine-viewer/viewer')
|
||||||
const pathfinder = require('mineflayer-pathfinder')
|
const pathfinder = require('mineflayer-pathfinder')
|
||||||
const { Vec3 } = require('vec3')
|
const { Vec3 } = require('vec3')
|
||||||
|
//@ts-ignore
|
||||||
global.THREE = require('three')
|
global.THREE = require('three')
|
||||||
const { initVR } = require('./lib/vr')
|
const { initVR } = require('./lib/vr')
|
||||||
|
|
||||||
|
@ -171,6 +173,7 @@ async function connect (options) {
|
||||||
|
|
||||||
if (proxy) {
|
if (proxy) {
|
||||||
console.log(`using proxy ${proxy} ${proxyport}`)
|
console.log(`using proxy ${proxy} ${proxyport}`)
|
||||||
|
//@ts-ignore
|
||||||
net.setProxy({ hostname: proxy, port: proxyport })
|
net.setProxy({ hostname: proxy, port: proxyport })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,7 +294,9 @@ async function connect (options) {
|
||||||
|
|
||||||
function changeCallback () {
|
function changeCallback () {
|
||||||
if (document.pointerLockElement === renderer.domElement ||
|
if (document.pointerLockElement === renderer.domElement ||
|
||||||
|
// @ts-ignore
|
||||||
document.mozPointerLockElement === renderer.domElement ||
|
document.mozPointerLockElement === renderer.domElement ||
|
||||||
|
// @ts-ignore
|
||||||
document.webkitPointerLockElement === renderer.domElement) {
|
document.webkitPointerLockElement === renderer.domElement) {
|
||||||
document.addEventListener('mousemove', moveCallback, false)
|
document.addEventListener('mousemove', moveCallback, false)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "webpack --config webpack.prod.js --progress && node build.js copyFiles",
|
"build": "webpack --config webpack.prod.js --progress && node build.js copyFiles",
|
||||||
"build-dev": "node build.js copyFilesDev && webpack serve --config webpack.dev.js --progress",
|
"build-dev": "node build.js copyFilesDev && webpack serve --config webpack.dev.js --progress",
|
||||||
"start": "node --max-old-space-size=8192 server.js 8080 dev",
|
"start": "NODE_OPTIONS=--max-old-space-size=8192 pnpm build-dev",
|
||||||
"prod-start": "node server.js",
|
"prod-start": "node server.js",
|
||||||
"build-dev-start": "npm run build-dev && npm run prod-start",
|
"build-dev-start": "npm run build-dev && npm run prod-start",
|
||||||
"build-start": "npm run build && npm run prod-start",
|
"build-start": "npm run build && npm run prod-start",
|
||||||
|
|
12
tsconfig.json
Normal file
12
tsconfig.json
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"allowJs": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"noEmit": true
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"index.js",
|
||||||
|
"globals.d.ts",
|
||||||
|
"lib"
|
||||||
|
]
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue