From 309cc1c53fce3fa2cead8955f90182a1d99b5841 Mon Sep 17 00:00:00 2001 From: Pranshu Chittora Date: Tue, 23 Apr 2019 13:33:44 +0530 Subject: [PATCH] docs(contribute): adds table of contents and info about dependencies. (#842) - [x] Adds Table of Contents. - [x] Adds a section about dependencies. **What kind of change does this PR introduce?** Docs **Motivation** - It was getting harder to reach the desired section in the doc. - CI failing while modifying dependency (not committing the `package-lock.json`) Hence everything sorted :tada: --- .github/CONTRIBUTING.md | 290 ++++++++++++++++++++++------------------ 1 file changed, 163 insertions(+), 127 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index cb1991ee88d..c3194a9eadc 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -5,6 +5,34 @@ appreciated and welcomed. If you're planning a new feature or changing the API, please create an issue first. This way we can ensure that your precious work is not in vain. +Table of Contents + +- [Issues](#issues) +- [Your first Contribution](#your-first-contribution) +- [Setup](#setup) + - [Using npm](#using-npm) + - [Using yarn](#using-yarn) +- [Running Tests](#running-tests) + - [Using npm](#using-npm-1) + - [Using yarn](#using-yarn-1) +- [Editor Config](#editor-config) +- [Dependencies](#dependencies) +- [Branching Model](#branching-model) +- [Naming a branch](#naming-a-branch) + - [Features](#features) + - [Fixes](#fixes) +- [Testing](#testing) +- [Pull Requests](#pull-requests) +- [Submitting a good Pull Request](#submitting-a-good-pull-request) +- [Commit message](#commit-message) + - [Commit Message Format](#commit-message-format) +- [Migrate with the CLI](#migrate-with-the-cli) + - [How it's being done](#how-its-being-done) + - [Structure of a transform](#structure-of-a-transform) + - [Further Work](#further-work) +- [Contributor License Agreement](#contributor-license-agreement) +- [Documentation](#documentation) + ## Issues Most of the time, when webpack does not work correctly, it might be a configuration issue. @@ -19,7 +47,7 @@ that include your `webpack.config.js` and relevant files. This way you help othe First of all, you will need to create an issue in Github for the feature or bugfix that you want to work on. When you open a new issue, there will be a template that will be automatically added to the text of the issue, which you would need to fill in. Doing this will help us to understand better what the ticket is about. -After you've created the issue, we will have a look, and provide feedback to your ticket. +After you've created the issue, we will have a look, and provide feedback to your ticket. In case it is a bug that you want to fix, we might help you with background information about the issue, so you can make an informed fix. @@ -27,136 +55,142 @@ In case you are suggesting a new feature, we will match your idea with our curre ## Setup -* Install [Node.js](https://nodejs.org/) if you don't have it already. - *Note: Node 6 or greater would be better for "best results".* -* Fork the **webpack-cli** repo at [https://github.com/webpack/webpack-cli](https://github.com/webpack/webpack-cli). -* `git clone && cd webpack-cli` +- Install [Node.js](https://nodejs.org/) if you don't have it already. + _Note: Node 6 or greater would be better for "best results"._ +- Fork the **webpack-cli** repo at [https://github.com/webpack/webpack-cli](https://github.com/webpack/webpack-cli). +- `git clone && cd webpack-cli` ### Using npm -* Install the dependencies and link them: +- Install the dependencies and link them: - ```bash - npm install - npm link - npm link webpack-cli - ``` + ```bash + npm install + npm link + npm link webpack-cli + ``` -* Bootstrap all the submodules before building for the first time +- Bootstrap all the submodules before building for the first time - ```bash - npm run bootstrap - npm run build - ``` + ```bash + npm run bootstrap + npm run build + ``` ### Using yarn -* If you don't have yarn yet: - - ```bash - npm install -g yarn - ``` - -* Install the dependencies and link them +- If you don't have yarn yet: - ```bash - yarn - yarn link - yarn link webpack-cli - ``` + ```bash + npm install -g yarn + ``` -* Bootstrap all the submodules before building for the first time +- Install the dependencies and link them - ```bash - yarn bootstrap - yarn build - ``` + ```bash + yarn + yarn link + yarn link webpack-cli + ``` +- Bootstrap all the submodules before building for the first time -## Testing + ```bash + yarn bootstrap + yarn build + ``` + +## Running Tests ### Using npm -* Run all the tests with: - - ```bash - npm run test - ``` +- Run all the tests with: + + ```bash + npm run test + ``` -* Run CLI tests with: - - ```bash - npm run test:cli - ``` +- Run CLI tests with: -* Run tests of all packages: - - ```bash - npm run test:packages - ``` + ```bash + npm run test:cli + ``` -* Test a single CLI test case: - - ```bash - npx jest path/to/my-test.js - ``` +- Run tests of all packages: -* You can also install jest globally and run tests without npx: + ```bash + npm run test:packages + ``` - ```bash - npm i -g jest - jest path/to/my-test.js - ``` +- Test a single CLI test case: -* You can run the linters: + ```bash + npx jest path/to/my-test.js + ``` - ```bash - npm run lint - ``` +- You can also install jest globally and run tests without npx: + + ```bash + npm i -g jest + jest path/to/my-test.js + ``` + +- You can run the linters: + + ```bash + npm run lint + ``` ### Using yarn -* Run all the tests with: - - ```bash - yarn test - ``` - -* Run CLI tests with: - - ```bash - yarn test:cli` - ``` - -* Run tests of all packages: - - ```bash - yarn test:packages - ``` - -* Test a single CLI test case: - - ```bash - yarn jest path/to/my-test.js - ``` - -* You can also install jest globally and run tests: - - ```bash - yarn global add jest - jest path/to/my-test.js - ``` - -* You can run the linters: - - ```bash - yarn lint - ``` +- Run all the tests with: + + ```bash + yarn test + ``` + +- Run CLI tests with: + + ```bash + yarn test:cli` + ``` + +- Run tests of all packages: + + ```bash + yarn test:packages + ``` + +- Test a single CLI test case: + + ```bash + yarn jest path/to/my-test.js + ``` + +- You can also install jest globally and run tests: + + ```bash + yarn global add jest + jest path/to/my-test.js + ``` + +- You can run the linters: + + ```bash + yarn lint + ``` + ## Editor Config The [.editorconfig](https://github.com/webpack/webpack-cli/blob/master/.editorconfig) in the root should ensure consistent formatting. Please make sure you've [installed the plugin](http://editorconfig.org/#download) if your text editor needs one. +## Dependencies + +This is a multi-package repository and dependencies are managed using [lerna](https://lerna.js.org/) + +> If you are adding or updating any dependency, please commit the updated `package-lock.json` file. + ## Branching Model We base our branching model on [git flow](http://nvie.com/posts/a-successful-git-branching-model/). Instead of working with a `develop` base branch, we use the `master` branch. We do it to ease the workflow a bit. However, we find that adding prefixes to the branches is useful. @@ -165,15 +199,15 @@ We base our branching model on [git flow](http://nvie.com/posts/a-successful-git Making a branch in your fork for your contribution is helpful in the following ways: -* It allows you to submit more than one contribution in a single PR. -* It allows us to identify what your contribution is about from the branch name. +- It allows you to submit more than one contribution in a single PR. +- It allows us to identify what your contribution is about from the branch name. You will want to checkout the `master` branch locally before creating your new branch. There are two types of branches: -* Feature -* Bugfix +- Feature +- Bugfix ### Features @@ -189,7 +223,7 @@ If you are fixing an existing bug, you can create a branch with the following pr ## Testing -Every bugfix or feature that you submit, needs to be tested. Writing tests for code is very important to prevent future bugs, and help to discover possible new bugs promptly. +Every bugfix or feature that you submit, needs to be tested. Writing tests for the code is very important to prevent future bugs, and help to discover possible new bugs promptly. It is important that you test the logic of the code you're writing, and that your tests really go through all your lines, branches and statements. This is the only way to ensure that the code coverage is high enough to ensure the users of the cli, that they are using a solid tool. @@ -204,11 +238,11 @@ In case you've got a small change in most of the cases, your pull request would ## Submitting a good Pull Request -* Write tests -* Follow the existing coding style -* Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) +- Write tests +- Follow the existing coding style +- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) -## Commit message format +## Commit message Our commit messages format follows the [angular.js commits format](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#commit-message-format). @@ -217,10 +251,11 @@ You can use `npm run commit` script to have an interactive way of making commits We don't use the scope. The template of a commit would look like this: ### Commit Message Format -Each commit message consists of a **header**, a **body** and a **footer**. The header has a special + +Each commit message consists of a **header**, a **body** and a **footer**. The header has a special format that includes a **type** and a **subject**: -``` +```md : @@ -228,16 +263,17 @@ format that includes a **type** and a **subject**: