react_on_rails 16.2.0.beta.4 → 16.2.0.beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +27 -8
  3. data/CONTRIBUTING.md +1 -1
  4. data/Gemfile.development_dependencies +0 -1
  5. data/Gemfile.lock +1 -9
  6. data/bin/ci-rerun-failures +39 -16
  7. data/bin/ci-run-failed-specs +1 -1
  8. data/bin/ci-switch-config +8 -2
  9. data/bin/lefthook/ruby-autofix +2 -1
  10. data/knip.ts +35 -9
  11. data/lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb.tt +32 -52
  12. data/lib/generators/react_on_rails/templates/base/base/config/shakapacker.yml +5 -1
  13. data/lib/react_on_rails/dev/server_manager.rb +11 -4
  14. data/lib/react_on_rails/doctor.rb +245 -0
  15. data/lib/react_on_rails/helper.rb +9 -0
  16. data/lib/react_on_rails/version.rb +1 -1
  17. data/react_on_rails_pro/CHANGELOG.md +7 -0
  18. data/react_on_rails_pro/CONTRIBUTING.md +2 -13
  19. data/react_on_rails_pro/Gemfile.lock +21 -3
  20. data/react_on_rails_pro/docs/code-splitting-loadable-components.md +1 -1
  21. data/react_on_rails_pro/docs/contributors-info/releasing.md +2 -2
  22. data/react_on_rails_pro/docs/installation.md +106 -104
  23. data/react_on_rails_pro/docs/node-renderer/basics.md +3 -3
  24. data/react_on_rails_pro/docs/node-renderer/error-reporting-and-tracing.md +8 -8
  25. data/react_on_rails_pro/docs/node-renderer/js-configuration.md +1 -1
  26. data/react_on_rails_pro/docs/updating.md +209 -15
  27. data/react_on_rails_pro/lib/react_on_rails_pro/concerns/stream.rb +58 -4
  28. data/react_on_rails_pro/lib/react_on_rails_pro/configuration.rb +17 -3
  29. data/react_on_rails_pro/lib/react_on_rails_pro/license_public_key.rb +9 -9
  30. data/react_on_rails_pro/lib/react_on_rails_pro/request.rb +41 -25
  31. data/react_on_rails_pro/lib/react_on_rails_pro/stream_request.rb +27 -7
  32. data/react_on_rails_pro/lib/react_on_rails_pro/utils.rb +3 -3
  33. data/react_on_rails_pro/lib/react_on_rails_pro/version.rb +1 -1
  34. data/react_on_rails_pro/package-scripts.yml +1 -1
  35. data/react_on_rails_pro/package.json +5 -8
  36. data/react_on_rails_pro/packages/node-renderer/src/integrations/api.ts +1 -1
  37. data/react_on_rails_pro/rakelib/public_key_management.rake +6 -5
  38. data/react_on_rails_pro/react_on_rails_pro.gemspec +1 -0
  39. data/react_on_rails_pro/spec/dummy/Gemfile.lock +20 -3
  40. data/react_on_rails_pro/spec/dummy/app/controllers/pages_controller.rb +3 -3
  41. data/react_on_rails_pro/spec/dummy/bin/dev +4 -8
  42. data/react_on_rails_pro/spec/dummy/client/node-renderer.js +3 -3
  43. data/react_on_rails_pro/spec/dummy/config/environments/production.rb +1 -1
  44. data/react_on_rails_pro/spec/dummy/config/initializers/react_on_rails.rb +28 -12
  45. data/react_on_rails_pro/spec/dummy/config.ru +1 -1
  46. data/react_on_rails_pro/spec/dummy/package.json +2 -2
  47. data/react_on_rails_pro/spec/dummy/spec/helpers/react_on_rails_pro_helper_spec.rb +40 -11
  48. data/react_on_rails_pro/spec/dummy/spec/rails_helper.rb +1 -1
  49. data/react_on_rails_pro/spec/dummy/spec/requests/renderer_console_logging_spec.rb +5 -5
  50. data/react_on_rails_pro/spec/dummy/spec/system/integration_spec.rb +20 -14
  51. data/react_on_rails_pro/spec/dummy/spec/system/renderer_integration_spec.rb +3 -3
  52. data/react_on_rails_pro/spec/dummy/yarn.lock +4 -4
  53. data/react_on_rails_pro/spec/execjs-compatible-dummy/config/environments/production.rb +1 -1
  54. data/react_on_rails_pro/spec/execjs-compatible-dummy/config/initializers/react_on_rails.rb +16 -43
  55. data/react_on_rails_pro/spec/react_on_rails_pro/assets_precompile_spec.rb +15 -18
  56. data/react_on_rails_pro/spec/react_on_rails_pro/cache_spec.rb +1 -1
  57. data/react_on_rails_pro/spec/react_on_rails_pro/configuration_spec.rb +5 -3
  58. data/react_on_rails_pro/spec/react_on_rails_pro/license_validator_spec.rb +27 -12
  59. data/react_on_rails_pro/spec/react_on_rails_pro/request_spec.rb +0 -27
  60. data/react_on_rails_pro/spec/react_on_rails_pro/spec_helper.rb +1 -1
  61. data/react_on_rails_pro/spec/react_on_rails_pro/stream_decorator_spec.rb +89 -0
  62. data/react_on_rails_pro/spec/react_on_rails_pro/stream_spec.rb +144 -0
  63. data/react_on_rails_pro/spec/react_on_rails_pro/support/caching.rb +1 -1
  64. data/react_on_rails_pro/spec/react_on_rails_pro/support/mock_block_helper.rb +4 -2
  65. metadata +2 -3
  66. data/react_on_rails_pro/spec/dummy/client/app/ror-auto-load-components/TestingStreamableComponent.jsx +0 -15
