From 88c7ccefd31f71e64cb198e6313ba658b2d9e1e0 Mon Sep 17 00:00:00 2001 From: "Jing Xu(RainX)" Date: Sat, 16 Sep 2023 11:32:07 +0800 Subject: [PATCH] docs: add the development related sections to CONTRIBUTING document --- README.md | 2 ++ docs/CONTRIBUTING.md | 51 ++++++++++++++++++++++++++++++++++++++------ 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 875b5d1a..ebc5dfb3 100644 --- a/README.md +++ b/README.md @@ -129,6 +129,8 @@ We are stilling waiting for someones to contribute, especially for the following - More docs - A script to monitor [upstream](https://github.com/phpstan/phpdoc-parser) updates and notify the author to catch up. +Please check out our [Contribution guide](docs/CONTRIBUTING.md) + ## How did we create the initial version of this project. We created most of our code by using ChatGPT as a tool to transform most code from https://github.com/phpstan/phpdoc-parser to TypeScript version. diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 6f9d7185..2bf316a0 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -5,19 +5,58 @@ Please note we have a [code of conduct](CODE_OF_CONDUCT.md), please follow it in ## Development environment setup -> **[?]** -> Proceed to describe how to setup local development environment. -> e.g: - To set up a development environment, please follow these steps: -1. Clone the repo +1. Before cloning the repo, ensure you have the following prerequisites installed. + + 1. Node.JS (You should install a [version manager](https://github.com/shadowspawn/node-version-usage) that could handle .node-version file) + 2. pnpm (You might have already installed it if you enabled the [Corepack](https://nodejs.org/api/corepack.html) feature) + 3. git + +2. Clone the repo ```sh git clone https://github.com/RightCapitalHQ/phpdoc-parser ``` -2. TODO +3. Install the dependencies + + ```sh + pnpm install + ``` + +## Guidelines + +- The code style follows the RightCapital [front-end style guide](https://github.com/RightCapitalHQ/frontend-style-guide) +- Some naming rules might be break. because for some variables or methods naming, we keep it the same as the upstream library(PHP version PHPDoc parer), It would make it easier to catch up the upstream changes. + + - eg. for the boolean variable/property name, our guide let us prefix the name with `is`, `has`, `can`, `should`, however, the upstream lib is not following this rule. so we just use the upstream's name. like `lines`, `indexes`, ``parseDescription`. + - Our style guide requires enum types to be named in camel case. but for the enum directly from upstream lib, we just use the all caps for the member of the enum. like + ```ts + enum ArrayShapeNodeKind { + ARRAY = 'array', + LIST = 'list', + } + ``` + +## Linting and testing the code. + +Please ensure your code is + +1. Passing the ESLint check and Prettier check +2. Passing all existing test cases + +and Your commit message is following the spec of the Conventional Commits ( https://www.conventionalcommits.org/ ) + +## Publishing and Changelog management + +we use [beachball](https://microsoft.github.io/beachball/) to automate the npm publishing and changelog. when you fire a PR. the only thing the contributor needs to take care is ensuring run + +```sh +pnpm change +``` + +to generate appropriate change file for us to bump the version and generate the changelog ## Issues and feature requests