File tree 4 files changed +17
-14
lines changed
4 files changed +17
-14
lines changed Original file line number Diff line number Diff line change 1
- // If you update this definition, make sure to also update the definition
2
- // in vite.config.ts to match.
3
- export const GAMEDEV_MODE : boolean = import . meta. env . VITE_WASM4_GAMEDEV_MODE !== "false" ;
4
-
1
+ export const GAMEDEV_MODE = WASM4_GAMEDEV_MODE ;
5
2
export const WIDTH = 160 ;
6
3
export const HEIGHT = 160 ;
7
4
Original file line number Diff line number Diff line change @@ -65,6 +65,11 @@ export class MenuOverlay extends LitElement {
65
65
background: rgba(0, 0, 0, 0.85);
66
66
}
67
67
68
+ .version {
69
+ color: #fff;
70
+ padding-bottom: 1em;
71
+ }
72
+
68
73
.menu {
69
74
border: 2px solid #f0f0f0;
70
75
padding: 0 1em 0 1em;
@@ -244,6 +249,9 @@ export class MenuOverlay extends LitElement {
244
249
245
250
render ( ) {
246
251
return html `
252
+ < div class ="version ">
253
+ WASM-4 v${ WASM4_VERSION }
254
+ </ div >
247
255
< div class ="menu ">
248
256
< ul style ="display: ${ this . optionContext === optionContext . DEFAULT ? "inherit" : "none" } ">
249
257
${ map ( options [ optionContext . DEFAULT ] , ( option , idx ) =>
Original file line number Diff line number Diff line change 1
1
// Include the types for Vite's special import.meta.env object.
2
2
/// <reference types="vite/client" />
3
3
4
- interface ImportMetaEnv {
5
- readonly VITE_WASM4_GAMEDEV_MODE : string
6
- }
4
+ declare const WASM4_VERSION : string
5
+ declare const WASM4_GAMEDEV_MODE : boolean
Original file line number Diff line number Diff line change 1
1
import { UserConfig , defineConfig } from 'vite' ;
2
2
import minifyHTML from 'rollup-plugin-minify-html-literals-v3' ;
3
-
4
- function isGamedevBuild ( ) : boolean {
5
- // If you update this definition, make sure to also update the definition
6
- // in src/constants.ts to match.
7
- return process . env . VITE_WASM4_GAMEDEV_MODE !== "false" ;
8
- }
3
+ import cliPackageJSON from '../../cli/package.json' ;
9
4
10
5
// https://vitejs.dev/config/
11
6
export default defineConfig ( ( { mode } ) => {
12
- const gamedev_build = isGamedevBuild ( ) ;
7
+ const gamedev_build = process . env . VITE_WASM4_GAMEDEV_MODE !== "false" ;
13
8
14
9
let user_config : UserConfig = {
15
10
server : {
@@ -46,6 +41,10 @@ export default defineConfig(({ mode }) => {
46
41
plugins : [
47
42
minifyHTML ( ) ,
48
43
] ,
44
+ define : {
45
+ WASM4_GAMEDEV_MODE : gamedev_build ,
46
+ WASM4_VERSION : JSON . stringify ( cliPackageJSON . version ) ,
47
+ } ,
49
48
} ;
50
49
51
50
return user_config ;
You can’t perform that action at this time.
0 commit comments