Skip to content

Commit 581605d

Browse files
ihabadhamclaude
andcommitted
Update documentation for public distribution
Remove all references to GitHub Packages and private distribution. Update package name from @shakacode-tools/react-on-rails-pro-node-renderer to react-on-rails-pro-node-renderer throughout documentation. Changes: - Completely rewrite installation.md to remove GitHub PAT authentication - Simplify to standard gem install and npm install commands - Add JWT license token configuration section - Update all code examples with unscoped package name - Remove GitHub Packages authentication instructions - Update contributor documentation to reflect all packages are public - Update CONTRIBUTING.md files to remove private package sections Documentation files updated: - react_on_rails_pro/docs/installation.md (major rewrite) - react_on_rails_pro/docs/node-renderer/basics.md - react_on_rails_pro/docs/node-renderer/js-configuration.md - react_on_rails_pro/docs/node-renderer/error-reporting-and-tracing.md - react_on_rails_pro/docs/code-splitting-loadable-components.md - docs/contributor-info/releasing.md - react_on_rails_pro/docs/contributors-info/releasing.md - CONTRIBUTING.md - react_on_rails_pro/CONTRIBUTING.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent f421185 commit 581605d

File tree

9 files changed

+143
-141
lines changed

9 files changed

+143
-141
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ Package [email protected] added ==> /Users/justin/shakacode/react-o
128128
Don't forget you may need to run yarn after adding packages with yalc to install/update dependencies/bin scripts.
129129
```
130130

131-
Of course, you can do the same with `react-on-rails-pro` and `@shakacode-tools/react-on-rails-pro-node-renderer` packages.
131+
Of course, you can do the same with `react-on-rails-pro` and `react-on-rails-pro-node-renderer` packages.
132132

133133
This is the approach `spec/dummy` apps use, so you can also look at their implementation.
134134

docs/contributor-info/releasing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ The release task publishes 5 packages with unified versioning:
5858

5959
1. **react-on-rails** - NPM package
6060
2. **react-on-rails-pro** - NPM package
61-
3. **react_on_rails** - RubyGem
62-
63-
**PRIVATE (GitHub Packages):** 4. **@shakacode-tools/react-on-rails-pro-node-renderer** - NPM package 5. **react_on_rails_pro** - RubyGem
61+
3. **react-on-rails-pro-node-renderer** - NPM package
62+
4. **react_on_rails** - RubyGem
63+
5. **react_on_rails_pro** - RubyGem
6464

6565
### Version Synchronization
6666

react_on_rails_pro/CONTRIBUTING.md

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -292,24 +292,13 @@ Contact Justin Gordon, [[email protected]](mailto:[email protected]) for r
292292

293293
## Prerequisites
294294

295-
You need authentication for both public and private package registries:
295+
You need authentication for public package registries:
296296

297297
**Public packages (npmjs.org + rubygems.org):**
298298
- NPM: Run `npm login`
299299
- RubyGems: Standard credentials via `gem push`
300300

301-
**Private packages (GitHub Packages):**
302-
- Get a GitHub personal access token with `write:packages` scope
303-
- Configure `~/.npmrc`:
304-
```ini
305-
//npm.pkg.github.com/:_authToken=<TOKEN>
306-
always-auth=true
307-
```
308-
- Configure `~/.gem/credentials`:
309-
```yaml
310-
:github: Bearer <GITHUB_TOKEN>
311-
```
312-
- Set environment variable: `export GITHUB_TOKEN=<TOKEN>`
301+
All React on Rails and React on Rails Pro packages are now published publicly to npmjs.org and RubyGems.org.
313302

314303
## Release Command
315304

react_on_rails_pro/docs/code-splitting-loadable-components.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ In your `node-renderer.js` file which runs node renderer, you need to specify `s
245245
```js
246246
const path = require('path');
247247
const env = process.env;
248-
const { reactOnRailsProNodeRenderer } = require('@shakacode-tools/react-on-rails-pro-node-renderer');
248+
const { reactOnRailsProNodeRenderer } = require('react-on-rails-pro-node-renderer');
249249

250250
const config = {
251251
...

react_on_rails_pro/docs/contributors-info/releasing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ rake release[17.0.0,false,verdaccio]
3535
This unified script releases all 5 packages together:
3636
- react-on-rails (NPM)
3737
- react-on-rails-pro (NPM)
38+
- react-on-rails-pro-node-renderer (NPM)
3839
- react_on_rails (RubyGem)
39-
- @shakacode-tools/react-on-rails-pro-node-renderer (NPM, GitHub Packages)
40-
- react_on_rails_pro (RubyGem, GitHub Packages)
40+
- react_on_rails_pro (RubyGem)
Lines changed: 122 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,183 +1,196 @@
11
# Installation
2-
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 [[email protected]](mailto:[email protected]) to give you one.
32

4-
Check the [CHANGELOG](https://github.com/shakacode/react_on_rails_pro/blob/master/CHANGELOG.md) to see what version you want.
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 [[email protected]](mailto:justin@shakacode.com) to purchase a license.
54

6-
# Version
5+
Check the [CHANGELOG](https://github.com/shakacode/react_on_rails/blob/master/CHANGELOG.md) to see what version you want.
76

8-
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`.
7+
## Version Format
98

