You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,10 @@ Changes since the last non-beta release.
27
27
28
28
-**Attribution Comment**: Added HTML comment attribution to Rails views containing React on Rails functionality. The comment automatically displays which version is in use (open source React on Rails or React on Rails Pro) and, for Pro users, shows the license status. This helps identify React on Rails usage across your application. [PR #1857](https://github.com/shakacode/react_on_rails/pull/1857) by [AbanoubGhadban](https://github.com/AbanoubGhadban).
29
29
30
+
#### Bug Fixes
31
+
32
+
-**Use as Git dependency**: All packages can now be installed as Git dependencies. This is useful for development and testing purposes. See
33
+
30
34
#### Breaking Changes
31
35
32
36
-**React on Rails Core Package**: Several Pro-only methods have been removed from the core package and are now exclusively available in the `react-on-rails-pro` package. If you're using any of the following methods, you'll need to migrate to React on Rails Pro:
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+98-24Lines changed: 98 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,59 +49,68 @@ It's critical to configure your IDE/editor to ignore certain directories. Otherw
49
49
- /spec/dummy/tmp
50
50
- /spec/react_on_rails/dummy-for-generators
51
51
52
-
# Configuring your test app to use your local fork
52
+
# Example apps
53
53
54
-
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.
54
+
The [`spec/dummy` app](https://github.com/shakacode/react_on_rails/blob/master/spec/dummy) is an example of the various setup techniques you can use with the gem.
55
55
56
-
```text
57
-
├── test_app
58
-
| └── client
59
-
└── react_on_rails
60
-
└── spec
61
-
└── dummy
62
-
```
56
+
There are also two such apps for React on Rails Pro: [one using the Node renderer](https://github.com/shakacode/react_on_rails/blob/master/react_on_rails_pro/spec/dummy) and [one using ExecJS](https://github.com/shakacode/react_on_rails/blob/master/react_on_rails_pro/spec/execjs-compatible-dummy).
57
+
58
+
When you add a new feature, consider adding an example demonstrating it to the example apps.
59
+
60
+
# Testing your changes in an external application
61
+
62
+
You may also want to test your React on Rails changes with your own application.
63
+
There are three main ways to do it: using local dependencies, Git dependencies, or tarballs.
64
+
65
+
## Local version
63
66
64
-
##Testing the Ruby Gem
67
+
### Ruby
65
68
66
-
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:
69
+
To make your Rails app use a local version of our gems, use
gem "react_on_rails", path:"<React on Rails root>"
70
73
```
71
74
72
-
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**.
75
+
and/or
73
76
74
-
## Testing the Node package for React on Rails via Yalc
77
+
```ruby
78
+
gem "react_on_rails_pro", path:"<React on Rails root>/react_on_rails_pro"
79
+
```
80
+
81
+
Note that you will need to run `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**.
75
82
76
-
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:
83
+
### JS
84
+
85
+
First, be **sure** to build the NPM package:
77
86
78
87
```sh
79
-
cdreact_on_rails/
88
+
cd<React on Rails root>
80
89
yarn
81
90
82
91
# Update the lib directory with babel compiled files
83
92
yarn run build-watch
84
93
```
85
94
86
-
You need to do this once:
95
+
You need to do this once to make sure your app depends on our package:
87
96
88
97
```
89
-
# Will send the updates to other folders
98
+
cd <React on Rails root>/packages/react-on-rails
90
99
yalc publish
91
-
cd spec/dummy
100
+
cd <your project root>
92
101
yalc add react-on-rails
93
102
```
94
103
95
104
The workflow is:
96
105
97
106
1. Make changes to the node package.
98
-
2.**CRITICAL**: Run yalc push to send updates to all linked apps:
107
+
2.**CRITICAL**: Run `yalc push` to send updates to all linked apps:
99
108
100
109
```
101
-
cd <top dir>
110
+
cd <React on Rails root>/packages/react-on-rails
102
111
# Will send the updates to other folders - MUST DO THIS AFTER ANY CHANGES
Don't forget you may need to run yarn after adding packages with yalc to install/update dependencies/bin scripts.
120
129
```
121
130
122
-
#### Example: Testing NPM changes with the dummy app
131
+
Of course, you can do the same with `react-on-rails-pro` and `@shakacode-tools/react-on-rails-pro-node-renderer` packages.
132
+
133
+
This is the approach `spec/dummy` apps use, so you can also look at their implementation.
134
+
135
+
### Example: Testing NPM changes with the dummy app
123
136
124
137
1. Add `console.log('Hello!')` to [clientStartup.ts, function render](https://github.com/shakacode/react_on_rails/blob/master/packages/react-on-rails/src/clientStartup.ts) in `/packages/react-on-rails/src/clientStartup.ts` to confirm we're getting an update to the node package client side. Do the same for function `serverRenderReactComponent` in [/packages/react-on-rails/src/serverRenderReactComponent.ts](https://github.com/shakacode/react_on_rails/blob/master/packages/react-on-rails/src/serverRenderReactComponent.ts).
125
-
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.
138
+
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:3000/`. 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.
139
+
140
+
## Git dependencies
141
+
142
+
If you push your local changes to Git, you can use them as dependencies as follows:
143
+
144
+
### Ruby
145
+
146
+
Adjust depending on the repo you pushed to and commit/branch you want to use, see [Bundler documentation](https://bundler.io/guides/git.html):
0 commit comments