Skip to content

Commit

Permalink
refactor: 使用monorepo组织代码
Browse files Browse the repository at this point in the history
refactor: 使用monorepo组织代码
  • Loading branch information
TBXark authored Nov 14, 2024
2 parents c83e559 + b40290e commit 6631e56
Show file tree
Hide file tree
Showing 123 changed files with 8,747 additions and 6,617 deletions.
5 changes: 4 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ node_modules
plugins
scripts
wrangler.toml
config.json
config.json
packages/**/dist
packages/**/node_modules
packages/**/tsconfig.tsbuildinfo
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm install
- run: npm run build
- run: node ./dist/index.js
node-version: 20
- run: npm install -g pnpm
- run: pnpm install
- run: pnpm run build:all
8 changes: 5 additions & 3 deletions .github/workflows/cloudflare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
- run: touch wrangler.toml
- run: |
cat << 'EOF' > wrangler.toml
${{secrets.WRANGLER_TOML}}
EOF
- run: npm install
- run: CLOUDFLARE_API_TOKEN=${{ secrets.CF_API_TOKEN }} npm run wrangler deploy --config=wrangler.toml > /dev/null
- run: npm install -g pnpm
- run: pnpm install
- run: pnpm run build:all
- run: CLOUDFLARE_API_TOKEN=${{ secrets.CF_API_TOKEN }} pnpm run wrangler deploy --config=wrangler.toml > /dev/null

- name: Check CF_WORKERS_DOMAIN exists
run: |
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build and Publish Docker Image

on:
push:
branches: [ master ]
workflow_dispatch:

jobs:
build-and-push:
permissions:
packages: write
contents: read
runs-on: ubuntu-latest
steps:
- name: Build and push Docker image
uses: TBXark/docker-action@master
with:
docker_registry: ghcr.io
docker_username: ${{ github.actor }}
docker_password: ${{ secrets.GITHUB_TOKEN }}
backup_registry: ${{ secrets.BACKUP_REGISTRY }}
backup_username: ${{ secrets.BACKUP_USERNAME }}
backup_password: ${{ secrets.BACKUP_PASSWORD }}
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ out
.vscode
.vercel
.wrangler
/config.json
/wrangler.toml
/wrangler-test.toml
config.json
wrangler.toml
/dist/index.cjs
/dist/index.d.ts
/dist/src
/packages/**/dist
17 changes: 9 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
FROM node:alpine AS build
WORKDIR /app
COPY package.json tsconfig.json vite.config.ts ./
RUN npm install
COPY src src
RUN npm run build:local
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
RUN npm install -g pnpm
COPY . .
RUN pnpm install
RUN pnpm -r run build


FROM node:alpine AS production
WORKDIR /app
COPY package.json ./
RUN npm install --omit=dev
COPY --from=build /app/dist ./dist
COPY packages/apps/local/package.docker.json package.json
RUN npm install
COPY --from=build /app/packages/apps/local/dist/index.js index.js
EXPOSE 8787
CMD ["npm", "run", "start:dist"]
CMD ["npm", "run", "start"]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ You can customize the system initialization information so that your debugged pe

<details>
<summary>example</summary>
<img style="max-width: 600px;" alt="image" src="./doc/demo.jpg">
<img style="max-width: 600px;" alt="image" src="./doc/demo.png">
</details>


Expand All @@ -34,7 +34,7 @@ You can customize the system initialization information so that your debugged pe
- Streaming output
- Multi-language support
- Text-to-image generation
- [Plugin System](plugins), customizable plugins.
- [Plugin System](doc/en/PLUGINS.md), customizable plugins.


## Documentation
Expand Down
4 changes: 2 additions & 2 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ChatGPT-Telegram-Workers

<details>
<summary>查看Demo</summary>
<img style="max-width: 600px;" alt="image" src="doc/demo.jpg">
<img style="max-width: 600px;" alt="image" src="doc/demo.png">
</details>


Expand All @@ -31,7 +31,7 @@ ChatGPT-Telegram-Workers
- 流式输出
- 多语言支持
- 文字生成图片
- [插件系统](plugins),可以自定义插件
- [插件系统](doc/cn/PLUGINS.md),可以自定义插件


## 文档
Expand Down
2 changes: 1 addition & 1 deletion dist/buildinfo.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6631e56

Please sign in to comment.