10-
# Ruby
11-
## Gem Installation
12-
1. Ensure your **Rails** app is using the **react_on_rails** gem, version greater than 11.0.7.
13-
1. Add the `react_on_rails_pro` gem to your **Gemfile**. Substitute the appropriate version number.
14-
15-
## Gemfile Change
9+
For the below docs, find the desired `<version>` in the CHANGELOG. Note that for pre-release versions:
10+
- Gems use all periods: `16.2.0.beta.1`
11+
- NPM packages use dashes: `16.2.0-beta.1`
1612

17-
Replace the following in the snippet for the Gemfile
18-
1. `<account>` for the api key
19-
2. `<api-key>`
20-
3. `<version>` desired
13+
# Ruby Gem Installation
2114

22-
```ruby
23-
source "https://<rorp-account>:<token>@"\
24-
"rubygems.pkg.github.com/shakacode-tools" do
25-
gem "react_on_rails_pro", "<version>"
26-
end
27-
```
15+
## Prerequisites
16+
17+
Ensure your **Rails** app is using the **react_on_rails** gem, version 16.0.0 or higher.
2818

29-
## Alternate installation keeping the key out of your Gemfile
19+
## Install react_on_rails_pro Gem
20+
21+
Add the `react_on_rails_pro` gem to your **Gemfile**:
3022

3123
```ruby
32-
source "https://rubygems.pkg.github.com/shakacode-tools" do
33-
gem "react_on_rails_pro", "<version>"
34-
end
24+
gem "react_on_rails_pro", "~> 16.1"
3525
```
36-
Or use the `gem install` command:
26+
27+
Then run:
3728

3829
```bash
39-
gem install react_on_rails_pro --version "<version>> --source "https://rubygems.pkg.github.com/shakacode-tools"
30+
bundle install
4031
```
4132

42-
Then edit your permissions for bundler at the command line:
33+
Or install directly:
4334

35+
```bash
36+
gem install react_on_rails_pro --version "<version>"
4437
```
45-
bundle config set rubygems.pkg.github.com <username>:<token>
38+
39+
## License Configuration
40+
41+
Set your license token as an environment variable:
42+
43+
```bash
44+
export REACT_ON_RAILS_PRO_LICENSE="your-license-token-here"
4645
```
4746

48-
## Using a branch in your Gemfile
49-
Note, you should probably use an ENV value for the token so that you don't check this into your source code.
50-
```ruby
51-
gem "react_on_rails_pro", version: "<version>", git: "https://[your-github-token]:[email protected]/shakacode/react_on_rails_pro.git", tag: "<version>"
52-
```
47+
Or configure it in your Rails initializer (not recommended for production):
48+
49+
```ruby
50+
# config/initializers/react_on_rails_pro.rb
51+
ReactOnRailsPro.configure do |config|
52+
config.license_token = ENV["REACT_ON_RAILS_PRO_LICENSE"]
53+
end
54+
```
5355

5456
## Rails Configuration
55-
You don't need to create an initializer if you are satisfied with the default as described in
56-
[Configuration](./configuration.md)
5757

58-
# Node Package
59-
Note, you only need to install the Node Package if you are using the standalone node renderer, `NodeRenderer`.
58+
You don't need to create an initializer if you are satisfied with the defaults as described in [Configuration](./configuration.md).
6059

61-
## Installation
60+
For basic setup:
6261

