Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Astro 中文社区! #76

Draft
wants to merge 57 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
de11c99
refactor: 重构 Astro 中文社区网站
liruifengv Jan 8, 2025
b3ef0c4
format file
liruifengv Jan 8, 2025
cd531bf
feat: Supabase 接入
liruifengv Jan 8, 2025
be5e28d
feat: Supabase 注册、登录
liruifengv Jan 9, 2025
2d47334
feat: 注册改为 actions 实现
liruifengv Jan 9, 2025
eb8a72d
feat: Supabase 注册、登录
liruifengv Jan 9, 2025
66f8120
feat: 新增 supabaseAdmin
liruifengv Jan 9, 2025
52f3fc4
format files
liruifengv Jan 9, 2025
8e3915c
feat: GitHub 登录
liruifengv Jan 9, 2025
f1349b2
feat: GitHub 登录
liruifengv Jan 9, 2025
8668437
feat: 添加 cloudflare 适配器
liruifengv Jan 9, 2025
6431050
fix: use `url` in context
liruifengv Jan 10, 2025
b7cf0d9
remove unused code
liruifengv Jan 10, 2025
234e10e
chore: 修改 cloudflare 图像服务
liruifengv Jan 10, 2025
13b8a88
chore: 使用 cloudflare 环境变量
liruifengv Jan 10, 2025
f8cc936
test: 打印调试 cloudflare 环境变量
liruifengv Jan 10, 2025
15eeaf3
test: 打印调试 cloudflare 环境变量
liruifengv Jan 10, 2025
8ae28cc
test: 打印调试 cloudflare 环境变量
liruifengv Jan 10, 2025
47db208
feat: 修改环境变量
liruifengv Jan 10, 2025
5e9c993
test: 打印调试 cloudflare 环境变量
liruifengv Jan 10, 2025
c47c776
重新部署
liruifengv Jan 10, 2025
f4a9c0c
重新部署
liruifengv Jan 10, 2025
bd6b4f5
重新部署
liruifengv Jan 10, 2025
9d294d8
重新部署
liruifengv Jan 10, 2025
f271c72
重新部署
liruifengv Jan 10, 2025
d74bef8
重新部署
liruifengv Jan 10, 2025
4a7511d
重新部署
liruifengv Jan 10, 2025
ef08c4c
重新部署
liruifengv Jan 10, 2025
b8dc8dd
重新部署
liruifengv Jan 10, 2025
1e5391b
重新部署
liruifengv Jan 10, 2025
991c11e
重新部署
liruifengv Jan 10, 2025
9d6e641
重新部署
liruifengv Jan 10, 2025
0cabd46
Merge branch 'dev2' into dev
liruifengv Jan 13, 2025
9320bd0
delete console.log
liruifengv Jan 13, 2025
03e0bbb
feat: 增加dark mode
liruifengv Jan 13, 2025
868b8f4
feat: 增加dark mode
liruifengv Jan 13, 2025
f66db27
feat: 修改showcase 样式
liruifengv Jan 13, 2025
b188495
chore: 安装集成
liruifengv Jan 13, 2025
d1d2671
feat: 格式化astro.config.mjs
liruifengv Jan 13, 2025
5de6ed2
chore: 安装依赖
liruifengv Jan 13, 2025
a0ff89f
chore: 更新 CF 图片处理方式
liruifengv Jan 13, 2025
26d0266
删除无用项
liruifengv Jan 13, 2025
927eb8e
fix deploy failed
liruifengv Jan 13, 2025
0020d1c
chore: format
liruifengv Jan 13, 2025
0fb9e92
chore: format
liruifengv Jan 13, 2025
7452c1a
chore: format
liruifengv Jan 13, 2025
fc933b5
feat: 通过 google 登录
liruifengv Jan 13, 2025
96d17cc
feat: 显示用户头像
liruifengv Jan 13, 2025
3f5ca25
feat: server island
liruifengv Jan 13, 2025
0b9487b
chore: 用户系统设计
liruifengv Jan 14, 2025
1f2e6bb
fix errors
liruifengv Jan 14, 2025
68937e0
feat: 修改功能
liruifengv Jan 14, 2025
cb94611
feat: 使用 @supabase/ssr 包
liruifengv Jan 15, 2025
ce5c4b6
fix: 修改中间件
liruifengv Jan 15, 2025
5f1c7dd
delete console
liruifengv Jan 15, 2025
74c4782
format
liruifengv Jan 15, 2025
0e6a5b8
feat: 首页逻辑
liruifengv Jan 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SUPABASE_URL=
SUPABASE_ANON_KEY=
SUPABASE_ROLE_KEY=
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ pnpm-debug.log*
# environment variables
.env
.env.production
.dev.vars
.wrangler/dev.vars
wrangler.toml

# macOS-specific files
.DS_Store
Expand Down
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,9 @@
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true
}
},
"[astro]": {
"editor.defaultFormatter": "astro-build.astro-vscode",
"editor.formatOnSave": true
}
}
1 change: 1 addition & 0 deletions .wrangler/.dev.vars.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SUPABASE_ROLE_KEY=123
3 changes: 3 additions & 0 deletions .wrangler/wrangler.toml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[vars]
SUPABASE_URL = "123"
SUPABASE_ANON_KEY = "456"
141 changes: 95 additions & 46 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,52 +1,101 @@
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
import { defineConfig, envField } from 'astro/config';
import tailwind from "@astrojs/tailwind";
const site = 'https://astro-cn.com/';
import cloudflare from '@astrojs/cloudflare';
import icon from "astro-icon";
import react from "@astrojs/react";
import expressiveCode from "astro-expressive-code";

import siteInfo from './src/data/site-info';

import sitemap from "@astrojs/sitemap";

import mdx from "@astrojs/mdx";

// https://astro.build/config
export default defineConfig({
site,
integrations: [starlight({
title: 'Astro 中文网站 Showcase',
social: {
github: 'https://github.com/liruifengv/astro-site-showcase-cn'
},
head: [{
tag: 'meta',
attrs: {
property: 'og:image',
content: site + 'og.png?v=1'
}
}, {
tag: 'meta',
attrs: {
property: 'twitter:image',
content: site + 'og.png?v=1'
site: siteInfo.url,
output: 'server',
integrations: [
tailwind({
// 禁用默认的基础样式
applyBaseStyles: false,
}),
icon(),
react(),
sitemap(),
expressiveCode({
themes: ["material-theme-darker"],
plugins: [{
name: "custom-style",
baseStyles: () => `
.frame.is-terminal:not(.has-title) .header {display: none;}
.frame .header {border-bottom: 2px solid #313131;}
.frame.is-terminal .header::before {display: none;}
.frame.is-terminal:not(.has-title) {
--button-spacing: 0.4rem;
}
.frame.is-terminal:not(.has-title) code, .frame.is-terminal:not(.has-title) pre {
border-radius: 4px
}
.frame.is-terminal .header {
justify-content: initial;
font-weight: initial;
padding-left: 1rem;
color: #fff;
}
`,
hooks: {}
}],
useThemedScrollbars: false,
useThemedSelectionColors: false,
styleOverrides: {
uiLineHeight: "inherit",
codeFontSize: "0.875rem",
codeLineHeight: "1.25rem",
borderRadius: "4px",
borderWidth: "0px",
codePaddingInline: "1rem",
codeFontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;'
}
}, {
tag: 'script',
attrs: {
src: 'https://www.googletagmanager.com/gtag/js?id=G-E8HJ681XLY',
async: true
}
}, {
tag: 'script',
content: `
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-E8HJ681XLY');
`
}],
pagination: false,
pagefind: false,
customCss: ['./src/styles/tailwind.css'],
sidebar: [{
label: 'Showcase',
link: '/showcase/'
}]
}), tailwind({
// 禁用默认的基础样式
applyBaseStyles: false,
})]
}),
mdx()
],
adapter: cloudflare({
imageService: 'passthrough',
platformProxy: {
enabled: true,
configPath: '.wrangler/wrangler.toml',
},
}),
markdown: {
shikiConfig: {
theme: "material-theme-darker",
wrap: false
},
},
env: {
schema: {
SUPABASE_URL: envField.string({
context: "server",
access: "public",
}),
SUPABASE_ANON_KEY: envField.string({
context: "server",
access: "public",
}),
SUPABASE_ROLE_KEY: envField.string({
context: "server",
access: "secret",
}),
},
},
vite: {
resolve: {
// Use react-dom/server.edge instead of react-dom/server.browser for React 19.
// Without this, MessageChannel from node:worker_threads needs to be polyfilled.
alias: import.meta.env.PROD && {
"react-dom/server": "react-dom/server.edge",
},
},
}
});
9 changes: 7 additions & 2 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@
"enabled": true
},
"files": {
"ignore": ["src/**/dist/*"]
"ignore": ["src/**/dist/*", "*.astro"]
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
}
},
"javascript": {
"formatter": {
"semicolons": "asNeeded"
}
}
}
31 changes: 23 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "astro-site-showcase-cn",
"name": "astro-cn.com",
"type": "module",
"version": "0.0.1",
"version": "0.1.0",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
Expand All @@ -15,17 +15,32 @@
"check": "biome check --apply src"
},
"dependencies": {
"@astrojs/check": "^0.5.10",
"@astrojs/starlight": "^0.21.5",
"@astrojs/starlight-tailwind": "^2.0.3",
"@astrojs/check": "^0.9.4",
"@astrojs/cloudflare": "^12.1.0",
"@astrojs/mdx": "^4.0.5",
"@astrojs/react": "^4.1.3",
"@astrojs/sitemap": "^3.2.1",
"@astrojs/tailwind": "^5.1.2",
"astro": "^4.16.5",
"@iconify/tailwind": "^1.2.0",
"@supabase/ssr": "^0.5.2",
"@supabase/supabase-js": "^2.47.12",
"astro": "^5.1.3",
"astro-expressive-code": "^0.39.0",
"astro-icon": "^1.1.5",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"sharp": "^0.32.6",
"tailwindcss": "^3.4.14",
"typescript": "^5.6.3"
"typescript": "^5.7.2",
"zod": "^3.24.1"
},
"author": "liruifengv",
"devDependencies": {
"@biomejs/biome": "1.6.3"
"@biomejs/biome": "1.6.3",
"@iconify-json/ri": "^1.2.5",
"@types/react": "^19.0.6",
"@types/react-dom": "^19.0.3",
"smartypants": "^0.2.2",
"supabase": ">=1.8.1"
}
}
Loading
Loading