Skip to content

Commit efe8209

Browse files
committed
refactor: v0.2.0
1 parent 8a0e265 commit efe8209

88 files changed

Lines changed: 2621 additions & 5073 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.*
2+
dist
3+
node_modules

.eslintrc.json

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
id: meta
2929
uses: docker/metadata-action@v5
3030
with:
31-
images: sunls24/online-tools
31+
images: sunls24/devtools
3232
tags: |
3333
type=raw,value=latest
3434
type=ref,event=tag
@@ -42,3 +42,7 @@ jobs:
4242
labels: ${{ steps.meta.outputs.labels }}
4343
cache-from: type=gha
4444
cache-to: type=gha,mode=max
45+
build-args: |
46+
UMAMI_ID=${{ vars.UMAMI_ID }}
47+
UMAMI_URL=${{ vars.UMAMI_URL }}
48+
UMAMI_DOMAINS=${{ vars.UMAMI_DOMAINS }}

.gitignore

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,3 @@
1-
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2-
3-
# dependencies
4-
/node_modules
5-
/.pnp
6-
.pnp.js
7-
8-
# testing
9-
/coverage
10-
11-
# next.js
12-
/.next/
13-
/out/
14-
15-
# production
16-
/build
17-
18-
# misc
19-
.DS_Store
20-
*.pem
21-
22-
# debug
23-
npm-debug.log*
24-
yarn-debug.log*
25-
yarn-error.log*
26-
27-
# local env files
28-
.env*.local
29-
30-
# vercel
31-
.vercel
32-
33-
# typescript
34-
*.tsbuildinfo
35-
next-env.d.ts
36-
371
.idea
2+
.DS_Store
3+
.env.local

.prettierignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

Dockerfile

Lines changed: 20 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,29 @@
1-
FROM node:20-alpine AS base
2-
3-
# Install dependencies only when needed
4-
FROM base AS deps
5-
RUN apk add --no-cache libc6-compat
1+
FROM oven/bun:alpine AS bun-builder
62
WORKDIR /app
3+
ARG UMAMI_ID
4+
ARG UMAMI_URL
5+
ARG UMAMI_DOMAINS
76

8-
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
9-
RUN \
10-
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
11-
elif [ -f package-lock.json ]; then npm ci; \
12-
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \
13-
else echo "Lockfile not found." && exit 1; \
14-
fi
7+
COPY ./web/package.json ./web/bun.lock ./
8+
RUN bun install --frozen-lockfile
9+
COPY ./web .
10+
RUN bunx astro telemetry disable && bun run build
1511

16-
# Rebuild the source code only when needed
17-
FROM base AS builder
12+
FROM golang:1.24-alpine AS builder
1813
WORKDIR /app
19-
COPY --from=deps /app/node_modules ./node_modules
14+
COPY go.mod go.sum ./
15+
RUN go mod download
2016
COPY . .
17+
COPY --from=bun-builder /app/dist ./web/dist/
18+
RUN CGO_ENABLED=0 go build -ldflags '-s -w' -o devtools cmd/main.go
2119

22-
ENV NEXT_TELEMETRY_DISABLED 1
23-
RUN \
24-
if [ -f yarn.lock ]; then yarn run build; \
25-
elif [ -f package-lock.json ]; then npm run build; \
26-
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \
27-
else echo "Lockfile not found." && exit 1; \
28-
fi
29-
30-
# Production image, copy all the files and run next
31-
FROM base AS runner
20+
FROM alpine AS runner
3221
WORKDIR /app
22+
COPY --from=builder /app/devtools .
23+
RUN apk add --no-cache tzdata
3324

34-
ENV NODE_ENV production
35-
ENV NEXT_TELEMETRY_DISABLED 1
36-
37-
RUN addgroup --system --gid 1001 nodejs
38-
RUN adduser --system --uid 1001 nextjs
39-
40-
COPY --from=builder /app/public ./public
41-
42-
RUN mkdir .next
43-
RUN chown nextjs:nodejs .next
44-
45-
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
46-
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
47-
48-
USER nextjs
49-
25+
ENV TZ=Asia/Shanghai
26+
ENV HOST=127.0.0.1
27+
ENV PORT=3000
5028
EXPOSE 3000
51-
ENV PORT 3000
52-
CMD HOSTNAME="127.0.0.1" node server.js
29+
CMD ["/app/devtools"]

README.md

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# 💬 概述
22

3+
**(正在重构中)**
4+
5+
使用 Golang + Astro + React 重构替换 Next.js
6+
37
一款简洁高效的在线工具箱
48

59
- [x] JSON 在线解析及格式化验证
@@ -9,24 +13,19 @@
913

1014
## 🚀 本地运行
1115

12-
1. 克隆仓库:
13-
14-
```sh
15-
git clone https://github.com/sunls24/online-tools
16-
```
17-
18-
2. 安装依赖项:
19-
20-
```bash
21-
pnpm install
22-
```
16+
```shell
17+
# 安装 bun
18+
brew install oven-sh/bun/bun
2319

24-
3. 本地运行:
20+
# 前端打包
21+
cd web && bun install && bun run build && cd -
2522

26-
```bash
27-
pnpm dev
23+
# 运行
24+
go run cmd/main.go
2825
```
2926

30-
## ☁️ 使用 Vercel 部署
27+
## sqlc 生成数据库模型
3128

32-
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fsunls24%2Fonline-tools)
29+
```shell
30+
go generate ./internal/sqlc
31+
```

app/[tool]/page.tsx

Lines changed: 0 additions & 43 deletions
This file was deleted.

app/globals.css

Lines changed: 0 additions & 22 deletions
This file was deleted.

app/layout.tsx

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)