Skip to content

Commit

Permalink
pwa work
Browse files Browse the repository at this point in the history
ponderingdemocritus committed Oct 27, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 4f4c1a0 commit 003ac93
Showing 25 changed files with 2,516 additions and 338 deletions.
16 changes: 8 additions & 8 deletions client/.env.production
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
VITE_PUBLIC_MASTER_ADDRESS="0x24c2cabac53965693c322c98061ea40469ca0ce640408fd69c960ef61d6d950"
VITE_PUBLIC_MASTER_PRIVATE_KEY="0x7ca06a1fbb9ae7c672a345c647942c632ffe42ee730897131b5335b5fbfb460"
VITE_PUBLIC_MASTER_ADDRESS="0x40f749bc315c75f3dc575490955b3595c736378054cc8ee80379e811f36fc7d"
VITE_PUBLIC_MASTER_PRIVATE_KEY="0x1c2304d35a10f6199004c2e4ef913194ac86622852388db7f3ce2a6816cfa90"
VITE_PUBLIC_WORLD_ADDRESS="0x320b2713e324fe3125bbc42d85ff69cb3c0908b436fa38a35746dbc45deeb11"
VITE_PUBLIC_ACCOUNT_CLASS_HASH="0x07dc7899aa655b0aae51eadff6d801a58e97dd99cf4666ee59e704249e51adf2"
VITE_EVENT_KEY="0x1a2f334228cee715f1f0f54053bb6b5eac54fa336e0bc1aacf7516decb0471d"
VITE_PUBLIC_TORII="https://api.cartridge.gg/x/eternum-44/torii"
VITE_PUBLIC_NODE_URL="https://api.cartridge.gg/x/eternum-44/katana/"
VITE_PUBLIC_TORII="https://api.cartridge.gg/x/eternum-45/torii"
VITE_PUBLIC_NODE_URL="https://api.cartridge.gg/x/eternum-45/katana/"
VITE_PUBLIC_DEV=false
VITE_PUBLIC_GAME_VERSION="v1.0.0-rc.1"
VITE_PUBLIC_SHOW_FPS=false
VITE_PUBLIC_GRAPHICS_DEV=false
VITE_PUBLIC_TORII_RELAY="/dns4/api.cartridge.gg/tcp/443/x-parity-wss/%2Fx%2Feternum-42%2Ftorii%2Fwss"
VITE_PUBLIC_TORII_RELAY="/dns4/api.cartridge.gg/tcp/443/x-parity-wss/%2Fx%2Feternum-45%2Ftorii%2Fwss"

VITE_SEASON_PASS_ADDRESS="0x257e686612fb1b64fb39ff09573bd23093a7e079b8f353d08edbe79191c9bd2"
VITE_REALMS_ADDRESS="0x24fe0922f1a146dc187a8f89d9d3604d6c2c12c908a0cbec1cd282fe4e87f74"
VITE_LORDS_ADDRESS="0x4ab2c297d68b115a9d6526600cebd2f927a57a0295c907edc057596e9fe6ff8"
VITE_SEASON_PASS_ADDRESS="0x3cf3c5bcbb3ee9555a75413f43451731eda2d9da3de184b6a596c21e41bd558"
VITE_REALMS_ADDRESS="0x6dbe64d293d2c2bb51a1ccb62a40a783911460737a9cd3fee8279d6f8dafe8"
VITE_LORDS_ADDRESS="0x14319fede7a706a8e81db772b999ae98cebb5880fd62c8c0a8b5a72107381fe"
4 changes: 3 additions & 1 deletion client/.gitignore
Original file line number Diff line number Diff line change
@@ -22,4 +22,6 @@ dist-ssr
*.njsproj
*.sln
*.sw?
yarn.lock
yarn.lock

