|
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 [email protected] |
| 3 | +## Upgrading from GitHub Packages to Public Distribution |
5 | 4 |
|
6 | | -* ShakaCode does: |
7 | | - * Creates a github user, like customer-rorp with email [email protected] 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 [[email protected]](mailto:[email protected]) 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: [email protected] 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}: [email protected]/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 [[email protected]](mailto:[email protected]) if you need a new token |
| 216 | + |
| 217 | +### Need Help? |
| 218 | + |
| 219 | +If you encounter issues during migration, contact [[email protected]](mailto:[email protected]) for support. |
0 commit comments