Skip to content

Commit c204310

Browse files
author
linchengyuan.77
committed
chore: initialize repository and enable GitHub Pages workflow
Change-Id: I4112bf4a70d72aab1842d9bfc45f53d4913e00aa
1 parent 932edcd commit c204310

93 files changed

Lines changed: 37760 additions & 0 deletions

Some content is hidden

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

.babelrc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"presets": [
3+
[
4+
"next/babel",
5+
{
6+
"preset-react": {
7+
"development": true
8+
}
9+
}
10+
]
11+
],
12+
"plugins": [
13+
"@react-dev-inspector/babel-plugin"
14+
]
15+
}

.coze

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[project]
2+
requires = ["nodejs-24"]
3+
4+
[dev]
5+
build = ["bash", "./scripts/prepare.sh"]
6+
run = ["bash", "./scripts/dev.sh"]
7+
deps = ["git"] # -> apt install git
8+
9+
[deploy]
10+
build = ["bash","./scripts/build.sh"]
11+
run = ["bash","./scripts/start.sh"]
12+
deps = ["git"] # -> apt install git

.github/workflows/deploy.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: "pages"
15+
cancel-in-progress: false
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Setup pnpm
25+
uses: pnpm/action-setup@v4
26+
with:
27+
version: 9
28+
29+
- name: Setup Node
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: 24
33+
cache: pnpm
34+
35+
- name: Install dependencies
36+
run: pnpm install
37+
38+
- name: Build
39+
run: pnpm build
40+
41+
- name: Upload artifact
42+
uses: actions/upload-pages-artifact@v3
43+
with:
44+
path: ./out
45+
46+
deploy:
47+
environment:
48+
name: github-pages
49+
url: ${{ steps.deployment.outputs.page_url }}
50+
runs-on: ubuntu-latest
51+
needs: build
52+
steps:
53+
- name: Deploy to GitHub Pages
54+
id: deployment
55+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
node_modules
2+
.next
3+
out
4+
.DS_Store
5+
.env
6+
.env.local
7+
.env.production
8+
.env.development
9+
coverage

.npmrc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
loglevel=error
2+
registry=https://registry.npmmirror.com
3+
4+
strictStorePkgContentCheck=false
5+
verifyStoreIntegrity=false
6+
7+
# 网络优化
8+
network-concurrency=16
9+
fetch-retries=3
10+
fetch-timeout=60000
11+
12+
# 严格使用 peer dependencies
13+
strict-peer-dependencies=false
14+
15+
# 自动生成 lockfile
16+
auto-install-peers=true
17+
18+
# lockfile 配置
19+
lockfile=true
20+
prefer-frozen-lockfile=true
21+
22+
# 如果 lockfile 存在但过期,更新而不是失败
23+
resolution-mode=highest

