Skip to content

Commit 761179b

Browse files
committed
Add Contributing guide, Code Of Conduct
Also use doctoc for table of contents in readme Readme updated to reference other docs and looks cleaner Update Docs
1 parent 4721ff1 commit 761179b

File tree

4 files changed

+253
-29
lines changed

4 files changed

+253
-29
lines changed

CODE_OF_CONDUCT.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
## Our Standards
8+
9+
Examples of behavior that contributes to creating a positive environment include:
10+
11+
* Using welcoming and inclusive language
12+
* Being respectful of differing viewpoints and experiences
13+
* Gracefully accepting constructive criticism
14+
* Focusing on what is best for the community
15+
* Showing empathy towards other community members
16+
17+
Examples of unacceptable behavior by participants include:
18+
19+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
20+
* Trolling, insulting/derogatory comments, and personal or political attacks
21+
* Public or private harassment
22+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
23+
* Other conduct which could reasonably be considered inappropriate in a professional setting
24+
25+
## Our Responsibilities
26+
27+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28+
29+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30+
31+
## Scope
32+
33+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34+
35+
## Enforcement
36+
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at neonmd@hotmail.co.uk. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38+
39+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40+
41+
## Attribution
42+
43+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44+
45+
[homepage]: http://contributor-covenant.org
46+
[version]: http://contributor-covenant.org/version/1/4/