63-
1. Create a subdirectory of your rails project for the Node renderer. Let's use `react-on-rails-pro`.
64-
65-
2. Create a file `react-on-rails-pro/.npmrc` with the following
62+
```ruby
63+
# config/initializers/react_on_rails_pro.rb
64+
ReactOnRailsPro.configure do |config|
65+
# Your configuration here
66+
# See docs/configuration.md for all options
67+
end
6668
```
67-
always-auth=true
68-
//npm.pkg.github.com/:_authToken=<token>
69-
@shakacode-tools:registry=https://npm.pkg.github.com
69+
70+
# Node Package Installation
71+
72+
**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.
73+
74+
## Install react-on-rails-pro-node-renderer
75+
76+
### Using npm:
77+
78+
```bash
79+
npm install react-on-rails-pro-node-renderer
80+
```
81+
82+
### Using yarn:
83+
84+
```bash
85+
yarn add react-on-rails-pro-node-renderer
7086
```
7187

72-
3. Create a `react-on-rails-pro/package.json`
88+
### Add to package.json:
89+
7390
```json
7491
{
75-
"private": true,
7692
"dependencies": {
77-
"@shakacode-tools/react-on-rails-pro-node-renderer": "<version>"
78-
},
79-
"scripts": {
80-
"node-renderer": "echo 'Starting React on Rails Pro Node Renderer.' && node ./react-on-rails-pro-node-renderer.js"
93+
"react-on-rails-pro-node-renderer": "16.1.1"
8194
}
8295
}
8396
```
8497

85-
4. Be sure to run `npm i` **and not** `yarn` as only npm seems to work with the private github packages.
98+
## Node Renderer Setup
8699

87-
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)
88-
89-
5. You can start the renderer with either the executable `node-renderer` or, preferably, with
90-
a startup JS file, say called `react-on-rails-pro/react-on-rails-pro-node-renderer.js` with
91-
these contents. _Note the use of the namespaced **`@shakacode-tools/react-on-rails-pro-node-renderer`** for the package.
100+
Create a JavaScript file to configure and launch the node renderer, for example `react-on-rails-pro-node-renderer.js`:
92101

93102
```js
94-
const path = require('path')
95-
const {
96-
reactOnRailsProNodeRenderer,
97-
} = require('@shakacode-tools/react-on-rails-pro-node-renderer')
103+
const path = require('path');
104+
const { reactOnRailsProNodeRenderer } = require('react-on-rails-pro-node-renderer');
98105

99-
const env = process.env
106+
const env = process.env;
100107

101108
const config = {
102109
bundlePath: path.resolve(__dirname, '../.node-renderer-bundles'),
103110

104111
// Listen at RENDERER_PORT env value or default port 3800
105112
logLevel: env.RENDERER_LOG_LEVEL || 'debug', // show all logs
106113

107-
// See value in /config/initializers/react_on_rails_pro.rb. Should use env
108-
// value in real app.
109-
password: 'myPassword1',
114+
// Password for Rails <-> Node renderer communication
115+
// See value in /config/initializers/react_on_rails_pro.rb
116+
password: env.RENDERER_PASSWORD || 'changeme',
110117

111-
// Save bundle to "tmp/bundles" dir of our dummy app
112-
// This is the default
113118
port: env.RENDERER_PORT || 3800,
114119

115120
// supportModules should be set to true to allow the server-bundle code to
116-
// see require, exports, etc.
117-
// `false` is like the ExecJS behavior
118-
// this option is required to equal `true` in order to use loadable components
121+
// see require, exports, etc. (`false` is like the ExecJS behavior)
122+
// This option is required to equal `true` in order to use loadable components
119123
supportModules: true,
120124

121125
// workersCount defaults to the number of CPUs minus 1
122-
workersCount: Number(process.env.NODE_RENDERER_CONCURRENCY || 3),
123-
124-
// Next 2 params, allWorkersRestartInterval and
125-
// delayBetweenIndividualWorkerRestarts must both should be set if you wish
126-
// to have automatic worker restarting, say to clear memory leaks.
127-
// time is in minutes between restarting all workers
128-
// Enable next 2 if the renderer is running out of memory
129-
// allWorkersRestartInterval: 15,
130-
// time in minutes between each worker restarting when restarting all workers
131-
// delayBetweenIndividualWorkerRestarts: 2,
132-
}
126+
workersCount: Number(env.NODE_RENDERER_CONCURRENCY || 3),
127+
128+
// Optional: Automatic worker restarting (for memory leak mitigation)
129+
// allWorkersRestartInterval: 15, // minutes between restarting all workers
130+
// delayBetweenIndividualWorkerRestarts: 2, // minutes between each worker restart
131+
};
133132

134133
// Renderer detects a total number of CPUs on virtual hostings like Heroku
135134
// or CircleCI instead of CPUs number allocated for current container. This
136135
// results in spawning many workers while only 1-2 of them really needed.
137136
if (env.CI) {
138-
config.workersCount = 2
137+
config.workersCount = 2;
139138
}
140139

141-
reactOnRailsProNodeRenderer(config)
140+
reactOnRailsProNodeRenderer(config);
142141
```
143142

