Skip to content

Commit

Permalink
docs(none): ✏️ add Contribution Guide
Browse files Browse the repository at this point in the history
  • Loading branch information
Maidang1 committed Oct 11, 2024
1 parent 83c71cf commit b31e6f7
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
35 changes: 35 additions & 0 deletions CONTRIBUTING-zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 贡献指南

非常感谢您对 Farm 插件的贡献, 在您提交 Pull Request 之前, 请先阅读以下指南。

## 目录结构

目前 Farm 插件仓库支持 rust 插件和 JavaScript 插件。 rust 插件全部放置在 rust-plugins 下面
JavaScript 插件全部放置在 js-plugins 下面。同时为了方便管理,项目并存 pnpm monorepo 和 rust monorepo。

## 开发 rust 插件

rust 插件内部结构和 farm rust 提供的模版一致,可以直接使用 cli `pnpm create farm-plugin @farmfe/plugin-xxx --type rust` 工具创建,需要注意的是,cli 创建存在一些冗余文件,需要手动删除。可以参考其他的 rust 插件目录结构。同时需要将下列的 crate 包使用 monorepo 的包

```toml
[workspace.dependencies]
farmfe_core = { version = "0.6.4" }
farmfe_utils = { version = "0.1.5" }
farmfe_toolkit_plugin_types = { version = "0.0.20" }
farmfe_macro_plugin = { version = "0.0.4" }
farmfe_toolkit = "0.0.13"
```

修改已有插件的时候,需要注意版本号的更新。需要在插件的根目录下面的运行 `npx changeset` && `npx changeset version` 来更新版本号。

## 开发 JavaScript 插件

开发 JavaScript 插件的时候,同样可以使用 cli `pnpm create farm-plugin @farmfe/plugin-xxx --type js` 来创建,其他和 rust 插件注意事项一致

## 提交 commit 信息规范

为了提高 CI 的运行效率,尽可能的只发布有变动的包,但 rust 插件和 js 插件的发布流程差异较多,我们通过 commit message 来区分发布的包。提交信息的时候 全局运行 `pnpm commit` 来提交 commit 信息,需要根据提示来选择相应的 scope。

## 提交 Pull Request

**PR title** 规范和 commit message 一致。
34 changes: 34 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Contribution Guide

Thank you very much for contributing to the Farm plugins. Please read the following guidelines before submitting a Pull Request.

## Directory Structure

Currently, the Farm plugins repository supports both Rust plugins and JavaScript plugins. Rust plugins are all placed under the rust-plugins directory, and JavaScript plugins are all placed under the js-plugins directory. To facilitate management, the project uses both pnpm monorepo and rust monorepo

## Developing Rust Plugins

The internal structure of Rust plugins is consistent with the template provided by Farm Rust. You can directly use the CLI tool `pnpm create farm-plugin @farmfe/plugin-xxx --type rust` to create a new plugin. Note that the CLI creates some redundant files that need to be manually deleted. You can refer to the directory structure of other Rust plugins. Additionally, you need to use the following crate packages from the monorepo:

```toml
[workspace.dependencies]
farmfe_core = { version = "0.6.4" }
farmfe_utils = { version = "0.1.5" }
farmfe_toolkit_plugin_types = { version = "0.0.20" }
farmfe_macro_plugin = { version = "0.0.4" }
farmfe_toolkit = "0.0.13"
```

When modifying existing plugins, be sure to update the version numbers. Run npx changeset and npx changeset version in the root directory of the plugin to update the version numbers.

## Developing JavaScript Plugins

When developing JavaScript plugins, you can also use the CLI tool `pnpm create farm-plugin @farmfe/plugin-xxx --type js` to create a new plugin. The other considerations are the same as for Rust plugins.

## Commit Message Guidelines

To improve CI efficiency, we aim to release only the packages that have changes. However, the release processes for Rust plugins and JavaScript plugins differ significantly. We use commit messages to distinguish the packages to be released. When committing, run pnpm commit globally to submit the commit message, and follow the prompts to select the appropriate scope.

## Submitting a Pull Request

The **PR title** should follow the same conventions as the commit message.

0 comments on commit b31e6f7

Please sign in to comment.