CONTRIBUTING.md

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
# Contributing to React-Rails
2+
3+
🎉 Thanks for taking the time to contribute! 🎉
4+
5+
With 2 Million+ downloads of the react-rails Gem and another 100k+ downloads of react_ujs on NPM, you're helping the biggest React + Rails community!
6+
7+
What follows is a set of guidelines for contributing to React-Rails, inside the [react-js Organization](https://github.com/reactjs), part of the wider [React Community](https://reactcommunity.org/)
8+
9+
By contributing to React-Rails, you agree to abide by the [code of conduct](https://github.com/reactjs/react-rails/blob/master/CODE_OF_CONDUCT.md).
10+
11+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
12+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
13+
14+
15+
- [How Can I Contribute?](#how-can-i-contribute)
16+
- [Reporting Bugs](#reporting-bugs)
17+
- [Before Submitting A Bug Report](#before-submitting-a-bug-report)
18+
- [How Do I Submit A (Good) Bug Report?](#how-do-i-submit-a-good-bug-report)
19+
- [Your First Code Contribution](#your-first-code-contribution)
20+
- [Pull Requests](#pull-requests)
21+
- [Development](#development)
22+
- [Local dev](#local-dev)
23+
- [Running tests](#running-tests)
24+
- [Updating the pre-bundled react](#updating-the-pre-bundled-react)
25+
- [Updating ReactRailsUJS](#updating-reactrailsujs)
26+
- [Releasing the Gem](#releasing-the-gem)
27+
- [Styleguides](#styleguides)
28+
- [Git Commit Messages](#git-commit-messages)
29+
- [Ruby styleguide](#ruby-styleguide)
30+
- [Issue and Pull Request Labels](#issue-and-pull-request-labels)
31+
32+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
33+
34+
## How Can I Contribute?
35+
36+
### Reporting Bugs
37+
38+
#### Before Submitting A Bug Report
39+
* **Check the [wiki](https://github.com/reactjs/react-rails/wiki).** You might be able to find a guide on what you're experiencing. Most importantly, check if you can reproduce the problem [in the latest version of React-Rails with React_ujs](https://github.com/reactjs/react-rails/tree/master), sometimes we have already fixed the issue.
40+
* **Perform a [cursory search](https://github.com/reactjs/react-rails/issues)** to see if the problem has already been reported. If it has **and the issue is still open**, add a comment to the existing issue instead of opening a new one. If **the issue is closed** open a new issue with reproduction steps and reference the old one.
41+
* **If the problem is with pre-rendering, turn off pre-rendering and look at Chrome's developer console**, that normally reveals more details about what the true error message is if it's a syntax error in a component or failing to require a component file.
42+
43+
#### How Do I Submit A (Good) Bug Report?
44+
Bugs are tracked as [GitHub issues](https://guides.github.com/features/issues/).
45+
Create an issue and provide the following information by filling in [the template](ISSUE_TEMPLATE.md).
46+
47+
Explain the problem and include additional details to help maintainers reproduce the problem:
48+
49+
* **Use a clear and descriptive title** for the issue to identify the problem.
50+
* **Describe the exact steps which reproduce the problem** in as many details as possible. When listing steps, **don't just say what you did, but explain how you did it**. For example, If you're using Browserify instead of Webpacker, how did you do it?
51+
* **Provide specific examples to demonstrate the steps**. Include links to files or GitHub projects, Gists, or copy/pasteable snippets, which you use in those examples. If you're providing snippets in the issue, use [Markdown code blocks](https://help.github.com/articles/markdown-basics/#multiple-lines).
52+
* **Describe the behavior you observed after following the steps** and point out what exactly is the problem with that behavior.
53+
* **Explain which behavior you expected to see instead and why.**
54+
* **Include screenshots and animated GIFs** which show you following the described steps and clearly demonstrate the problem. You can use [this tool](http://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and [this tool](https://github.com/colinkeenan/silentcast) or [this tool](https://github.com/GNOME/byzanz) on Linux.
55+
56+
Include details about your configuration and environment, React-Rails integrates many tools, versions of many things could be the culprit, though we try test as many as reasonable in our [Travis Build](.travis.yml)
57+
58+
* **Which version of React-Rails are you using?**
59+
* **Which version of React_UJS are you using?**
60+
* **Which version of Webpacker/Sprockets are you using?**
61+
* **Which version of Rails are you using?**
62+
63+
### Your First Code Contribution
64+
65+
Unsure where to begin contributing to React-Rails? You can start by looking through these `help-wanted` issues:
66+
67+
* [Help wanted issues][help-wanted]
68+
69+
This issue list is sorted by total number of comments. While not perfect, number of comments is a reasonable proxy for impact a given change will have.
70+
71+
#### Pull Requests
72+
73+
See [git commit message style](#git-commit-messages)
74+
75+
* Fill in [the required template](PULL_REQUEST_TEMPLATE.md)
76+
* Do not include issue numbers in the PR title
77+
* Include screenshots and animated GIFs in your pull request whenever possible.
78+
* Follow the [styleguides](#styleguides) where possible but readability is the most important!
79+
* Include intention-revealing [Minitest](https://github.com/seattlerb/minitest) tests in the `./test` folder. It's important people know *why* a test exists by reading it more than *what* it does, we can read the source for the *what*.
80+
* Document new code where you're able.
81+
82+
#### Development
83+
84+
##### Local dev
85+
86+
Clone down the [react-rails-example-app](https://github.com/bookofgreg/react-rails-example-app), it has several branches for different scenarios. It's designed to contain very simple examples of each feature of React-Rails.
87+
88+
To develop Ruby code, change the Gemfile to point to a local copy of react-rails.
89+
```
90+
gem 'react-rails', path: '../react-rails'
91+
```
92+
93+
To develop the React_UJS NPM Package, make your changes and run `npm pack` to make a `.tgz` bundle, then in react-rails-example-app `yarn add ../react_ujs-<version>.tgz`
94+
95+
##### Running tests
96+
97+
`bundle exec appraisal install` to install gems on every gemfile Appraisal contains.
98+
`rake test` or `bundle exec appraisal rake test` runs everything.
99+
or run a specific suite using `bundle exec appraisal <appraisal name> rake test`
100+
- Find appraisal names in [Appraisals](Appraisals)
101+
- Integration tests run in Headless Chrome which is included in Chrome (59+ linux,OSX | 60+ Windows)
102+
- ChromeDriver is included with `chromedriver-helper` gem so no need to manually install that 👍
103+
104+
##### Updating the pre-bundled react
105+
- Update React with `rake react:update`
106+
It outputs an ironically webpacked couple of files into `lib/assets/react-source/<environment>/react(-server).js` where it will be picked up by `sprockets` in `lib/react/rails/asset_variant.rb`
107+
108+
##### Updating ReactRailsUJS
109+
- Update the UJS with `rake ujs:update`
110+
- (For Maintainers) To release a new NPM version:
111+
- Update the version in `react_ujs/package.json`
112+
- Commit & push to master
113+
- `bundle exec rake ujs:publish` (runs `npm publish`)
114+
115+
##### Releasing the Gem
116+
- (For Maintainers) To release a new RubyGems version:
117+
- Increment the version in `lib/react/rails/version.rb`
118+
- Add an entry to `VERSIONS.md`
119+
- Update the [changelog](CHANGELOG.md) (find recent changes on GitHub by listing commits or showing closed PRs)
120+
- Commit changes & push to master
121+
- `bundle exec rake release`: pushes a tag to GitHub, builds a `.gem`, and pushes to RubyGems
122+
123+
## Styleguides
124+
125+
### Git Commit Messages
126+
127+
* Use the present tense ("Add feature" not "Added feature")
128+
* Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
129+
* Limit the first line to 72 characters or less
130+
* Reference issues and pull requests liberally after the first line
131+
* * When only changing documentation, include `[ci skip]` in the [commit description](https://docs.travis-ci.com/user/customizing-the-build/#Skipping-a-build) so we don't waste Travis's Open source resources.
132+
* Consider starting the commit message with an applicable emoji:
133+
* :art: `:art:` when improving the format/structure of the code
134+
* :racehorse: `:racehorse:` when improving performance
135+
* :memo: `:memo:` when writing docs
136+
* :bug: `:bug:` when fixing a bug
137+
* :fire: `:fire:` when removing code or files
138+
* :green_heart: `:green_heart:` when fixing the CI build
139+
* :white_check_mark: `:white_check_mark:` when adding tests
140+
* :lock: `:lock:` when dealing with security
141+
* :arrow_up: `:arrow_up:` when upgrading dependencies
142+
* :arrow_down: `:arrow_down:` when downgrading dependencies
143+
* :shirt: `:shirt:` when removing linter warnings
144+
145+
### Ruby styleguide
146+
147+
Ruby Style in this repo should attempt to follow the standard ruby styles as defined in `Rubocop`. This is more of a guide than a rule so use common sense, readability is more important than the style guide!
148+
149+
## Issue and Pull Request Labels
150+
151+
Todo
152+
153+
Finally, thanks to the [Atom Organization](https://github.com/atom) where this Contributing guide is based! :heart: :green_heart:

ISSUE_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Help us help you! Please choose one:
1+
Help us help you! Have you looked for similar issues? Do you have reproduction steps? [Contributing Guide](CONTRIBUTING.md#reporting-bugs)
22

33
- [ ] My app crashes with `react-rails`, so I've included the stack trace and the exact steps which make it crash.
44
- [ ] My app doesn't crash, but I'm getting unexpected behavior. So, I've described the unexpected behavior and suggested a new behavior.

README.md

Lines changed: 53 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,40 @@
88

99
React-Rails makes it easy to use [React](http://facebook.github.io/react/) and [JSX](http://facebook.github.io/react/docs/jsx-in-depth.html) in your Ruby on Rails (3.2 to 5+) application.
1010

11-
Automatic Server-side Rendering (SSR) with **Webpacker** 3+ down to 1.1 support!
11+
Automatic Server-side Rendering (SSR) for SEO benefits with **Webpacker** 1.1 to 3+ and Sprockets 2 to 4 support!
12+
13+
Example app code available here: https://github.com/BookOfGreg/react-rails-example-app
14+
15+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
16+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
17+
18+
19+
- [Learn more](#learn-more)
20+
- [Get started with Webpacker](#get-started-with-webpacker)
21+
- [File naming](#file-naming)
22+
- [Use with Asset Pipeline](#use-with-asset-pipeline)
23+
- [Custom JSX Transformer](#custom-jsx-transformer)
24+
- [React.js versions](#reactjs-versions)
25+
- [View Helper](#view-helper)
26+
- [Custom View Helper](#custom-view-helper)
27+
- [UJS](#ujs)
28+
- [Mounting & Unmounting](#mounting--unmounting)
29+
- [Event Handling](#event-handling)
30+
- [`getConstructor`](#getconstructor)
31+
- [Server-Side Rendering](#server-side-rendering)
32+
- [Configuration](#configuration)
33+
- [JavaScript State](#javascript-state)
34+
- [Custom Server Renderer](#custom-server-renderer)
35+
- [Controller Actions](#controller-actions)
36+
- [Component Generator](#component-generator)
37+
- [Use with JBuilder](#use-with-jbuilder)
38+
- [Camelize Props](#camelize-props)
39+
- [Upgrading](#upgrading)
40+
- [2.3 to 2.4](#23-to-24)
41+
- [Related Projects](#related-projects)
42+
- [Contributing](#contributing)
43+
44+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
1245

1346
## Learn more
1447
- React's [Getting Started guide](https://facebook.github.io/react/docs/getting-started.html)
@@ -483,46 +516,38 @@ You can also specify this option in `react_component`:
483516
484517
### 2.3 to 2.4
485518
519+
Keep your `react_ujs` up to date, `yarn upgrade`
520+
486521
React-Rails 2.4.x uses React 16+ which no longer has React Addons. Therefore the pre-bundled version of react no longer has an addons version, if you need addons still, there is the 2.3.1+ version of the gem that still has addons.
487522
488-
If you need to make changes for the prebundled react, see the migration docs here:
523+
If you need to make changes in your components for the prebundled react, see the migration docs here:
489524
490525
- https://reactjs.org/blog/2016/11/16/react-v15.4.0.html
491526
- https://reactjs.org/blog/2017/04/07/react-v15.5.0.html
492527
- https://reactjs.org/blog/2017/06/13/react-v15.6.0.html
493528
494529
495-
For the vast majority this will get you most of the migration:
530+
For the vast majority of cases this will get you most of the migration:
496531
- global find+replace `React.Prop` -> `Prop`
497532
- add `import PropTypes from 'prop-types'` (Webpacker only)
498533
- re-run `bundle exec rails webpacker:install:react` to update npm packages (Webpacker only)
499534
535+
## Related Projects
536+
537+
- [webpacker-react](https://github.com/renchap/webpacker-react): Integration of React with Rails utilizing Webpack with Hot Module Replacement (HMR).
538+
- [react\_on\_rails](https://github.com/shakacode/react_on_rails): Integration of React with Rails utilizing Webpack, Redux, React-Router.
539+
- [react-rails-hot-loader](https://github.com/rmosolgo/react-rails-hot-loader) Simple live-reloader for `react-rails`.
540+
- [react-rails-benchmark_renderer](https://github.com/pboling/react-rails-benchmark_renderer) adds performance instrumentation to server rendering.
541+
- [Ruby Hyperloop](http://ruby-hyperloop.org/): Use Ruby to build reactive user interfaces with React.
542+
500543
## Contributing
501544
502-
We have a [Code of Conduct]() that you need to follow.
545+
🎉 Thanks for taking the time to contribute! 🎉
546+
547+
With 2 Million+ downloads of the react-rails Gem and another 100k+ downloads of react_ujs on NPM, you're helping the biggest React + Rails community!
548+
549+
By contributing to React-Rails, you agree to abide by the [code of conduct](https://github.com/reactjs/react-rails/blob/master/CODE_OF_CONDUCT.md).
550+
503551
You can always help by submitting patches or triaging issues, even offering reproduction steps to issues is incredibly helpful!
504552
505-
### Running tests
506-
`rake test` or `bundle exec appraisal rake test` runs everything.
507-
or run a specific suite using `bundle exec appraisal <appraisal name> rake test`
508-
- Integration tests run in Headless Chrome which is included in Chrome (59+ linux,OSX | 60+ Windows)
509-
- ChromeDriver is included with `chromedriver-helper` gem so no need to manually install that 👍
510-
511-
### Updating the pre-bundled react
512-
- Update React with `rake react:update`
513-
It outputs an ironically webpacked couple of files into `lib/assets/react-source/<environment>/react(-server).js` where it will be picked up by `sprockets` in `lib/react/rails/asset_variant.rb`
514-
515-
### Updating ReactRailsUJS
516-
- Update the UJS with `rake ujs:update`
517-
- To release a new NPM version:
518-
- Update the version in `react_ujs/package.json`
519-
- Commit & push to master
520-
- `bundle exec rake ujs:publish` (runs `npm publish`)
521-
522-
### Releasing the Gem
523-
- To release a new RubyGems version:
524-
- Increment the version in `lib/react/rails/version.rb`
525-
- Add an entry to `VERSIONS.md`
526-
- Update the changelog (find recent changes on GitHub by listing commits or showing closed PRs)
527-
- Commit changes & push to master
528-
- `bundle exec rake release`: pushes a tag to GitHub, builds a `.gem`, and pushes to RubyGems
553+
Please see our [Contribution guide](https://github.com/reactjs/react-rails/blob/master/CONTRIBUTING.md) for more info.

0 commit comments

Comments
 (0)