144-
## Instructions for using a branch
143+
Add a script to your `package.json`:
145144

146-
Install the node-renderer executable, possibly globally. Substitute the branch name or tag for `master`
145+
```json
146+
{
147+
"scripts": {
148+
"node-renderer": "node ./react-on-rails-pro-node-renderer.js"
149+
}
150+
}
147151
```
148-
yarn global add https://<your-github-token>:[email protected]/shakacode/react_on_rails_pro.git\#master
152+
153+
Start the renderer:
154+
155+
```bash
156+
npm run node-renderer
149157
```
150158

151-
This installs a binary `node-renderer`.
159+
## Rails Configuration for Node Renderer
152160

153-
### Using Github packages
161+
Configure Rails to use the remote node renderer:
154162

155-
Login into npm
163+
```ruby
164+
# config/initializers/react_on_rails_pro.rb
165+
ReactOnRailsPro.configure do |config|
166+
config.server_renderer = "NodeRenderer"
156167

157-
```bash
158-
npm install @shakacode-tools/react-on-rails-pro-node-renderer@<version>
159-
```
168+
# Configure renderer connection
169+
config.renderer_url = ENV["REACT_RENDERER_URL"] || "http://localhost:3800"
170+
config.renderer_password = ENV["RENDERER_PASSWORD"] || "changeme"
160171

161-
or edit package.json directly
162-
```json
163-
"@shakacode-tools/react-on-rails-pro-node-renderer": "<version>"
164-
```
172+
# Enable prerender caching (recommended)
173+
config.prerender_caching = true
174+
end
175+
```
165176

166-
### Configuration
167-
See [NodeRenderer JavaScript Configuration](./node-renderer/js-configuration.md).
177+
### Configuration Options
168178

169-
#### Webpack Configuration
170-
Set your server bundle webpack configuration to use a target of `node` per the [Webpack docs](https://webpack.js.org/concepts/targets/#usage).
179+
See [Rails Configuration Options](./configuration.md) for all available settings.
171180

172-
## Authentication when using Github packages
173-
[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)
181+
Pay attention to:
182+
- `config.server_renderer = "NodeRenderer"` - Required to use node renderer
183+
- `config.renderer_url` - URL where your node renderer is running
184+
- `config.renderer_password` - Shared secret for authentication
185+
- `config.prerender_caching` - Enable caching (recommended)
174186

175-
Create a new ~/.npmrc file if one doesn't exist.
176-
```
177-
//npm.pkg.github.com/:_authToken=TOKEN
178-
```
187+
## Webpack Configuration
179188

180-
To configure bundler if you don't want the token in your Gemfile:
181-
```
182-
bundle config https://rubygems.pkg.github.com/OWNER USERNAME:TOKEN
183-
```
189+
Set your server bundle webpack configuration to use a target of `node` per the [Webpack docs](https://webpack.js.org/concepts/targets/#usage).
190+
191+
## Additional Documentation
192+
193+
- [Node Renderer Basics](./node-renderer/basics.md)
194+
- [Node Renderer JavaScript Configuration](./node-renderer/js-configuration.md)
195+
- [Rails Configuration Options](./configuration.md)
196+
- [Error Reporting and Tracing](./node-renderer/error-reporting-and-tracing.md)

react_on_rails_pro/docs/node-renderer/basics.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ For the most control over the setup, create a JavaScript file to start the NodeR
3333
cd renderer-app
3434
```
3535
2. Make sure you have **Node.js** version **14** or higher and **Yarn** installed.
36-
3. Init node application and yarn add to install `@shakacode-tools/react-on-rails-pro-node-renderer` package.
36+
3. Init node application and install the `react-on-rails-pro-node-renderer` package.
3737
```sh
3838
yarn init
39-
yarn add https://[your-github-token]:[email protected]/shakacode/react_on_rails_pro.git\#master
39+
yarn add react-on-rails-pro-node-renderer
4040
```
4141
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 bundlePath:
4242

4343
```javascript
4444
import path from 'path';
45-
import reactOnRailsProNodeRenderer from '@shakacode-tools/react-on-rails-pro-node-renderer';
45+
import reactOnRailsProNodeRenderer from 'react-on-rails-pro-node-renderer';
4646

4747
const config = {
4848
bundlePath: path.resolve(__dirname, '../.node-renderer-bundles'),

0 commit comments

Comments
 (0)