dev-dist
6 changes: 6 additions & 0 deletions client/index.html
Original file line number Diff line number Diff line change
@@ -77,6 +77,12 @@
<link rel="prefetch" href="/textures/paper/worldmap-bg.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>Realms: Eternum</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="My Awesome App description">
<link rel="icon" href="/images/favicon.ico">
<link rel="apple-touch-icon" href="/images/apple-touch-icon-180x180.png" sizes="180x180">
<link rel="mask-icon" href="/images/maskable-icon-512x512.png" color="#FFFFFF">
<meta name="theme-color" content="#ffffff">
</head>
<body>
<div id="root"></div>
17 changes: 10 additions & 7 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -9,7 +9,8 @@
"test": "vitest run",
"test:watch": "vitest",
"test:ui": "vitest --ui",
"coverage": "vitest run --coverage"
"coverage": "vitest run --coverage",
"generate-pwa-assets": "pwa-assets-generator"
},
"peerDependencies": {
"starknet": "6.11.0"
@@ -18,13 +19,13 @@
"@bibliothecadao/eternum": "workspace:^",
"@cartridge/connector": "^0.5.0-alpha.2",
"@cartridge/controller": "^0.5.0-alpha.2",
"@dojoengine/core": "1.0.0-alpha.23",
"@dojoengine/create-burner": "1.0.0-alpha.23",
"@dojoengine/react": "1.0.0-alpha.23",
"@dojoengine/core": "1.0.0-alpha.24",
"@dojoengine/create-burner": "1.0.0-alpha.24",
"@dojoengine/react": "1.0.0-alpha.24",
"@dojoengine/recs": "^2.0.13",
"@dojoengine/state": "1.0.0-alpha.23",
"@dojoengine/torii-client": "1.0.0-alpha.23",
"@dojoengine/utils": "1.0.0-alpha.23",
"@dojoengine/state": "1.0.0-alpha.24",
"@dojoengine/torii-client": "1.0.0-alpha.24",
"@dojoengine/utils": "1.0.0-alpha.24",
"@headlessui/react": "^1.7.18",
"@latticexyz/utils": "^2.0.0-next.12",
"@radix-ui/react-select": "^2.0.0",
@@ -35,6 +36,7 @@
"@starknet-react/chains": "^3.0.2",
"@starknet-react/core": "^3.0.3",
"@vercel/analytics": "^1.2.2",
"@vite-pwa/assets-generator": "^0.2.6",
"buffer": "^6.0.3",
"clsx": "^1.2.1",
"framer-motion": "^11.0.24",
@@ -55,6 +57,7 @@
"three-stdlib": "^2.29.5",
"use-sound": "^4.0.1",
"vite-plugin-mkcert": "^1.17.6",
"vite-plugin-pwa": "^0.20.5",
"vitest-canvas-mock": "^0.3.3",
"wouter": "^2.12.1",
"zustand": "^4.5.2"
Binary file added client/public/images/apple-touch-icon-180x180.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/public/images/favicon.ico
Binary file not shown.
Binary file added client/public/images/maskable-icon-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/public/images/pwa-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/public/images/pwa-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/public/images/pwa-64x64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions client/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
User-agent: *
Allow: /
6 changes: 6 additions & 0 deletions client/pwa-assets.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { defineConfig, minimal2023Preset } from "@vite-pwa/assets-generator/config";

export default defineConfig({
preset: minimal2023Preset,
images: ["public/images/eternum_logo.png"],
});
63 changes: 63 additions & 0 deletions client/vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"headers": [
{
"source": "/(.*).html",
"headers": [
{
"key": "Cache-Control",
"value": "public, max-age=0, must-revalidate"
}
]
},
{
"source": "/sw.js",
"headers": [
{
"key": "Cache-Control",
"value": "public, max-age=0, must-revalidate"
}
]
},
{
"source": "/manifest.webmanifest",
"headers": [
{
"key": "Content-Type",
"value": "application/manifest+json"
}
]
},
{
"source": "/assets/(.*)",
"headers": [
{
"key": "Cache-Control",
"value": "max-age=31536000, immutable"
}
]
},
{
"source": "/(.*)",
"headers": [
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-Frame-Options",
"value": "DENY"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block"
}
]
}
],
"rewrites": [
{
"source": "/(.*)",
"destination": "/index.html"
}
]
}
52 changes: 47 additions & 5 deletions client/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,57 @@
import svgr from "@svgr/rollup";
import react from "@vitejs/plugin-react";
import { resolve } from "path";
import path, { resolve } from "path";
import { defineConfig } from "vite";
import mkcert from "vite-plugin-mkcert";

import svgr from "@svgr/rollup";
import path from "path";
import { VitePWA } from "vite-plugin-pwa";
import topLevelAwait from "vite-plugin-top-level-await";
import wasm from "vite-plugin-wasm";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [mkcert(), svgr({ dimensions: false, svgo: false, typescript: true }), react(), wasm(), topLevelAwait()],
plugins: [
mkcert(),
svgr({ dimensions: false, svgo: false, typescript: true }),
react(),
wasm(),
topLevelAwait(),
VitePWA({
registerType: "autoUpdate",
devOptions: {
enabled: true,
},
manifest: {
name: "Eternum",
short_name: "Eternum",
description: "Rule the Hex",
theme_color: "#000000",
background_color: "#000000",
display: "standalone",
orientation: "landscape",
scope: "/",
start_url: "/",
icons: [
{
src: "/images/pwa-64x64.png",
sizes: "64x64",
type: "image/png",
purpose: "any maskable",
},
{
src: "/images/pwa-192x192.png",
sizes: "192x192",
type: "image/png",
purpose: "any maskable",
},
{
src: "/images/pwa-512x512.png",
sizes: "512x512",
type: "image/png",
purpose: "any maskable",
},
],
},
}),
],
resolve: {
alias: {
events: "events",
Loading

0 comments on commit 003ac93

Please sign in to comment.