strapi/CONTRIBUTING.md

165 lines
7.2 KiB
Markdown
Raw Normal View History

# Contribute to Strapi
2016-03-18 11:12:50 +01:00
2019-05-28 15:33:07 +02:00
Strapi is an open-source project administered by [the Strapi team](https://strapi.io/company). We appreciate your interest and efforts to contribute to Strapi.
2016-03-18 11:12:50 +01:00
2019-05-28 15:33:07 +02:00
All efforts to contribute are highly appreciated, we recommend you talk to a maintainer prior to spending a lot of time making a pull request that may not align with the project roadmap.
2016-03-18 11:12:50 +01:00
## Open Development & Community Driven
2019-05-27 18:57:24 +02:00
2017-12-13 12:21:16 +01:00
Strapi is open-source under the [MIT license](https://github.com/strapi/strapi/blob/master/LICENSE.md). All the work done is available on GitHub.
2019-05-28 15:33:07 +02:00
2017-12-13 12:21:16 +01:00
The core team and the contributors send pull requests which go through the same validation process.
2019-05-28 15:33:07 +02:00
## Feature Requests
Feature Requests by the community are highly encouraged. Please feel free to submit a [feature request](https://portal.productboard.com/strapi) or to upvote 👍 [an existing feature request](https://portal.productboard.com/strapi) in the ProductBoard.
2017-12-13 12:21:16 +01:00
## RFCs
Some important changes in Strapi require some thoughts to be put into the design phase before starting working on a PR.
The RFC (Request For Comments) process will help us create consensus among the core team and include as much feedback as possible from the community, for these upcoming changes.
Before contributing, you will probably have to create a RFC on this [strapi/rfcs](https://github.com/strapi/rfcs) repo.
2019-05-27 18:57:24 +02:00
## Code of Conduct
2017-12-13 12:21:16 +01:00
2019-05-28 15:33:07 +02:00
This project and everyone participating in it are governed by the [Strapi Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please read the [full text](CODE_OF_CONDUCT.md) so that you can read which actions may or may not be tolerated.
2017-12-13 12:21:16 +01:00
2019-05-27 18:57:24 +02:00
## Bugs
2017-12-13 12:21:16 +01:00
2019-05-28 15:33:07 +02:00
We are using [GitHub Issues](https://github.com/strapi/strapi/issues) to manage our public bugs. We keep a close eye on this so before filing a new issue, try to make sure the problem does not already exist.
2017-12-13 12:21:16 +01:00
2019-05-27 18:57:24 +02:00
---
2019-05-27 18:57:24 +02:00
## Before Submitting a Pull Request
2017-12-13 12:21:16 +01:00
2019-05-27 18:57:24 +02:00
The core team will review your pull request and will either merge it, request changes to it, or close it.
2017-12-13 12:21:16 +01:00
2019-05-27 20:28:15 +02:00
**Before submitting your pull request** make sure the following requirements are fulfilled:
2017-12-13 12:21:16 +01:00
2019-05-27 18:57:24 +02:00
- Fork the repository and create your branch from `master`.
- Run `yarn setup` in the repository root.
2019-05-28 15:33:07 +02:00
- If youve fixed a bug or added code that should be tested, add the tests and then link the corresponding issue in either your commit or your PR!
- Ensure the test suites are passing:
2019-05-27 18:57:24 +02:00
- `yarn test:unit`
- `yarn test:front`
- Make sure your code lints (`yarn lint`).
2018-05-04 12:44:15 +02:00
2019-05-27 18:57:24 +02:00
## Contribution Prerequisites
2018-05-04 12:44:15 +02:00
2019-05-27 21:57:02 +02:00
- You have [Node](https://nodejs.org/en/) at v10.x.x only and [Yarn](https://yarnpkg.com/en/) at v1.2.0+.
2019-05-27 18:57:24 +02:00
- You are familiar with Git.
2019-05-27 18:57:24 +02:00
## Development Workflow
2017-12-13 12:21:16 +01:00
2019-05-28 15:33:07 +02:00
To facilitate the contribution, we have drastically reduced the amount of commands necessary to install the entire development environment.
2019-06-01 08:51:42 -07:00
First of all, you need to check if you're using the [required versions of Node.js and npm](https://strapi.io/documentation/3.0.0-beta.x/getting-started/install-requirements.html)
2017-12-13 12:21:16 +01:00
2019-05-27 18:57:24 +02:00
Then, please follow the instructions below:
2017-12-13 12:21:16 +01:00
#### 1. Fork the [repository](https://github.com/strapi/strapi)
2019-05-27 18:57:24 +02:00
[Go to the repository](https://github.com/strapi/strapi) and fork it to your own GitHub account.
#### 2. Clone from your repository
2018-08-08 14:30:40 +02:00
```bash
2019-05-27 18:57:24 +02:00
git clone git@github.com:YOUR_USERNAME/strapi.git
2018-08-08 14:30:40 +02:00
```
#### 3. Install the dependencies
2018-08-08 14:30:40 +02:00
2019-05-27 18:57:24 +02:00
Go to the root of the repository.
2018-08-08 14:30:40 +02:00
```bash
2019-05-27 18:57:24 +02:00
cd strapi && yarn setup
2018-08-08 14:30:40 +02:00
```
#### 4. Start the example application
2018-08-08 14:30:40 +02:00
2019-05-27 18:57:24 +02:00
**Go to the getstarted application**
2018-08-08 14:30:40 +02:00
```bash
2019-05-27 18:57:24 +02:00
cd strapi/examples/getstarted
yarn develop
2018-08-08 14:30:40 +02:00
```
The server (API) is available at http://localhost:1337
**WARNING** ⚠️ If you've followed the recommended setup, you should not be able to reach the administration panel at http://localhost:1337/admin.
2018-08-08 14:30:40 +02:00
2019-05-27 18:57:24 +02:00
**Start the administration panel server**
2018-08-08 14:30:40 +02:00
```bash
2019-05-27 18:57:24 +02:00
cd strapi/packages/strapi-admin
yarn develop
2018-08-08 14:30:40 +02:00
```
The administration panel is available at http://localhost:4000/admin
**Awesome! You are now able to contribute to Strapi.**
2019-05-27 18:57:24 +02:00
#### 5. Available commands
- `yarn watch` starts yarn watch in all packages.
- `yarn build` builds the `strapi-helper-plugin` (use this command when you develop in the administration panel).
- `yarn setup` installs the dependencies.
- `yarn lint` lints the codebase.
- `yarn test:clean` removes the coverage.
- `yarn test:front` runs the front-end related tests.
- `yarn test:front:watch` runs an interactive test watcher for the front-end.
- `yarn test:snyk` checks the dependencies vulnerabilities.
- `yarn test:unit` runs the back-end unit tests.
- `yarn test:e2e` runs an end-to-end test suite.
- `yarn test:generate-app` generates a test application.
- `yarn test:start-app` starts the test application.
2018-08-08 14:30:40 +02:00
---
2017-12-13 12:21:16 +01:00
## Running the tests
2019-05-27 18:57:24 +02:00
**Changing the database:**
2019-05-28 15:33:07 +02:00
You can run the test suites using different databases:
```bash
2019-08-05 09:10:00 +02:00
$ node test/e2e.js --db=sqlite
$ node test/e2e.js --db=mongo
$ node test/e2e.js --db=postgres
$ node test/e2e.js --db=mysql
```
2019-05-27 18:57:24 +02:00
---
2019-05-28 15:33:07 +02:00
## Miscellaneous
2019-05-27 18:57:24 +02:00
### Repository Organization
2019-05-28 15:33:07 +02:00
We chose to to use a monorepo design that exploits [Yarn Workspaces](https://yarnpkg.com/en/docs/workspaces) in the way [React](https://github.com/facebook/react/tree/master/packages) or [Babel](https://github.com/babel/babel/tree/master/packages) does. This allows the community to easily maintain the whole ecosystem, keep it up-to-date and consistent.
2019-05-28 15:33:07 +02:00
We do our best to keep the master branch as clean as possible, with tests passing at all times. However, it may happen that the master branch moves faster than the release cycle. Therefore check the [releases on npm](https://www.npmjs.com/package/strapi) so that you're always up-to-date with the latest stable version.
2019-05-27 18:57:24 +02:00
### Reporting an issue
2016-03-18 11:12:50 +01:00
2019-05-28 15:33:07 +02:00
Before submitting an issue you need to make sure:
2019-05-27 18:57:24 +02:00
2019-05-28 15:33:07 +02:00
- You are experiencing a concrete technical issue with Strapi.
- You have already searched for related [issues](https://github.com/strapi/strapi/issues), and found none open (if you found a related _closed_ issue, please link to it from your post).
- You are not asking a question about how to use Strapi or about whether or not Strapi has a certain feature. For general help using Strapi, you may:
- Refer to [the official Strapi documentation](http://strapi.io).
- Ask a member of the community in the [Strapi Slack Community](https://slack.strapi.io/).
- Ask a question on [StackOverflow](http://stackoverflow.com/questions/tagged/strapi).
2016-03-18 11:12:50 +01:00
- Your issue title is concise, on-topic and polite.
2019-05-28 15:33:07 +02:00
- You can and do provide steps to reproduce your issue.
2016-03-18 11:12:50 +01:00
- You have tried all the following (if relevant) and your issue remains:
- Make sure you have the right application started.
- Make sure the [issue template](.github/ISSUE_TEMPLATE) is respected.
- Make sure your issue body is readable and [well formated](https://guides.github.com/features/mastering-markdown).
2016-03-18 11:12:50 +01:00
- Make sure you've killed the Strapi server with CTRL+C and started it again.
- Make sure the application you are using to reproduce the issue has a clean `node_modules` directory, meaning:
2019-05-27 18:57:24 +02:00
- no dependencies are linked (e.g. you haven't run `npm link`)
- that you haven't made any inline changes to files in the `node_modules` folder
- that you don't have any weird global dependency loops. The easiest way to double-check any of the above, if you aren't sure, is to run: `$ rm -rf node_modules && npm cache clear && npm install`.