A bunch of shit
This commit is contained in:
parent
6b09a5350e
commit
19e6beaec4
12 changed files with 1042 additions and 27 deletions
|
|
@ -1,3 +1,30 @@
|
||||||
import { defineConfig } from 'astro/config';
|
import { defineConfig } from 'astro/config';
|
||||||
|
import type { Plugin } from 'vite';
|
||||||
|
import wisp from "wisp-server-node";
|
||||||
|
import node from '@astrojs/node';
|
||||||
|
import tailwindcss from '@tailwindcss/vite';
|
||||||
|
|
||||||
export default defineConfig({});
|
const viteWispServer = (): Plugin => {
|
||||||
|
return {
|
||||||
|
name: 'vite-wisp-server',
|
||||||
|
configureServer(server) {
|
||||||
|
server.httpServer?.on('upgrade', (req, socket, head) => {
|
||||||
|
console.log('3');
|
||||||
|
req.url.startsWith('/wisp') ? wisp.routeRequest(req, socket, head) : undefined
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
vite: {
|
||||||
|
plugins: [
|
||||||
|
tailwindcss(),
|
||||||
|
viteWispServer()
|
||||||
|
]
|
||||||
|
},
|
||||||
|
output: 'server',
|
||||||
|
adapter: node({
|
||||||
|
mode: 'middleware'
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
|
||||||
22
package.json
22
package.json
|
|
@ -3,15 +3,25 @@
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "astro dev",
|
"dev:server": "tsx --watch server",
|
||||||
"build": "astro build",
|
"dev:client": "astro dev",
|
||||||
"preview": "astro preview",
|
"dev": "npm run dev:client",
|
||||||
|
"build:server": "tsc -p server",
|
||||||
|
"build:client": "astro check && astro build",
|
||||||
|
"build": "npm run build:server & npm run build:client",
|
||||||
|
"bstart": "npm run build && npm run start",
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/node": "^9.1.3",
|
"@astrojs/node": "^9.1.3",
|
||||||
|
"@fastify/middie": "^9.0.3",
|
||||||
|
"@fastify/static": "^8.1.1",
|
||||||
|
"@tailwindcss/vite": "^4.0.14",
|
||||||
"@titaniumnetwork-dev/ultraviolet": "^3.2.10",
|
"@titaniumnetwork-dev/ultraviolet": "^3.2.10",
|
||||||
"astro": "^5.5.2",
|
"astro": "^5.5.2",
|
||||||
|
"fastify": "^5.2.1",
|
||||||
|
"tailwindcss": "^4.0.14",
|
||||||
|
"vite": "^6.2.2",
|
||||||
"wisp-server-node": "^1.1.7"
|
"wisp-server-node": "^1.1.7"
|
||||||
},
|
},
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
|
|
@ -21,5 +31,9 @@
|
||||||
"sharp",
|
"sharp",
|
||||||
"utf-8-validate"
|
"utf-8-validate"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^22.13.10",
|
||||||
|
"tsx": "^4.19.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
946
pnpm-lock.yaml
generated
946
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
29
server/index.ts
Normal file
29
server/index.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
import Fastify, { FastifyReply, FastifyRequest } from 'fastify';
|
||||||
|
import fastifyMiddie from '@fastify/middie';
|
||||||
|
import fastifyStatic from '@fastify/static';
|
||||||
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
|
//@ts-ignore this is created at runtime. No types associated w/it
|
||||||
|
import { handler as astroHandler } from "../dist/server/entry.mjs";
|
||||||
|
|
||||||
|
|
||||||
|
const app = Fastify({
|
||||||
|
logger: true,
|
||||||
|
ignoreDuplicateSlashes: true,
|
||||||
|
ignoreTrailingSlash: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
await app.register(fastifyStatic, {
|
||||||
|
root: fileURLToPath(new URL('../dist/client', import.meta.url))
|
||||||
|
});
|
||||||
|
|
||||||
|
await app.register(fastifyMiddie);
|
||||||
|
|
||||||
|
await app.use(astroHandler);
|
||||||
|
|
||||||
|
const port = parseInt(process.env.PORT as string) || parseInt("8080");
|
||||||
|
|
||||||
|
app.listen({ port: port, host: "0.0.0.0" }).then(async () => {
|
||||||
|
console.log(`Server listening on http://localhost:${port}/`);
|
||||||
|
console.log(`Server also listening on http://0.0.0.0:${port}/`);
|
||||||
|
});
|
||||||
11
server/tsconfig.json
Normal file
11
server/tsconfig.json
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2020",
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"noEmit": false,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"paths": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
0
src/components/Header.astro
Normal file
0
src/components/Header.astro
Normal file
|
|
@ -1 +0,0 @@
|
||||||
|
|
||||||
|
|
@ -1,3 +1,6 @@
|
||||||
|
---
|
||||||
|
import "@styles/global.css";
|
||||||
|
---
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
|
@ -5,10 +8,12 @@
|
||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||||
<meta name="generator" content={Astro.generator} />
|
<meta name="generator" content={Astro.generator} />
|
||||||
<title>Astro Basics</title>
|
<title>Radius</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="h-full">
|
||||||
<slot />
|
<div class="h-full w-full fixed">
|
||||||
|
<slot />
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
---
|
---
|
||||||
import Welcome from '../components/Welcome.astro';
|
import Layout from '@layouts/Layout.astro';
|
||||||
import Layout from '../layouts/Layout.astro';
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<Layout>
|
||||||
|
<h1> E </h1>
|
||||||
|
</Layout>
|
||||||
|
|
|
||||||
1
src/styles/global.css
Normal file
1
src/styles/global.css
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
@import "tailwindcss";
|
||||||
0
src/utils/.gitkeep
Normal file
0
src/utils/.gitkeep
Normal file
|
|
@ -1,5 +1,15 @@
|
||||||
{
|
{
|
||||||
"extends": "astro/tsconfigs/strict",
|
"extends": "astro/tsconfigs/strict",
|
||||||
"include": [".astro/types.d.ts", "**/*"],
|
"include": [".astro/types.d.ts", "**/*"],
|
||||||
"exclude": ["dist"]
|
"exclude": ["dist"],
|
||||||
|
"compilerOptions": {
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"@components/*": ["src/components/*"],
|
||||||
|
"@layouts/*": ["src/layouts/*"],
|
||||||
|
"@utils/*": ["src/utils/*"],
|
||||||
|
"@assets/*": ["src/assets/*"],
|
||||||
|
"@styles/*": ["src/styles/*"]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue