Skip to content

Commit

Permalink
init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
javayhu committed Jul 3, 2024
0 parents commit 29bc1d2
Show file tree
Hide file tree
Showing 178 changed files with 1,021,365 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Dockerfile
.dockerignore
node_modules
npm-debug.log
README.md
.next
.git
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
; https://editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# build output
dist/
.output/
.json/

# dependencies
node_modules/

# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
yarn.lock
package-lock.json


# environment variables
.env
.env.production

# macOS-specific files
.DS_Store

# ignore .astro directory
.astro

.idea

# ignore vercel/netlify adapter
.vercel
.netlify
4 changes: 4 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"MD033": false,
"MD013": false
}
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/pages/works/[id].astro
11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"plugins": ["prettier-plugin-astro"],
"overrides": [
{
"files": ["*.astro"],
"options": {
"parser": "astro"
}
}
]
}
43 changes: 43 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
ARG INSTALLER=npm

FROM node:20-alpine AS base

# Install dependencies only when needed
FROM base AS deps
ARG INSTALLER

# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app

# Install dependencies based on the preferred package manager
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
RUN \
if [ "${INSTALLER}" == "yarn" ]; then yarn --frozen-lockfile; \
elif [ "${INSTALLER}" == "npm" ]; then npm ci; \
elif [ "${INSTALLER}" == "pnpm" ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \
else echo "Valid installer not set." && exit 1; \
fi


# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .

# RUN chmod u+x ./installer && ./installer
ARG INSTALLER
RUN \
if [ "${INSTALLER}" == "yarn" ]; then yarn build; \
elif [ "${INSTALLER}" == "npm" ]; then npm run build; \
elif [ "${INSTALLER}" == "pnpm" ]; then pnpm run build; \
else echo "Valid installer not set." && exit 1; \
fi

# Production image, copy all the files and run nginx
FROM nginx:alpine AS runner
COPY ./config/nginx/nginx.conf /etc/nginx/nginx.conf
COPY --from=builder /app/dist /usr/share/nginx/html

WORKDIR /usr/share/nginx/html
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2023 - Present, Zeon Studio

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
76 changes: 76 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<h1 align=center>海棠诗社</h1>

<p align=center>海棠诗社,古诗词的数字桃源</p>

<p align=center>如果觉得这个项目不错的话,可以点个⭐,非常感谢 </p>

## 📌 Key Features

- 🎯 按诗集、朝代、诗人、诗词等方式检索,内容丰富,信息齐全
- 📝 按选集、主题、节日、节气、词牌、时令、地理等方式精选分类
- 🔍 海棠诗社全站响应式布局,兼容移动端,支持暗黑模式,响应速度快
- 👤 海棠诗社支持添加自己喜欢的诗词到个人诗单,永久收藏世间的美好

### 📄 Tech Stacks

- 🖥️ Frontend: @astrodotbuild + @tailwindcss + @shadcn
- 👤 Authentication: @supabase auth
- 📫 Email: @resend
- 📊 Analytics: google analytics + umami
- 🌏 Domain: @Namecheap
- 🗂️ Database: @supabase + @DrizzleORM

## 🔗 Integrations

- astro/react
- astro/sitemap
- astro/tailwind
- astro/vercel

## 🚀 Getting Started

### 📦 Dependencies

- astro 4.0+
- node v20.10+
- npm v10.2+
- tailwind v3.3+

### 👉 Install Dependencies

```bash
npm install
```

### 👉 Development Command

```bash
npm run dev
```

### 👉 Build Command

```bash
npm run build
```

### 👉 Build and Run With Docker

```bash
docker build -t haitang .
# or
# docker --build-arg INSTALLER=npm build -t haitang .
# or
# docker --build-arg INSTALLER=pnpm build -t haitang .

docker run -p 3000:80 haitang
# or
# docker run --rm -p 3000:80 haitang
```

<!-- licence -->
## 📝 License

Copyright (c) 2023 - Present, Designed & Developed by [javayhu](https://javayhu.site)

**Code License:** Released under the [MIT](LICENSE) license.
53 changes: 53 additions & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import mdx from "@astrojs/mdx";
import react from "@astrojs/react";
import sitemap from "@astrojs/sitemap";
import tailwind from "@astrojs/tailwind";
import AutoImport from "astro-auto-import";
import { defineConfig, squooshImageService } from "astro/config";
import remarkCollapse from "remark-collapse";
import remarkToc from "remark-toc";
import config from "./src/config/config.json";
import icon from "astro-icon";
import partytown from "@astrojs/partytown";

import vercel from "@astrojs/vercel/serverless";

// https://astro.build/config
export default defineConfig({
output: 'server',
adapter: vercel(),
site: config.site.base_url,
base: config.site.base_path ? config.site.base_path : "/",
trailingSlash: config.site.trailing_slash ? "always" : "never",
image: {
service: squooshImageService()
},
integrations: [react(), sitemap(), tailwind({
config: {
applyBaseStyles: false
}
}), AutoImport({
imports: []
}), mdx(), icon({
include: {
tabler: ['*']
}
}), partytown({
config: {
debug: true,
forward: ['dataLayer.push']
}
})
// solidJs()
],
markdown: {
remarkPlugins: [remarkToc, [remarkCollapse, {
test: "Table of contents"
}]],
shikiConfig: {
theme: "one-dark-pro",
wrap: true
},
extendDefaultPlugins: true
}
});
17 changes: 17 additions & 0 deletions components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": false,
"tsx": true,
"tailwind": {
"config": "tailwind.config.js",
"css": "src/styles/main.scss",
"baseColor": "gray",
"cssVariables": false,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
}
31 changes: 31 additions & 0 deletions config/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
worker_processes 1;

events {
worker_connections 1024;
}

http {
server {
listen 80;
server_name _;

root /usr/share/nginx/html;
index index.html index.htm;
include /etc/nginx/mime.types;

gzip on;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;

error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
internal;
}

location / {
try_files $uri ${uri}.html $uri/index.html =404;
}
}
}
Loading

0 comments on commit 29bc1d2

Please sign in to comment.