Skip to content

Commit bf63dfb

Browse files
committed
use astro db+vercel
1 parent 7d83b9f commit bf63dfb

20 files changed

+950
-300
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ RUN --mount=type=secret,id=env,dst=/etc/secrets/.env \
1717
&& cp /etc/secrets/.env .env \
1818
&& npm install \
1919
&& npm run prisma-generate \
20-
&& npm run build
20+
&& npx astro build --remote
2121

2222
ENV HOST=0.0.0.0
2323
ENV PORT=4321

astro.config.ts

+44-56
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,22 @@ import { remarkSummary } from "./src/plugins/remark-summary";
2929
// transformerNotationHighlight,
3030
// } from "shikiji-transformers";
3131
import db from "@astrojs/db";
32+
import vercel from "@astrojs/vercel/serverless";
3233
import expressiveCode from "astro-expressive-code";
34+
import "@astrojs/db/virtual.d.ts";
3335
const __dirname = dirname(fileURLToPath(import.meta.url));
3436

3537
/**
3638
* @type {import('astro').AstroConfig}
3739
*/
3840

41+
// https://astro.build/config
3942
export default defineConfig({
4043
output: "server",
41-
adapter: node({
42-
mode: "standalone",
43-
}),
44+
adapter: vercel(),
45+
// adapter: node({
46+
// mode: "standalone",
47+
// }),
4448
site: "https://www.railsdev.dev",
4549
integrations: [
4650
customImageResizer,
@@ -62,44 +66,36 @@ export default defineConfig({
6266
remarkPlugins: [
6367
// @ts-expect-error - This is a valid plugin that returns a Transformer,
6468
// but the type definition is not compatible with the expected [unified.Plugin, string[]] type.
65-
[
66-
remarkShakuCodeAnnotate,
67-
{
68-
fallbackToShiki: true,
69-
theme: "material-theme-darker",
70-
langs: [
71-
"bash",
72-
"fish",
73-
"go",
74-
"html",
75-
"javascript",
76-
"json",
77-
"jsonc",
78-
"jsx",
79-
"lua",
80-
"rb",
81-
"ruby",
82-
"sh",
83-
"toml",
84-
"ts",
85-
"ts",
86-
"tsx",
87-
"typescript",
88-
"vim",
89-
"yaml",
90-
"yml",
91-
],
92-
},
93-
],
94-
],
95-
rehypePlugins: [
96-
[
97-
rehypeAutolinkHeadings,
98-
{
99-
behavior: "append",
100-
},
101-
],
69+
[remarkShakuCodeAnnotate, {
70+
fallbackToShiki: true,
71+
theme: "material-theme-darker",
72+
langs: [
73+
"bash",
74+
"fish",
75+
"go",
76+
"html",
77+
"javascript",
78+
"json",
79+
"jsonc",
80+
"jsx",
81+
"lua",
82+
"rb",
83+
"ruby",
84+
"sh",
85+
"toml",
86+
"ts",
87+
"ts",
88+
"tsx",
89+
"typescript",
90+
"vim",
91+
"yaml",
92+
"yml",
93+
],
94+
}],
10295
],
96+
rehypePlugins: [[rehypeAutolinkHeadings, {
97+
behavior: "append",
98+
}]],
10399
shikiConfig: {
104100
theme: "material-theme-darker",
105101
transformers: [
@@ -134,23 +130,15 @@ export default defineConfig({
134130
$: path.resolve(__dirname, "./src"),
135131
},
136132
},
137-
plugins: [
138-
svgr({
139-
include: "**/*.svg?react",
140-
svgrOptions: {
141-
plugins: ["@svgr/plugin-svgo", "@svgr/plugin-jsx"],
142-
svgoConfig: {
143-
plugins: [
144-
"preset-default",
145-
"removeTitle",
146-
"removeDesc",
147-
"removeDoctype",
148-
"cleanupIds",
149-
],
150-
},
133+
plugins: [svgr({
134+
include: "**/*.svg?react",
135+
svgrOptions: {
136+
plugins: ["@svgr/plugin-svgo", "@svgr/plugin-jsx"],
137+
svgoConfig: {
138+
plugins: ["preset-default", "removeTitle", "removeDesc", "removeDoctype", "cleanupIds"],
151139
},
152-
}),
153-
],
140+
},
141+
})],
154142
},
155143
image: {
156144
service: squooshImageService(),

dprint.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
"lineWidth": 80,
66
"textWrap": "always"
77
},
8-
"biome": {},
8+
"biome": {
9+
"associations": [
10+
"!**/tests/*.ts"
11+
]
12+
},
913
"excludes": ["**/node_modules", "**/*-lock.json"],
1014
"plugins": [
1115
"https://plugins.dprint.dev/typescript-0.90.4.wasm",

eslint.config.cjs

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
const eslintPluginAstro = require("eslint-plugin-astro");
2-
// const eslintPluginA11y = require("eslint-plugin-jsx-a11y");
32
module.exports = [
43
// add more generic rule sets here, such as:
54
// js.configs.recommended,
65
...eslintPluginAstro.configs["flat/recommended"], // In CommonJS, the `flat/` prefix is required.
76
// ...eslintPluginAstro.configs["flat/jsx-a11y-recommended"], // In CommonJS, the `flat/` prefix is required.
87
// ...eslintPluginA11y.configs.recommended
98
{
9+
files: ["*.astro", "*.tsx"],
1010
rules: {
11-
// override/add rules settings here, such as:
12-
// "astro/no-set-html-directive": "error"
11+
"@typescript-eslint/no-unused-vars": [
12+
"error",
13+
{
14+
varsIgnorePattern: "^(Props|_)$",
15+
argsIgnorePattern: "^_",
16+
},
17+
],
1318
},
1419
},
1520
];

0 commit comments

Comments
 (0)