Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ dist-ssr
.env
coverage
*.tsbuildinfo
packages/core/src/version.ts
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/bootstrap/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@mavonengine/create-bootstrap",
"type": "module",
"version": "0.0.6",
"version": "0.0.7",
"description": "Bootstrap a MavonEngine multiplayer project",
"license": "MIT",
"bin": {
Expand Down
2 changes: 1 addition & 1 deletion packages/bootstrap/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const TAG_URL
= 'https://github.com/MavonEngine/Core/archive/refs/tags/0.0.11-alpha.zip'
= 'https://github.com/MavonEngine/Core/archive/refs/tags/0.0.12-alpha.zip'

export const TEMPLATE_SUBPATH = 'packages/multiplayer-template'
7 changes: 4 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@mavonengine/core",
"type": "module",
"version": "0.0.10",
"version": "0.0.14",
"description": "",
"author": "",
"license": "MIT",
Expand Down Expand Up @@ -34,8 +34,9 @@
"vite.config.js"
],
"scripts": {
"build": "rm -f tsconfig.build.tsbuildinfo && tsc -p tsconfig.build.json && find src -name '*.glsl' -o -name '*.css' | while read f; do mkdir -p dist/$(dirname ${f#src/}) && cp $f dist/${f#src/}; done",
"dev": "rm -f tsconfig.build.tsbuildinfo && tsc -p tsconfig.build.json --watch",
"prepare": "node scripts/generate-version.js",
"build": "node scripts/generate-version.js && rm -f tsconfig.build.tsbuildinfo && tsc -p tsconfig.build.json && find src -name '*.glsl' -o -name '*.css' | while read f; do mkdir -p dist/$(dirname ${f#src/}) && cp $f dist/${f#src/}; done",
"dev": "node scripts/generate-version.js && rm -f tsconfig.build.tsbuildinfo && tsc -p tsconfig.build.json --watch",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"bench": "vitest bench",
Expand Down
11 changes: 11 additions & 0 deletions packages/core/scripts/generate-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { readFileSync, writeFileSync } from 'node:fs'
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'

const __dirname = dirname(fileURLToPath(import.meta.url))
const { version } = JSON.parse(readFileSync(resolve(__dirname, '../package.json'), 'utf8'))

writeFileSync(
resolve(__dirname, '../src/version.ts'),
`export const version = '${version}'\n`,
)
2 changes: 1 addition & 1 deletion packages/core/src/BaseGame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import type winston from 'winston'
import type Logger from './Utils/Logger'
import type GameObjectInterface from './World/GameObjectInterface'
import { Clock, Raycaster, Scene } from 'three'
import { version as ENGINE_VERSION } from '../package.json' with { type: 'json' }
import EventEmitter from './Utils/EventEmitter'
import { version as ENGINE_VERSION } from './version'

import BaseWorld from './World/BaseWorld'

Expand Down
70 changes: 0 additions & 70 deletions packages/core/tests/vite/plugins/packageJsonPlugin.test.ts

This file was deleted.

6 changes: 0 additions & 6 deletions packages/core/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import { readFileSync } from 'node:fs'
import { dirname } from 'node:path'
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vite'
import glsl from 'vite-plugin-glsl'
import { createPackageJsonPlugin } from './vite/plugins/packageJsonPlugin.js'

const GLSL_FILTER = /\.glsl$/

const coreRoot = dirname(fileURLToPath(import.meta.url))

const mavonEngineGlslPlugin = {
name: 'glsl',
setup(build) {
Expand All @@ -29,7 +24,6 @@ export default defineConfig({
esbuildOptions: {
plugins: [
mavonEngineGlslPlugin,
createPackageJsonPlugin(coreRoot),
],
},
},
Expand Down
31 changes: 0 additions & 31 deletions packages/core/vite/plugins/packageJsonPlugin.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/multiplayer-template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"lint:fix": "eslint . --fix"
},
"dependencies": {
"@mavonengine/core": "0.0.10"
"@mavonengine/core": "0.0.14"
},
"devDependencies": {
"@antfu/eslint-config": "^8.0.0",
Expand Down
26 changes: 0 additions & 26 deletions packages/multiplayer-template/server/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,5 @@
import type { Plugin } from 'esbuild'
import fs from 'node:fs'
import path from 'node:path'
import { defineConfig } from 'tsup'

const PACKAGE_JSON_FILTER = /[/\\]package\.json$/
const ALL_FILTER = /.*/
const IDENTIFIER_FILTER = /^[a-z_$][\w$]*$/i

const packageJsonPlugin: Plugin = {
name: 'package-json',
setup(build) {
build.onResolve({ filter: PACKAGE_JSON_FILTER }, args => ({
path: path.resolve(args.resolveDir, args.path),
namespace: 'pkg-json',
}))
build.onLoad({ filter: ALL_FILTER, namespace: 'pkg-json' }, (args) => {
const pkg = JSON.parse(fs.readFileSync(args.path, 'utf8'))
const named = Object.entries(pkg)
.filter(([k]) => IDENTIFIER_FILTER.test(k))
.map(([k, v]) => `export const ${k} = ${JSON.stringify(v)};`)
.join('\n')
return { contents: `${named}\nexport default ${JSON.stringify(pkg)};`, loader: 'js' }
})
},
}

export default defineConfig({
entry: ['src/index.ts'],
platform: 'node',
Expand All @@ -40,5 +15,4 @@ export default defineConfig({
'winston',
'three',
],
esbuildPlugins: [packageJsonPlugin],
})
Loading