@@ -1,108 +1,112 @@
1
1
  # Installation
2
2
 
3
- Since the repository is private, you will get a **GitHub Personal Access Token** and an account that can access the packages. Substitute that value in the commands below. If you dont' have this, ask [justin@shakacode.com](mailto:justin@shakacode.com) to give you one.
3
+ React on Rails Pro packages are published publicly on npmjs.org and RubyGems.org. Installation requires a valid **license token** for runtime validation. Contact [justin@shakacode.com](mailto:justin@shakacode.com) to purchase a license.
4
4
 
5
- Check the [CHANGELOG](https://github.com/shakacode/react_on_rails_pro/blob/master/CHANGELOG.md) to see what version you want.
5
+ **Upgrading from GitHub Packages?** See the [Upgrading Guide](./updating.md) for migration instructions.
6
6
 
7
- # Version
7
+ Check the [CHANGELOG](https://github.com/shakacode/react_on_rails/blob/master/CHANGELOG.md) to see what version you want.
8
8
 
9
- For the below docs, find the desired `<version>` in the CHANGELOG. Note, for pre-release versions, gems have all periods, and node packages uses a dash, like gem `3.0.0.rc.0` and node package `3.0.0-rc.0`.
9
+ ## Version Format
10
10
 
11
- # Ruby
11
+ For the below docs, find the desired `<version>` in the CHANGELOG. Note that for pre-release versions:
12
12
 
13
- ## Gem Installation
13
+ - Gems use all periods: `16.2.0.beta.1`
14
+ - NPM packages use dashes: `16.2.0-beta.1`
14
15
 
15
- 1. Ensure your **Rails** app is using the **react_on_rails** gem, version greater than 11.0.7.
16
- 1. Add the `react_on_rails_pro` gem to your **Gemfile**. Substitute the appropriate version number.
16
+ # Ruby Gem Installation
17
17
 
18
- ## Gemfile Change
18
+ ## Prerequisites
19
19
 
20
- Replace the following in the snippet for the Gemfile
20
+ Ensure your **Rails** app is using the **react_on_rails** gem, version 16.0.0 or higher.
21
21
 
22
- 1. `<account>` for the api key
23
- 2. `<api-key>`
24
- 3. `<version>` desired
22
+ ## Install react_on_rails_pro Gem
23
+
24
+ Add the `react_on_rails_pro` gem to your **Gemfile**:
25
25
 
26
26
  ```ruby
27
- source "https://<rorp-account>:<token>@"\
28
- "rubygems.pkg.github.com/shakacode-tools" do
29
- gem "react_on_rails_pro", "<version>"
30
- end
27
+ gem "react_on_rails_pro", "~> 16.2"
31
28
  ```
32
29
 
33
- ## Alternate installation keeping the key out of your Gemfile
30
+ Then run:
34
31
 
35
- ```ruby
36
- source "https://rubygems.pkg.github.com/shakacode-tools" do
37
- gem "react_on_rails_pro", "<version>"
38
- end
32
+ ```bash
33
+ bundle install
39
34
  ```
40
35
 
41
- Or use the `gem install` command:
36
+ Or install directly:
42
37
 
43
38
  ```bash
44
- gem install react_on_rails_pro --version "<version>> --source "https://rubygems.pkg.github.com/shakacode-tools"
39
+ gem install react_on_rails_pro --version "<version>"
45
40
  ```
46
41
 
47
- Then edit your permissions for bundler at the command line:
42
+ ## License Configuration
48
43
 
49
- ```
50
- bundle config set rubygems.pkg.github.com <username>:<token>
51
- ```
44
+ Set your license token as an environment variable:
52
45
 
53
- ## Using a branch in your Gemfile
46
+ ```bash
47
+ export REACT_ON_RAILS_PRO_LICENSE="your-license-token-here"
48
+ ```
54
49
 
55
- Note, you should probably use an ENV value for the token so that you don't check this into your source code.
50
+ Or configure it in your Rails initializer (not recommended for production):
56
51
 
57
52
  ```ruby
58
- gem "react_on_rails_pro", version: "<version>", git: "https://[your-github-token]:x-oauth-basic@github.com/shakacode/react_on_rails_pro.git", tag: "<version>"
53
+ # config/initializers/react_on_rails_pro.rb
54
+ ReactOnRailsPro.configure do |config|
55
+ config.license_token = ENV["REACT_ON_RAILS_PRO_LICENSE"]
56
+ end
59
57
  ```
60
58
 
59
+ ⚠️ **Security Warning**: Never commit your license token to version control. Always use environment variables or secure secret management systems (like Rails credentials, Heroku config vars, AWS Secrets Manager, etc.).
60
+
61
61
  ## Rails Configuration
62
62
 
63
- You don't need to create an initializer if you are satisfied with the default as described in
64
- [Configuration](./configuration.md)
63
+ You don't need to create an initializer if you are satisfied with the defaults as described in [Configuration](./configuration.md).
65
64
 
66
- # Node Package
65
+ For basic setup:
67
66
 
68
- Note, you only need to install the Node Package if you are using the standalone node renderer, `NodeRenderer`.
67
+ ```ruby
68
+ # config/initializers/react_on_rails_pro.rb
69
+ ReactOnRailsPro.configure do |config|
70
+ # Your configuration here
71
+ # See docs/configuration.md for all options
72
+ end
73
+ ```
69
74
 
70
- ## Installation
75
+ # Node Package Installation
71
76
 
72
- 1. Create a subdirectory of your rails project for the Node renderer. Let's use `react-on-rails-pro`.
73
- 2. Create a file `react-on-rails-pro/.npmrc` with the following
77
+ **Note:** You only need to install the Node Package if you are using the standalone node renderer (`NodeRenderer`). If you're using `ExecJS` (the default), skip this section.
74
78
 
79
+ ## Install react-on-rails-pro-node-renderer
80
+
81
+ ### Using npm:
82
+
83
+ ```bash
84
+ npm install react-on-rails-pro-node-renderer
75
85
  ```
76
- always-auth=true
77
- //npm.pkg.github.com/:_authToken=<token>
78
- @shakacode-tools:registry=https://npm.pkg.github.com
86
+
87
+ ### Using yarn:
88
+
89
+ ```bash
90
+ yarn add react-on-rails-pro-node-renderer
79
91
  ```
80
92
 
81
- 3. Create a `react-on-rails-pro/package.json`
93
+ ### Add to package.json:
82
94
 
83
95
  ```json
84
96
  {
85
- "private": true,
86
97
  "dependencies": {
87
- "@shakacode-tools/react-on-rails-pro-node-renderer": "<version>"
88
- },
89
- "scripts": {
90
- "node-renderer": "echo 'Starting React on Rails Pro Node Renderer.' && node ./react-on-rails-pro-node-renderer.js"
98
+ "react-on-rails-pro-node-renderer": "^16.2.0"
91
99
  }
92
100
  }
93
101
  ```
94
102
 
95
- 4. Be sure to run `npm i` **and not** `yarn` as only npm seems to work with the private github packages.
96
-
97
- If you really want to use yarn, see [Yarn can't find private Github npm registry](https://stackoverflow.com/questions/58316109/yarn-cant-find-private-github-npm-registry)
103
+ ## Node Renderer Setup
98
104
 
99
- 5. You can start the renderer with either the executable `node-renderer` or, preferably, with
100
- a startup JS file, say called `react-on-rails-pro/react-on-rails-pro-node-renderer.js` with
101
- these contents. \_Note the use of the namespaced **`@shakacode-tools/react-on-rails-pro-node-renderer`** for the package.
105
+ Create a JavaScript file to configure and launch the node renderer, for example `react-on-rails-pro-node-renderer.js`:
102
106
 
103
107
  ```js
104
108
  const path = require('path');
105
- const { reactOnRailsProNodeRenderer } = require('@shakacode-tools/react-on-rails-pro-node-renderer');
109
+ const { reactOnRailsProNodeRenderer } = require('react-on-rails-pro-node-renderer');
106
110
 
107
111
  const env = process.env;
108
112
 
@@ -112,34 +116,24 @@ const config = {
112
116
  // Listen at RENDERER_PORT env value or default port 3800
113
117
  logLevel: env.RENDERER_LOG_LEVEL || 'debug', // show all logs
114
118
 
115
- // See value in /config/initializers/react_on_rails_pro.rb. Should use env
116
- // value in real app.
117
- password: 'myPassword1',
119
+ // Password for Rails <-> Node renderer communication
120
+ // See value in /config/initializers/react_on_rails_pro.rb
121
+ password: env.RENDERER_PASSWORD || 'changeme',
118
122
 
119
- // Save bundle to "tmp/bundles" dir of our dummy app
120
- // This is the default
121
123
  port: env.RENDERER_PORT || 3800,
122
124
 
123
125
  // supportModules should be set to true to allow the server-bundle code to
124
- // see require, exports, etc.
125
- // `false` is like the ExecJS behavior
126
- // this option is required to equal `true` in order to use loadable components
126
+ // see require, exports, etc. (`false` is like the ExecJS behavior)
127
+ // This option is required to equal `true` in order to use loadable components
127
128
  supportModules: true,
128
129
 
129
130
  // workersCount defaults to the number of CPUs minus 1
130
- workersCount: Number(process.env.NODE_RENDERER_CONCURRENCY || 3),
131
-
132
- // Next 2 params, allWorkersRestartInterval and
133
- // delayBetweenIndividualWorkerRestarts must both should be set if you wish
134
- // to have automatic worker restarting, say to clear memory leaks.
135
- // time is in minutes between restarting all workers
136
- // Enable next 2 if the renderer is running out of memory
137
- // allWorkersRestartInterval: 15,
138
- // time in minutes between each worker restarting when restarting all workers
139
- // delayBetweenIndividualWorkerRestarts: 2,
140
- // Also, you can set he parameter gracefulWorkerRestartTimeout to force the worker to restart
141
- // If it's the time for the worker to restart, the worker waits until it serves all active requests before restarting
142
- // If a worker stuck because of a memory leakage or an infinite loop, you can set a timeout that master waits for it before killing the worker
131
+ workersCount: Number(env.NODE_RENDERER_CONCURRENCY || 3),
132
+
133
+ // Optional: Automatic worker restarting (for memory leak mitigation)
134
+ // allWorkersRestartInterval: 15, // minutes between restarting all workers
135
+ // delayBetweenIndividualWorkerRestarts: 2, // minutes between each worker restart
136
+ // gracefulWorkerRestartTimeout: undefined, // timeout for graceful worker restart; forces restart if worker stuck
143
137
  };
144
138
 
145
139
  // Renderer detects a total number of CPUs on virtual hostings like Heroku
@@ -152,50 +146,58 @@ if (env.CI) {
152
146
  reactOnRailsProNodeRenderer(config);
153
147
  ```
154
148
 
155
- ## Instructions for using a branch
156
-
157
- Install the node-renderer executable, possibly globally. Substitute the branch name or tag for `master`
149
+ Add a script to your `package.json`:
158
150
 
151
+ ```json
152
+ {
153
+ "scripts": {
154
+ "node-renderer": "node ./react-on-rails-pro-node-renderer.js"
155
+ }
156
+ }
159
157
  ```
160
- yarn global add https://<your-github-token>:x-oauth-basic@github.com/shakacode/react_on_rails_pro.git\#master
161
- ```
162
-
163
- This installs a binary `node-renderer`.
164
158
 
165
- ### Using Github packages
166
-
167
- Login into npm
159
+ Start the renderer:
168
160
 
169
161
  ```bash
170
- npm install @shakacode-tools/react-on-rails-pro-node-renderer@<version>
162
+ npm run node-renderer
171
163
  ```
172
164
 
173
- or edit package.json directly
165
+ ## Rails Configuration for Node Renderer
174
166
 
175
- ```json
176
- "@shakacode-tools/react-on-rails-pro-node-renderer": "<version>"
177
- ```
167
+ Configure Rails to use the remote node renderer:
178
168
 
179
- ### Configuration
169
+ ```ruby
170
+ # config/initializers/react_on_rails_pro.rb
171
+ ReactOnRailsPro.configure do |config|
172
+ config.server_renderer = "NodeRenderer"
180
173
 
181
- See [NodeRenderer JavaScript Configuration](./node-renderer/js-configuration.md).
174
+ # Configure renderer connection
175
+ config.renderer_url = ENV["REACT_RENDERER_URL"] || "http://localhost:3800"
176
+ config.renderer_password = ENV["RENDERER_PASSWORD"] || "changeme"
182
177
 
183
- #### Webpack Configuration
178
+ # Enable prerender caching (recommended)
179
+ config.prerender_caching = true
180
+ end
181
+ ```
184
182
 
185
- Set your server bundle webpack configuration to use a target of `node` per the [Webpack docs](https://webpack.js.org/concepts/targets/#usage).
183
+ ### Configuration Options
186
184
 
187
- ## Authentication when using Github packages
185
+ See [Rails Configuration Options](./configuration.md) for all available settings.
188
186
 
189
- [Auth for the npm package](https://docs.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-npm-for-use-with-github-packages#authenticating-to-github-packages)
187
+ Pay attention to:
190
188
 
191
- Create a new ~/.npmrc file if one doesn't exist.
189
+ - `config.server_renderer = "NodeRenderer"` - Required to use node renderer
190
+ - `config.renderer_url` - URL where your node renderer is running
191
+ - `config.renderer_password` - Shared secret for authentication
192
+ - `config.prerender_caching` - Enable caching (recommended)
192
193
 
193
- ```
194
- //npm.pkg.github.com/:_authToken=TOKEN
195
- ```
194
+ ## Webpack Configuration
196
195
 
197
- To configure bundler if you don't want the token in your Gemfile:
196
+ Set your server bundle webpack configuration to use a target of `node` per the [Webpack docs](https://webpack.js.org/concepts/targets/#usage).
198
197
 
199
- ```
200
- bundle config https://rubygems.pkg.github.com/OWNER USERNAME:TOKEN
201
- ```
198
+ ## Additional Documentation
199
+
200
+ - [Node Renderer Basics](./node-renderer/basics.md)
201
+ - [Node Renderer JavaScript Configuration](./node-renderer/js-configuration.md)
202
+ - [Rails Configuration Options](./configuration.md)
203
+ - [Error Reporting and Tracing](./node-renderer/error-reporting-and-tracing.md)
@@ -37,16 +37,16 @@ For the most control over the setup, create a JavaScript file to start the NodeR
37
37
  cd renderer-app
38
38
  ```
39
39
  2. Make sure you have **Node.js** version **14** or higher and **Yarn** installed.
40
- 3. Init node application and yarn add to install `@shakacode-tools/react-on-rails-pro-node-renderer` package.
40
+ 3. Init node application and install the `react-on-rails-pro-node-renderer` package.
41
41
  ```sh
42
42
  yarn init
43
- yarn add https://[your-github-token]:x-oauth-basic@github.com/shakacode/react_on_rails_pro.git\#master
43
+ yarn add react-on-rails-pro-node-renderer
44
44
  ```
45
45
  4. Configure a JavaScript file that will launch the rendering server per the docs in [Node Renderer JavaScript Configuration](./js-configuration.md). For example, create a file `node-renderer.js`. Here is a simple example that uses all the defaults except for serverBundleCachePath:
46
46
 
47
47
  ```javascript
48
48
  import path from 'path';
49
- import reactOnRailsProNodeRenderer from '@shakacode-tools/react-on-rails-pro-node-renderer';
49
+ import reactOnRailsProNodeRenderer from 'react-on-rails-pro-node-renderer';
50
50
 
51
51
  const config = {
52
52
  serverBundleCachePath: path.resolve(__dirname, '../.node-renderer-bundles'),
@@ -14,10 +14,10 @@ It should initialize the services according to your requirements and then enable
14
14
  3. Then load the integration:
15
15
 
16
16
  ```js
17
- require('@shakacode-tools/react-on-rails-pro-node-renderer/integrations/sentry').init();
17
+ require('react-on-rails-pro-node-renderer/integrations/sentry').init();
18
18
  ```
19
19
 
20
- - Use `@shakacode-tools/react-on-rails-pro-node-renderer/integrations/sentry6` instead of `.../sentry` for versions of Sentry SDK older than 7.63.0.
20
+ - Use `react-on-rails-pro-node-renderer/integrations/sentry6` instead of `.../sentry` for versions of Sentry SDK older than 7.63.0.
21
21
  - For Sentry SDK v8+ you can use `.init({ fastify: true })` to capture additional Fastify-related information.
22
22
 
23
23
  ### Sentry Tracing
@@ -40,7 +40,7 @@ To enable Sentry Tracing:
40
40
  2. Then load the integration:
41
41
 
42
42
  ```js
43
- require('@shakacode-tools/react-on-rails-pro-node-renderer/integrations/honeybadger').init();
43
+ require('react-on-rails-pro-node-renderer/integrations/honeybadger').init();
44
44
  ```
45
45
 
46
46
  Use `init({ fastify: true })` to capture additional Fastify-related information.
@@ -49,7 +49,7 @@ To enable Sentry Tracing:
49
49
  You can create your own integrations in the same way as the provided ones.
50
50
  If you have access to the React on Rails Pro repository,
51
51
  you can use [their implementations](https://github.com/shakacode/react_on_rails_pro/tree/master/packages/node-renderer/src/integrations) as examples.
52
- Import these functions from `@shakacode-tools/react-on-rails-pro-node-renderer/integrations/api`:
52
+ Import these functions from `react-on-rails-pro-node-renderer/integrations/api`:
53
53
 
54
54
  ### Error reporting services
55
55
 
@@ -59,7 +59,7 @@ Import these functions from `@shakacode-tools/react-on-rails-pro-node-renderer/i
59
59
  For example, integrating with BugSnag can be as simple as
60
60
  ```js
61
61
  const Bugsnag = require('@bugsnag/js');
62
- const { addNotifier } = require('@shakacode-tools/react-on-rails-pro-node-renderer/integrations/api');
62
+ const { addNotifier } = require('react-on-rails-pro-node-renderer/integrations/api');
63
63
 
64
64
  Bugsnag.start({ /* your options */ });
65
65
 
@@ -76,7 +76,7 @@ To track requests as [sessions](https://docs.bugsnag.com/platforms/javascript/ca
76
76
  the above example becomes
77
77
  ```js
78
78
  const Bugsnag = require('@bugsnag/js');
79
- const { addNotifier, setupTracing } = require('@shakacode-tools/react-on-rails-pro-node-renderer/integrations/api');
79
+ const { addNotifier, setupTracing } = require('react-on-rails-pro-node-renderer/integrations/api');
80
80
 
81
81
  Bugsnag.start({ /* your options */ });
82
82
 
@@ -117,7 +117,7 @@ Bugsnag v7 is a bit more complicated:
117
117
 
118
118
  ```js
119
119
  const Bugsnag = require('@bugsnag/js');
120
- const { addNotifier, setupTracing } = require('@shakacode-tools/react-on-rails-pro-node-renderer/integrations/api');
120
+ const { addNotifier, setupTracing } = require('react-on-rails-pro-node-renderer/integrations/api');
121
121
 
122
122
  Bugsnag.start({ /* your options */ });
123
123
 
@@ -142,7 +142,7 @@ If you want to report HTTP requests from Fastify, you can use `configureFastify`
142
142
  Extending the above example:
143
143
 
144
144
  ```js
145
- const { configureFastify } = require('@shakacode-tools/react-on-rails-pro-node-renderer/integrations/api');
145
+ const { configureFastify } = require('react-on-rails-pro-node-renderer/integrations/api');
146
146
 
147
147
  configureFastify((app) => {
148
148
  app.addHook('onError', (_req, _reply, error, done) => {
@@ -57,7 +57,7 @@ Create a file './node-renderer.js'
57
57
 
58
58
  ```js
59
59
  import path from 'path';
60
- import { reactOnRailsProNodeRenderer } from '@shakacode-tools/react-on-rails-pro-node-renderer';
60
+ import { reactOnRailsProNodeRenderer } from 'react-on-rails-pro-node-renderer';
61
61
 
62
62
  const config = {
63
63
  // Save bundles to relative "./.node-renderer-bundles" dir of our app
@@ -1,25 +1,219 @@
1
- # Using a Branch Rather Than a Published Package
2
- _And Old Installation Instructions_
1
+ # Upgrading React on Rails Pro
3
2
 
4
- ## Get the oauth token from justin@shakacode.com
3
+ ## Upgrading from GitHub Packages to Public Distribution
5
4
 
6
- * ShakaCode does:
7
- * Creates a github user, like customer-rorp with email customer-rorp@shakacode.com created via a Google apps group.
8
- * Confirm email for account
9
- * Add user to have read-only access for shakacode/react_on_rails_pro
10
- * Create an auth token for this user.
5
+ ### Who This Guide is For
11
6
 
7
+ This guide is for existing React on Rails Pro customers who are:
12
8
 
13
- ## Update the Gemfile
9
+ - Currently using GitHub Packages authentication (private distribution)
10
+ - On version 16.2.0-beta.x or earlier
11
+ - Upgrading to version 16.2.0 or higher
12
+
13
+ If you're a new customer, see [Installation](./installation.md) instead.
14
+
15
+ ### What's Changing
16
+
17
+ React on Rails Pro packages are now **publicly distributed** via npmjs.org and RubyGems.org:
18
+
19
+ - ✅ No more GitHub Personal Access Tokens (PATs)
20
+ - ✅ No more `.npmrc` configuration
21
+ - ✅ Simplified installation with standard `gem install` and `npm install`
22
+ - ✅ License validation now happens at **runtime** using JWT tokens
23
+
24
+ Package names have changed:
25
+
26
+ - **Scoped** (old): `@shakacode-tools/react-on-rails-pro-node-renderer`
27
+ - **Unscoped** (new): `react-on-rails-pro-node-renderer`
28
+
29
+ ### Your Current Setup (GitHub Packages)
30
+
31
+ If you're upgrading, you currently have:
32
+
33
+ **1. Gemfile with GitHub Packages source:**
34
+
35
+ ```ruby
36
+ source "https://rubygems.pkg.github.com/shakacode-tools" do
37
+ gem "react_on_rails_pro", "16.1.1"
38
+ end
39
+ ```
40
+
41
+ **2. `.npmrc` file with GitHub authentication:**
42
+
43
+ ```
44
+ always-auth=true
45
+ //npm.pkg.github.com/:_authToken=YOUR_TOKEN
46
+ @shakacode-tools:registry=https://npm.pkg.github.com
47
+ ```
48
+
49
+ **3. Scoped package name in package.json:**
50
+
51
+ ```json
52
+ {
53
+ "private": true,
54
+ "dependencies": {
55
+ "@shakacode-tools/react-on-rails-pro-node-renderer": "16.1.1"
56
+ }
57
+ }
58
+ ```
59
+
60
+ **4. Scoped require statements:**
61
+
62
+ ```javascript
63
+ const { reactOnRailsProNodeRenderer } = require('@shakacode-tools/react-on-rails-pro-node-renderer');
64
+ ```
65
+
66
+ ### Migration Steps
67
+
68
+ #### Step 1: Update Gemfile
69
+
70
+ **Remove** the GitHub Packages source and use standard gem installation:
71
+
72
+ ```diff
73
+ - source "https://rubygems.pkg.github.com/shakacode-tools" do
74
+ - gem "react_on_rails_pro", "16.1.1"
75
+ - end
76
+ + gem "react_on_rails_pro", "~> 16.2"
77
+ ```
78
+
79
+ Then run:
80
+
81
+ ```bash
82
+ bundle install
83
+ ```
84
+
85
+ #### Step 2: Remove .npmrc Configuration
86
+
87
+ If you have a `.npmrc` file with GitHub Packages authentication, **delete it** or remove the GitHub-specific lines:
88
+
89
+ ```bash
90
+ # Remove the entire file if it only contained GitHub Packages config
91
+ rm .npmrc
92
+
93
+ # Or edit it to remove these lines:
94
+ # always-auth=true
95
+ # //npm.pkg.github.com/:_authToken=YOUR_TOKEN
96
+ # @shakacode-tools:registry=https://npm.pkg.github.com
97
+ ```
98
+
99
+ #### Step 3: Update package.json
100
+
101
+ Change the package name from **scoped** to **unscoped**:
102
+
103
+ ```diff
104
+ {
105
+ "dependencies": {
106
+ - "@shakacode-tools/react-on-rails-pro-node-renderer": "16.1.1"
107
+ + "react-on-rails-pro-node-renderer": "^16.2.0"
108
+ }
109
+ }
110
+ ```
111
+
112
+ Then reinstall:
113
+
114
+ ```bash
115
+ npm install
116
+ # or
117
+ yarn install
118
+ ```
119
+
120
+ #### Step 4: Update Require Statements
121
+
122
+ Update all require/import statements to use the **unscoped** package name:
123
+
124
+ **In your node renderer configuration file:**
125
+
126
+ ```diff
127
+ - const { reactOnRailsProNodeRenderer } = require('@shakacode-tools/react-on-rails-pro-node-renderer');
128
+ + const { reactOnRailsProNodeRenderer } = require('react-on-rails-pro-node-renderer');
129
+ ```
130
+
131
+ **If using integrations (Sentry, Honeybadger):**
132
+
133
+ ```diff
134
+ - require('@shakacode-tools/react-on-rails-pro-node-renderer/integrations/sentry').init();
135
+ + require('react-on-rails-pro-node-renderer/integrations/sentry').init();
136
+
137
+ - require('@shakacode-tools/react-on-rails-pro-node-renderer/integrations/honeybadger').init();
138
+ + require('react-on-rails-pro-node-renderer/integrations/honeybadger').init();
139
+ ```
140
+
141
+ #### Step 5: Configure License Token
142
+
143
+ Add your React on Rails Pro license token as an environment variable:
144
+
145
+ ```bash
146
+ export REACT_ON_RAILS_PRO_LICENSE="your-license-token-here"
147
+ ```
148
+
149
+ **Or** configure it in your Rails initializer:
14
150
 
15
151
  ```ruby
16
- CUSTOMER_GITHUB_AUTH = '3f5fblahblahblah:x-oauth-basic'
17
- gem "react_on_rails_pro", git: "https://#{CUSTOMER_GITHUB_AUTH}@github.com/shakacode/react_on_rails_pro.git", tag: '1.0.0'
152
+ # config/initializers/react_on_rails_pro.rb
153
+ ReactOnRailsPro.configure do |config|
154
+ config.license_token = ENV["REACT_ON_RAILS_PRO_LICENSE"]
155
+ end
156
+ ```
157
+
158
+ ⚠️ **Security Warning**: Never commit your license token to version control. Always use environment variables or secure secret management systems (Rails credentials, Heroku config vars, AWS Secrets Manager, etc.).
159
+
160
+ **Where to get your license token:** Contact [justin@shakacode.com](mailto:justin@shakacode.com) if you don't have your license token.
161
+
162
+ ### Verify Migration
163
+
164
+ #### 1. Verify Gem Installation
165
+
166
+ ```bash
167
+ bundle list | grep react_on_rails_pro
168
+ # Should show: react_on_rails_pro (16.2.0) or higher
169
+ ```
170
+
171
+ #### 2. Verify NPM Package Installation
172
+
173
+ ```bash
174
+ npm list react-on-rails-pro-node-renderer
175
+ # or
176
+ yarn list --pattern react-on-rails-pro-node-renderer
177
+
178
+ # Should show: react-on-rails-pro-node-renderer@16.2.0 or higher
18
179
  ```
19
180
 
20
- ## Update the client/package.json
181
+ #### 3. Verify License Token
182
+
183
+ Start your Rails server. You should see a success message in the logs:
21
184
 
22
- ```sh
23
- CUSTOMER_GITHUB_AUTH=3f5fblahblahblah
24
- yarn add https://${CUSTOMER_GITHUB_AUTH}:x-oauth-basic@github.com/shakacode/react_on_rails_pro.git\#1.0.0
25
185
  ```
186
+ React on Rails Pro license validated successfully
187
+ ```
188
+
189
+ If the license is invalid or missing, you'll see an error with instructions.
190
+
191
+ #### 4. Test Your Application
192
+
193
+ - Start your Rails server
194
+ - Start the node renderer (if using): `npm run node-renderer`
195
+ - Verify that server-side rendering works correctly
196
+
197
+ ### Troubleshooting
198
+
199
+ #### "Could not find gem 'react_on_rails_pro'"
200
+
201
+ - Ensure you removed the GitHub Packages source from your Gemfile
202
+ - Run `bundle install` again
203
+ - Check that you have the correct version specified
204
+
205
+ #### "Cannot find module 'react-on-rails-pro-node-renderer'"
206
+
207
+ - Verify you updated all require statements to the unscoped name
208
+ - Delete `node_modules` and reinstall: `rm -rf node_modules && npm install`
209
+ - Check that package.json has the correct unscoped package name
210
+
211
+ #### "License validation failed"
212
+
213
+ - Ensure `REACT_ON_RAILS_PRO_LICENSE` environment variable is set
214
+ - Verify the token string is correct (no extra spaces or quotes)
215
+ - Contact [justin@shakacode.com](mailto:justin@shakacode.com) if you need a new token
216
+
217
+ ### Need Help?
218
+
219
+ If you encounter issues during migration, contact [justin@shakacode.com](mailto:justin@shakacode.com) for support.