feat: vercel adapter

This commit is contained in:
TrèsAbhi committed 2024-10-09 22:04:43 -05:00
1 parent 53662c1174
commit e52063c12d
7 files changed
+26 -27

No files matched your search

BIN
View File
Binary file not shown.
+4 -3
View File
@@ -12,13 +12,13 @@
"build:assets": "bun --filter=@blitzkit/scripts run build:assets", "build:assets": "bun --filter=@blitzkit/scripts run build:assets",
"build:averages": "bun --filter=@blitzkit/scripts run build:averages", "build:averages": "bun --filter=@blitzkit/scripts run build:averages",
"build:bot": "rm -rf dist/bot && mkdir -p dist/bot/prisma && bun build src/index.ts src/workers/bot.ts src/workers/render.ts --outdir dist/bot --target=bun --splitting --sourcemap=inline --external sharp && cp -R src/lang dist/bot/lang && prisma generate && cp prisma/schema.prisma dist/bot/prisma/schema.prisma && cp -R node_modules/prisma/*.node dist/bot/prisma && cd dist/bot && bun init -y && bun add sharp", "build:bot": "rm -rf dist/bot && mkdir -p dist/bot/prisma && bun build src/index.ts src/workers/bot.ts src/workers/render.ts --outdir dist/bot --target=bun --splitting --sourcemap=inline --external sharp && cp -R src/lang dist/bot/lang && prisma generate && cp prisma/schema.prisma dist/bot/prisma/schema.prisma && cp -R node_modules/prisma/*.node dist/bot/prisma && cd dist/bot && bun init -y && bun add sharp",
"build:website": "prisma generate && cd packages/website && bun run build && cd ../..", "build:website": "prisma generate && cd packages/website && bun run build",
"build:sitemap": "bun scripts/sitemap.ts", "build:sitemap": "bun scripts/sitemap.ts",
"build:docs": "vitepress build docs", "build:docs": "vitepress build docs",
"build:ratingleaderboard": "bun --script scripts/buildRatingLeaderboard.ts", "build:ratingleaderboard": "bun --script scripts/buildRatingLeaderboard.ts",
"dev:bot": "bun build:bot && bun start:bot", "dev:bot": "bun build:bot && bun start:bot",
"dev:docs": "vitepress dev docs", "dev:docs": "vitepress dev docs",
"dev:website": "cd packages/website && bun run dev && cd ../..", "dev:website": "cd packages/website && bun run dev",
"dev:api": "bun --filter=@blitzkit/api run dev", "dev:api": "bun --filter=@blitzkit/api run dev",
"start:bot": "bun dist/bot/index.js", "start:bot": "bun dist/bot/index.js",
"start:website": "bun --filter=@blitzkit/website run start", "start:website": "bun --filter=@blitzkit/website run start",
@@ -29,7 +29,8 @@
"update": "yarn upgrade --latest", "update": "yarn upgrade --latest",
"tunnel": "cloudflared tunnel --url http://localhost:3000", "tunnel": "cloudflared tunnel --url http://localhost:3000",
"discoverids": "scripts/discoverIds.ts", "discoverids": "scripts/discoverIds.ts",
"build:protos": "bun packages/scripts/src/protos.ts" "build:protos": "bun packages/scripts/src/protos.ts",
"preview:website": "cd packages/website && bun run preview"
}, },
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
+1 -1
View File
@@ -12,7 +12,6 @@ yarn-debug.log*
yarn-error.log* yarn-error.log*
pnpm-debug.log* pnpm-debug.log*
# environment variables # environment variables
.env .env
.env.production .env.production
@@ -22,3 +21,4 @@ pnpm-debug.log*
# jetbrains setting folder # jetbrains setting folder
.idea/ .idea/
.vercel/
+5 -3
View File
@@ -1,10 +1,15 @@
// @ts-check // @ts-check
import react from '@astrojs/react'; import react from '@astrojs/react';
import vercel from '@astrojs/vercel/serverless';
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin'; import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
import { defineConfig } from 'astro/config'; import { defineConfig } from 'astro/config';
export default defineConfig({ export default defineConfig({
devToolbar: { enabled: false },
output: 'hybrid',
adapter: vercel(),
integrations: [react()], integrations: [react()],
vite: { vite: {
plugins: [vanillaExtractPlugin()], plugins: [vanillaExtractPlugin()],
@@ -15,7 +20,4 @@ export default defineConfig({
}, },
}, },
}, },
devToolbar: { enabled: false },
outDir: '../../dist/website',
}); });
+6 -6
View File
@@ -10,8 +10,6 @@
"astro": "astro" "astro": "astro"
}, },
"dependencies": { "dependencies": {
"@astrojs/check": "^0.9.3",
"@astrojs/react": "^3.6.2",
"@blitzkit/core": "workspace:*", "@blitzkit/core": "workspace:*",
"@nanostores/persistent": "^0.10.2", "@nanostores/persistent": "^0.10.2",
"@nanostores/react": "^0.7.3", "@nanostores/react": "^0.7.3",
@@ -22,12 +20,10 @@
"@react-three/fiber": "^8.17.6", "@react-three/fiber": "^8.17.6",
"@vanilla-extract/css": "^1.15.5", "@vanilla-extract/css": "^1.15.5",
"@vanilla-extract/dynamic": "^2.1.2", "@vanilla-extract/dynamic": "^2.1.2",
"astro": "^4.15.6",
"compare-versions": "^6.1.1", "compare-versions": "^6.1.1",
"immer": "^10.1.1", "immer": "^10.1.1",
"markdown-to-jsx": "^7.5.0", "markdown-to-jsx": "^7.5.0",
"nanostores": "^0.11.3", "nanostores": "^0.11.3",
"purgecss": "^6.0.0",
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
"react-promise-suspense": "^0.3.4", "react-promise-suspense": "^0.3.4",
@@ -35,9 +31,13 @@
"zustand": "^4.5.5" "zustand": "^4.5.5"
}, },
"devDependencies": { "devDependencies": {
"@astrojs/check": "^0.9.3",
"@astrojs/react": "^3.6.2",
"@astrojs/vercel": "^7.8.1",
"@types/react": "^18.3.5",
"@types/react-dom": "^18",
"@types/three": "^0.160.0", "@types/three": "^0.160.0",
"@vanilla-extract/vite-plugin": "^4.0.15", "@vanilla-extract/vite-plugin": "^4.0.15",
"@types/react-dom": "^18", "astro": "^4.15.6"
"@types/react": "^18.3.5"
} }
} }
+3 -14
View File
@@ -13,9 +13,7 @@ const tool = TOOLS.find((tool) => tool.id === toolId);
<RootLayout> <RootLayout>
{ {
tool && ( tool && isToolRoot && (
<>
{isToolRoot && (
<> <>
<title>{tool.title}</title> <title>{tool.title}</title>
<meta property="og:image" content={imgur(tool.image)} /> <meta property="og:image" content={imgur(tool.image)} />
@@ -23,20 +21,10 @@ const tool = TOOLS.find((tool) => tool.id === toolId);
{tool.pageDescription !== undefined && ( {tool.pageDescription !== undefined && (
<> <>
<meta name="description" content={tool.pageDescription} /> <meta name="description" content={tool.pageDescription} />
<meta <meta property="og:description" content={tool.pageDescription} />
property="og:description"
content={tool.pageDescription}
/>
</> </>
)} )}
</>
)}
</>
)
}
{
pathSplit.length === 3 && (
<Box <Box
style={{ style={{
backgroundImage: `url(${imgur(tool!.image, { backgroundImage: `url(${imgur(tool!.image, {
@@ -59,6 +47,7 @@ const tool = TOOLS.find((tool) => tool.id === toolId);
<Text>{tool?.description}</Text> <Text>{tool?.description}</Text>
</Flex> </Flex>
</Box> </Box>
</>
) )
} }
@@ -0,0 +1,7 @@
import type { APIContext } from 'astro';
export const prerender = false;
export async function GET({}: APIContext) {
return Response.json({ hello: 'world' });
}