Skip to content

Commit

Permalink
chore(examples): add vite example
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Jan 10, 2024
1 parent 37e89f8 commit 9da64d2
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 0 deletions.
24 changes: 24 additions & 0 deletions examples/vite/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
1 change: 1 addition & 0 deletions examples/vite/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
12 changes: 12 additions & 0 deletions examples/vite/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>phaser-jsx</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="src/main.tsx"></script>
</body>
</html>
18 changes: 18 additions & 0 deletions examples/vite/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview",
"start": "vite --open --force"
},
"dependencies": {
"phaser": "^3.70.0"
},
"devDependencies": {
"typescript": "^5.2.2",
"vite": "^5.0.8"
},
"license": "MIT"
}
11 changes: 11 additions & 0 deletions examples/vite/src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Phaser from 'phaser';

import { render, Text } from '../../../src';

new Phaser.Game({
scene: {
create() {
render(<Text text="Hello, world!" />, this);
},
},
});
1 change: 1 addition & 0 deletions examples/vite/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
23 changes: 23 additions & 0 deletions examples/vite/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,

"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,

"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,

"jsx": "react-jsx"
},
"include": ["src"]
}

0 comments on commit 9da64d2

Please sign in to comment.