From 26889141259c3cf735ad017ec07e7f77096fbce0 Mon Sep 17 00:00:00 2001 From: Darth Pika <103236915+darth-pika-hu@users.noreply.github.com> Date: Tue, 9 May 2023 16:47:41 -0700 Subject: [PATCH 1/4] Create cloudflare-pages-cn.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加Cloudflare Pages的部署说明。这里临时说明,Next-on-Pages有一个bug将很快修复,修复后,Build命令会修改。 --- docs/cloudflare-pages-cn.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 docs/cloudflare-pages-cn.md diff --git a/docs/cloudflare-pages-cn.md b/docs/cloudflare-pages-cn.md new file mode 100644 index 000000000..faaeeedaa --- /dev/null +++ b/docs/cloudflare-pages-cn.md @@ -0,0 +1,31 @@ +# Cloudflare Pages 的部署说明 + +## 如何新建项目 +从Github fork 本项目,然后登录dash.cloudflare.com,进入pages。 + + +1. 点击 Create a project; +2. 选择 Connect to Git; +3. 关联Cloudlfare Pages和你的GitHub账号; +4. 选中你fork的此项目; +5. 点击 Begin setup; +6. Project name, Production branch,默认即可,有需要按实际改动; +7. Build Settings下的Framework prsets要选Next.js; +8. Build command 暂时不要用默认的命令,因为有node:buffer的bug,写我给的这个: +``` +npx https://prerelease-registry.devprod.cloudflare.dev/next-on-pages/runs/4930842298/npm-package-next-on-pages-230 --experimental-minify +``` +9. Build output directory 用系统默认,不要改动; +10. Root Directory 不要改动; +11. Environment variables ,点击>,然后Add variable,按如下填写: + NODE_VERSION=20.1 + NEXT_TELEMETRY_DISABLE=1 + OPENAI_API_KEY=你自己的API Key + YARN_VERSION=1.22.19 + PHP_VERSION=7.4 + 下面的根据实际需要选填: + CODE= 可选填,访问密码,可以使用逗号隔开多个密码。 + OPENAI_ORG_ID= 可选填,指定 OpenAI 中的组织 ID + HIDE_USER_API_KEY=1 可选,不让用户自行填入 API Key + DISABLE_GPT4=1 可选,不让用户使用 GPT-4 +12. Save and Deploy From 652d803739277f40c79bdacc05388faea2ac57bf Mon Sep 17 00:00:00 2001 From: Darth Pika <103236915+darth-pika-hu@users.noreply.github.com> Date: Tue, 9 May 2023 17:25:00 -0700 Subject: [PATCH 2/4] Update cloudflare-pages-cn.md --- docs/cloudflare-pages-cn.md | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/docs/cloudflare-pages-cn.md b/docs/cloudflare-pages-cn.md index faaeeedaa..de663cc8b 100644 --- a/docs/cloudflare-pages-cn.md +++ b/docs/cloudflare-pages-cn.md @@ -18,14 +18,20 @@ npx https://prerelease-registry.devprod.cloudflare.dev/next-on-pages/runs/493084 9. Build output directory 用系统默认,不要改动; 10. Root Directory 不要改动; 11. Environment variables ,点击>,然后Add variable,按如下填写: - NODE_VERSION=20.1 - NEXT_TELEMETRY_DISABLE=1 - OPENAI_API_KEY=你自己的API Key - YARN_VERSION=1.22.19 - PHP_VERSION=7.4 + -NODE_VERSION=20.1 + -NEXT_TELEMETRY_DISABLE=1 + -OPENAI_API_KEY=你自己的API Key + -YARN_VERSION=1.22.19 + -PHP_VERSION=7.4 下面的根据实际需要选填: - CODE= 可选填,访问密码,可以使用逗号隔开多个密码。 - OPENAI_ORG_ID= 可选填,指定 OpenAI 中的组织 ID - HIDE_USER_API_KEY=1 可选,不让用户自行填入 API Key - DISABLE_GPT4=1 可选,不让用户使用 GPT-4 -12. Save and Deploy + -CODE= 可选填,访问密码,可以使用逗号隔开多个密码 + -OPENAI_ORG_ID= 可选填,指定 OpenAI 中的组织 ID + -HIDE_USER_API_KEY=1 可选,不让用户自行填入 API Key + -DISABLE_GPT4=1 可选,不让用户使用 GPT-4 +12. Save and Deploy; +13. 点Cancel deployment,因为要填 Compatibility flags; +14. 去Build settings, Functions, 找到Compatibility flags; +15. Configure Production compatibility flag 填 nodejs_compat; +16. Configure Preview compatibility flag 填 nodejs_compat; +17. 去 Deployments,点Retry depolyment. +18. Enjoy. From be58d3afb644a3a0202f1d11213a5e37295cfa9f Mon Sep 17 00:00:00 2001 From: Darth Pika <103236915+darth-pika-hu@users.noreply.github.com> Date: Tue, 9 May 2023 17:31:19 -0700 Subject: [PATCH 3/4] Update cloudflare-pages-cn.md --- docs/cloudflare-pages-cn.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/docs/cloudflare-pages-cn.md b/docs/cloudflare-pages-cn.md index de663cc8b..ff4a3d600 100644 --- a/docs/cloudflare-pages-cn.md +++ b/docs/cloudflare-pages-cn.md @@ -18,16 +18,19 @@ npx https://prerelease-registry.devprod.cloudflare.dev/next-on-pages/runs/493084 9. Build output directory 用系统默认,不要改动; 10. Root Directory 不要改动; 11. Environment variables ,点击>,然后Add variable,按如下填写: - -NODE_VERSION=20.1 - -NEXT_TELEMETRY_DISABLE=1 - -OPENAI_API_KEY=你自己的API Key - -YARN_VERSION=1.22.19 - -PHP_VERSION=7.4 + + - NODE_VERSION=20.1 + - NEXT_TELEMETRY_DISABLE=1 + - OPENAI_API_KEY=你自己的API Key + - YARN_VERSION=1.22.19 + - PHP_VERSION=7.4 + 下面的根据实际需要选填: - -CODE= 可选填,访问密码,可以使用逗号隔开多个密码 - -OPENAI_ORG_ID= 可选填,指定 OpenAI 中的组织 ID - -HIDE_USER_API_KEY=1 可选,不让用户自行填入 API Key - -DISABLE_GPT4=1 可选,不让用户使用 GPT-4 + + - CODE= 可选填,访问密码,可以使用逗号隔开多个密码 + - OPENAI_ORG_ID= 可选填,指定 OpenAI 中的组织 ID + - HIDE_USER_API_KEY=1 可选,不让用户自行填入 API Key + - DISABLE_GPT4=1 可选,不让用户使用 GPT-4 12. Save and Deploy; 13. 点Cancel deployment,因为要填 Compatibility flags; 14. 去Build settings, Functions, 找到Compatibility flags; From 89551774db3b42166648ac1645b7391a4b2e4668 Mon Sep 17 00:00:00 2001 From: Darth Pika <103236915+darth-pika-hu@users.noreply.github.com> Date: Tue, 9 May 2023 17:45:01 -0700 Subject: [PATCH 4/4] Re-format the Chinese version and added an English version Finally found a computer. --- docs/cloudflare-pages-cn.md | 67 ++++++++++++++++++------------------- docs/cloudflare-pages-en.md | 38 +++++++++++++++++++++ 2 files changed, 71 insertions(+), 34 deletions(-) create mode 100644 docs/cloudflare-pages-en.md diff --git a/docs/cloudflare-pages-cn.md b/docs/cloudflare-pages-cn.md index ff4a3d600..2f9a99f2d 100644 --- a/docs/cloudflare-pages-cn.md +++ b/docs/cloudflare-pages-cn.md @@ -1,40 +1,39 @@ -# Cloudflare Pages 的部署说明 +# Cloudflare Pages 部署指南 ## 如何新建项目 -从Github fork 本项目,然后登录dash.cloudflare.com,进入pages。 +在 Github 上 fork 本项目,然后登录到 dash.cloudflare.com 并进入 Pages。 +1. 点击 "Create a project"。 +2. 选择 "Connect to Git"。 +3. 关联 Cloudflare Pages 和你的 GitHub 账号。 +4. 选中你 fork 的此项目。 +5. 点击 "Begin setup"。 +6. 对于 "Project name" 和 "Production branch",可以使用默认值,也可以根据需要进行更改。 +7. 在 "Build Settings" 中,选择 "Framework presets" 选项并选择 "Next.js"。 +8. 由于 node:buffer 的 bug,暂时不要使用默认的 "Build command"。请使用以下命令: + ``` + npx https://prerelease-registry.devprod.cloudflare.dev/next-on-pages/runs/4930842298/npm-package-next-on-pages-230 --experimental-minify + ``` +9. 对于 "Build output directory",使用默认值并且不要修改。 +10. 不要修改 "Root Directory"。 +11. 对于 "Environment variables",点击 ">" 然后点击 "Add variable"。按照以下信息填写: -1. 点击 Create a project; -2. 选择 Connect to Git; -3. 关联Cloudlfare Pages和你的GitHub账号; -4. 选中你fork的此项目; -5. 点击 Begin setup; -6. Project name, Production branch,默认即可,有需要按实际改动; -7. Build Settings下的Framework prsets要选Next.js; -8. Build command 暂时不要用默认的命令,因为有node:buffer的bug,写我给的这个: -``` -npx https://prerelease-registry.devprod.cloudflare.dev/next-on-pages/runs/4930842298/npm-package-next-on-pages-230 --experimental-minify -``` -9. Build output directory 用系统默认,不要改动; -10. Root Directory 不要改动; -11. Environment variables ,点击>,然后Add variable,按如下填写: + - `NODE_VERSION=20.1` + - `NEXT_TELEMETRY_DISABLE=1` + - `OPENAI_API_KEY=你自己的API Key` + - `YARN_VERSION=1.22.19` + - `PHP_VERSION=7.4` - - NODE_VERSION=20.1 - - NEXT_TELEMETRY_DISABLE=1 - - OPENAI_API_KEY=你自己的API Key - - YARN_VERSION=1.22.19 - - PHP_VERSION=7.4 + 根据实际需要,可以选择填写以下选项: - 下面的根据实际需要选填: - - - CODE= 可选填,访问密码,可以使用逗号隔开多个密码 - - OPENAI_ORG_ID= 可选填,指定 OpenAI 中的组织 ID - - HIDE_USER_API_KEY=1 可选,不让用户自行填入 API Key - - DISABLE_GPT4=1 可选,不让用户使用 GPT-4 -12. Save and Deploy; -13. 点Cancel deployment,因为要填 Compatibility flags; -14. 去Build settings, Functions, 找到Compatibility flags; -15. Configure Production compatibility flag 填 nodejs_compat; -16. Configure Preview compatibility flag 填 nodejs_compat; -17. 去 Deployments,点Retry depolyment. -18. Enjoy. + - `CODE= 可选填,访问密码,可以使用逗号隔开多个密码` + - `OPENAI_ORG_ID= 可选填,指定 OpenAI 中的组织 ID` + - `HIDE_USER_API_KEY=1 可选,不让用户自行填入 API Key` + - `DISABLE_GPT4=1 可选,不让用户使用 GPT-4` + +12. 点击 "Save and Deploy"。 +13. 点击 "Cancel deployment",因为需要填写 Compatibility flags。 +14. 前往 "Build settings"、"Functions",找到 "Compatibility flags"。 +15. 在 "Configure Production compatibility flag" 和 "Configure Preview compatibility flag" 中填写 "nodejs_compat"。 +16. 前往 "Deployments",点击 "Retry deployment"。 +17. Enjoy. \ No newline at end of file diff --git a/docs/cloudflare-pages-en.md b/docs/cloudflare-pages-en.md new file mode 100644 index 000000000..ee8ff6a6b --- /dev/null +++ b/docs/cloudflare-pages-en.md @@ -0,0 +1,38 @@ +# Cloudflare Pages Deployment Guide + +## How to create a new project +Fork this project on GitHub, then log in to dash.cloudflare.com and go to Pages. + +1. Click "Create a project". +2. Choose "Connect to Git". +3. Connect Cloudflare Pages to your GitHub account. +4. Select the forked project. +5. Click "Begin setup". +6. For "Project name" and "Production branch", use the default values or change them as needed. +7. In "Build Settings", choose the "Framework presets" option and select "Next.js". +8. Do not use the default "Build command" due to a node:buffer bug. Instead, use the following command: + ``` + npx https://prerelease-registry.devprod.cloudflare.dev/next-on-pages/runs/4930842298/npm-package-next-on-pages-230 --experimental-minify + ``` +9. For "Build output directory", use the default value and do not modify it. +10. Do not modify "Root Directory". +11. For "Environment variables", click ">" and then "Add variable". Fill in the following information: + - `NODE_VERSION=20.1` + - `NEXT_TELEMETRY_DISABLE=1` + - `OPENAI_API_KEY=your_own_API_key` + - `YARN_VERSION=1.22.19` + - `PHP_VERSION=7.4` + + Optionally fill in the following based on your needs: + + - `CODE= Optional, access passwords, multiple passwords can be separated by commas` + - `OPENAI_ORG_ID= Optional, specify the organization ID in OpenAI` + - `HIDE_USER_API_KEY=1 Optional, do not allow users to enter their own API key` + - `DISABLE_GPT4=1 Optional, do not allow users to use GPT-4` + +12. Click "Save and Deploy". +13. Click "Cancel deployment" because you need to fill in Compatibility flags. +14. Go to "Build settings", "Functions", and find "Compatibility flags". +15. Fill in "nodejs_compat" for both "Configure Production compatibility flag" and "Configure Preview compatibility flag". +16. Go to "Deployments" and click "Retry deployment". +17. Enjoy. \ No newline at end of file