Install and Release
We're releasing this as a unified release with 5 packages total. We keep the version numbers in sync across all packages using unified versioning.
Testing the Gem before Release from a Rails App
See Contributing
Releasing a New Version
Run rake -D release to see instructions on how to release via the rake task.
Release Command
rake release[version,dry_run,registry,skip_push]
Arguments:
-
version(required): Version bump type or explicit version- Bump types:
patch,minor,major - Explicit:
16.2.0 - Pre-release:
16.2.0.beta.1(rubygem format with dots, converted to16.2.0-beta.1for NPM)
- Bump types:
-
dry_run(optional):trueto preview changes without releasing- Default:
false
- Default:
-
registry(optional): Publishing registry for testingverdaccio: Publish all NPM packages to local Verdaccio (skips RubyGems)npm: Normal release to npmjs.org + rubygems.org (default)
-
skip_push(optional): Skip git push to remoteskip_push: Don't push commits/tags to remote- Default: pushes to remote
Examples:
rake release[patch] # Bump patch version (16.1.1 → 16.1.2)
rake release[minor] # Bump minor version (16.1.1 → 16.2.0)
rake release[major] # Bump major version (16.1.1 → 17.0.0)
rake release[16.2.0] # Set explicit version
rake release[16.2.0.beta.1] # Set pre-release version (→ 16.2.0-beta.1 for NPM)
rake release[16.2.0,true] # Dry run to preview changes
rake release[16.2.0,false,verdaccio] # Test with local Verdaccio
rake release[patch,false,npm,skip_push] # Release but don't push to GitHub
What Gets Released
The release task publishes 5 packages with unified versioning:
PUBLIC (npmjs.org + rubygems.org):
- react-on-rails - NPM package
- react-on-rails-pro - NPM package
- react-on-rails-pro-node-renderer - NPM package
- react_on_rails - RubyGem
- react_on_rails_pro - RubyGem
Version Synchronization
The task updates versions in all the following files:
Core package:
react_on_rails/lib/react_on_rails/version.rb(source of truth for all packages)package.json(root workspace)packages/react-on-rails/package.jsonGemfile.lock(root)react_on_rails/spec/dummy/Gemfile.lock
Pro package:
react_on_rails_pro/lib/react_on_rails_pro/version.rb(VERSION only, not PROTOCOL_VERSION)react_on_rails_pro/package.json(node-renderer)packages/react-on-rails-pro/package.json(+ dependency version)react_on_rails_pro/Gemfile.lockreact_on_rails_pro/spec/dummy/Gemfile.lock
Note:
react_on_rails_pro.gemspecdynamically referencesReactOnRails::VERSIONreact-on-rails-proNPM dependency is pinned to exact version (e.g.,"react-on-rails": "16.2.0")
Pre-release Versions
For pre-release versions, the gem version format is automatically converted to NPM semver format:
- Gem:
3.0.0.beta.1 - NPM:
3.0.0-beta.1
Pre-Release Checklist
Before running the release command, verify:
-
NPM authentication: Run
npm whoamito confirm you're logged in- If not logged in, the release script will automatically run
npm loginfor you
- If not logged in, the release script will automatically run
-
RubyGems authentication: Ensure you have valid credentials for
gem push -
No uncommitted changes: Run
git statusto verify clean working tree
Release Process
When you run rake release[X.Y.Z], the task will:
- Check for uncommitted changes (will abort if found)
- Verify NPM authentication (will run
npm loginif needed) - Pull latest changes from the remote repository
- Clean up example directories
- Bump the gem version in
react_on_rails/lib/react_on_rails/version.rb - Update all package.json files with the new version
- Update the Pro package's dependency on react-on-rails
- Update the dummy app's Gemfile.lock
- Commit all version changes with message "Bump version to X.Y.Z"
- Create a git tag
vX.Y.Z - Push commits and tags to the remote repository
- Publish
react-on-railsto NPM (requires 2FA token) - Publish
react-on-rails-proto NPM (requires 2FA token) - Publish
react_on_railsto RubyGems (requires 2FA token)
Two-Factor Authentication
You'll need to enter OTP tokens when prompted:
- Once for publishing
react-on-railsto NPM - Once for publishing
react-on-rails-proto NPM - Once for publishing
react_on_railsto RubyGems
Post-Release Steps
After a successful release, update the changelog using one of these options:
Option A - Use Claude Code (recommended):
Run the /update-changelog command in Claude Code. This will analyze commits, write changelog entries, and create a PR automatically.
Option B - Manual (headers only, you must write entries):
-
Update the CHANGELOG.md headers:
bundle exec rake update_changelogNote: This only adds version headers and links. You must write the actual changelog entries manually.
-
Commit and push:
git commit -a -m 'Update CHANGELOG.md'
git push
Requirements
NPM Publishing
You must be logged in and have publish permissions:
For public packages (npmjs.org):
npm login
RubyGems Publishing
For public gem (rubygems.org):
- Standard RubyGems credentials via
gem push
Ruby Version Management
The script automatically detects and switches Ruby versions when needed:
- Supports: RVM, rbenv, asdf
- Set via
RUBY_VERSION_MANAGERenvironment variable (default:rvm) - Example: Pro dummy app requires Ruby 3.3.7, script auto-switches from 3.3.0
Dependencies
This task depends on the gem-release Ruby gem, which is installed via bundle install.
Testing with Verdaccio
Before releasing to production, test the release process locally:
-
Install and start Verdaccio:
npm install -g verdaccio
verdaccio -
Run release with verdaccio registry:
rake release[patch,false,verdaccio] -
This will:
- Publish all 3 NPM packages to local Verdaccio
- Skip RubyGem publishing
- Update version files (revert manually after testing)
-
Test installing from Verdaccio:
npm set registry http://localhost:4873/
npm install react-on-rails@16.2.0
# Reset when done:
npm config delete registry
Troubleshooting
Dry Run First
Always test with a dry run before actually releasing:
rake release[16.2.0,true]
This shows you exactly what would be updated without making any changes.
NPM Authentication Issues
If you see errors like "Access token expired" or "E404 Not Found" during NPM publish:
- Your NPM token has expired (tokens now expire after 90 days)
- Run
npm loginto refresh your credentials - Retry the release
The release script now checks NPM authentication at the start and will automatically run npm login if needed, so this issue will be caught and handled before any changes are made.
If Release Fails
If the release fails partway through (e.g., during NPM publish):
-
Check what was published:
- NPM:
npm view react-on-rails@X.Y.Z - RubyGems:
gem list react_on_rails -r -a
- NPM:
-
If the git tag was created but packages weren't published:
- Delete the tag:
git tag -d vX.Y.Z && git push origin :vX.Y.Z - Revert the version commit:
git reset --hard HEAD~1 && git push -f - Start over with
rake release[X.Y.Z]
- Delete the tag:
-
If some packages were published but not others:
- You can manually publish the missing packages:
cd packages/react-on-rails && pnpm version X.Y.Z && pnpm publish
cd ../react-on-rails-pro && pnpm version X.Y.Z && pnpm publish
gem releasepnpm publish -rwill publish all packages where current version isn't published yet.
- You can manually publish the missing packages:
Version History
Running rake release[X.Y.Z] will create a commit that looks like this:
commit abc123...
Author: Your Name <your.email@example.com>
Date: Mon Jan 1 12:00:00 2024 -0500
Bump version to 16.2.0
diff --git a/react_on_rails/lib/react_on_rails/version.rb b/react_on_rails/lib/react_on_rails/version.rb
index 1234567..abcdefg 100644
--- a/react_on_rails/lib/react_on_rails/version.rb
+++ b/react_on_rails/lib/react_on_rails/version.rb
@@ -1,3 +1,3 @@
module ReactOnRails
- VERSION = "16.1.1"
+ VERSION = "16.2.0"
end
diff --git a/package.json b/package.json
index 2345678..bcdefgh 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "react-on-rails-workspace",
- "version": "16.1.1",
+ "version": "16.2.0",
...
}