From cc88d587cccfad52afdd097b36e20f881f3e5c5d Mon Sep 17 00:00:00 2001 From: ihabadham Date: Wed, 5 Nov 2025 00:12:56 +0200 Subject: [PATCH 1/7] Switch Pro packages to public distribution Remove GitHub Packages configuration to publish Pro packages publicly on npmjs.org and RubyGems.org. Changes: - Remove publishConfig from react_on_rails_pro/package.json (node-renderer) - Update release script to publish Pro gem to RubyGems.org (remove --key github --host) - Update all messaging from PRIVATE/GitHub Packages to PUBLIC/npmjs.org/RubyGems.org - Update script documentation to reflect all packages are now public - Update success message for unified public distribution This follows Bob's pattern from react-on-rails-pro NPM package (already configured for public). Runtime enforcement via JWT license validation remains unchanged. --- rakelib/release.rake | 37 ++++++++++++--------------------- react_on_rails_pro/package.json | 3 --- 2 files changed, 13 insertions(+), 27 deletions(-) diff --git a/rakelib/release.rake b/rakelib/release.rake index 205a534c35..184bdca3a0 100644 --- a/rakelib/release.rake +++ b/rakelib/release.rake @@ -29,9 +29,8 @@ This will update and release: PUBLIC (npmjs.org + rubygems.org): - react-on-rails NPM package - react-on-rails-pro NPM package - - react_on_rails RubyGem - PRIVATE (GitHub Packages): - @shakacode-tools/react-on-rails-pro-node-renderer NPM package + - react_on_rails RubyGem - react_on_rails_pro RubyGem 1st argument: Version (patch/minor/major OR explicit version like 16.2.0) @@ -208,24 +207,15 @@ task :release, %i[version dry_run registry skip_push] do |_t, args| sh_in_dir(gem_root, "yarn workspace react-on-rails-pro publish --new-version #{actual_npm_version} #{npm_publish_args}") - # Publish node-renderer NPM package (to Verdaccio or GitHub Packages depending on mode) + # Publish node-renderer NPM package (PUBLIC on npmjs.org) puts "\n#{'=' * 80}" - if use_verdaccio - puts "Publishing node-renderer to Verdaccio (local)..." - else - puts "Publishing PRIVATE node-renderer to GitHub Packages..." - end + puts "Publishing PUBLIC node-renderer to #{use_verdaccio ? 'Verdaccio (local)' : 'npmjs.org'}..." puts "=" * 80 # Publish react-on-rails-pro-node-renderer NPM package - node_renderer_registry = if use_verdaccio - "Verdaccio (http://localhost:4873/)" - else - "GitHub Packages" - end node_renderer_name = "@shakacode-tools/react-on-rails-pro-node-renderer" - puts "\nPublishing #{node_renderer_name}@#{actual_npm_version} to #{node_renderer_registry}..." - puts "Ensure you're authenticated with GitHub Packages (see ~/.npmrc)" unless use_verdaccio + puts "\nPublishing #{node_renderer_name}@#{actual_npm_version}..." + puts "Carefully add your OTP for NPM when prompted." unless use_verdaccio sh_in_dir(pro_gem_root, "yarn publish --new-version #{actual_npm_version} --no-git-tag-version #{npm_publish_args}") @@ -241,14 +231,13 @@ task :release, %i[version dry_run registry skip_push] do |_t, args| sh_in_dir(gem_root, "gem release") puts "\n#{'=' * 80}" - puts "Publishing PRIVATE Ruby gem to GitHub Packages..." + puts "Publishing PUBLIC Pro Ruby gem to RubyGems.org..." puts "=" * 80 - # Publish react_on_rails_pro Ruby gem to GitHub Packages - puts "\nPublishing react_on_rails_pro gem to GitHub Packages..." - puts "Ensure you have GitHub token in ~/.gem/credentials" - sh_in_dir(pro_gem_root, - "gem release --key github --host https://rubygems.pkg.github.com/shakacode-tools") + # Publish react_on_rails_pro Ruby gem to RubyGems.org + puts "\nPublishing react_on_rails_pro gem to RubyGems.org..." + puts "Carefully add your OTP for Rubygems when prompted." + sh_in_dir(pro_gem_root, "gem release") end end @@ -290,9 +279,9 @@ task :release, %i[version dry_run registry skip_push] do |_t, args| MSG unless use_verdaccio - msg += "\n Ruby Gems:\n" - msg += " - react_on_rails #{actual_gem_version} (RubyGems.org)\n" - msg += " - react_on_rails_pro #{actual_gem_version} (GitHub Packages)\n" + msg += "\n Ruby Gems (RubyGems.org):\n" + msg += " - react_on_rails #{actual_gem_version}\n" + msg += " - react_on_rails_pro #{actual_gem_version}\n" end if skip_push diff --git a/react_on_rails_pro/package.json b/react_on_rails_pro/package.json index 26cb4705e2..672c29b164 100644 --- a/react_on_rails_pro/package.json +++ b/react_on_rails_pro/package.json @@ -17,9 +17,6 @@ "bin": { "react-on-rails-pro-node-renderer": "packages/node-renderer/dist/default-node-renderer.js" }, - "publishConfig": { - "registry": "https://npm.pkg.github.com" - }, "directories": { "doc": "docs" }, From c9b4a181458c7f5468c25858f9f81473fb6748e8 Mon Sep 17 00:00:00 2001 From: ihabadham Date: Wed, 5 Nov 2025 21:11:06 +0200 Subject: [PATCH 2/7] Remove @shakacode-tools scope from node-renderer package MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change package name from @shakacode-tools/react-on-rails-pro-node-renderer to react-on-rails-pro-node-renderer (unscoped). Rationale: - @shakacode-tools scope was only needed for GitHub Packages (requires scoping) - Now publishing to public npmjs.org where scoping is optional - Matches naming pattern of react-on-rails and react-on-rails-pro (both unscoped) - Unscoped packages are public by default (no --access public flag needed) - @shakacode-tools npm org doesn't exist on npmjs.org Migration impact: Small number of Pro customers will need to update their node-renderer.js imports when upgrading (Justin will handle directly). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- rakelib/release.rake | 8 ++++---- react_on_rails_pro/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rakelib/release.rake b/rakelib/release.rake index 184bdca3a0..4e3d98dcf0 100644 --- a/rakelib/release.rake +++ b/rakelib/release.rake @@ -29,7 +29,7 @@ This will update and release: PUBLIC (npmjs.org + rubygems.org): - react-on-rails NPM package - react-on-rails-pro NPM package - - @shakacode-tools/react-on-rails-pro-node-renderer NPM package + - react-on-rails-pro-node-renderer NPM package - react_on_rails RubyGem - react_on_rails_pro RubyGem @@ -213,7 +213,7 @@ task :release, %i[version dry_run registry skip_push] do |_t, args| puts "=" * 80 # Publish react-on-rails-pro-node-renderer NPM package - node_renderer_name = "@shakacode-tools/react-on-rails-pro-node-renderer" + node_renderer_name = "react-on-rails-pro-node-renderer" puts "\nPublishing #{node_renderer_name}@#{actual_npm_version}..." puts "Carefully add your OTP for NPM when prompted." unless use_verdaccio sh_in_dir(pro_gem_root, @@ -275,7 +275,7 @@ task :release, %i[version dry_run registry skip_push] do |_t, args| Published to #{npm_registry_note}: - react-on-rails@#{actual_npm_version} - react-on-rails-pro@#{actual_npm_version} - - @shakacode-tools/react-on-rails-pro-node-renderer@#{actual_npm_version} + - react-on-rails-pro-node-renderer@#{actual_npm_version} MSG unless use_verdaccio @@ -302,7 +302,7 @@ task :release, %i[version dry_run registry skip_push] do |_t, args| To test installation: npm install --registry http://localhost:4873/ react-on-rails@#{actual_npm_version} npm install --registry http://localhost:4873/ react-on-rails-pro@#{actual_npm_version} - npm install --registry http://localhost:4873/ @shakacode-tools/react-on-rails-pro-node-renderer@#{actual_npm_version} + npm install --registry http://localhost:4873/ react-on-rails-pro-node-renderer@#{actual_npm_version} Note: Ruby gems were not published (Verdaccio is NPM-only) diff --git a/react_on_rails_pro/package.json b/react_on_rails_pro/package.json index 672c29b164..5b6a88e4d4 100644 --- a/react_on_rails_pro/package.json +++ b/react_on_rails_pro/package.json @@ -1,5 +1,5 @@ { - "name": "@shakacode-tools/react-on-rails-pro-node-renderer", + "name": "react-on-rails-pro-node-renderer", "version": "16.1.1", "protocolVersion": "2.0.0", "description": "react-on-rails-pro JavaScript for react_on_rails_pro Ruby gem", From 32ef93d2ae6970bef2b9cf260253eeb3d20e80c7 Mon Sep 17 00:00:00 2001 From: ihabadham Date: Wed, 5 Nov 2025 23:02:08 +0200 Subject: [PATCH 3/7] Update documentation for public distribution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- CONTRIBUTING.md | 2 +- docs/contributor-info/releasing.md | 6 +- react_on_rails_pro/CONTRIBUTING.md | 15 +- .../code-splitting-loadable-components.md | 2 +- .../docs/contributors-info/releasing.md | 4 +- react_on_rails_pro/docs/installation.md | 231 +++++++++--------- .../docs/node-renderer/basics.md | 6 +- .../error-reporting-and-tracing.md | 16 +- .../docs/node-renderer/js-configuration.md | 2 +- 9 files changed, 143 insertions(+), 141 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9d7700c3ee..f0d5d5d047 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -128,7 +128,7 @@ Package react-on-rails@12.0.0-12070fd1 added ==> /Users/justin/shakacode/react-o Don't forget you may need to run yarn after adding packages with yalc to install/update dependencies/bin scripts. ``` -Of course, you can do the same with `react-on-rails-pro` and `@shakacode-tools/react-on-rails-pro-node-renderer` packages. +Of course, you can do the same with `react-on-rails-pro` and `react-on-rails-pro-node-renderer` packages. This is the approach `spec/dummy` apps use, so you can also look at their implementation. diff --git a/docs/contributor-info/releasing.md b/docs/contributor-info/releasing.md index 1c1833d070..2538635c6f 100644 --- a/docs/contributor-info/releasing.md +++ b/docs/contributor-info/releasing.md @@ -58,9 +58,9 @@ The release task publishes 5 packages with unified versioning: 1. **react-on-rails** - NPM package 2. **react-on-rails-pro** - NPM package -3. **react_on_rails** - RubyGem - -**PRIVATE (GitHub Packages):** 4. **@shakacode-tools/react-on-rails-pro-node-renderer** - NPM package 5. **react_on_rails_pro** - RubyGem +3. **react-on-rails-pro-node-renderer** - NPM package +4. **react_on_rails** - RubyGem +5. **react_on_rails_pro** - RubyGem ### Version Synchronization diff --git a/react_on_rails_pro/CONTRIBUTING.md b/react_on_rails_pro/CONTRIBUTING.md index 402e06d752..98eaf8a9f8 100644 --- a/react_on_rails_pro/CONTRIBUTING.md +++ b/react_on_rails_pro/CONTRIBUTING.md @@ -347,24 +347,13 @@ Contact Justin Gordon, [justin@shakacode.com](mailto:justin@shakacode.com) for r ## Prerequisites -You need authentication for both public and private package registries: +You need authentication for public package registries: **Public packages (npmjs.org + rubygems.org):** - NPM: Run `npm login` - RubyGems: Standard credentials via `gem push` -**Private packages (GitHub Packages):** -- Get a GitHub personal access token with `write:packages` scope -- Configure `~/.npmrc`: - ```ini - //npm.pkg.github.com/:_authToken= - always-auth=true - ``` -- Configure `~/.gem/credentials`: - ```yaml - :github: Bearer - ``` -- Set environment variable: `export GITHUB_TOKEN=` +All React on Rails and React on Rails Pro packages are now published publicly to npmjs.org and RubyGems.org. ## Release Command diff --git a/react_on_rails_pro/docs/code-splitting-loadable-components.md b/react_on_rails_pro/docs/code-splitting-loadable-components.md index 3a520aca79..bd06ea4a59 100644 --- a/react_on_rails_pro/docs/code-splitting-loadable-components.md +++ b/react_on_rails_pro/docs/code-splitting-loadable-components.md @@ -245,7 +245,7 @@ In your `node-renderer.js` file which runs node renderer, you need to specify `s ```js const path = require('path'); const env = process.env; -const { reactOnRailsProNodeRenderer } = require('@shakacode-tools/react-on-rails-pro-node-renderer'); +const { reactOnRailsProNodeRenderer } = require('react-on-rails-pro-node-renderer'); const config = { ... diff --git a/react_on_rails_pro/docs/contributors-info/releasing.md b/react_on_rails_pro/docs/contributors-info/releasing.md index 83378179a2..3e543c7038 100644 --- a/react_on_rails_pro/docs/contributors-info/releasing.md +++ b/react_on_rails_pro/docs/contributors-info/releasing.md @@ -35,6 +35,6 @@ rake release[17.0.0,false,verdaccio] This unified script releases all 5 packages together: - react-on-rails (NPM) - react-on-rails-pro (NPM) +- react-on-rails-pro-node-renderer (NPM) - react_on_rails (RubyGem) -- @shakacode-tools/react-on-rails-pro-node-renderer (NPM, GitHub Packages) -- react_on_rails_pro (RubyGem, GitHub Packages) +- react_on_rails_pro (RubyGem) diff --git a/react_on_rails_pro/docs/installation.md b/react_on_rails_pro/docs/installation.md index 45c3b306ea..856edf0512 100644 --- a/react_on_rails_pro/docs/installation.md +++ b/react_on_rails_pro/docs/installation.md @@ -1,102 +1,109 @@ # Installation -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. -Check the [CHANGELOG](https://github.com/shakacode/react_on_rails_pro/blob/master/CHANGELOG.md) to see what version you want. +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. -# Version +Check the [CHANGELOG](https://github.com/shakacode/react_on_rails/blob/master/CHANGELOG.md) to see what version you want. -For the below docs, find the desired `` 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`. +## Version Format -# Ruby -## Gem Installation -1. Ensure your **Rails** app is using the **react_on_rails** gem, version greater than 11.0.7. -1. Add the `react_on_rails_pro` gem to your **Gemfile**. Substitute the appropriate version number. - -## Gemfile Change +For the below docs, find the desired `` in the CHANGELOG. Note that for pre-release versions: +- Gems use all periods: `16.2.0.beta.1` +- NPM packages use dashes: `16.2.0-beta.1` -Replace the following in the snippet for the Gemfile -1. `` for the api key -2. `` -3. `` desired +# Ruby Gem Installation -```ruby -source "https://:@"\ - "rubygems.pkg.github.com/shakacode-tools" do - gem "react_on_rails_pro", "" -end -``` +## Prerequisites + +Ensure your **Rails** app is using the **react_on_rails** gem, version 16.0.0 or higher. -## Alternate installation keeping the key out of your Gemfile +## Install react_on_rails_pro Gem + +Add the `react_on_rails_pro` gem to your **Gemfile**: ```ruby -source "https://rubygems.pkg.github.com/shakacode-tools" do - gem "react_on_rails_pro", "" -end +gem "react_on_rails_pro", "~> 16.1" ``` -Or use the `gem install` command: + +Then run: ```bash -gem install react_on_rails_pro --version "> --source "https://rubygems.pkg.github.com/shakacode-tools" +bundle install ``` -Then edit your permissions for bundler at the command line: +Or install directly: +```bash +gem install react_on_rails_pro --version "" ``` -bundle config set rubygems.pkg.github.com : + +## License Configuration + +Set your license token as an environment variable: + +```bash +export REACT_ON_RAILS_PRO_LICENSE="your-license-token-here" ``` -## Using a branch in your Gemfile -Note, you should probably use an ENV value for the token so that you don't check this into your source code. - ```ruby - gem "react_on_rails_pro", version: "", git: "https://[your-github-token]:x-oauth-basic@github.com/shakacode/react_on_rails_pro.git", tag: "" - ``` +Or configure it in your Rails initializer (not recommended for production): + +```ruby +# config/initializers/react_on_rails_pro.rb +ReactOnRailsPro.configure do |config| + config.license_token = ENV["REACT_ON_RAILS_PRO_LICENSE"] +end +``` ## Rails Configuration -You don't need to create an initializer if you are satisfied with the default as described in -[Configuration](./configuration.md) -# Node Package -Note, you only need to install the Node Package if you are using the standalone node renderer, `NodeRenderer`. +You don't need to create an initializer if you are satisfied with the defaults as described in [Configuration](./configuration.md). -## Installation +For basic setup: -1. Create a subdirectory of your rails project for the Node renderer. Let's use `react-on-rails-pro`. - -2. Create a file `react-on-rails-pro/.npmrc` with the following +```ruby +# config/initializers/react_on_rails_pro.rb +ReactOnRailsPro.configure do |config| + # Your configuration here + # See docs/configuration.md for all options +end ``` -always-auth=true -//npm.pkg.github.com/:_authToken= -@shakacode-tools:registry=https://npm.pkg.github.com + +# Node Package Installation + +**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. + +## Install react-on-rails-pro-node-renderer + +### Using npm: + +```bash +npm install react-on-rails-pro-node-renderer +``` + +### Using yarn: + +```bash +yarn add react-on-rails-pro-node-renderer ``` -3. Create a `react-on-rails-pro/package.json` +### Add to package.json: + ```json { - "private": true, "dependencies": { - "@shakacode-tools/react-on-rails-pro-node-renderer": "" - }, - "scripts": { - "node-renderer": "echo 'Starting React on Rails Pro Node Renderer.' && node ./react-on-rails-pro-node-renderer.js" + "react-on-rails-pro-node-renderer": "16.1.1" } } ``` -4. Be sure to run `npm i` **and not** `yarn` as only npm seems to work with the private github packages. +## Node Renderer Setup -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) - -5. You can start the renderer with either the executable `node-renderer` or, preferably, with - a startup JS file, say called `react-on-rails-pro/react-on-rails-pro-node-renderer.js` with - these contents. _Note the use of the namespaced **`@shakacode-tools/react-on-rails-pro-node-renderer`** for the package. +Create a JavaScript file to configure and launch the node renderer, for example `react-on-rails-pro-node-renderer.js`: ```js -const path = require('path') -const { - reactOnRailsProNodeRenderer, -} = require('@shakacode-tools/react-on-rails-pro-node-renderer') +const path = require('path'); +const { reactOnRailsProNodeRenderer } = require('react-on-rails-pro-node-renderer'); -const env = process.env +const env = process.env; const config = { bundlePath: path.resolve(__dirname, '../.node-renderer-bundles'), @@ -104,80 +111,86 @@ const config = { // Listen at RENDERER_PORT env value or default port 3800 logLevel: env.RENDERER_LOG_LEVEL || 'debug', // show all logs - // See value in /config/initializers/react_on_rails_pro.rb. Should use env - // value in real app. - password: 'myPassword1', + // Password for Rails <-> Node renderer communication + // See value in /config/initializers/react_on_rails_pro.rb + password: env.RENDERER_PASSWORD || 'changeme', - // Save bundle to "tmp/bundles" dir of our dummy app - // This is the default port: env.RENDERER_PORT || 3800, // supportModules should be set to true to allow the server-bundle code to - // see require, exports, etc. - // `false` is like the ExecJS behavior - // this option is required to equal `true` in order to use loadable components + // see require, exports, etc. (`false` is like the ExecJS behavior) + // This option is required to equal `true` in order to use loadable components supportModules: true, // workersCount defaults to the number of CPUs minus 1 - workersCount: Number(process.env.NODE_RENDERER_CONCURRENCY || 3), - - // Next 2 params, allWorkersRestartInterval and - // delayBetweenIndividualWorkerRestarts must both should be set if you wish - // to have automatic worker restarting, say to clear memory leaks. - // time is in minutes between restarting all workers - // Enable next 2 if the renderer is running out of memory - // allWorkersRestartInterval: 15, - // time in minutes between each worker restarting when restarting all workers - // delayBetweenIndividualWorkerRestarts: 2, -} + workersCount: Number(env.NODE_RENDERER_CONCURRENCY || 3), + + // Optional: Automatic worker restarting (for memory leak mitigation) + // allWorkersRestartInterval: 15, // minutes between restarting all workers + // delayBetweenIndividualWorkerRestarts: 2, // minutes between each worker restart +}; // Renderer detects a total number of CPUs on virtual hostings like Heroku // or CircleCI instead of CPUs number allocated for current container. This // results in spawning many workers while only 1-2 of them really needed. if (env.CI) { - config.workersCount = 2 + config.workersCount = 2; } -reactOnRailsProNodeRenderer(config) +reactOnRailsProNodeRenderer(config); ``` -## Instructions for using a branch +Add a script to your `package.json`: -Install the node-renderer executable, possibly globally. Substitute the branch name or tag for `master` +```json +{ + "scripts": { + "node-renderer": "node ./react-on-rails-pro-node-renderer.js" + } +} ``` -yarn global add https://:x-oauth-basic@github.com/shakacode/react_on_rails_pro.git\#master + +Start the renderer: + +```bash +npm run node-renderer ``` -This installs a binary `node-renderer`. +## Rails Configuration for Node Renderer -### Using Github packages +Configure Rails to use the remote node renderer: -Login into npm +```ruby +# config/initializers/react_on_rails_pro.rb +ReactOnRailsPro.configure do |config| + config.server_renderer = "NodeRenderer" -```bash -npm install @shakacode-tools/react-on-rails-pro-node-renderer@ -``` + # Configure renderer connection + config.renderer_url = ENV["REACT_RENDERER_URL"] || "http://localhost:3800" + config.renderer_password = ENV["RENDERER_PASSWORD"] || "changeme" -or edit package.json directly -```json -"@shakacode-tools/react-on-rails-pro-node-renderer": "" -``` + # Enable prerender caching (recommended) + config.prerender_caching = true +end +``` -### Configuration -See [NodeRenderer JavaScript Configuration](./node-renderer/js-configuration.md). +### Configuration Options -#### Webpack Configuration -Set your server bundle webpack configuration to use a target of `node` per the [Webpack docs](https://webpack.js.org/concepts/targets/#usage). +See [Rails Configuration Options](./configuration.md) for all available settings. -## Authentication when using Github packages -[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) +Pay attention to: +- `config.server_renderer = "NodeRenderer"` - Required to use node renderer +- `config.renderer_url` - URL where your node renderer is running +- `config.renderer_password` - Shared secret for authentication +- `config.prerender_caching` - Enable caching (recommended) -Create a new ~/.npmrc file if one doesn't exist. -``` -//npm.pkg.github.com/:_authToken=TOKEN -``` +## Webpack Configuration -To configure bundler if you don't want the token in your Gemfile: -``` -bundle config https://rubygems.pkg.github.com/OWNER USERNAME:TOKEN -``` +Set your server bundle webpack configuration to use a target of `node` per the [Webpack docs](https://webpack.js.org/concepts/targets/#usage). + +## Additional Documentation + +- [Node Renderer Basics](./node-renderer/basics.md) +- [Node Renderer JavaScript Configuration](./node-renderer/js-configuration.md) +- [Rails Configuration Options](./configuration.md) +- [Error Reporting and Tracing](./node-renderer/error-reporting-and-tracing.md) diff --git a/react_on_rails_pro/docs/node-renderer/basics.md b/react_on_rails_pro/docs/node-renderer/basics.md index 352e109d63..78e480d268 100644 --- a/react_on_rails_pro/docs/node-renderer/basics.md +++ b/react_on_rails_pro/docs/node-renderer/basics.md @@ -33,16 +33,16 @@ For the most control over the setup, create a JavaScript file to start the NodeR cd renderer-app ``` 2. Make sure you have **Node.js** version **14** or higher and **Yarn** installed. -3. Init node application and yarn add to install `@shakacode-tools/react-on-rails-pro-node-renderer` package. +3. Init node application and install the `react-on-rails-pro-node-renderer` package. ```sh yarn init - yarn add https://[your-github-token]:x-oauth-basic@github.com/shakacode/react_on_rails_pro.git\#master + yarn add react-on-rails-pro-node-renderer ``` 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: ```javascript import path from 'path'; - import reactOnRailsProNodeRenderer from '@shakacode-tools/react-on-rails-pro-node-renderer'; + import reactOnRailsProNodeRenderer from 'react-on-rails-pro-node-renderer'; const config = { bundlePath: path.resolve(__dirname, '../.node-renderer-bundles'), diff --git a/react_on_rails_pro/docs/node-renderer/error-reporting-and-tracing.md b/react_on_rails_pro/docs/node-renderer/error-reporting-and-tracing.md index 861afbb0fa..988c45bbc4 100644 --- a/react_on_rails_pro/docs/node-renderer/error-reporting-and-tracing.md +++ b/react_on_rails_pro/docs/node-renderer/error-reporting-and-tracing.md @@ -14,10 +14,10 @@ It should initialize the services according to your requirements and then enable 3. Then load the integration: ```js - require('@shakacode-tools/react-on-rails-pro-node-renderer/integrations/sentry').init(); + require('react-on-rails-pro-node-renderer/integrations/sentry').init(); ``` - - Use `@shakacode-tools/react-on-rails-pro-node-renderer/integrations/sentry6` instead of `.../sentry` for versions of Sentry SDK older than 7.63.0. + - Use `react-on-rails-pro-node-renderer/integrations/sentry6` instead of `.../sentry` for versions of Sentry SDK older than 7.63.0. - For Sentry SDK v8+ you can use `.init({ fastify: true })` to capture additional Fastify-related information. ### Sentry Tracing @@ -40,7 +40,7 @@ To enable Sentry Tracing: 2. Then load the integration: ```js - require('@shakacode-tools/react-on-rails-pro-node-renderer/integrations/honeybadger').init(); + require('react-on-rails-pro-node-renderer/integrations/honeybadger').init(); ``` Use `init({ fastify: true })` to capture additional Fastify-related information. @@ -49,7 +49,7 @@ To enable Sentry Tracing: You can create your own integrations in the same way as the provided ones. If you have access to the React on Rails Pro repository, you can use [their implementations](https://github.com/shakacode/react_on_rails_pro/tree/master/packages/node-renderer/src/integrations) as examples. -Import these functions from `@shakacode-tools/react-on-rails-pro-node-renderer/integrations/api`: +Import these functions from `react-on-rails-pro-node-renderer/integrations/api`: ### Error reporting services @@ -59,7 +59,7 @@ Import these functions from `@shakacode-tools/react-on-rails-pro-node-renderer/i For example, integrating with BugSnag can be as simple as ```js const Bugsnag = require('@bugsnag/js'); -const { addNotifier } = require('@shakacode-tools/react-on-rails-pro-node-renderer/integrations/api'); +const { addNotifier } = require('react-on-rails-pro-node-renderer/integrations/api'); Bugsnag.start({ /* your options */ }); @@ -76,7 +76,7 @@ To track requests as [sessions](https://docs.bugsnag.com/platforms/javascript/ca the above example becomes ```js const Bugsnag = require('@bugsnag/js'); -const { addNotifier, setupTracing } = require('@shakacode-tools/react-on-rails-pro-node-renderer/integrations/api'); +const { addNotifier, setupTracing } = require('react-on-rails-pro-node-renderer/integrations/api'); Bugsnag.start({ /* your options */ }); @@ -117,7 +117,7 @@ Bugsnag v7 is a bit more complicated: ```js const Bugsnag = require('@bugsnag/js'); -const { addNotifier, setupTracing } = require('@shakacode-tools/react-on-rails-pro-node-renderer/integrations/api'); +const { addNotifier, setupTracing } = require('react-on-rails-pro-node-renderer/integrations/api'); Bugsnag.start({ /* your options */ }); @@ -142,7 +142,7 @@ If you want to report HTTP requests from Fastify, you can use `configureFastify` Extending the above example: ```js -const { configureFastify } = require('@shakacode-tools/react-on-rails-pro-node-renderer/integrations/api'); +const { configureFastify } = require('react-on-rails-pro-node-renderer/integrations/api'); configureFastify((app) => { app.addHook('onError', (_req, _reply, error, done) => { diff --git a/react_on_rails_pro/docs/node-renderer/js-configuration.md b/react_on_rails_pro/docs/node-renderer/js-configuration.md index 8a99561a4c..cf9172623b 100644 --- a/react_on_rails_pro/docs/node-renderer/js-configuration.md +++ b/react_on_rails_pro/docs/node-renderer/js-configuration.md @@ -54,7 +54,7 @@ If you have any of them set, see [Error Reporting and Tracing](./error-reporting Create a file './node-renderer.js' ```js import path from 'path'; -import { reactOnRailsProNodeRenderer } from '@shakacode-tools/react-on-rails-pro-node-renderer'; +import { reactOnRailsProNodeRenderer } from 'react-on-rails-pro-node-renderer'; const config = { // Save bundles to relative "./.node-renderer-bundles" dir of our app From 6b3f1c843f775e10a2c6cad9926599aa70f949dd Mon Sep 17 00:00:00 2001 From: ihabadham Date: Wed, 5 Nov 2025 23:11:36 +0200 Subject: [PATCH 4/7] Update test files and source code with unscoped package name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix ESLint errors from CI by updating all remaining references from @shakacode-tools/react-on-rails-pro-node-renderer to react-on-rails-pro-node-renderer. Files updated: - react_on_rails_pro/spec/dummy/client/node-renderer.js (3 requires) - react_on_rails_pro/packages/node-renderer/src/integrations/api.ts (JSDoc example) - react_on_rails_pro/spec/dummy/package.json (dependency + yalc link) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../packages/node-renderer/src/integrations/api.ts | 2 +- react_on_rails_pro/spec/dummy/client/node-renderer.js | 6 +++--- react_on_rails_pro/spec/dummy/package.json | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/react_on_rails_pro/packages/node-renderer/src/integrations/api.ts b/react_on_rails_pro/packages/node-renderer/src/integrations/api.ts index 62a94e8d04..88e2e2e14e 100644 --- a/react_on_rails_pro/packages/node-renderer/src/integrations/api.ts +++ b/react_on_rails_pro/packages/node-renderer/src/integrations/api.ts @@ -4,7 +4,7 @@ * @example * ```ts * import Bugsnag from '@bugsnag/js'; - * import { addNotifier, setupTracing } from '@shakacode-tools/react-on-rails-pro-node-renderer/integrations/api'; + * import { addNotifier, setupTracing } from 'react-on-rails-pro-node-renderer/integrations/api'; * Bugsnag.start({ ... }); * * addNotifier((msg) => { Bugsnag.notify(msg); }); diff --git a/react_on_rails_pro/spec/dummy/client/node-renderer.js b/react_on_rails_pro/spec/dummy/client/node-renderer.js index f2abb36592..184d468737 100644 --- a/react_on_rails_pro/spec/dummy/client/node-renderer.js +++ b/react_on_rails_pro/spec/dummy/client/node-renderer.js @@ -5,14 +5,14 @@ const Sentry = require('@sentry/node'); const { env } = process; // Use this for package installation test: -const { reactOnRailsProNodeRenderer } = require('@shakacode-tools/react-on-rails-pro-node-renderer'); +const { reactOnRailsProNodeRenderer } = require('react-on-rails-pro-node-renderer'); Honeybadger.configure({ // This is a test account for React on Rails Pro. Substitute your own. apiKey: 'a602365c', environment: process.env.NODE_ENV ?? 'development', }); -require('@shakacode-tools/react-on-rails-pro-node-renderer/integrations/honeybadger').init(); +require('react-on-rails-pro-node-renderer/integrations/honeybadger').init(); // This is a test account for React on Rails Pro. // Substitute your own DSN. @@ -25,7 +25,7 @@ Sentry.init({ // Sentry recommends adjusting this value in production, or using tracesSampler for finer control tracesSampleRate: 1.0, }); -require('@shakacode-tools/react-on-rails-pro-node-renderer/integrations/sentry').init({ tracing: true }); +require('react-on-rails-pro-node-renderer/integrations/sentry').init({ tracing: true }); const config = { // This is the default but avoids searching for the Rails root diff --git a/react_on_rails_pro/spec/dummy/package.json b/react_on_rails_pro/spec/dummy/package.json index 055bc02474..2b30da2214 100644 --- a/react_on_rails_pro/spec/dummy/package.json +++ b/react_on_rails_pro/spec/dummy/package.json @@ -17,7 +17,7 @@ "@loadable/server": "^5.16.2", "@loadable/webpack-plugin": "^5.15.2", "@sentry/node": "^7.120.0", - "@shakacode-tools/react-on-rails-pro-node-renderer": "link:.yalc/@shakacode-tools/react-on-rails-pro-node-renderer", + "react-on-rails-pro-node-renderer": "link:.yalc/react-on-rails-pro-node-renderer", "@shakacode/use-ssr-computation.macro": "^1.2.4", "@shakacode/use-ssr-computation.runtime": "^2.0.0", "@webpack-cli/serve": "^1.6.0", @@ -98,7 +98,7 @@ "test": "yarn run build:test && yarn run lint && rspec", "lint": "cd ../.. && nps lint", "e2e-test": "playwright test", - "preinstall": "yarn run link-source && yalc add --link react-on-rails-pro && cd .yalc/react-on-rails-pro && yalc add --link react-on-rails && cd ../.. && yalc add --link @shakacode-tools/react-on-rails-pro-node-renderer", + "preinstall": "yarn run link-source && yalc add --link react-on-rails-pro && cd .yalc/react-on-rails-pro && yalc add --link react-on-rails && cd ../.. && yalc add --link react-on-rails-pro-node-renderer", "link-source": "cd ../../.. && yarn && yarn run yalc:publish && cd react_on_rails_pro && yarn && yalc publish", "postinstall": "test -f post-yarn-install.local && ./post-yarn-install.local || true", "build:test": "rm -rf public/webpack/test && rm -rf ssr-generated && RAILS_ENV=test NODE_ENV=test bin/shakapacker", From 33e2533e64d97136c11f690b3f476c237b991178 Mon Sep 17 00:00:00 2001 From: ihabadham Date: Wed, 5 Nov 2025 23:20:20 +0200 Subject: [PATCH 5/7] Fix package name in build script error message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update error message from @shakacode-tools/react-on-rails-pro-node-renderer to react-on-rails-pro-node-renderer in package-scripts.yml 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- react_on_rails_pro/package-scripts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react_on_rails_pro/package-scripts.yml b/react_on_rails_pro/package-scripts.yml index f9971f10a0..b075e8b745 100644 --- a/react_on_rails_pro/package-scripts.yml +++ b/react_on_rails_pro/package-scripts.yml @@ -47,7 +47,7 @@ scripts: [ -f packages/node-renderer/dist/ReactOnRailsProNodeRenderer.js ] || (nps build >/dev/null 2>&1 || true) && [ -f packages/node-renderer/dist/ReactOnRailsProNodeRenderer.js ] || - { echo 'Building @shakacode-tools/react-on-rails-pro-node-renderer seems to have failed!'; } + { echo 'Building react-on-rails-pro-node-renderer seems to have failed!'; } clean: description: Clean the project From 998ca6c94ee76edefca19dd5289666937712b589 Mon Sep 17 00:00:00 2001 From: ihabadham Date: Wed, 5 Nov 2025 23:36:35 +0200 Subject: [PATCH 6/7] Update yarn.lock for unscoped node-renderer package name --- react_on_rails_pro/spec/dummy/yarn.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/react_on_rails_pro/spec/dummy/yarn.lock b/react_on_rails_pro/spec/dummy/yarn.lock index c7d322fe25..8136c5367f 100644 --- a/react_on_rails_pro/spec/dummy/yarn.lock +++ b/react_on_rails_pro/spec/dummy/yarn.lock @@ -1228,10 +1228,6 @@ dependencies: "@sentry/types" "7.120.0" -"@shakacode-tools/react-on-rails-pro-node-renderer@link:.yalc/@shakacode-tools/react-on-rails-pro-node-renderer": - version "0.0.0" - uid "" - "@shakacode/use-ssr-computation.macro@^1.2.4": version "1.2.4" resolved "https://registry.yarnpkg.com/@shakacode/use-ssr-computation.macro/-/use-ssr-computation.macro-1.2.4.tgz#b247d683e3133126dbdb42060c26e1c34a8b625d" @@ -5452,6 +5448,10 @@ react-is@^16.12.0, react-is@^16.13.1, react-is@^16.7.0: resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== +"react-on-rails-pro-node-renderer@link:.yalc/react-on-rails-pro-node-renderer": + version "0.0.0" + uid "" + "react-on-rails-pro@link:.yalc/react-on-rails-pro": version "0.0.0" uid "" From 53ed09c2136d3615662b1db76204f7b3e2a03717 Mon Sep 17 00:00:00 2001 From: ihabadham Date: Wed, 5 Nov 2025 23:57:04 +0200 Subject: [PATCH 7/7] Update repository URL and add license token security warning --- react_on_rails_pro/docs/installation.md | 2 ++ react_on_rails_pro/package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/react_on_rails_pro/docs/installation.md b/react_on_rails_pro/docs/installation.md index 856edf0512..9ef421e8bb 100644 --- a/react_on_rails_pro/docs/installation.md +++ b/react_on_rails_pro/docs/installation.md @@ -53,6 +53,8 @@ ReactOnRailsPro.configure do |config| end ``` +⚠️ **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.). + ## Rails Configuration You don't need to create an initializer if you are satisfied with the defaults as described in [Configuration](./configuration.md). diff --git a/react_on_rails_pro/package.json b/react_on_rails_pro/package.json index 5b6a88e4d4..f9adec6182 100644 --- a/react_on_rails_pro/package.json +++ b/react_on_rails_pro/package.json @@ -116,7 +116,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/shakacode-tools/react_on_rails_pro.git" + "url": "git+https://github.com/shakacode/react_on_rails.git" }, "keywords": [ "react",