DEPLOYMENT.md

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
# JSON Formatter 应用部署指南
2+
3+
## 📦 包含的文件
4+
5+
压缩包包含以下关键内容:
6+
7+
- **源代码**:完整的 Next.js + TypeScript 项目
8+
- **国际化文件**:英文、简体中文、繁体中文支持
9+
- **UI 组件**:shadcn/ui 组件库
10+
- **配置文件**:Next.js、TypeScript、ESLint 等配置
11+
- **依赖文件**:package.json 和 pnpm-lock.yaml
12+
13+
## 🚀 快速部署
14+
15+
### 1. 解压文件
16+
17+
```bash
18+
tar -xzf json-formatter-app.tar.gz
19+
cd projects
20+
```
21+
22+
### 2. 安装依赖
23+
24+
```bash
25+
# 使用 pnpm 安装依赖(推荐)
26+
pnpm install
27+
```
28+
29+
### 3. 启动开发服务器
30+
31+
```bash
32+
# 使用 coze CLI 启动开发环境
33+
coze dev
34+
```
35+
36+
应用将在 http://localhost:5000 上运行
37+
38+
### 4. 构建生产版本
39+
40+
```bash
41+
# 构建项目
42+
coze build
43+
44+
# 启动生产服务器
45+
coze start
46+
```
47+
48+
## 📋 系统要求
49+
50+
- Node.js 24+
51+
- pnpm 8+
52+
- 现代浏览器(支持 Monaco Editor)
53+
54+
## 🔧 环境变量
55+
56+
无需配置环境变量,应用开箱即用。
57+
58+
## 🌐 功能特性
59+
60+
- ✅ JSON 格式化和压缩
61+
- ✅ 查找替换功能
62+
- ✅ 转义字符处理(定向和全部)
63+
- ✅ Python Dict ↔ JSON 互转
64+
- ✅ 单引号转双引号
65+
- ✅ 历史记录保存和回溯
66+
- ✅ 国际化支持(英文、简体中文、繁体中文)
67+
- ✅ 自动语言检测
68+
- ✅ 深色模式编辑器
69+
70+
## 📁 项目结构
71+
72+
```
73+
projects/
74+
├── src/
75+
│ ├── app/ # Next.js App Router 页面
76+
│ │ ├── page.tsx # 主页面
77+
│ │ └── layout.tsx # 根布局
78+
│ ├── components/ # React 组件
79+
│ │ ├── ui/ # shadcn/ui 组件
80+
│ │ └── LanguageSelector.tsx # 语言选择器
81+
│ ├── i18n/ # 国际化配置
82+
│ │ ├── index.ts # i18n 工具函数
83+
│ │ └── locales/ # 语言包
84+
│ │ ├── en.ts
85+
│ │ ├── zh-CN.ts
86+
│ │ └── zh-TW.ts
87+
│ ├── hooks/ # React Hooks
88+
│ └── lib/ # 工具函数
89+
├── public/ # 静态资源
90+
├── package.json # 项目配置
91+
├── pnpm-lock.yaml # 依赖锁定文件
92+
├── .coze # Coze CLI 配置
93+
└── next.config.ts # Next.js 配置
94+
```
95+
96+
## 🛠️ 自定义配置
97+
98+
### 修改默认端口
99+
100+
编辑 `.coze` 文件,修改 `run` 命令中的端口:
101+
102+
```toml
103+
[dev]
104+
run = ["pnpm", "dev", "--port", "5000", "--host"]
105+
```
106+
107+
### 添加新的语言支持
108+
109+
1.`src/i18n/locales/` 创建新的语言文件
110+
2.`src/i18n/index.ts` 中注册新语言
111+
3. 更新 `Locale` 类型定义
112+
113+
### 修改编辑器主题
114+
115+
编辑 `src/app/page.tsx`,修改 Monaco Editor 的 `theme` 属性:
116+
117+
```typescript
118+
<Editor
119+
theme="vs-light" // 改为浅色主题
120+
// ...
121+
/>
122+
```
123+
124+
## 🔒 注意事项
125+
126+
1. **Node.js 版本**:确保使用 Node.js 24 或更高版本
127+
2. **包管理器**:必须使用 pnpm,不要使用 npm 或 yarn
128+
3. **端口冲突**:确保 5000 端口未被占用
129+
4. **浏览器兼容性**:建议使用 Chrome、Firefox、Edge 等现代浏览器
130+
131+
## 📝 技术栈
132+
133+
- **框架**:Next.js 16 (App Router)
134+
- **语言**:TypeScript 5
135+
- **UI 库**:shadcn/ui (Radix UI + Tailwind CSS)
136+
- **编辑器**:Monaco Editor
137+
- **包管理**:pnpm
138+
- **构建工具**:Coze CLI
139+
140+
## 🤝 支持与反馈
141+
142+
如有问题或建议,请通过以下方式联系:
143+
144+
- 查看项目 README.md
145+
- 检查控制台错误信息
146+
- 确认依赖是否正确安装
147+
148+
## 📜 许可证
149+
150+
本项目基于 Coze Code 创建和使用。
151+
152+
---
153+
154+
**最后更新**:2025-01-22
155+
**版本**:1.0.0

0 commit comments

Comments
 (0)