separate out visualizer library
This commit is contained in:
parent
3eeaab6cec
commit
0c6d978442
30 changed files with 95 additions and 10 deletions
|
@ -5,7 +5,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"build-wasm": "wasm-pack build ./planetwars-rs --target web",
|
"build-wasm": "wasm-pack build ../planetwars-rs --target web",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"check": "svelte-check --tsconfig ./tsconfig.json"
|
"check": "svelte-check --tsconfig ./tsconfig.json"
|
||||||
},
|
},
|
||||||
|
@ -13,7 +13,6 @@
|
||||||
"@originjs/vite-plugin-commonjs": "^1.0.1",
|
"@originjs/vite-plugin-commonjs": "^1.0.1",
|
||||||
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.30",
|
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.30",
|
||||||
"@tsconfig/svelte": "^2.0.1",
|
"@tsconfig/svelte": "^2.0.1",
|
||||||
"rollup-plugin-polyfill-node": "^0.8.0",
|
|
||||||
"svelte": "^3.44.0",
|
"svelte": "^3.44.0",
|
||||||
"svelte-check": "^2.2.7",
|
"svelte-check": "^2.2.7",
|
||||||
"svelte-preprocess": "^4.9.8",
|
"svelte-preprocess": "^4.9.8",
|
||||||
|
@ -23,11 +22,8 @@
|
||||||
"vite-plugin-wasm-pack": "^0.1.9"
|
"vite-plugin-wasm-pack": "^0.1.9"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"buffer": "^6.0.3",
|
|
||||||
"extract-svg-path": "^2.1.0",
|
|
||||||
"load-svg": "^1.0.0",
|
|
||||||
"moment": "^2.29.1",
|
"moment": "^2.29.1",
|
||||||
"svg-mesh-3d": "^1.1.0",
|
"pw-visualizer": "file:../pw-visualizer",
|
||||||
"ts-heap": "^1.1.3"
|
"planetwars-rs": "file:../planetwars-rs/pkg"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import * as visualizer from '../lib/visualizer/index';
|
import * as visualizer from "pw-visualizer";
|
||||||
|
|
||||||
export let matchLog = null;
|
export let matchLog = null;
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
||||||
visualizer.set_loading(false);
|
visualizer.set_loading(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="main" class="loading">
|
<div id="main" class="loading">
|
||||||
|
@ -57,5 +58,5 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@import 'visualizer/style.css';
|
@import 'pw-visualizer/src/style.css';
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -7,7 +7,7 @@ import wasmPack from 'vite-plugin-wasm-pack';
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [
|
plugins: [
|
||||||
svelte(),
|
svelte(),
|
||||||
wasmPack(["./planetwars-rs"]),
|
wasmPack([], ["planetwars-rs"]),
|
||||||
viteCommonjs({
|
viteCommonjs({
|
||||||
transformMixedEsModules: true,
|
transformMixedEsModules: true,
|
||||||
}),
|
}),
|
||||||
|
|
2
web/pw-visualizer/.gitignore
vendored
Normal file
2
web/pw-visualizer/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
node_modules
|
||||||
|
package-lock.json
|
19
web/pw-visualizer/index.html
Normal file
19
web/pw-visualizer/index.html
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<!-- polyfill global -->
|
||||||
|
<script>
|
||||||
|
const global = globalThis;
|
||||||
|
</script>
|
||||||
|
<!-- end polyfill -->
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<link rel="icon" href="/favicon.ico" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Planetwars</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
<script type="module" src="/src/main.ts"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
29
web/pw-visualizer/package.json
Normal file
29
web/pw-visualizer/package.json
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
{
|
||||||
|
"name": "pw-visualizer",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "vite build",
|
||||||
|
"build-wasm": "wasm-pack build ../planetwars-rs --target web"
|
||||||
|
},
|
||||||
|
"files": ["src"],
|
||||||
|
"main": "src/index.ts",
|
||||||
|
"devDependencies": {
|
||||||
|
"@originjs/vite-plugin-commonjs": "^1.0.1",
|
||||||
|
"tslib": "^2.3.1",
|
||||||
|
"typescript": "^4.4.4",
|
||||||
|
"vite": "^2.7.2",
|
||||||
|
"vite-plugin-wasm-pack": "^0.1.9"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"buffer": "^6.0.3",
|
||||||
|
"extract-svg-path": "^2.1.0",
|
||||||
|
"load-svg": "^1.0.0",
|
||||||
|
"svg-mesh-3d": "^1.1.0",
|
||||||
|
"ts-heap": "^1.1.3"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"planetwars-rs": "file:../planetwars-rs/pkg"
|
||||||
|
}
|
||||||
|
}
|
14
web/pw-visualizer/tsconfig.json
Normal file
14
web/pw-visualizer/tsconfig.json
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "esnext",
|
||||||
|
"useDefineForClassFields": true,
|
||||||
|
"module": "esnext",
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"allowJs": false,
|
||||||
|
"checkJs": false
|
||||||
|
},
|
||||||
|
"include": ["src/**/*.d.ts", "src/**/*.ts", "src/**/*.js", "src/**/*.svelte"]
|
||||||
|
}
|
24
web/pw-visualizer/vite.config.js
Normal file
24
web/pw-visualizer/vite.config.js
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
import { defineConfig } from 'vite'
|
||||||
|
import { viteCommonjs } from '@originjs/vite-plugin-commonjs'
|
||||||
|
import wasmPack from 'vite-plugin-wasm-pack';
|
||||||
|
|
||||||
|
// https://vitejs.dev/config/
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [
|
||||||
|
wasmPack([], ["planetwars-rs"]),
|
||||||
|
viteCommonjs({
|
||||||
|
transformMixedEsModules: true,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
build: {
|
||||||
|
commonjsOptions: {
|
||||||
|
transformMixedEsModules: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
server: {
|
||||||
|
proxy: {
|
||||||
|
"/api/": "http://localhost:5000",
|
||||||
|
"/ws": "ws://localhost:5000/ws",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
Loading…
Reference in a new issue