react_on_rails_pro 16.2.0.beta.8

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.
Files changed (109) hide show
  1. checksums.yaml +7 -0
  2. data/.controlplane/Dockerfile +49 -0
  3. data/.controlplane/controlplane.yml +22 -0
  4. data/.controlplane/gvc.yml +25 -0
  5. data/.controlplane/postgres.yml +33 -0
  6. data/.controlplane/rails.yml +49 -0
  7. data/.controlplane/redis.yml +18 -0
  8. data/.gitignore +77 -0
  9. data/.prettierignore +12 -0
  10. data/.prettierrc +19 -0
  11. data/.rspec +2 -0
  12. data/.rubocop.yml +120 -0
  13. data/.scss-lint.yml +205 -0
  14. data/CHANGELOG.md +570 -0
  15. data/CI_SETUP.md +502 -0
  16. data/CONTRIBUTING.md +376 -0
  17. data/Dockerfile +63 -0
  18. data/Gemfile +8 -0
  19. data/Gemfile.development_dependencies +74 -0
  20. data/Gemfile.loader +32 -0
  21. data/Gemfile.lock +527 -0
  22. data/LICENSE +98 -0
  23. data/LICENSE_SETUP.md +272 -0
  24. data/README.md +577 -0
  25. data/Rakefile +13 -0
  26. data/app/controllers/react_on_rails_pro/rsc_payload_controller.rb +7 -0
  27. data/app/helpers/react_on_rails_pro_helper.rb +360 -0
  28. data/app/views/react_on_rails_pro/rsc_payload.html.erb +1 -0
  29. data/babel.config.js +4 -0
  30. data/docs/bundle-caching.md +205 -0
  31. data/docs/caching.md +234 -0
  32. data/docs/code-splitting-loadable-components.md +313 -0
  33. data/docs/code-splitting.md +349 -0
  34. data/docs/configuration.md +165 -0
  35. data/docs/contributors-info/onboarding-customers.md +6 -0
  36. data/docs/contributors-info/releasing.md +40 -0
  37. data/docs/contributors-info/style.md +33 -0
  38. data/docs/home-pro.md +146 -0
  39. data/docs/installation.md +203 -0
  40. data/docs/js-memory-leaks.md +22 -0
  41. data/docs/node-renderer/basics.md +92 -0
  42. data/docs/node-renderer/debugging.md +38 -0
  43. data/docs/node-renderer/error-reporting-and-tracing.md +160 -0
  44. data/docs/node-renderer/heroku.md +102 -0
  45. data/docs/node-renderer/js-configuration.md +91 -0
  46. data/docs/node-renderer/troubleshooting.md +5 -0
  47. data/docs/profiling-server-side-rendering-code.md +179 -0
  48. data/docs/react-server-components/add-streaming-and-interactivity.md +190 -0
  49. data/docs/react-server-components/create-without-ssr.md +448 -0
  50. data/docs/react-server-components/glossary.md +102 -0
  51. data/docs/react-server-components/how-react-server-components-work.md +243 -0
  52. data/docs/react-server-components/inside-client-components.md +332 -0
  53. data/docs/react-server-components/purpose-and-benefits.md +243 -0
  54. data/docs/react-server-components/rendering-flow.md +86 -0
  55. data/docs/react-server-components/selective-hydration-in-streamed-components.md +75 -0
  56. data/docs/react-server-components/server-side-rendering.md +72 -0
  57. data/docs/react-server-components/tutorial.md +19 -0
  58. data/docs/release-notes/4.0.md +94 -0
  59. data/docs/release-notes/v4-react-server-components.md +66 -0
  60. data/docs/ruby-api.md +11 -0
  61. data/docs/streaming-server-rendering.md +210 -0
  62. data/docs/troubleshooting.md +24 -0
  63. data/docs/updating.md +219 -0
  64. data/eslint.config.mjs +220 -0
  65. data/lib/react_on_rails_pro/assets_precompile.rb +230 -0
  66. data/lib/react_on_rails_pro/cache.rb +88 -0
  67. data/lib/react_on_rails_pro/concerns/rsc_payload_renderer.rb +38 -0
  68. data/lib/react_on_rails_pro/concerns/stream.rb +103 -0
  69. data/lib/react_on_rails_pro/configuration.rb +228 -0
  70. data/lib/react_on_rails_pro/constants.rb +8 -0
  71. data/lib/react_on_rails_pro/engine.rb +24 -0
  72. data/lib/react_on_rails_pro/error.rb +14 -0
  73. data/lib/react_on_rails_pro/license_public_key.rb +30 -0
  74. data/lib/react_on_rails_pro/license_validator.rb +188 -0
  75. data/lib/react_on_rails_pro/prepare_node_renderer_bundles.rb +40 -0
  76. data/lib/react_on_rails_pro/rendering_error.rb +5 -0
  77. data/lib/react_on_rails_pro/request.rb +318 -0
  78. data/lib/react_on_rails_pro/routes.rb +13 -0
  79. data/lib/react_on_rails_pro/server_rendering_js_code.rb +102 -0
  80. data/lib/react_on_rails_pro/server_rendering_pool/node_rendering_pool.rb +133 -0
  81. data/lib/react_on_rails_pro/server_rendering_pool/pro_rendering.rb +117 -0
  82. data/lib/react_on_rails_pro/stream_cache.rb +61 -0
  83. data/lib/react_on_rails_pro/stream_request.rb +170 -0
  84. data/lib/react_on_rails_pro/utils.rb +222 -0
  85. data/lib/react_on_rails_pro/v8_log_processor.rb +50 -0
  86. data/lib/react_on_rails_pro/version.rb +6 -0
  87. data/lib/react_on_rails_pro.rb +23 -0
  88. data/package-scripts.yml +109 -0
  89. data/package.json +159 -0
  90. data/rakelib/dummy_apps.rake +22 -0
  91. data/rakelib/lint.rake +32 -0
  92. data/rakelib/public_key_management.rake +155 -0
  93. data/rakelib/rbs.rake +47 -0
  94. data/rakelib/run_rspec.rake +81 -0
  95. data/rakelib/task_helpers.rb +45 -0
  96. data/rakelib/yard.rake +20 -0
  97. data/react_on_rails_pro.gemspec +47 -0
  98. data/readme-gen-docs.md +1 -0
  99. data/script/bootstrap +33 -0
  100. data/script/preinstall.js +31 -0
  101. data/script/setup +23 -0
  102. data/script/test +38 -0
  103. data/sig/react_on_rails_pro/cache.rbs +13 -0
  104. data/sig/react_on_rails_pro/configuration.rbs +100 -0
  105. data/sig/react_on_rails_pro/error.rbs +4 -0
  106. data/sig/react_on_rails_pro/utils.rbs +7 -0
  107. data/sig/react_on_rails_pro.rbs +5 -0
  108. data/yarn.lock +7599 -0
  109. metadata +319 -0
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,376 @@
1
+ # Tips for Contributors
2
+
3
+ ## Installation
4
+
5
+ Install [yalc](https://github.com/wclr/yalc).
6
+
7
+
8
+ ```sh
9
+ cd react_on_rails_pro
10
+ bundle && yarn && cd spec/dummy && bundle && yarn
11
+ ```
12
+ To use the `React 18 Apollo with GraphQL` example you need to seed the testing database inside `spec/dummy` directory.
13
+ ```sh
14
+ rake db:seed
15
+ ```
16
+
17
+
18
+ See the example apps under `/spec`
19
+
20
+ ## Summary
21
+
22
+ For non-doc fixes:
23
+
24
+ * Provide changelog entry in the [unreleased section of the CHANGELOG.md](https://github.com/shakacode/react_on_rails_pro/blob/master/CHANGELOG.md#unreleased).
25
+ * Ensure CI passes and that you added a test that passes with the fix and fails without the fix.
26
+ * Squash all commits down to one with a nice commit message *ONLY* once final review is given. Make sure this single commit is rebased on top of master.
27
+ * Please address all code review comments.
28
+ * Ensure that docs are updated accordingly if a feature is added.
29
+
30
+ ## Commit Messages
31
+
32
+ From [How to Write a Git Commit Message](http://chris.beams.io/posts/git-commit/)
33
+
34
+ #### The seven rules of a great git commit message
35
+ > Keep in mind: This has all been said before.
36
+
37
+ 1. Separate subject from body with a blank line
38
+ 1. Limit the subject line to 50 characters
39
+ 1. Capitalize the subject line
40
+ 1. Do not end the subject line with a period
41
+ 1. Use the imperative mood in the subject line
42
+ 1. Wrap the body at 72 characters
43
+ 1. Use the body to explain what and why vs. how
44
+
45
+
46
+ ## Doc Changes
47
+
48
+ When making doc changes, we want the change to work on both https://www.shakacode.com/react-on-rails-pro/docs/ and when browsing the GitHub repo.
49
+ The issue is that the Shakacode site is generated only from files in [`docs`](./docs), so any references from them to non-doc files must use the full GitHub URL.
50
+
51
+ ### Links to other docs:
52
+ * When making references to doc files, use a relative URL path like:
53
+ `[Installation Overview](docs/basics/installation-overview.md)`
54
+
55
+ * When making references to source code files, use a full url path like:
56
+ `[spec/dummy/config/initializers/react_on_rails.rb](https://github.com/shakacode/react_on_rails_pro/tree/master/spec/dummy/config/initializers/react_on_rails.rb)`
57
+
58
+
59
+ ## To run tests:
60
+ See [Run NPM JS tests](#run-npm-js-tests) for the JS tests and [RSpec Testing](#rspec-testing) for the Ruby tests.
61
+
62
+ See [Dev Initial Setup](#dev-initial-setup) below for, well... initial setup.
63
+
64
+ ## CI Testing and Optimization
65
+
66
+ React on Rails Pro shares the optimized CI pipeline with the main gem. The CI system intelligently runs only relevant tests based on file changes.
67
+
68
+ ### CI Behavior
69
+
70
+ - **On PRs/Branches**: Runs reduced test matrix (latest Ruby/Node versions only) for faster feedback
71
+ - **On Master**: Runs full test matrix (all Ruby/Node/dependency combinations) for complete coverage
72
+ - **Docs-only changes**: CI skips entirely when only `.md` files or `docs/` directory change
73
+
74
+ ### Local CI Tools
75
+
76
+ The repository root provides local CI tools that work with both the main gem and Pro:
77
+
78
+ #### `bin/ci-local` - Smart Local CI Runner
79
+
80
+ Run from the **repository root** to test Pro changes:
81
+
82
+ ```bash
83
+ # Navigate to repository root first
84
+ cd ..
85
+
86
+ # Auto-detect what to test (includes Pro tests if Pro files changed)
87
+ bin/ci-local
88
+
89
+ # Run all CI checks (same as master branch)
90
+ bin/ci-local --all
91
+
92
+ # Quick check - only fast tests
93
+ bin/ci-local --fast
94
+ ```
95
+
96
+ The detector automatically identifies Pro-related changes and runs appropriate Pro tests.
97
+
98
+ #### `script/ci-changes-detector` - Change Analysis
99
+
100
+ Analyzes changes to both main gem and Pro:
101
+
102
+ ```bash
103
+ # From repository root
104
+ script/ci-changes-detector origin/master
105
+ ```
106
+
107
+ ### CI Best Practices for Pro
108
+
109
+ ✅ **DO:**
110
+ - Run `bin/ci-local` from repository root before pushing
111
+ - Test Pro changes alongside main gem changes if modifying both
112
+ - Use `bin/ci-local --fast` during rapid iteration
113
+
114
+ ❌ **DON'T:**
115
+ - Push Pro changes without testing locally first
116
+ - Modify both Pro and main gem without running full tests
117
+
118
+ For comprehensive CI documentation, see [`../docs/CI_OPTIMIZATION.md`](../docs/CI_OPTIMIZATION.md) in the repository root.
119
+
120
+ # IDE/Editor Setup
121
+ It's critical to configure your IDE/editor to ignore certain directories. Otherwise your IDE might slow to a crawl!
122
+
123
+ * /coverage
124
+ * /tmp
125
+ * /node_modules
126
+ * /spec/dummy/app/assets/webpack
127
+ * /spec/dummy/log
128
+ * /spec/dummy/node_modules
129
+ * /spec/dummy/client/node_modules
130
+ * /spec/dummy/tmp
131
+
132
+
133
+ # Configuring your test app to use your local fork
134
+ You can test the `react_on_rails_pro` gem using your own external test_app or the gem's internal `spec/dummy` app. The `spec/dummy` app is an example of the various setup techniques you can use with the gem.
135
+ As of 2018-04-28, this directory mirrors the test app spec/dummy on https://github.com/shakacode/react_on_rails plus a few additional tests.
136
+
137
+ ```
138
+ ├── test_app
139
+ | └── client
140
+ └── react_on_rails_pro
141
+ └── spec
142
+ └── dummy
143
+ ```
144
+
145
+ ## Testing the Ruby Gem
146
+ If you want to test the ruby parts of the gem with an application before you release a new version of the gem, you can specify the path to your local version via your test app's Gemfile:
147
+
148
+ ```ruby
149
+ gem "react_on_rails_pro", path: "../path-to-react_on_rails_pro"
150
+ gem "react_on_rails"
151
+ ```
152
+ ================================================================================
153
+
154
+ Set `config.server_renderer = "NodeRenderer"` in your `ReactOnRailsPro.configure` block in the initializer.
155
+
156
+ After making this change, run `bundle install`.
157
+
158
+ > [!NOTE]
159
+ > You will need to restart your Rails application if you make any changes to the gem.
160
+
161
+ ## Testing the Node package for react_on_rails_pro
162
+ In addition to testing the Ruby parts out, you can also test the node package parts of the gem with an external application.
163
+
164
+ To do this, follow the instructions in the
165
+ [Local Node Package](#local-node-package).
166
+
167
+ ### Example: Testing NPM changes with the dummy app
168
+
169
+ 1. Add `console.log('Hello!')` [here](https://github.com/shakacode/react_on_rails_pro/blob/more_test_and_docs/packages/node-renderer/src/ReactOnRailsProNodeRenderer.js#L6) in `packages/node-renderer/src/ReactOnRailsProNodeRenderer.js` to confirm we're getting an update to the node package.
170
+ 2. The `preinstall` script of `spec/dummy` builds the NPM package and sets up `yalc` to use it for the renderer.
171
+ It's run automatically when you run `yarn install`.
172
+ 3. Refresh the browser if the server is already running or start the server using `foreman start -f Procfile.dev` from `spec/dummy` and navigate to `http://localhost:3000/`. You will now see the `Hello!` message printed in the browser's console.
173
+
174
+ > [!NOTE]
175
+ > `yalc` makes the NPM package available globally on the machine.
176
+ > So, if you have the repo checked out more than once to compare behavior between branches,
177
+ > make sure to run `yarn install` every time you switch to a new copy.
178
+
179
+ # Development Setup for Gem and Node Package Contributors
180
+
181
+ ## Checklist before Committing
182
+ 1. Run all JS tests, dummy app tests and linters.
183
+ 2. Did you need any more tests for your change?
184
+ 3. Did you document your change? Update the README.md?
185
+
186
+ ## Dev Initial Setup
187
+
188
+ ### Prereqs
189
+ After checking out the repo, making sure you have rvm and nvm setup (setup ruby and node), cd to `spec/dummy` and run `bin/setup` to install ruby dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
190
+
191
+
192
+ ### Building the Node Package for Development
193
+
194
+ At the root:
195
+ ```
196
+ nps build
197
+ ```
198
+
199
+ ### Modifying the startup for testing
200
+
201
+ This is a possible update to package.json to debug the lockfile. Notice the `NODE_DEBUG=LOCKFILE,ROR`
202
+
203
+ ```json
204
+ "developing": "rm -rf /tmp/react-on-rails-pro-node-renderer-bundles && RENDERER_LOG_LEVEL=info NODE_DEBUG=LOCKFILE,ROR node --enable-source-maps --experimental-modules packages/node-renderer/lib/default-node-renderer.js",
205
+ ```
206
+
207
+ See https://nodejs.org/api/util.html#util_util_debuglog_section for details on `debuglog`.
208
+
209
+ ### Local Node Package
210
+ Because the example and dummy apps rely on the `react_on_rails_pro` node package, they should link directly to your local version to pick up any changes you may have made to that package.
211
+ To achieve this, you can use `yalc`.
212
+ The easy way to do this is to run the command below in the dummy app root directory.
213
+ For more information check the script section of the
214
+ [spec/dummy/package.json](spec/dummy/package.json) file.
215
+
216
+ ```sh
217
+ cd spec/dummy
218
+ yarn install
219
+ ```
220
+
221
+ > [!NOTE]
222
+ > This runs npm under the hood as explained in the **Test NPM for react_on_rails_pro** section above.
223
+
224
+ From now on, the example and dummy apps will use your local packages/node-renderer folder as the `react_on_rails_pro` node package.
225
+
226
+ ### Install NPM dependencies and build the NPM package for react_on_rails_pro
227
+
228
+ ```sh
229
+ cd react_on_rails_pro
230
+ yarn install
231
+ ```
232
+
233
+ Or run this, which builds the yarn package, then the webpack files for spec/dummy, and finally runs tests in
234
+ spec/dummy.
235
+
236
+
237
+ ```sh
238
+ # Optionally change default selenium_firefox driver
239
+ # export DRIVER=poltergeist
240
+ cd react_on_rails_pro
241
+ yarn run dummy:spec
242
+ ```
243
+
244
+ ### Run NPM JS tests
245
+
246
+ ```sh
247
+ cd react_on_rails_pro
248
+ yarn test
249
+ ```
250
+
251
+ ### Debugging NPM JS tests
252
+
253
+ Example of using ndb to debug a test
254
+ ```bash
255
+ ndb $(yarn bin)/jest --runInBand packages/node-renderer/tests/**/*.test.[jt]s -t 'FriendsAndGuests bundle for commit 1a7fe417'
256
+ ```
257
+ Hit F8 and then a debugger statement within the test will get hit.
258
+
259
+ ### Creating new VM tests
260
+ 1. copy a server bundle to `packages/node-renderer/tests/fixtures/projects/<project-name>/<commit>`
261
+ 2. create a directory with a hash representing the commit of the project
262
+
263
+ ### Async issues with Jest
264
+ Beware that Jest runs multiple test files synchronously, so you can't use the same temporary directory
265
+ between tests. See the file [`packages/node-renderer/tests/helper.ts`](packages/node-renderer/tests/helper.ts) for how we handle this.
266
+
267
+ ### Run most tests and linting
268
+
269
+ ```sh
270
+ cd react_on_rails_pro
271
+ yarn run check
272
+ ```
273
+
274
+ ### Starting the Dummy App
275
+ Before running the dummy app,
276
+ you need to generate JavaScript packs in the dummy app project.
277
+ To do this,
278
+ go to `spec/dummy` directory and run the following rake task:
279
+
280
+ ```sh
281
+ bundle exec rake react_on_rails:generate_packs
282
+ ```
283
+
284
+ Since the dummy app requires several processes to run in the background, don't run `rails s` directly.
285
+ Instead, run `foreman start -f Procfile.dev`.
286
+ This requires [the `foreman` gem](https://github.com/ddollar/foreman) to be installed (`gem install foreman`).
287
+ Alternatively, you can use [`overmind`](https://github.com/DarthSim/overmind).
288
+
289
+ Doing this ensures the asset generation by webpack
290
+ and node renderer run in the background,
291
+ which is essential for the dummy app to work.
292
+
293
+ If you change the webpack configs, then you need to restart `foreman`.
294
+
295
+ ### RSpec Testing
296
+
297
+ Before running Ruby tests ensure you have done the following steps in `spec/dummy` directory:
298
+
299
+ ```sh
300
+ # in the root directory
301
+ bundle install
302
+ yarn install
303
+
304
+ cd spec/dummy
305
+
306
+ bundle install
307
+ bundle exec rake react_on_rails:generate_packs
308
+
309
+ yarn install
310
+
311
+ RAILS_ENV=test bin/shakapacker # to generate assets for test environment
312
+ ```
313
+
314
+ Then in a separate terminal, run the following to run the Node renderer and the test Rails server (only needed for the streaming tests) in the background:
315
+
316
+ ```sh
317
+ # in spec/dummy directory
318
+ yarn run node-renderer
319
+ RAILS_ENV=test bin/dev&
320
+ ```
321
+
322
+ Get back to your main terminal and run:
323
+
324
+ ```sh
325
+ bundle exec rspec
326
+ ```
327
+
328
+ If you run `rspec` at the top level, you'll see this message: `require': cannot load such file -- rails_helper (LoadError)`
329
+
330
+ After running a test, you can view the coverage results in SimpleCov reports by opening `coverage/index.html`.
331
+
332
+ ### Debugging
333
+ Start the sample app like this for some debug printing:
334
+
335
+ ```sh
336
+ TRACE_REACT_ON_RAILS=true && foreman start -f Procfile.dev
337
+ ```
338
+
339
+ # Releasing
340
+
341
+ ⚠️ **The release process has moved to the repository root.**
342
+
343
+ React on Rails Pro is now released together with React on Rails using unified versioning.
344
+ All packages (core + pro) are released together with the same version number.
345
+
346
+ Contact Justin Gordon, [justin@shakacode.com](mailto:justin@shakacode.com) for release permissions.
347
+
348
+ ## Prerequisites
349
+
350
+ You need authentication for public package registries:
351
+
352
+ **Public packages (npmjs.org + rubygems.org):**
353
+ - NPM: Run `npm login`
354
+ - RubyGems: Standard credentials via `gem push`
355
+
356
+ All React on Rails and React on Rails Pro packages are now published publicly to npmjs.org and RubyGems.org.
357
+
358
+ ## Release Command
359
+
360
+ From the **repository root**, run:
361
+
362
+ ```bash
363
+ # Full release
364
+ cd /path/to/react_on_rails
365
+ rake release[17.0.0]
366
+
367
+ # Dry run first
368
+ rake release[17.0.0,true]
369
+
370
+ # Test with Verdaccio
371
+ rake release[17.0.0,false,verdaccio]
372
+ ```
373
+
374
+ For complete documentation, see:
375
+ - [Root Release Documentation](../docs/contributor-info/releasing.md)
376
+ - Run `rake -D release` for inline help
data/Dockerfile ADDED
@@ -0,0 +1,63 @@
1
+ # Using Ubuntu Xenial Xerus 16.04 LTS (this is a minimal image with curl and vcs tool pre-installed):
2
+ FROM buildpack-deps:xenial
3
+
4
+ # Install dependencies.
5
+ RUN \
6
+ apt-get update \
7
+ && apt-get install tzdata build-essential \
8
+ chrpath libssl-dev libxft-dev libfreetype6 \
9
+ libfreetype6-dev libfontconfig1 libfontconfig1-dev -y
10
+
11
+ # Install Phantomjs 2.1.1:
12
+ ENV PHANTOM_JS=phantomjs-2.1.1-linux-x86_64
13
+ RUN \
14
+ wget https://github.com/Medium/phantomjs/releases/download/v2.1.1/$PHANTOM_JS.tar.bz2 \
15
+ && tar xvjf $PHANTOM_JS.tar.bz2 \
16
+ && mv $PHANTOM_JS /usr/local/share \
17
+ && ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin
18
+
19
+ # Add new user "renderer":
20
+ RUN adduser renderer
21
+
22
+ # Switch to created user and run further commands form its home directory.
23
+ # $HOME does not work under ENV directive (https://github.com/moby/moby/issues/2637), so we use custom ENV variable:
24
+ USER renderer
25
+ ENV USER_HOME=/home/renderer
26
+ WORKDIR $USER_HOME
27
+
28
+ # Install Ruby 2.4.3 from source, set GEM_HOME and expose executable paths:
29
+ ENV RUBY_MAJOR_MINOR=2.4
30
+ ENV RUBY_VERSION=$RUBY_MAJOR_MINOR.3
31
+ RUN \
32
+ wget http://ftp.ruby-lang.org/pub/ruby/$RUBY_MAJOR_MINOR/ruby-$RUBY_VERSION.tar.gz \
33
+ && tar -xvzf ruby-$RUBY_VERSION.tar.gz \
34
+ && rm ruby-$RUBY_VERSION.tar.gz \
35
+ && cd ruby-$RUBY_VERSION/ \
36
+ && ./configure --prefix=$USER_HOME \
37
+ && make \
38
+ && make install
39
+ ENV RUBY_HOME=$USER_HOME/ruby-$RUBY_VERSION
40
+ ENV GEM_HOME=$RUBY_HOME/gems
41
+ ENV PATH=$PATH:$RUBY_HOME:$RUBY_HOME/bin:$RUBY_HOME/gems/bin:
42
+
43
+ RUN gem install bundler
44
+
45
+ ENV NODE_VERSION=8.9.4
46
+ RUN \
47
+ wget https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz \
48
+ && tar -xvzf node-v$NODE_VERSION-linux-x64.tar.gz \
49
+ && mv node-v$NODE_VERSION-linux-x64 nodejs \
50
+ && rm node-v$NODE_VERSION-linux-x64.tar.gz
51
+ ENV PATH=$PATH:$USER_HOME/nodejs/bin:
52
+
53
+ ENV YARN_VERSION=1.6.0
54
+ RUN \
55
+ wget https://github.com/yarnpkg/yarn/releases/download/v$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz \
56
+ && mkdir yarn \
57
+ && tar -xvzf yarn-v$YARN_VERSION.tar.gz -C yarn \
58
+ && rm yarn-v$YARN_VERSION.tar.gz
59
+ ENV PATH=$PATH:$USER_HOME/yarn/yarn-v$YARN_VERSION/bin:
60
+
61
+ # Create a directory for the application and run further commands form there.
62
+ RUN mkdir -p project
63
+ WORKDIR $USER_HOME/project
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem"s dependencies in react_on_rails.gemspec
6
+ gemspec
7
+
8
+ eval_gemfile File.expand_path("./Gemfile.loader", __dir__)
@@ -0,0 +1,74 @@
1
+ # Keep in sync with https://github.com/shakacode/react_on_rails/blob/master/Gemfile.development_dependencies
2
+ # frozen_string_literal: true
3
+
4
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
5
+
6
+ ruby '3.3.7'
7
+
8
+ gem "react_on_rails", path: "../"
9
+
10
+ gem "shakapacker", "9.3.0"
11
+ gem "bootsnap", require: false
12
+ gem "rails", "~> 7.1"
13
+ gem "puma", "~> 6"
14
+
15
+ # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
16
+ gem "jbuilder"
17
+
18
+ gem "pg"
19
+
20
+ # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
21
+ gem "turbolinks"
22
+ gem "sqlite3", "~> 1.4"
23
+ gem "uglifier"
24
+ gem "jquery-rails"
25
+ gem "sprockets"
26
+ gem "sass-rails"
27
+
28
+ gem "net-http"
29
+ gem "net-smtp"
30
+ gem "net-imap"
31
+
32
+ gem "amazing_print"
33
+
34
+ group :development do
35
+ # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
36
+ gem 'web-console'
37
+ gem 'listen'
38
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
39
+ gem 'spring'
40
+ gem 'spring-watcher-listen'
41
+ end
42
+
43
+ group :development, :test do
44
+ gem 'faker'
45
+ gem 'graphiql-rails'
46
+ gem 'pry', '>= 0.14.1' # Console with powerful introspection capabilities
47
+ # Need to use master of pry-byebug to use latest pry version
48
+ gem 'pry-byebug', github: 'shakacode/pry-byebug' # Integrates pry with byebug
49
+ gem 'pry-doc' # Provide MRI Core documentation
50
+ gem 'pry-rails' # Causes rails console to open pry. `DISABLE_PRY_RAILS=1 rails c` can still open with IRB
51
+ gem 'pry-theme' # An easy way to customize Pry colors via theme files
52
+
53
+ gem "rbs", require: false
54
+ gem "rubocop", "1.36.0", require: false
55
+ gem 'rubocop-performance', "1.15.0", require: false
56
+ gem 'rubocop-rspec', "2.13.2", require: false
57
+ gem "scss_lint", require: false
58
+ gem 'fakefs', require: 'fakefs/safe'
59
+ end
60
+
61
+ group :test do
62
+ gem "capybara", ">= 3.38.0"
63
+ gem "capybara-screenshot"
64
+ gem "coveralls", require: false
65
+ gem "equivalent-xml"
66
+ gem "generator_spec"
67
+ gem "launchy"
68
+ gem "rspec_junit_formatter"
69
+ gem "rspec-rails"
70
+ gem "rspec-retry"
71
+ gem "selenium-webdriver", "4.9.0"
72
+ gem "webmock"
73
+ gem "webdrivers", "5.3.0"
74
+ end
data/Gemfile.loader ADDED
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Load base dependencies
4
+ base_deps = File.read(File.expand_path("./Gemfile.development_dependencies", __dir__))
5
+
6
+ # Determine which override file to use
7
+ override_deps = if ENV["CI"] == "true" && File.exist?(File.expand_path("./Gemfile.ci", __dir__))
8
+ # In CI environment, use CI dependencies
9
+ File.read(File.expand_path("./Gemfile.ci", __dir__))
10
+ elsif File.exist?(File.expand_path("./Gemfile.local", __dir__))
11
+ # In non-CI environment, use local dependencies if they exist
12
+ File.read(File.expand_path("./Gemfile.local", __dir__))
13
+ else
14
+ ""
15
+ end
16
+
17
+ # Parse override gems
18
+ override_gem_names = override_deps.scan(/^\s*gem\s+["']([^"']+)["']/).flatten
19
+
20
+ # Remove overridden gems from base dependencies
21
+ override_gem_names.each do |gem_name|
22
+ base_deps.gsub!(/^\s*gem\s+["']#{gem_name}["'].*$/, '')
23
+ end
24
+
25
+ # Clean up any blank lines created by removals
26
+ base_deps.gsub!(/^\s*$\n/, '')
27
+
28
+ # Evaluate the modified base dependencies
29
+ eval(base_deps)
30
+
31
+ # Evaluate override dependencies if they exist
32
+ eval(override_deps) unless override_deps.empty?