Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM oven/bun:1.3.10 AS bun

FROM mcr.microsoft.com/devcontainers/typescript-node:24
COPY --from=bun /usr/local/bin/bun /usr/local/bin/bun
COPY --from=bun /usr/local/bin/bunx /usr/local/bin/bunx
29 changes: 29 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "Bun",
"build": { "dockerfile": "Dockerfile" },
"postCreateCommand": "bun install",
"customizations": {
"vscode": {
"extensions": [
"ms-azuretools.vscode-docker",
"oven.bun-vscode",
"yzhang.markdown-all-in-one",
"unifiedjs.vscode-mdx",
"xyc.vscode-mdx-preview",
"jock.svg",
"redhat.vscode-yaml",
"clinyong.vscode-css-modules",
"akamud.vscode-caniuse",
"visualstudioexptteam.intellicode-api-usage-examples",
"pflannery.vscode-versionlens",
"christian-kohler.npm-intellisense",
"esbenp.prettier-vscode",
"rangav.vscode-thunder-client",
"eamodio.gitlens",
"github.vscode-pull-request-github",
"github.vscode-github-actions",
"GitHub.copilot-chat"
]
}
}
}
19 changes: 19 additions & 0 deletions .github/pr-badge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# install https://pullrequestbadge.com/ first

- icon: visualstudio
label: "GitHub.dev"
message: "PR-$prNumber"
color: "blue"
url: "https://github.dev/$owner/$repo/pull/$prNumber"

- icon: github
label: "GitHub codespaces"
message: "PR-$prNumber"
color: "black"
url: "https://codespaces.new/$owner/$repo/pull/$prNumber"

- icon: git
label: "GitPod.io"
message: "PR-$prNumber"
color: "orange"
url: "https://gitpod.io/?autostart=true#https://github.com/$owner/$repo/pull/$prNumber"
89 changes: 89 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# These settings are synced to GitHub by https://probot.github.io/apps/settings/

repository:
allow_merge_commit: false

delete_branch_on_merge: true

enable_vulnerability_alerts: true

labels:
- name: bug
color: "#d73a4a"
description: Something isn't working

- name: documentation
color: "#0075ca"
description: Improvements or additions to documentation

- name: duplicate
color: "#cfd3d7"
description: This issue or pull request already exists

- name: enhancement
color: "#a2eeef"
description: Some improvements

- name: feature
color: "#16b33f"
description: New feature or request

- name: good first issue
color: "#7057ff"
description: Good for newcomers

- name: help wanted
color: "#008672"
description: Extra attention is needed

- name: invalid
color: "#e4e669"
description: This doesn't seem right

- name: question
color: "#d876e3"
description: Further information is requested

- name: wontfix
color: "#ffffff"
description: This will not be worked on

- name: reward
color: "#f9d0c4"
description: GitHub-reward for contributions

branches:
- name: main
# https://docs.github.com/en/rest/reference/repos#update-branch-protection
protection:
# Required. Require at least one approving review on a pull request, before merging. Set to null to disable.
required_pull_request_reviews:
# The number of approvals required. (1-6)
required_approving_review_count: 1
# Dismiss approved reviews automatically when a new commit is pushed.
dismiss_stale_reviews: true
# Blocks merge until code owners have reviewed.
require_code_owner_reviews: true
# Specify which users and teams can dismiss pull request reviews.
# Pass an empty dismissal_restrictions object to disable.
# User and team dismissal_restrictions are only available for organization-owned repositories.
# Omit this parameter for personal repositories.
dismissal_restrictions:
# users: []
# teams: []
# Required. Require status checks to pass before merging. Set to null to disable
required_status_checks:
# Required. Require branches to be up to date before merging.
strict: true
# Required. The list of status checks to require in order to merge into this branch
contexts: []
# Required. Enforce all configured restrictions for administrators.
# Set to true to enforce required status checks for repository administrators.
# Set to null to disable.
enforce_admins: true
# Prevent merge commits from being pushed to matching branches
required_linear_history: true
# Required. Restrict who can push to this branch.
# Team and user restrictions are only available for organization-owned repositories.
# Set to null to disable.
restrictions: null
120 changes: 69 additions & 51 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,80 @@
name: Deploy to GitHub Pages
name: Deploy to Vercel

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
branches:
- "**"

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

