Browse Source

Add contribution document

杜府 3 years ago
parent
commit
2a9699cce6
2 changed files with 144 additions and 0 deletions
  1. 72 0
      doc/guide/contribution.md
  2. 72 0
      doc/guide/contribution_en.md

+ 72 - 0
doc/guide/contribution.md

@@ -0,0 +1,72 @@
+## 介绍
+
+感谢你使用 STDF。
+
+以下是关于向 STDF 提交反馈或代码的指南。在向 STDF 提交 issue 或者 PR 之前,请先花几分钟时间阅读以下内容。
+
+## Issue 规范
+
+-   遇到问题时,请先确认这个问题是否已经在 issue 中有记录或者已被修复。
+-   提 issue 时,请用简短的语言描述遇到的问题,并添加出现问题时的环境和复现步骤。
+
+## 本地开发
+
+在进行本地开发前,请先确保你的开发环境中安装了 Git 与 Node.js。
+
+调试 STDF 必须要有个工程环境,为此提供了一个简单的 Demo 工程。STDF 本身不受 Node 版本限制,Demo 使用 Vite 开发,所以请确保你的 Node.js 版本 >= 14.18+,参考 [Vite 官网](https://cn.vitejs.dev/guide/#scaffolding-your-first-vite-project)。
+
+> 推荐使用 [pnpm](https://pnpm.io/zh) 进行包管理。
+
+> 推荐安装针对 Svelte 的 [VSCode 插件](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode) 或者 [WebStorm 插件](https://plugins.jetbrains.com/plugin/12375-svelte) 进行开发。
+
+> 推荐安装针对 Tailwind 的 [VSCode 插件](https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss)。WebStorm 默认集成,[了解更多](https://www.jetbrains.com/help/webstorm/tailwind-css.html)。
+
+按照下面的步骤操作,即可在本地快速启动 STDF Demo。
+
+```bash
+## 克隆 STDF Demo 仓库
+git clone git@github.com:dufu1991/demo-stdf.git
+
+## 进入项目目录
+cd demo-stdf
+
+## 安装依赖
+pnpm i
+## or
+npm i
+
+## 启动项目
+npm run dev
+```
+
+启动成功之后,可在浏览器中打开 `http://localhost:8888` 查看效果,请将浏览器的开发者工具切换为移动端模式。
+
+针对 Demo 内的组件,可以在 `node_modules/stdf/src` 目录下找到对应文件进行修改并实时查看修改效果。注意,VS Code 与 WebStorm 都支持在调用组件时直接跳转到组件源码。
+
+> 如果此仓库的 STDF 不是最新版本,请先升级到最新版本。
+
+如果不想本地开发,可以选择使用 StackBlitz 在线简单调试。直接打开 [STDF Demo](https://stackblitz.com/github/dufu1991/demo-stdf) 即可开始在线调试。
+
+## 提交 PR
+
+如果你是第一次在 GitHub 上提 Pull Request ,可以阅读下面这两篇文章来学习:
+
+-   [第一次参与开源](https://github.com/firstcontributions/first-contributions/blob/main/translations/README.zh-cn.md)
+-   [如何优雅地在 GitHub 上贡献代码](https://segmentfault.com/a/1190000000736629)
+
+### 流程
+
+-   请先 fork 一份 STDF (https://github.com/dufu1991/stdf) 到自己的仓库,如果已经 fork 过,请同步主仓库的最新代码。
+-   基于 fork 后仓库的 main 分支新建一个分支,比如 `feature/add_Loading_type`,克隆至本地。
+-   将上述 Demo 工程中内 `node_modules/stdf/src` 下修改并验证通过的组件文件复制到新分支中 `components/src` 对应目录下。
+-   补充此次修改的中英文档中,文档位于 `doc/components` 目录下。根据具体修改内容可能需要修改 api、FAQ、guide、version 等文档。对 version 的修改请增加 tag,具体参考 [STDF Version tag](https://github.com/dufu1991/stdf/blob/main/doc/components/button/version.md?plain=1)。
+-   提 Pull Request 到主仓库的 main 分支。
+-   Pull Request 会在 Review 通过后被合并到主仓库,并发布新版本至 npm。
+
+### 注意事项
+
+在提交 Pull Request 时,请注意:
+
+-   保持你的 PR 足够小,一般一个 PR 只解决单个组件文件,解决单个问题或添加单个功能,以便于 Review。
+-   当新增组件或者修改原有组件时,记得在 Demo 中验证通过,保证代码的稳定。
+-   在 PR 中请添加合适的描述,如果有关联 Issue,请注明一下。

+ 72 - 0
doc/guide/contribution_en.md

@@ -0,0 +1,72 @@
+## Introduction
+
+Thank you for using STDF.
+
+Below are guidelines for submitting feedback or code to STDF. Before submitting an issue or PR to STDF, please take a few minutes to read the following content.
+
+## Issue Guidelines
+
+-   When encountering problems, please first confirm whether the problem has been recorded in the issue or has been fixed.
+-   When submitting an issue, describe the problem briefly and add information about the environment and reproduction steps when the problem occurs.
+
+## Local Development
+
+Before local development, make sure that Git and Node.js are installed in your development environment.
+
+Debugging of STDF requires a project environment. Therefore, we provide a simple Demo project. The version of Node.js used by STDF is not limited; however, Vite is used for developing Demo projects. Therefore, ensure that your Node.js version >= 14.18+ (refer to [Vite official website](https://vitejs.dev/guide/#scaffolding-your-first-vite-project)).
+
+> It is recommended to use [pnpm](https://pnpm.io) for package management.
+>
+> It is recommended to install [VSCode plugin](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode) or [WebStorm plugin](https://plugins.jetbrains.com/plugin/12375-svelte) specifically designed for Svelte development.
+>
+> It is recommended to install [VSCode plugin](https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss) specifically designed for Tailwind CSS. WebStorm integrates it by default ([learn more here](https://www.jetbrains.com/help/webstorm/tailwind-css.html)).
+
+Follow these steps below to quickly start up STDF Demo locally:
+
+```bash
+## Clone repository of STDF Demo
+git clone git@github.com:dufu1991/demo-stdf.git
+
+## Enter the project directory
+cd demo-stdf
+
+## Install dependencies
+pnpm i
+## or
+npm i
+
+## Start the project
+npm run dev
+```
+
+After successful startup, you can open `http://localhost:8888` in your browser to view the effect. Please switch your browser's developer tools to mobile mode.
+
+For components within Demo, you can find corresponding files under `node_modules/stdf/src` and modify them to see real-time modification effects. Note that both VS Code and WebStorm support jumping directly to component source code when calling components.
+
+> If STDF in this repository is not the latest version, please upgrade it first.
+
+If you do not want local development, you can choose to use StackBlitz for simple online debugging. Simply open [STDF Demo](https://stackblitz.com/github/dufu1991/demo-stdf) to start online debugging.
+
+## Submitting PRs
+
+If this is your first time submitting a Pull Request on GitHub, read these two articles:
+
+-   [First Contributions](https://github.com/firstcontributions/first-contributions/blob/main/translations/README.zh-cn.md)
+-   [How To Contribute To Open Source Without Being A Jerk](https://segmentfault.com/a/1190000000736629)
+
+### Process
+
+-   Fork STDF (https://github.com/dufu1991/stdf) into your own repository; if already forked before, synchronize with the latest code from main repository.
+-   Create a new branch based on main branch of forked repository such as `feature/add_Loading_type`, clone it locally.
+-   Copy modified component files under `node_modules/stdf/src` in above mentioned Demo project and verify them successfully onto corresponding directories under `components/src`.
+-   In the Chinese and English documents updated this time, the document is located in the `doc/components` directory. Depending on the specific modifications, it may be necessary to modify documents such as api, FAQ, guide, and version. When modifying the version, please add a tag. For details, refer to [STDF Version tag](https://github.com/dufu1991/stdf/blob/main/doc/components/button/version_en.md?plain=1).
+-   Submit a Pull Request to main branch of primary repository.
+-   After the Pull Request is approved in Review, it will be merged into the main repository and a new version will be released to npm.
+
+### Notes
+
+When submitting a Pull Request, please note:
+
+-   Keep your PR small enough. Generally, one PR only solves a single component file or adds a single feature to solve a single problem for ease of review.
+-   When adding or modifying components, remember to verify them successfully in Demo project to ensure code stability.
+-   Please add appropriate descriptions in PRs. If there are related issues, please indicate them.