react_on_rails 16.2.0.beta.3 → 16.2.0.beta.4
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/CLAUDE.md +59 -0
- data/CONTRIBUTING.md +48 -0
- data/Gemfile.development_dependencies +1 -0
- data/Gemfile.lock +25 -2
- data/SWITCHING_CI_CONFIGS.md +55 -6
- data/Steepfile +51 -0
- data/bin/ci-rerun-failures +34 -11
- data/bin/ci-run-failed-specs +25 -1
- data/bin/ci-switch-config +254 -32
- data/bin/lefthook/check-trailing-newlines +2 -12
- data/bin/lefthook/eslint-lint +0 -10
- data/bin/lefthook/prettier-format +0 -10
- data/bin/lefthook/ruby-autofix +1 -5
- data/lib/react_on_rails/configuration.rb +56 -12
- data/lib/react_on_rails/controller.rb +3 -3
- data/lib/react_on_rails/doctor.rb +4 -2
- data/lib/react_on_rails/helper.rb +3 -3
- data/lib/react_on_rails/pro_helper.rb +2 -44
- data/lib/react_on_rails/react_component/render_options.rb +7 -7
- data/lib/react_on_rails/utils.rb +40 -0
- data/lib/react_on_rails/version.rb +1 -1
- data/react_on_rails_pro/CHANGELOG.md +135 -29
- data/react_on_rails_pro/Gemfile.development_dependencies +1 -0
- data/react_on_rails_pro/Gemfile.lock +6 -3
- data/react_on_rails_pro/README.md +559 -38
- data/react_on_rails_pro/docs/installation.md +40 -22
- data/react_on_rails_pro/docs/node-renderer/basics.md +26 -19
- data/react_on_rails_pro/docs/node-renderer/js-configuration.md +24 -22
- data/react_on_rails_pro/docs/node-renderer/troubleshooting.md +2 -0
- data/react_on_rails_pro/lib/react_on_rails_pro/version.rb +1 -1
- data/react_on_rails_pro/package.json +1 -1
- data/react_on_rails_pro/packages/node-renderer/src/master/restartWorkers.ts +39 -17
- data/react_on_rails_pro/packages/node-renderer/src/master.ts +15 -4
- data/react_on_rails_pro/packages/node-renderer/src/shared/configBuilder.ts +44 -5
- data/react_on_rails_pro/packages/node-renderer/src/shared/utils.ts +4 -2
- data/react_on_rails_pro/packages/node-renderer/src/worker/handleGracefulShutdown.ts +49 -0
- data/react_on_rails_pro/packages/node-renderer/src/worker/vm.ts +3 -3
- data/react_on_rails_pro/packages/node-renderer/src/worker.ts +5 -2
- data/react_on_rails_pro/packages/node-renderer/tests/helper.ts +8 -8
- data/react_on_rails_pro/packages/node-renderer/tests/testingNodeRendererConfigs.js +1 -1
- data/react_on_rails_pro/packages/node-renderer/tests/worker.test.ts +19 -19
- data/react_on_rails_pro/rakelib/rbs.rake +47 -0
- data/react_on_rails_pro/sig/react_on_rails_pro/cache.rbs +13 -0
- data/react_on_rails_pro/sig/react_on_rails_pro/configuration.rbs +100 -0
- data/react_on_rails_pro/sig/react_on_rails_pro/error.rbs +4 -0
- data/react_on_rails_pro/sig/react_on_rails_pro/utils.rbs +7 -0
- data/react_on_rails_pro/sig/react_on_rails_pro.rbs +5 -0
- data/react_on_rails_pro/spec/dummy/Gemfile.lock +6 -3
- data/react_on_rails_pro/spec/dummy/client/node-renderer.js +1 -1
- data/react_on_rails_pro/spec/dummy/spec/system/integration_spec.rb +16 -17
- data/sig/react_on_rails/controller.rbs +1 -1
- data/sig/react_on_rails/error.rbs +4 -0
- data/sig/react_on_rails/helper.rbs +2 -2
- data/sig/react_on_rails/json_parse_error.rbs +10 -0
- data/sig/react_on_rails/prerender_error.rbs +21 -0
- data/sig/react_on_rails/smart_error.rbs +28 -0
- data/sig/react_on_rails.rbs +3 -24
- metadata +14 -3
- data/lib/react_on_rails/pro_utils.rb +0 -37
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 559d44da8c51be70681ed059f69f1fb67856a41f86c95bdd35d2a2bbed79f0f8
|
|
4
|
+
data.tar.gz: 92cd87455b4e96407dcc6b06a5c2eb36a66a229305be63dbb55cd02d6774b638
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6877a9fa47c913a103f146b8b6f0e35409618f7341f22fa0f362d73fe2bc2f3348a8d7593aa65dce56b245118a08892b8a2ea8c043ccb21bdc17955145a07189
|
|
7
|
+
data.tar.gz: 9c81ce27f0c3fee5aea1767613fe696377ea8a4bf61c68a86291ab171c662388cc931f9c7c47d41fa82ed3a27afa8cb953b4ce25ec0408a096c93a107bb5cde4
|
data/CHANGELOG.md
CHANGED
|
@@ -49,12 +49,30 @@ Changes since the last non-beta release.
|
|
|
49
49
|
|
|
50
50
|
- **Shakapacker 9.2.0 Upgrade**: Upgraded Shakapacker from 9.1.0 to 9.2.0. This minor version update adds a new `bin/shakapacker-config` utility for debugging webpack/rspack configurations with doctor mode, save mode, and stdout mode options. Supports YAML, JSON, and Node.js inspect output formats. by [justin808](https://github.com/justin808).
|
|
51
51
|
|
|
52
|
+
- **Removed Pro Warning Badge**: Removed the visual warning badge that appeared when non-Pro users attempted to enable Pro-only features like `immediate_hydration`. Pro features are now silently disabled when a Pro license is not available, providing a cleaner user experience without intrusive warning banners. [PR #1993](https://github.com/shakacode/react_on_rails/pull/1993) by [AbanoubGhadban](https://github.com/AbanoubGhadban).
|
|
53
|
+
|
|
54
|
+
- **`immediate_hydration` now automatically enabled for Pro users**: The `config.immediate_hydration` configuration option has been removed. Immediate hydration is now automatically enabled for React on Rails Pro users and disabled for non-Pro users, simplifying configuration while providing optimal performance by default. Component-level overrides are still supported via the `immediate_hydration` parameter on `react_component`, `redux_store`, and `stream_react_component` helpers. [PR 1997](https://github.com/shakacode/react_on_rails/pull/1997) by [AbanoubGhadban](https://github.com/AbanoubGhadban).
|
|
55
|
+
|
|
56
|
+
- **`generated_component_packs_loading_strategy` now defaults based on Pro license**: When using Shakapacker >= 8.2.0, the default loading strategy is now `:async` for Pro users and `:defer` for non-Pro users. This provides optimal performance for Pro users while maintaining compatibility for non-Pro users. You can still explicitly set the strategy in your configuration. [PR #1993](https://github.com/shakacode/react_on_rails/pull/1993) by [AbanoubGhadban](https://github.com/AbanoubGhadban).
|
|
57
|
+
|
|
52
58
|
#### Bug Fixes
|
|
53
59
|
|
|
54
60
|
- **Use as Git dependency**: All packages can now be installed as Git dependencies. This is useful for development and testing purposes. See [CONTRIBUTING.md](./CONTRIBUTING.md#git-dependencies) for documentation. [PR #1873](https://github.com/shakacode/react_on_rails/pull/1873) by [alexeyr-ci2](https://github.com/alexeyr-ci2).
|
|
55
61
|
|
|
56
62
|
#### Breaking Changes
|
|
57
63
|
|
|
64
|
+
- **`config.immediate_hydration` configuration removed**: The `config.immediate_hydration` setting in `config/initializers/react_on_rails.rb` has been removed. Immediate hydration is now automatically enabled for React on Rails Pro users and automatically disabled for non-Pro users.
|
|
65
|
+
|
|
66
|
+
**Migration steps:**
|
|
67
|
+
|
|
68
|
+
- Remove any `config.immediate_hydration = true` or `config.immediate_hydration = false` lines from your `config/initializers/react_on_rails.rb` file
|
|
69
|
+
- Pro users: No action needed - immediate hydration is now enabled automatically for optimal performance
|
|
70
|
+
- Non-Pro users: No action needed - standard hydration behavior continues to work as before
|
|
71
|
+
- Component-level overrides: You can still override behavior per-component using `react_component("MyComponent", immediate_hydration: false)` or `redux_store("MyStore", immediate_hydration: true)`
|
|
72
|
+
- If a non-Pro user explicitly sets `immediate_hydration: true` on a component or store, a warning will be logged and it will be enforced to fall back to standard hydration (the value will be overridden to `false`)
|
|
73
|
+
|
|
74
|
+
[PR 1997](https://github.com/shakacode/react_on_rails/pull/1997) by [AbanoubGhadban](https://github.com/AbanoubGhadban).
|
|
75
|
+
|
|
58
76
|
- **React on Rails Core Package**: Several Pro-only methods have been removed from the core package and are now exclusively available in the `react-on-rails-pro` package. If you're using any of the following methods, you'll need to migrate to React on Rails Pro:
|
|
59
77
|
- `getOrWaitForComponent()`
|
|
60
78
|
- `getOrWaitForStore()`
|
data/CLAUDE.md
CHANGED
|
@@ -45,6 +45,11 @@ Pre-commit hooks automatically run:
|
|
|
45
45
|
- Check formatting without fixing: `yarn start format.listDifferent`
|
|
46
46
|
- **Build**: `yarn run build` (compiles TypeScript to JavaScript in packages/react-on-rails/lib)
|
|
47
47
|
- **Type checking**: `yarn run type-check`
|
|
48
|
+
- **RBS Type Checking**:
|
|
49
|
+
- Validate RBS signatures: `bundle exec rake rbs:validate`
|
|
50
|
+
- Run Steep type checker: `bundle exec rake rbs:steep`
|
|
51
|
+
- Run both: `bundle exec rake rbs:all`
|
|
52
|
+
- List RBS files: `bundle exec rake rbs:list`
|
|
48
53
|
- **⚠️ MANDATORY BEFORE GIT PUSH**: `bundle exec rubocop` and fix ALL violations + ensure trailing newlines
|
|
49
54
|
- Never run `npm` commands, only equivalent Yarn Classic ones
|
|
50
55
|
|
|
@@ -117,6 +122,60 @@ This script:
|
|
|
117
122
|
- 🔄 **Deduplicates** - removes duplicate specs
|
|
118
123
|
- 📁 **Auto-detects directory** - runs from spec/dummy when needed
|
|
119
124
|
|
|
125
|
+
## RBS Type Checking
|
|
126
|
+
|
|
127
|
+
React on Rails uses RBS (Ruby Signature) for static type checking with Steep.
|
|
128
|
+
|
|
129
|
+
### Quick Start
|
|
130
|
+
|
|
131
|
+
- **Validate signatures**: `bundle exec rake rbs:validate` (run by CI)
|
|
132
|
+
- **Run type checker**: `bundle exec rake rbs:steep` (currently disabled in CI due to existing errors)
|
|
133
|
+
- **Runtime checking**: Enabled by default in tests when `rbs` gem is available
|
|
134
|
+
|
|
135
|
+
### Runtime Type Checking
|
|
136
|
+
|
|
137
|
+
Runtime type checking is **ENABLED BY DEFAULT** during test runs for:
|
|
138
|
+
- `rake run_rspec:gem` - Unit tests
|
|
139
|
+
- `rake run_rspec:dummy` - Integration tests
|
|
140
|
+
- `rake run_rspec:dummy_no_turbolinks` - Integration tests without Turbolinks
|
|
141
|
+
|
|
142
|
+
**Performance Impact**: Runtime type checking adds overhead (typically 5-15%) to test execution. This is acceptable during development and CI as it catches type errors in actual execution paths that static analysis might miss.
|
|
143
|
+
|
|
144
|
+
To disable runtime checking (e.g., for faster test iterations during development):
|
|
145
|
+
```bash
|
|
146
|
+
DISABLE_RBS_RUNTIME_CHECKING=true rake run_rspec:gem
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**When to disable**: Consider disabling during rapid test-driven development cycles where you're running tests frequently. Re-enable before committing to catch type violations.
|
|
150
|
+
|
|
151
|
+
### Adding Type Signatures
|
|
152
|
+
|
|
153
|
+
When creating new Ruby files in `lib/react_on_rails/`:
|
|
154
|
+
|
|
155
|
+
1. **Create RBS signature**: Add `sig/react_on_rails/filename.rbs`
|
|
156
|
+
2. **Add to Steepfile**: Include `check "lib/react_on_rails/filename.rb"` in Steepfile
|
|
157
|
+
3. **Validate**: Run `bundle exec rake rbs:validate`
|
|
158
|
+
4. **Type check**: Run `bundle exec rake rbs:steep`
|
|
159
|
+
5. **Fix errors**: Address any type errors before committing
|
|
160
|
+
|
|
161
|
+
### Files Currently Type-Checked
|
|
162
|
+
|
|
163
|
+
See `Steepfile` for the complete list. Core files include:
|
|
164
|
+
- `lib/react_on_rails.rb`
|
|
165
|
+
- `lib/react_on_rails/configuration.rb`
|
|
166
|
+
- `lib/react_on_rails/helper.rb`
|
|
167
|
+
- `lib/react_on_rails/packer_utils.rb`
|
|
168
|
+
- `lib/react_on_rails/server_rendering_pool.rb`
|
|
169
|
+
- And 5 more (see Steepfile for full list)
|
|
170
|
+
|
|
171
|
+
### Pro Package Type Checking
|
|
172
|
+
|
|
173
|
+
The Pro package has its own RBS signatures in `react_on_rails_pro/sig/`.
|
|
174
|
+
|
|
175
|
+
Validate Pro signatures:
|
|
176
|
+
```bash
|
|
177
|
+
cd react_on_rails_pro && bundle exec rake rbs:validate
|
|
178
|
+
```
|
|
120
179
|
## Changelog
|
|
121
180
|
|
|
122
181
|
- **Update CHANGELOG.md for user-visible changes only** (features, bug fixes, breaking changes, deprecations, performance improvements)
|
data/CONTRIBUTING.md
CHANGED
|
@@ -14,6 +14,7 @@ During this transition:
|
|
|
14
14
|
|
|
15
15
|
- [docs/contributor-info/Releasing](./docs/contributor-info/releasing.md) for instructions on releasing.
|
|
16
16
|
- [docs/contributor-info/pull-requests](./docs/contributor-info/pull-requests.md)
|
|
17
|
+
- [docs/contributor-info/rbs-type-signatures](./docs/contributor-info/rbs-type-signatures.md) for information on RBS type signatures
|
|
17
18
|
- See other docs in [docs/contributor-info](./docs/contributor-info)
|
|
18
19
|
|
|
19
20
|
## Prerequisites
|
|
@@ -421,6 +422,53 @@ The CI system intelligently skips unnecessary work:
|
|
|
421
422
|
|
|
422
423
|
For more details, see [`docs/CI_OPTIMIZATION.md`](./docs/CI_OPTIMIZATION.md).
|
|
423
424
|
|
|
425
|
+
### CI Control Commands
|
|
426
|
+
|
|
427
|
+
React on Rails provides PR comment commands to control CI behavior:
|
|
428
|
+
|
|
429
|
+
#### `/run-skipped-ci` - Enable Full CI Mode
|
|
430
|
+
|
|
431
|
+
Runs all skipped CI checks and enables full CI mode for the PR:
|
|
432
|
+
|
|
433
|
+
```
|
|
434
|
+
/run-skipped-ci
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
**What it does:**
|
|
438
|
+
|
|
439
|
+
- Triggers all CI workflows that were skipped due to unchanged code
|
|
440
|
+
- Adds the `full-ci` label to the PR
|
|
441
|
+
- **Persists across future commits** - all subsequent pushes will run the full test suite
|
|
442
|
+
- Runs minimum dependency tests (Ruby 3.2, Node 20, Shakapacker 8.2.0, React 18)
|
|
443
|
+
|
|
444
|
+
**When to use:**
|
|
445
|
+
|
|
446
|
+
- You want comprehensive testing across all configurations
|
|
447
|
+
- Testing changes that might affect minimum supported versions
|
|
448
|
+
- Validating generator changes or core functionality
|
|
449
|
+
- Before merging PRs that touch critical paths
|
|
450
|
+
|
|
451
|
+
#### `/stop-run-skipped-ci` - Disable Full CI Mode
|
|
452
|
+
|
|
453
|
+
Removes the `full-ci` label and returns to standard CI behavior:
|
|
454
|
+
|
|
455
|
+
```
|
|
456
|
+
/stop-run-skipped-ci
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
**What it does:**
|
|
460
|
+
|
|
461
|
+
- Removes the `full-ci` label from the PR
|
|
462
|
+
- Future commits will use the optimized CI suite (tests only changed code)
|
|
463
|
+
- Does not stop currently running workflows
|
|
464
|
+
|
|
465
|
+
**When to use:**
|
|
466
|
+
|
|
467
|
+
- You've validated changes with full CI and want to return to faster feedback
|
|
468
|
+
- Reducing CI time during rapid iteration on a PR
|
|
469
|
+
|
|
470
|
+
**Note:** The `full-ci` label is preserved on merged PRs as a historical record of which PRs ran with comprehensive testing.
|
|
471
|
+
|
|
424
472
|
### Install Generator
|
|
425
473
|
|
|
426
474
|
In your Rails app add this gem with a path to your fork.
|
|
@@ -34,6 +34,7 @@ group :development, :test do
|
|
|
34
34
|
gem "pry-rails"
|
|
35
35
|
gem "pry-rescue"
|
|
36
36
|
gem "rbs", require: false
|
|
37
|
+
gem "steep", require: false
|
|
37
38
|
gem "rubocop", "1.61.0", require: false
|
|
38
39
|
gem "rubocop-performance", "~>1.20.0", require: false
|
|
39
40
|
gem "rubocop-rspec", "~>2.26", require: false
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
react_on_rails (16.2.0.beta.
|
|
4
|
+
react_on_rails (16.2.0.beta.4)
|
|
5
5
|
addressable
|
|
6
6
|
connection_pool
|
|
7
7
|
execjs (~> 2.5)
|
|
@@ -120,7 +120,8 @@ GEM
|
|
|
120
120
|
thor (>= 0.19.4, < 2.0)
|
|
121
121
|
tins (~> 1.6)
|
|
122
122
|
crass (1.0.6)
|
|
123
|
-
|
|
123
|
+
csv (3.3.5)
|
|
124
|
+
cypress-on-rails (1.20.0)
|
|
124
125
|
rack
|
|
125
126
|
date (3.3.4)
|
|
126
127
|
debug (1.9.2)
|
|
@@ -135,6 +136,7 @@ GEM
|
|
|
135
136
|
erubi (1.13.1)
|
|
136
137
|
execjs (2.9.1)
|
|
137
138
|
ffi (1.16.3)
|
|
139
|
+
fileutils (1.8.0)
|
|
138
140
|
gem-release (2.2.2)
|
|
139
141
|
generator_spec (0.10.0)
|
|
140
142
|
activesupport (>= 3.0.0)
|
|
@@ -349,6 +351,7 @@ GEM
|
|
|
349
351
|
sass (~> 3.5, >= 3.5.5)
|
|
350
352
|
sdoc (2.6.1)
|
|
351
353
|
rdoc (>= 5.0)
|
|
354
|
+
securerandom (0.4.1)
|
|
352
355
|
selenium-webdriver (4.9.0)
|
|
353
356
|
rexml (~> 3.2, >= 3.2.5)
|
|
354
357
|
rubyzip (>= 1.2.2, < 3.0)
|
|
@@ -375,11 +378,29 @@ GEM
|
|
|
375
378
|
sprockets (>= 3.0.0)
|
|
376
379
|
sqlite3 (1.7.3)
|
|
377
380
|
mini_portile2 (~> 2.8.0)
|
|
381
|
+
steep (1.9.4)
|
|
382
|
+
activesupport (>= 5.1)
|
|
383
|
+
concurrent-ruby (>= 1.1.10)
|
|
384
|
+
csv (>= 3.0.9)
|
|
385
|
+
fileutils (>= 1.1.0)
|
|
386
|
+
json (>= 2.1.0)
|
|
387
|
+
language_server-protocol (>= 3.15, < 4.0)
|
|
388
|
+
listen (~> 3.0)
|
|
389
|
+
logger (>= 1.3.0)
|
|
390
|
+
parser (>= 3.1)
|
|
391
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
392
|
+
rbs (~> 3.8)
|
|
393
|
+
securerandom (>= 0.1)
|
|
394
|
+
strscan (>= 1.0.0)
|
|
395
|
+
terminal-table (>= 2, < 4)
|
|
396
|
+
uri (>= 0.12.0)
|
|
378
397
|
stringio (3.1.7)
|
|
379
398
|
strscan (3.1.0)
|
|
380
399
|
sync (0.5.0)
|
|
381
400
|
term-ansicolor (1.8.0)
|
|
382
401
|
tins (~> 1.0)
|
|
402
|
+
terminal-table (3.0.2)
|
|
403
|
+
unicode-display_width (>= 1.1.1, < 3)
|
|
383
404
|
thor (1.4.0)
|
|
384
405
|
tilt (2.3.0)
|
|
385
406
|
timeout (0.4.1)
|
|
@@ -399,6 +420,7 @@ GEM
|
|
|
399
420
|
uglifier (4.2.0)
|
|
400
421
|
execjs (>= 0.3.0, < 3)
|
|
401
422
|
unicode-display_width (2.5.0)
|
|
423
|
+
uri (1.1.1)
|
|
402
424
|
webdrivers (5.3.0)
|
|
403
425
|
nokogiri (~> 1.6)
|
|
404
426
|
rubyzip (>= 1.3.0)
|
|
@@ -458,6 +480,7 @@ DEPENDENCIES
|
|
|
458
480
|
spring (~> 4.0)
|
|
459
481
|
sprockets (~> 4.0)
|
|
460
482
|
sqlite3 (~> 1.6)
|
|
483
|
+
steep
|
|
461
484
|
turbo-rails
|
|
462
485
|
turbolinks
|
|
463
486
|
uglifier
|
data/SWITCHING_CI_CONFIGS.md
CHANGED
|
@@ -53,24 +53,53 @@ The project runs tests against two configurations:
|
|
|
53
53
|
|
|
54
54
|
## Prerequisites
|
|
55
55
|
|
|
56
|
-
You must have a version manager
|
|
56
|
+
You must have a version manager installed to manage Ruby and Node versions. The script supports:
|
|
57
|
+
|
|
58
|
+
- **[mise](https://mise.jdx.dev/)** - Recommended, modern, manages both Ruby and Node
|
|
59
|
+
- **[asdf](https://asdf-vm.com/)** - Legacy option, manages both Ruby and Node
|
|
60
|
+
- **[rvm](https://rvm.io/) + [nvm](https://github.com/nvm-sh/nvm)** - Separate managers for Ruby and Node
|
|
61
|
+
|
|
62
|
+
### Option 1: mise (Recommended)
|
|
57
63
|
|
|
58
64
|
```bash
|
|
59
|
-
# Install mise
|
|
65
|
+
# Install mise
|
|
60
66
|
brew install mise
|
|
61
67
|
echo 'eval "$(mise activate zsh)"' >> ~/.zshrc
|
|
62
68
|
source ~/.zshrc
|
|
63
69
|
|
|
64
|
-
#
|
|
70
|
+
# mise automatically reads from .tool-versions
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Option 2: asdf
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Install asdf
|
|
65
77
|
brew install asdf
|
|
66
78
|
echo -e "\n. $(brew --prefix asdf)/libexec/asdf.sh" >> ~/.zshrc
|
|
67
79
|
source ~/.zshrc
|
|
68
80
|
|
|
69
|
-
# Install plugins
|
|
81
|
+
# Install plugins
|
|
70
82
|
asdf plugin add ruby
|
|
71
83
|
asdf plugin add nodejs
|
|
72
84
|
```
|
|
73
85
|
|
|
86
|
+
### Option 3: rvm + nvm
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Install rvm for Ruby
|
|
90
|
+
\curl -sSL https://get.rvm.io | bash -s stable
|
|
91
|
+
source ~/.rvm/scripts/rvm
|
|
92
|
+
|
|
93
|
+
# Install nvm for Node
|
|
94
|
+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
|
|
95
|
+
# Add to shell config (the installer usually does this automatically)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Important Notes:**
|
|
99
|
+
|
|
100
|
+
- If you only have rvm (no nvm) or only nvm (no rvm), the script will detect this and provide helpful error messages guiding you to install the missing manager or switch to mise/asdf.
|
|
101
|
+
- **Do not mix version managers** (e.g., don't install both mise and rvm). The script prioritizes mise > asdf > rvm+nvm, so mise/asdf will always take precedence. Using multiple managers can cause confusion about which versions are active.
|
|
102
|
+
|
|
74
103
|
## Detailed Usage
|
|
75
104
|
|
|
76
105
|
### 1. Check Current Configuration
|
|
@@ -107,7 +136,9 @@ This will:
|
|
|
107
136
|
```bash
|
|
108
137
|
# Reload your shell to pick up new Ruby/Node versions
|
|
109
138
|
cd <project-root>
|
|
110
|
-
mise current
|
|
139
|
+
mise current # For mise users
|
|
140
|
+
# asdf current # For asdf users
|
|
141
|
+
# rvm current && nvm current # For rvm+nvm users
|
|
111
142
|
|
|
112
143
|
# Build and test
|
|
113
144
|
rake node_package
|
|
@@ -137,7 +168,9 @@ This will:
|
|
|
137
168
|
```bash
|
|
138
169
|
# Reload your shell to pick up new Ruby/Node versions
|
|
139
170
|
cd <project-root>
|
|
140
|
-
mise current
|
|
171
|
+
mise current # For mise users
|
|
172
|
+
# asdf current # For asdf users
|
|
173
|
+
# rvm current && nvm current # For rvm+nvm users
|
|
141
174
|
|
|
142
175
|
# Build and test
|
|
143
176
|
rake node_package
|
|
@@ -243,6 +276,22 @@ asdf reshim ruby
|
|
|
243
276
|
asdf reshim nodejs
|
|
244
277
|
```
|
|
245
278
|
|
|
279
|
+
**For rvm + nvm:**
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
# Install and use specific Ruby version
|
|
283
|
+
rvm install 3.2.8 # or 3.4.3
|
|
284
|
+
rvm use 3.2.8
|
|
285
|
+
|
|
286
|
+
# Install and use specific Node version
|
|
287
|
+
nvm install 20.18.1 # or 22.12.0
|
|
288
|
+
nvm use 20.18.1
|
|
289
|
+
|
|
290
|
+
# Verify versions
|
|
291
|
+
ruby --version
|
|
292
|
+
node --version
|
|
293
|
+
```
|
|
294
|
+
|
|
246
295
|
### Yarn install fails
|
|
247
296
|
|
|
248
297
|
If you get package resolution errors:
|
data/Steepfile
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Steepfile - Configuration for Steep type checker
|
|
4
|
+
# See https://github.com/soutaro/steep for documentation
|
|
5
|
+
#
|
|
6
|
+
# IMPORTANT: This file lists only the files that are ready for type checking.
|
|
7
|
+
# We use a positive list (explicit check statements) rather than checking all files
|
|
8
|
+
# because not all files have RBS signatures yet.
|
|
9
|
+
#
|
|
10
|
+
# Files/directories intentionally excluded (no RBS signatures yet):
|
|
11
|
+
# - lib/generators/**/* - Rails generators (complex Rails integration)
|
|
12
|
+
# - lib/react_on_rails/engine.rb - Rails engine setup
|
|
13
|
+
# - lib/react_on_rails/doctor.rb - Diagnostic tool
|
|
14
|
+
# - lib/react_on_rails/locales/**/* - I18n files
|
|
15
|
+
# - lib/react_on_rails/props_js_builder.rb - TODO: Add signature
|
|
16
|
+
# - lib/react_on_rails/shakapacker/**/* - Shakapacker integration (complex)
|
|
17
|
+
#
|
|
18
|
+
# To add a new file to type checking:
|
|
19
|
+
# 1. Create corresponding RBS signature in sig/react_on_rails/filename.rbs
|
|
20
|
+
# 2. Add `check "lib/react_on_rails/filename.rb"` below
|
|
21
|
+
# 3. Run `bundle exec rake rbs:steep` to verify
|
|
22
|
+
# 4. Fix any type errors before committing
|
|
23
|
+
|
|
24
|
+
D = Steep::Diagnostic
|
|
25
|
+
|
|
26
|
+
target :lib do
|
|
27
|
+
# Core files with RBS signatures (alphabetically ordered for easy maintenance)
|
|
28
|
+
check "lib/react_on_rails.rb"
|
|
29
|
+
check "lib/react_on_rails/configuration.rb"
|
|
30
|
+
check "lib/react_on_rails/controller.rb"
|
|
31
|
+
check "lib/react_on_rails/git_utils.rb"
|
|
32
|
+
check "lib/react_on_rails/helper.rb"
|
|
33
|
+
check "lib/react_on_rails/packer_utils.rb"
|
|
34
|
+
check "lib/react_on_rails/server_rendering_pool.rb"
|
|
35
|
+
check "lib/react_on_rails/test_helper.rb"
|
|
36
|
+
check "lib/react_on_rails/utils.rb"
|
|
37
|
+
check "lib/react_on_rails/version_checker.rb"
|
|
38
|
+
|
|
39
|
+
# Specify RBS signature directories
|
|
40
|
+
signature "sig"
|
|
41
|
+
|
|
42
|
+
# Configure libraries (gems) - Steep will load their RBS signatures
|
|
43
|
+
configure_code_diagnostics(D::Ruby.default)
|
|
44
|
+
|
|
45
|
+
# Library configuration - standard library gems used by checked files
|
|
46
|
+
library "pathname"
|
|
47
|
+
library "singleton"
|
|
48
|
+
library "logger"
|
|
49
|
+
library "monitor"
|
|
50
|
+
library "securerandom"
|
|
51
|
+
end
|
data/bin/ci-rerun-failures
CHANGED
|
@@ -173,13 +173,8 @@ if [ -z "$FAILED_CHECKS" ]; then
|
|
|
173
173
|
exit 0
|
|
174
174
|
fi
|
|
175
175
|
|
|
176
|
-
echo -e "${YELLOW}Failed CI jobs:${NC}"
|
|
177
|
-
echo "$FAILED_CHECKS" | while read -r check; do
|
|
178
|
-
echo -e "${RED} ✗ $check${NC}"
|
|
179
|
-
done
|
|
180
|
-
echo ""
|
|
181
|
-
|
|
182
176
|
# Map CI job names to local commands
|
|
177
|
+
# NOTE: Version numbers below must match .github/workflows/main.yml matrix configuration
|
|
183
178
|
declare -A JOB_MAP
|
|
184
179
|
JOB_MAP["lint-js-and-ruby"]="bundle exec rubocop && yarn run eslint --report-unused-disable-directives && yarn start format.listDifferent"
|
|
185
180
|
JOB_MAP["rspec-package-tests"]="bundle exec rake run_rspec:gem"
|
|
@@ -188,6 +183,30 @@ JOB_MAP["dummy-app-integration-tests (3.4, 22, latest)"]="bundle exec rake run_r
|
|
|
188
183
|
JOB_MAP["dummy-app-integration-tests (3.2, 20, minimum)"]="bundle exec rake run_rspec:all_dummy"
|
|
189
184
|
JOB_MAP["examples"]="bundle exec rake run_rspec:shakapacker_examples"
|
|
190
185
|
|
|
186
|
+
# Map CI job names to human-readable versions (matches SWITCHING_CI_CONFIGS.md)
|
|
187
|
+
declare -A JOB_VERSION_MAP
|
|
188
|
+
JOB_VERSION_MAP["dummy-app-integration-tests (3.4, 22, latest)"]="Ruby 3.4, Node 22, Shakapacker 9.3.0, React 19"
|
|
189
|
+
JOB_VERSION_MAP["dummy-app-integration-tests (3.2, 20, minimum)"]="Ruby 3.2, Node 20, Shakapacker 8.2.0, React 18"
|
|
190
|
+
|
|
191
|
+
# Helper function to get version info for a job name
|
|
192
|
+
get_version_info() {
|
|
193
|
+
local job_name="$1"
|
|
194
|
+
for mapped_job_name in "${!JOB_VERSION_MAP[@]}"; do
|
|
195
|
+
if [[ "$job_name" == "$mapped_job_name"* ]]; then
|
|
196
|
+
echo " (${JOB_VERSION_MAP[$mapped_job_name]})"
|
|
197
|
+
return
|
|
198
|
+
fi
|
|
199
|
+
done
|
|
200
|
+
echo ""
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
echo -e "${YELLOW}Failed CI jobs:${NC}"
|
|
204
|
+
echo "$FAILED_CHECKS" | while read -r check; do
|
|
205
|
+
version_info=$(get_version_info "$check")
|
|
206
|
+
echo -e "${RED} ✗ $check${version_info}${NC}"
|
|
207
|
+
done
|
|
208
|
+
echo ""
|
|
209
|
+
|
|
191
210
|
# Track what we'll run (deduplicated)
|
|
192
211
|
declare -A COMMANDS_TO_RUN
|
|
193
212
|
|
|
@@ -218,7 +237,9 @@ fi
|
|
|
218
237
|
|
|
219
238
|
echo -e "${BLUE}Will run the following commands:${NC}"
|
|
220
239
|
for cmd in "${!COMMANDS_TO_RUN[@]}"; do
|
|
221
|
-
|
|
240
|
+
job_name="${COMMANDS_TO_RUN[$cmd]}"
|
|
241
|
+
version_info=$(get_version_info "$job_name")
|
|
242
|
+
echo -e "${BLUE} • $job_name${version_info}:${NC} $cmd"
|
|
222
243
|
done
|
|
223
244
|
echo ""
|
|
224
245
|
|
|
@@ -251,19 +272,21 @@ FAILED_COMMANDS=()
|
|
|
251
272
|
|
|
252
273
|
for cmd in "${!COMMANDS_TO_RUN[@]}"; do
|
|
253
274
|
job_name="${COMMANDS_TO_RUN[$cmd]}"
|
|
254
|
-
|
|
275
|
+
version_info=$(get_version_info "$job_name")
|
|
276
|
+
|
|
277
|
+
echo -e "${BLUE}▶ Running: $job_name${version_info}${NC}"
|
|
255
278
|
echo -e "${BLUE}Command: $cmd${NC}"
|
|
256
279
|
echo ""
|
|
257
280
|
|
|
258
281
|
# Note: Using eval here is safe because $cmd comes from predefined JOB_MAP,
|
|
259
282
|
# not from user input. Commands may contain shell operators like && and ||.
|
|
260
283
|
if eval "$cmd"; then
|
|
261
|
-
echo -e "${GREEN}✓ $job_name passed${NC}"
|
|
284
|
+
echo -e "${GREEN}✓ $job_name${version_info} passed${NC}"
|
|
262
285
|
echo ""
|
|
263
286
|
else
|
|
264
|
-
echo -e "${RED}✗ $job_name failed${NC}"
|
|
287
|
+
echo -e "${RED}✗ $job_name${version_info} failed${NC}"
|
|
265
288
|
echo ""
|
|
266
|
-
FAILED_COMMANDS+=("$job_name")
|
|
289
|
+
FAILED_COMMANDS+=("${job_name}${version_info}")
|
|
267
290
|
fi
|
|
268
291
|
done
|
|
269
292
|
|
data/bin/ci-run-failed-specs
CHANGED
|
@@ -105,6 +105,15 @@ else
|
|
|
105
105
|
if [[ "$line" =~ rspec[[:space:]]+(\./spec/[^[:space:]]+) ]]; then
|
|
106
106
|
spec="${BASH_REMATCH[1]}"
|
|
107
107
|
SPECS+=("$spec")
|
|
108
|
+
# Also handle bare spec paths like "spec/foo.rb[1:2:3]" or "./spec/foo.rb[1:2:3]"
|
|
109
|
+
# Strip trailing % and whitespace
|
|
110
|
+
elif [[ "$line" =~ (\.?/?spec/[^[:space:]%]+) ]]; then
|
|
111
|
+
spec="${BASH_REMATCH[1]}"
|
|
112
|
+
# Normalize to ./spec/ format
|
|
113
|
+
if [[ ! "$spec" =~ ^\. ]]; then
|
|
114
|
+
spec="./$spec"
|
|
115
|
+
fi
|
|
116
|
+
SPECS+=("$spec")
|
|
108
117
|
fi
|
|
109
118
|
done
|
|
110
119
|
fi
|
|
@@ -153,9 +162,24 @@ echo ""
|
|
|
153
162
|
|
|
154
163
|
# Confirm (read from /dev/tty to handle piped input)
|
|
155
164
|
if [ -t 0 ]; then
|
|
165
|
+
# stdin is a TTY, read directly
|
|
156
166
|
read -p "Run these specs now? [Y/n] " -n 1 -r REPLY
|
|
157
167
|
else
|
|
158
|
-
|
|
168
|
+
# stdin is not a TTY (piped input), try /dev/tty
|
|
169
|
+
# Check if we can actually open /dev/tty by attempting to use it in a subshell
|
|
170
|
+
set +e # Temporarily disable errexit for the check
|
|
171
|
+
(exec 0</dev/tty) 2>/dev/null
|
|
172
|
+
TTY_CHECK=$?
|
|
173
|
+
set -e # Re-enable errexit
|
|
174
|
+
|
|
175
|
+
if [ $TTY_CHECK -eq 0 ]; then
|
|
176
|
+
# Successfully opened /dev/tty, use it for confirmation
|
|
177
|
+
read -p "Run these specs now? [Y/n] " -n 1 -r REPLY < /dev/tty
|
|
178
|
+
else
|
|
179
|
+
# Cannot open /dev/tty, auto-confirm
|
|
180
|
+
echo "Run these specs now? [Y/n] Y (auto-confirmed, TTY unavailable)"
|
|
181
|
+
REPLY="Y"
|
|
182
|
+
fi
|
|
159
183
|
fi
|
|
160
184
|
echo
|
|
161
185
|
if [[ ! "${REPLY}" =~ ^[Yy]$ ]] && [[ ! -z "${REPLY}" ]]; then
|