You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by fe...@apache.org on 2023/11/13 04:33:00 UTC
(incubator-answer-website) branch main updated: Fix old repo URL (#121)
This is an automated email from the ASF dual-hosted git repository.
fenbox pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-answer-website.git
The following commit(s) were added to refs/heads/main by this push:
new bb95d98a Fix old repo URL (#121)
bb95d98a is described below
commit bb95d98a0527a5ab541e120a65a6adc71fe54ad8
Author: Fen <f3...@gmail.com>
AuthorDate: Sun Nov 12 22:32:56 2023 -0600
Fix old repo URL (#121)
---
.../index.md | 2 +-
.../index.md | 2 +-
docs/development/contributing/frontend.md | 2 +-
docs/development/extending/README.md | 14 +-
docs/development/extending/plugin_for_ui.md | 2 +-
docs/development/extending/plugin_translation.md | 4 +-
.../current/development/contributing/frontend.md | 239 +++++++--------------
.../current/development/extending/README.md | 14 +-
.../current/development/extending/plugin_for_ui.md | 2 +-
.../development/extending/plugin_translation.md | 2 +-
10 files changed, 97 insertions(+), 186 deletions(-)
diff --git a/blog/2023-05-12-what-is-q-and-a-platform-and-how-to-use-it/index.md b/blog/2023-05-12-what-is-q-and-a-platform-and-how-to-use-it/index.md
index 3556f3e1..694f7cbb 100644
--- a/blog/2023-05-12-what-is-q-and-a-platform-and-how-to-use-it/index.md
+++ b/blog/2023-05-12-what-is-q-and-a-platform-and-how-to-use-it/index.md
@@ -100,7 +100,7 @@ No matter what your Q&A platform is about, it’s always great to collect valuab
💻 [GitHub Repo](https://github.com/apache/incubator-answer): Keep an eye on what we are up to lately on GitHub.
📄[Documents](https://answer.apache.org/docs/): Everything you need to build your Answer Community from zero to hero.
🐞 [Bug Report](https://github.com/apache/incubator-answer/issues): Hunt a bug? Simply report it for us to track efficiently.
-🚩[Public Roadmap](https://github.com/orgs/answerdev/projects/1): Feel free to drop a comment here and be a part of our roadmap!
+🚩[Public Roadmap](https://github.com/orgs/apache/projects/301): Feel free to drop a comment here and be a part of our roadmap!
## Conclusion
diff --git a/blog/2023-09-27-celebrate-answer-first-anniversary-with-hacktoberfest-2023/index.md b/blog/2023-09-27-celebrate-answer-first-anniversary-with-hacktoberfest-2023/index.md
index 15a44253..0ebe1f57 100644
--- a/blog/2023-09-27-celebrate-answer-first-anniversary-with-hacktoberfest-2023/index.md
+++ b/blog/2023-09-27-celebrate-answer-first-anniversary-with-hacktoberfest-2023/index.md
@@ -43,7 +43,7 @@ Celebrate Answer’s first birthday with contributions, the more the better, no
### Vaunt Your Contribution
-We are partnering with [Vaunt](https://github.com/VauntDev) during Hacktoberfest to reward contributions. Our team will have an initial review of the submitted issues, and tag it with **hacktoberfest-accepted** first. Then, we will have a closer look to see whether it shares the same goals or visions with our[roadmap](https://github.com/orgs/answerdev/projects/1). If it’s a yes, we will add **LGTM** tag to it, and congratulations you’ll get a digital badge from us! Here's a group photo o [...]
+We are partnering with [Vaunt](https://github.com/VauntDev) during Hacktoberfest to reward contributions. Our team will have an initial review of the submitted issues, and tag it with **hacktoberfest-accepted** first. Then, we will have a closer look to see whether it shares the same goals or visions with our[roadmap](https://github.com/orgs/apache/projects/301). If it’s a yes, we will add **LGTM** tag to it, and congratulations you’ll get a digital badge from us! Here's a group photo of [...]

diff --git a/docs/development/contributing/frontend.md b/docs/development/contributing/frontend.md
index b5f9761a..2666b31c 100644
--- a/docs/development/contributing/frontend.md
+++ b/docs/development/contributing/frontend.md
@@ -26,7 +26,7 @@ corepack prepare pnpm@latest --activate
clone the repo locally and run following command in your terminal:
```shell
-$ git clone git@github.com:answerdev/answer.git answer
+$ git clone git@github.com:apache/incubator-answer.git answer
$ cd answer/ui
$ pnpm install
$ pnpm start
diff --git a/docs/development/extending/README.md b/docs/development/extending/README.md
index b4b23f72..c958b46f 100644
--- a/docs/development/extending/README.md
+++ b/docs/development/extending/README.md
@@ -41,21 +41,21 @@ We use the `build` command provided with the Answer binary to rebuild a version
```shell
# answer build --with [plugin@plugin_version=[replacement]] --output [file]
-$ ./answer build --with github.com/answerdev/plugins/connector/github
+$ ./answer build --with github.com/apache/incubator-answer-plugins/connector-github
# build a new answer with github login plugin then output to ./new_answer.
-$ ./answer build --with github.com/answerdev/plugins/connector/github@1.0.0 --output ./new_answer
+$ ./answer build --with github.com/apache/incubator-answer-plugins/connector-github@1.0.0 --output ./new_answer
# with multiple plugins
$ ./answer build \
---with github.com/answerdev/plugins/connector/github \
---with github.com/answerdev/plugins/connector/google
+--with github.com/apache/incubator-answer-plugins/connector-github \
+--with github.com/apache/incubator-answer-plugins/connector-google
# with local plugins
-$ ./answer build --with github.com/answerdev/plugins/connector/github@1.0.0=/my-local-space
+$ ./answer build --with github.com/apache/incubator-answer-plugins/connector-github@1.0.0=/my-local-space
# cross compilation. Build a linux-amd64 binary in macos
-$ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 ./answer build --with github.com/answerdev/plugins/connector/github
+$ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 ./answer build --with github.com/apache/incubator-answer-plugins/connector-github
```
:::tip
@@ -177,7 +177,7 @@ type Config interface {
#### Register initialization function
```go
-import "github.com/answerdev/answer/plugin"
+import "github.com/apache/incubator-answer/plugin"
func init() {
plugin.Register(&GitHubConnector{
diff --git a/docs/development/extending/plugin_for_ui.md b/docs/development/extending/plugin_for_ui.md
index cb0d840a..5bb591ee 100644
--- a/docs/development/extending/plugin_for_ui.md
+++ b/docs/development/extending/plugin_for_ui.md
@@ -59,7 +59,7 @@ With the above, if your plugin is functionally complete, you are ready to move o
// demo.go
package demo
-import "github.com/answerdev/answer/plugin"
+import "github.com/apache/incubator-answer/plugin"
type DemoPlugin struct {
}
diff --git a/docs/development/extending/plugin_translation.md b/docs/development/extending/plugin_translation.md
index f14347e7..b41edfc5 100644
--- a/docs/development/extending/plugin_translation.md
+++ b/docs/development/extending/plugin_translation.md
@@ -31,7 +31,7 @@ It's easy to build a `Translator` structure, just like this:
```go
import (
- "github.com/answerdev/answer/plugin"
+ "github.com/apache/incubator-answer/plugin"
)
plugin.MakeTranslator("plugin.github_connector.backend.name")
@@ -122,4 +122,4 @@ func (g *GitHubConnector) ConnectorName() plugin.Translator {
return plugin.MakeTranslator(i18n.ConnectorName)
}
```
-The `Answer` will automatically translate the key of the translation file into the corresponding language.
\ No newline at end of file
+The `Answer` will automatically translate the key of the translation file into the corresponding language.
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/development/contributing/frontend.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/development/contributing/frontend.md
index ffefe6bb..bf789ed6 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/development/contributing/frontend.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/development/contributing/frontend.md
@@ -1,208 +1,119 @@
---
---
-# 后端开发指南
->
-> 下面将说明如何配置环境来进行项目的后端开发工作
+# 前端开发指南
-## 如何设置开发环境
+## ⚙️ 先决条件
-### 先决条件
+- [Node.js](https://nodejs.org/) `>=16.17`
+- [pnpm](https://pnpm.io/) `>=7`
-- [Golang](https://go.dev/) `>=1.18`
-- 数据库依赖
- - MySQL `(>=5.7)`
- - PostgreSQL `(>=10)`
- - SQLite3
-- [wire](https://github.com/google/wire)
+在构建 Answer 项目时需要 pnpm。使用以下命令安装 pnpm 工具:
-### 工具
-
-#### wire
-
-我们使用 `wire` 来生成依赖关系。
-
-```shell
-go get github.com/google/wire/cmd/wire@latest
-go generate ./...
-go mod tidy
-```
-
-或者你可以使用 `make generate`。
-
-#### swag
-
-我们使用 `swag` 来生成 Swagger 文档。
-
-```shell
-swag init --generalInfo ./cmd/answer/main.go
+```bash
+corepack enable
+corepack prepare pnpm@v7.12.2 --activate
```
-或者你可以进入 `script` 目录并使用 `./gen-api.sh`。
+使用 Node.js v16.17 或更新版本,可以通过指定标签来安装最新版本的 pnpm:
-### 构建
-
-:::note
-如果这是你第一次启动 Answer,请先编译前端项目,以确保你可以更轻松地测试它。
-一旦你熟悉了 Answer,也可以使用 Swagger 进行测试。
-:::
-
-```shell
-# 前端编译(推荐)。如果遇到问题,请参考与前端相关的文档
-$ make ui
-# 进入目录
-$ cd cmd/answer/
-# 编译
-$ go build .
+```bash
+corepack prepare pnpm@latest --activate
```
-### 运行
+## 🔨 开发
-#### 安装
->
-> 如果这是你第一次启动 Answer,请按照以下步骤进行安装。如果不是,则可以跳过此步骤。
+在本地克隆仓库并在终端中运行以下命令:
```shell
-# 初始化环境
-$ ./answer init -C ./answer-data/
+git clone git@github.com:apache/incubator-answer.git answer
+cd answer/ui
+pnpm install
+pnpm start
```
-前往 <http://localhost:80/install> 访问安装页面。
-
-请参考 [安装文档](../../installation) 进行安装步骤。
+现在,你的浏览器应该自动打开并加载 `http://localhost:3000`。你也可以手动访问它。
-#### 启动
+## 👷 工作流
-```shell
-./answer run -C ./answer-data/
-```
-
-前往 <http://localhost:80/> 使用 Answer。
+克隆仓库并运行 pnpm install 初始化依赖项后,你可以使用以下项目命令:
-### Debug
+- `pnpm start` 在本地运行 Answer 网站。
+- `pnpm build` 为生产环境构建 Answer。
+- `pnpm lint` 检查和修复代码风格。
-我们使用 Swagger 测试 API 接口。Swagger 文档默认可用。前往 [http://localhost:80/swagger/index.html](http://127.0.0.1:8080/swagger/index.html) 访问 Swagger 页面。
+## 🌍 I18n(多语言)
-你可以使用 Swagger 进行更方便的调试。
+如果你需要添加或编辑语言条目,只需转到 `/i18n/en_US.yaml` 文件,所有前端语言条目都放在 `ui` 字段下。
-## 项目说明
+如果想帮助我们进行 i18n 翻译,请访问 [Answer at Crowdin](https://crowdin.com/translate/answer) 。
-### 包结构
+## 💡 项目说明
```
.
-├── cmd (main binary)
-├── configs (default configuration)
-├── docs (swagger documentation)
-├── i18n (International translation)
+├── cmd
+├── configs
+├── docs
+├── i18n
+ ├── en_US.yaml (basic language file)
+ ├── i18n.yaml (language list)
├── internal
- ├── base (Basic component without service attributes)
- ├── conf (Configuration)
- ├── constant (constant)
- ├── data (database/cache)
- ├── handler (request/response handler)
- ├── middleware (http middleware)
- ├── pager (Pagination)
- ├── reason (error reason key use to translator)
- ├── server (http server)
- ├── translator (translator for translate international)
- └── validator (validator for validate request)
- ├── cli (binary commands)
- ├── controller (request handler controller for user)
- ├── controller_backyard (request handler controller for admin)
- ├── entity (all entity about database table)
- ├── install (installation related)
- ├── migrations (upgrade related)
- ├── repo (database/cache operations)
- ├── router (http router)
- ├── schema (request/response schema)
- └── service (business logic)
-├── pkg (tools or third party)
-└── ui (frontend)
+├── ...
+└── ui (front-end project starts here)
+ ├── build (built results directory, usually without concern)
+ ├── public (html template for public)
+ ├── scripts (some scripting tools on front-end project)
+ ├── src (almost all front-end resources are here)
+ ├── assets (static resources)
+ ├── common (project information/data defined here)
+ ├── components (all components of the project)
+ ├── hooks (all hooks of the project)
+ ├── i18n (Initialize the front-end i18n)
+ ├── pages (all pages of the project)
+ ├── router (Project routing definition)
+ ├── services (all data api of the project)
+ ├── stores (all data stores of the project)
+ ├── utils (all utils of the project)
+ ├── plugins (UI Plugin Development & Debugging Directory)
```
-### 包之间的依赖关系
+## 🤝 贡献
-对于大多数 API,流程图非常简单,如下所示。
+#### 修复 Bug
-```
-router -> middleware -> controller(use schema) -> service -> repo(use entity)
-```
+如果你发现了一个 bug,请不要犹豫地 [提交 issue](https://github.com/apache/incubator-answer/issues)。如果你能修复它,请在提交 issue 时附上说明。如果它确实是一个 bug,你可以在我们确认后提交 PR,这将确保你不会做任何无用的工作。
-如果你想开发新的 API,可以按照以下步骤进行操作。
+#### 代码审查 & 注释
-1. 在 router 中添加路由规则 (GET/POST/PUT...)。
-2. 添加用于处理程序请求的 controller。该请求应在 controller 中进行验证。
-3. 添加一个 service 来处理业务。
-4. 添加用于保存或查询数据库或缓存中的数据的 repo 操作。
-5. 重新生成 swagger 文档并测试 API。
+在我们的开发中,有些代码不太合逻辑。如果你发现了它,请不要犹豫地向我们提交 PR。同样,一些函数没有注释。如果你能帮助我们补充它,我们将不胜感激。
-## 代码规范
+#### 翻译
-### 基本的
+我们所有的翻译都放在 `i18n` 目录下。
-我们使用 [uber 的 Golang](https://github.com/uber-go/guide) 来检查代码规范。
-
-### 代码规范检查
-
-`golangci-lint` 是一个快速的 Go 代码规范检查工具。我们使用 [golangci-lint](https://github.com/golangci/golangci-lint) 来检查代码规范。
-
-你可以使用以下命令检查你的代码格式。
-
-```bash
-go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.0
-golangci-lint run
-```
-
-## 我们需要你的贡献
-
-### 修复 Bug
-
-如果你发现了 Bug,请不要犹豫 [提交 issue](https://github.com/apache/incubator-answer/issues) 给我们。如果你可以修复它,请在提交 issue 时附上说明。如果问题已被确认是 Bug,你可以提交 PR,这将确保你不会做无用的工作。
-
-### 代码审查和注释
-
-在我们的开发过程中,有些代码可能不是很合乎逻辑。如果你发现了这些问题,请不要犹豫,向我们提交 PR。同样,有些函数可能没有注释。如果你可以帮助我们补充注释,我们将不胜感激。
-
-### 单元测试(非常需要)
-
-我们当前的单元测试覆盖率如下所示。显然,我们还需要添加更多的单元测试,因此我们非常欢迎你的贡献。
-
-<img
-src={require('/img/repo-unit-test-coverage-rate.png').default}
-alt="repo-unit-test-coverage-rate"
-width="300"
-/>
-
-### 翻译
-
-我们所有的翻译都放在 `i18n`目录中。
-
-1. 如果你发现你正在使用的语言中对应的键没有翻译,请提交你的翻译。
+1. 如果你发现你正在使用的语言中对应的键没有翻译,你可以提交你的翻译。
2. 如果你想提交新的语言翻译,请将你的语言添加到 `i18n.yaml` 文件中。
-### 新功能或插件
-
-1. 我们根据 [路线图](https://github.com/orgs/apache/projects/301) 开发计划开发功能。如果你有新功能的建议,请确认它们是否已经计划中。
-2. 插件将在未来发布,敬请期待。
-
-## 注意事项
-
-### 修改数据库表结构非常困难
+#### 功能或插件
-通常,我们不希望修改数据库表中已经存在的字段。如果需要更改,请遵循以下规则:
+1. 我们根据 [roadmap](https://github.com/orgs/apache/projects/301) 制定计划开发功能。如果你有新功能的建议,请确认它们是否已经计划。
+2. 插件将来会推出,敬请期待。
-1. 添加字段比修改字段更好。
-2. 修改任何字段都需要考虑对现有数据的影响。
-3. 修改数据库表结构需要测试对不同类型的数据库的影响,并为不同类型的数据库提供不同的 `SQL` 语句。对于 `MySQL/PostgreSQL/sqlite3`。
+## 📱环境支持
-## 构建工具
+| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br />Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br />Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/ [...]
+| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- [...]
+| 最近 2 个版本 | 最近 2 个版本 | 最近 2 个版本 [...]
-Answer 应用的后端使用以下组件/库构建:
+## ⭐ 使用了以下工具
-- [pacman](https://github.com/segmentfault/pacman) - 快速构建 Go 应用程序的工具包。
-- [gin](https://github.com/gin-gonic/gin/) - 路由器。
-- [validator](https://github.com/go-playground/validator/) - 验证。
-- [xorm](https://xorm.io/) - ORM.
-- [cobra](https://github.com/spf13/cobra) - CLI 应用程序。
-- [swag](https://github.com/swaggo/swag) - 生成 Swagger 文档。
+- [TypeScript](https://www.typescriptlang.org/) - 强类型 JavaScript。
+- [React.js](https://reactjs.org/) - 我们的前端是一个 React.js 应用程序。
+- [React Router](https://reactrouter.com/en/main) - 路由库。
+- [Bootstrap](https://getbootstrap.com/) - UI 库。
+- [React Bootstrap](https://react-bootstrap.github.io/) - UI 库(为 React 重新构建)。
+- [axios](https://github.com/axios/axios) - 请求库。
+- [SWR](https://swr.bootcss.com/) - 请求库。
+- [react-i18next](https://react.i18next.com/) - 国际化库。
+- [zustand](https://github.com/pmndrs/zustand) - 状态管理库。
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/development/extending/README.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/development/extending/README.md
index 048c1cc4..338b0f53 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/development/extending/README.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/development/extending/README.md
@@ -46,21 +46,21 @@ sidebar_position: 1
```shell
# answer build --with [plugin@plugin_version=[replacement]] --output [file]
-$ ./answer build --with github.com/answerdev/plugins/connector/github
+$ ./answer build --with github.com/apache/incubator-answer-plugins/connector-github
# 构建一个带有 github 登录插件的新 Answer,然后输出到 ./new_answer。
-$ ./answer build --with github.com/answerdev/plugins/connector/github@1.0.0 --output ./new_answer
+$ ./answer build --with github.com/apache/incubator-answer-plugins/connector-github@1.0.0 --output ./new_answer
# 带有多个插件
$ ./answer build \
---with github.com/answerdev/plugins/connector/github \
---with github.com/answerdev/plugins/connector/google
+--with github.com/apache/incubator-answer-plugins/connector-github \
+--with github.com/apache/incubator-answer-plugins/connector-google
# 带有本地插件
-$ ./answer build --with github.com/answerdev/plugins/connector/github@1.0.0=/my-local-space
+$ ./answer build --with github.com/apache/incubator-answer-plugins/connector-github@1.0.0=/my-local-space
# 交叉编译。在 macos 中构建一个 linux-amd64 二进制文件
-$ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 ./answer build --with github.com/answerdev/plugins/connector/github
+$ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 ./answer build --with github.com/apache/incubator-answer-plugins/connector-github
```
:::tip
@@ -190,7 +190,7 @@ type Config interface {
#### 注册初始化函数
```go
-import "github.com/answerdev/answer/plugin"
+import "github.com/apache/incubator-answer/plugin"
func init() {
plugin.Register(&GitHubConnector{
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/development/extending/plugin_for_ui.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/development/extending/plugin_for_ui.md
index 6d7b4fca..e8d67830 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/development/extending/plugin_for_ui.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/development/extending/plugin_for_ui.md
@@ -65,7 +65,7 @@ export { default as Demo } from './Demo';
// demo.go
package demo
-import "github.com/answerdev/answer/plugin"
+import "github.com/apache/incubator-answer/plugin"
type DemoPlugin struct {
}
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/development/extending/plugin_translation.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/development/extending/plugin_translation.md
index 98b99409..48f1343b 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/development/extending/plugin_translation.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/development/extending/plugin_translation.md
@@ -32,7 +32,7 @@ type ConfigField struct {
```go
import (
- "github.com/answerdev/answer/plugin"
+ "github.com/apache/incubator-answer/plugin"
)
plugin.MakeTranslator("plugin.github_connector.backend.name")