contents: write
jobs:
build:
Build-and-Deploy:
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/checkout@v6
if: ${{ env.VERCEL_TOKEN && env.VERCEL_ORG_ID && env.VERCEL_PROJECT_ID }}

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- uses: oven-sh/setup-bun@v2
if: ${{ env.VERCEL_TOKEN && env.VERCEL_ORG_ID && env.VERCEL_PROJECT_ID }}

- name: Restore cache
uses: actions/cache@v4
with:
path: |
.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/bun.lock', '**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-nextjs-

- name: Install dependencies
run: bun install

- name: Build with Next.js
run: bun run build
env:
NODE_ENV: production
NEXT_TELEMETRY_DISABLED: 1

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./out
- name: Deploy to Vercel
id: vercel-deployment
if: ${{ env.VERCEL_TOKEN && env.VERCEL_ORG_ID && env.VERCEL_PROJECT_ID }}
shell: bash
run: |
set -euo pipefail

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
bun install vercel -g

if [[ "$GITHUB_REF" == 'refs/heads/main' ]]; then
DeployOutput=$(vercel -t "$VERCEL_TOKEN" --prod)
else
DeployOutput=$(vercel -t "$VERCEL_TOKEN")
fi
echo "$DeployOutput"

ParsedURL=$(echo "$DeployOutput" | grep -Eo 'https://[^[:space:]]*\.vercel\.app' | tail -n 1)

if [[ -z "$ParsedURL" ]]; then
echo "Failed to parse Vercel URL from deploy output"
exit 1
fi
vercel inspect "$ParsedURL" -t "$VERCEL_TOKEN" -F json > vercel-inspect.json

InspectURL=$(jq -r '.url // empty' vercel-inspect.json)

if [[ -z "$InspectURL" ]]; then
echo "Failed to parse inspect url from vercel-inspect.json"
exit 1
fi
if [[ "$InspectURL" != http* ]]; then
InspectURL="https://$InspectURL"
fi
echo "preview-url=$InspectURL" >> "$GITHUB_OUTPUT"

- name: Lark notification
uses: Open-Source-Bazaar/feishu-action@v3
with:
url: ${{ secrets.LARK_CHATBOT_HOOK_URL }}
msg_type: interactive
content: |
schema: "2.0"
config:
wide_screen_mode: true
header:
title:
tag: plain_text
content: Vercel deployment
template: blue
body:
elements:
- tag: markdown
content: |
- **Git Repository**: [${{ github.server_url }}/${{ github.repository }}](${{ github.server_url }}/${{ github.repository }})
- **Code Branch**: [${{ github.ref }}](${{ github.server_url }}/${{ github.repository }}/tree/${{ github.ref_name }})
- **Commit Author**: [${{ github.actor }}](${{ github.server_url }}/${{ github.actor }})
- **Preview Link**: [${{ steps.vercel-deployment.outputs.preview-url }}](${{ steps.vercel-deployment.outputs.preview-url }})
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ next-env.d.ts
.yoyo/

# VSCode
.vscode/
.env*.local
.vscode/settings.json

# Security - prevent credential leaks
*.pem
Expand Down Expand Up @@ -78,5 +77,6 @@ __pycache__/
*.bak
*.backup
*.old
.vscode/

# Secret environment files (local overrides)
.env*.local
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export COREPACK_ENABLE_AUTO_PIN=0
npm run lint
npm test
1 change: 1 addition & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm run build
20 changes: 20 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"recommendations": [
"yzhang.markdown-all-in-one",
"unifiedjs.vscode-mdx",
"xyc.vscode-mdx-preview",
"jock.svg",
"redhat.vscode-yaml",
"clinyong.vscode-css-modules",
"akamud.vscode-caniuse",
"visualstudioexptteam.intellicode-api-usage-examples",
"pflannery.vscode-versionlens",
"christian-kohler.npm-intellisense",
"esbenp.prettier-vscode",
"rangav.vscode-thunder-client",
"eamodio.gitlens",
"github.vscode-pull-request-github",
"github.vscode-github-actions",
"GitHub.copilot-chat"
]
}
Loading