Skip to content

Commit 318e370

Browse files
justin808claude
andcommitted
Restructure monorepo with two top-level product directories
Move core code into react_on_rails/ directory alongside react_on_rails_pro/ to create clearer product separation in the monorepo. ## Changes ### Directory Structure - Move lib/, spec/, sig/, react_on_rails.gemspec into react_on_rails/ - Pro code remains in react_on_rails_pro/ (minimal changes) - NPM packages stay in packages/ (no changes) ### Configuration Updates - **Gemfile**: Add `path: "react_on_rails"` to gemspec declaration - **Gemspecs**: Update file listing to work with new structure - **Steepfile**: Update check paths and signature directory - **Rakefile helpers**: Add monorepo_root helper, update gem_root - **CI workflows**: Update all path references in GitHub Actions - **Documentation**: Update LICENSE.md, CONTRIBUTING.md path references ### Build Verification - ✅ Core gem builds successfully - ✅ Pro gem builds successfully - ✅ Bundle install works with new structure - 🔄 RSpec needs additional configuration (follow-up work) ## Benefits 1. **Crystal clear separation**: "Where's core?" → react_on_rails/ 2. **Symmetric structure**: Both products have identical organization 3. **Simpler licensing**: Directory boundaries match license boundaries 4. **Independent evolution**: Each product can evolve independently Ref: #2113 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 20d6969 commit 318e370

File tree

525 files changed

+102
-93
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

525 files changed

+102
-93
lines changed

.github/workflows/gem-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ jobs:
142142
run: |
143143
echo "CI_DEPENDENCY_LEVEL=${{ matrix.dependency-level }}" >> $GITHUB_ENV
144144
- name: Run rspec tests
145-
run: bundle exec rspec spec/react_on_rails
145+
run: bundle exec rspec react_on_rails/spec/react_on_rails
146146
- name: Store test results
147147
uses: actions/upload-artifact@v4
148148
with:

.github/workflows/integration-tests.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -142,31 +142,31 @@ jobs:
142142
- name: yalc publish for react-on-rails
143143
run: cd packages/react-on-rails && yalc publish
144144
- name: yalc add react-on-rails
145-
run: cd spec/dummy && yalc add react-on-rails
145+
run: cd react_on_rails/spec/dummy && yalc add react-on-rails
146146
- name: Install Node modules with Yarn for dummy app
147-
run: cd spec/dummy && yarn install --no-progress --no-emoji ${{ matrix.dependency-level == 'latest' && '--frozen-lockfile' || '' }}
147+
run: cd react_on_rails/spec/dummy && yarn install --no-progress --no-emoji ${{ matrix.dependency-level == 'latest' && '--frozen-lockfile' || '' }}
148148
- name: Save dummy app ruby gems to cache
149149
uses: actions/cache@v4
150150
with:
151-
path: spec/dummy/vendor/bundle
152-
key: dummy-app-gem-cache-${{ hashFiles('spec/dummy/Gemfile.lock') }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
151+
path: react_on_rails/spec/dummy/vendor/bundle
152+
key: dummy-app-gem-cache-${{ hashFiles('react_on_rails/spec/dummy/Gemfile.lock') }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
153153
- name: Install Ruby Gems for dummy app
154154
run: |
155-
cd spec/dummy
155+
cd react_on_rails/spec/dummy
156156
bundle lock --add-platform 'x86_64-linux'
157157
if ! bundle check --path=vendor/bundle; then
158158
bundle _2.5.9_ install --path=vendor/bundle --jobs=4 --retry=3
159159
fi
160160
- name: generate file system-based packs
161-
run: cd spec/dummy && RAILS_ENV="test" bundle exec rake react_on_rails:generate_packs
161+
run: cd react_on_rails/spec/dummy && RAILS_ENV="test" bundle exec rake react_on_rails:generate_packs
162162
- name: Build test bundles for dummy app
163-
run: cd spec/dummy && rm -rf public/webpack/test && yarn run build:rescript && RAILS_ENV="test" NODE_ENV="test" bin/shakapacker
163+
run: cd react_on_rails/spec/dummy && rm -rf public/webpack/test && yarn run build:rescript && RAILS_ENV="test" NODE_ENV="test" bin/shakapacker
164164
- id: get-sha
165165
run: echo "sha=\"$(git rev-parse HEAD)\"" >> "$GITHUB_OUTPUT"
166166
- name: Save test Webpack bundles to cache (for build number checksum used by RSpec job)
167167
uses: actions/cache/save@v4
168168
with:
169-
path: spec/dummy/public/webpack
169+
path: react_on_rails/spec/dummy/public/webpack
170170
key: dummy-app-webpack-bundle-${{ steps.get-sha.outputs.sha }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
171171

172172
dummy-app-integration-tests:
@@ -222,14 +222,14 @@ jobs:
222222
- name: Save dummy app ruby gems to cache
223223
uses: actions/cache@v4
224224
with:
225-
path: spec/dummy/vendor/bundle
226-
key: dummy-app-gem-cache-${{ hashFiles('spec/dummy/Gemfile.lock') }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
225+
path: react_on_rails/spec/dummy/vendor/bundle
226+
key: dummy-app-gem-cache-${{ hashFiles('react_on_rails/spec/dummy/Gemfile.lock') }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
227227
- id: get-sha
228228
run: echo "sha=\"$(git rev-parse HEAD)\"" >> "$GITHUB_OUTPUT"
229229
- name: Save test Webpack bundles to cache (for build number checksum used by RSpec job)
230230
uses: actions/cache@v4
231231
with:
232-
path: spec/dummy/public/webpack
232+
path: react_on_rails/spec/dummy/public/webpack
233233
key: dummy-app-webpack-bundle-${{ steps.get-sha.outputs.sha }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
234234
- name: Install Node modules with Yarn
235235
run: |
@@ -238,12 +238,12 @@ jobs:
238238
- name: yalc publish for react-on-rails
239239
run: cd packages/react-on-rails && yalc publish
240240
- name: yalc add react-on-rails
241-
run: cd spec/dummy && yalc add react-on-rails
241+
run: cd react_on_rails/spec/dummy && yalc add react-on-rails
242242
- name: Install Node modules with Yarn for dummy app
243-
run: cd spec/dummy && yarn install --no-progress --no-emoji ${{ matrix.dependency-level == 'latest' && '--frozen-lockfile' || '' }}
243+
run: cd react_on_rails/spec/dummy && yarn install --no-progress --no-emoji ${{ matrix.dependency-level == 'latest' && '--frozen-lockfile' || '' }}
244244
- name: Dummy JS tests
245245
run: |
246-
cd spec/dummy
246+
cd react_on_rails/spec/dummy
247247
yarn run test:js
248248
- name: Install Ruby Gems for package
249249
run: |
@@ -253,7 +253,7 @@ jobs:
253253
fi
254254
- name: Install Ruby Gems for dummy app
255255
run: |
256-
cd spec/dummy
256+
cd react_on_rails/spec/dummy
257257
bundle lock --add-platform 'x86_64-linux'
258258
if ! bundle check --path=vendor/bundle; then
259259
bundle _2.5.9_ install --path=vendor/bundle --jobs=4 --retry=3
@@ -273,14 +273,14 @@ jobs:
273273
- name: Increase the amount of inotify watchers
274274
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
275275
- name: generate file system-based packs
276-
run: cd spec/dummy && RAILS_ENV="test" bundle exec rake react_on_rails:generate_packs
276+
run: cd react_on_rails/spec/dummy && RAILS_ENV="test" bundle exec rake react_on_rails:generate_packs
277277
- name: Git Stuff
278278
if: matrix.dependency-level == 'minimum'
279279
run: |
280280
git config user.email "you@example.com"
281281
git config user.name "Your Name"
282282
git commit -am "stop generators from complaining about uncommitted code"
283-
- run: cd spec/dummy && bundle info shakapacker
283+
- run: cd react_on_rails/spec/dummy && bundle info shakapacker
284284
- name: Set packer version environment variable
285285
run: |
286286
echo "CI_DEPENDENCY_LEVEL=ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}" >> $GITHUB_ENV
@@ -295,14 +295,14 @@ jobs:
295295
uses: actions/upload-artifact@v4
296296
with:
297297
name: dummy-app-capybara-${{ github.run_id }}-${{ github.job }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
298-
path: spec/dummy/tmp/capybara
298+
path: react_on_rails/spec/dummy/tmp/capybara
299299
- name: Store artifacts
300300
uses: actions/upload-artifact@v4
301301
with:
302302
name: dummy-app-test-log-${{ github.run_id }}-${{ github.job }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
303-
path: spec/dummy/log/test.log
303+
path: react_on_rails/spec/dummy/log/test.log
304304
- name: Store artifacts
305305
uses: actions/upload-artifact@v4
306306
with:
307307
name: dummy-app-yarn-log-${{ github.run_id }}-${{ github.job }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
308-
path: spec/dummy/yarn-error.log
308+
path: react_on_rails/spec/dummy/yarn-error.log

.github/workflows/lint-js-and-ruby.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ jobs:
121121
- name: yalc publish for react-on-rails
122122
run: cd packages/react-on-rails && yalc publish
123123
- name: yalc add react-on-rails
124-
run: cd spec/dummy && yalc add react-on-rails
124+
run: cd react_on_rails/spec/dummy && yalc add react-on-rails
125125
- name: Install Node modules with Yarn for dummy app
126-
run: cd spec/dummy && yarn install --no-progress --no-emoji --frozen-lockfile
126+
run: cd react_on_rails/spec/dummy && yarn install --no-progress --no-emoji --frozen-lockfile
127127
- name: Install Ruby Gems for package
128128
run: bundle check --path=vendor/bundle || bundle _2.5.9_ install --path=vendor/bundle --jobs=4 --retry=3
129129
- name: Lint Ruby
@@ -137,17 +137,17 @@ jobs:
137137
- name: Save dummy app ruby gems to cache
138138
uses: actions/cache@v4
139139
with:
140-
path: spec/dummy/vendor/bundle
141-
key: dummy-app-gem-cache-${{ hashFiles('spec/dummy/Gemfile.lock') }}-lint
140+
path: react_on_rails/spec/dummy/vendor/bundle
141+
key: dummy-app-gem-cache-${{ hashFiles('react_on_rails/spec/dummy/Gemfile.lock') }}-lint
142142
- name: Install Ruby Gems for dummy app
143143
run: |
144-
cd spec/dummy
144+
cd react_on_rails/spec/dummy
145145
bundle lock --add-platform 'x86_64-linux'
146146
if ! bundle check --path=vendor/bundle; then
147147
bundle _2.5.9_ install --path=vendor/bundle --jobs=4 --retry=3
148148
fi
149149
- name: generate file system-based packs
150-
run: cd spec/dummy && RAILS_ENV="test" bundle exec rake react_on_rails:generate_packs
150+
run: cd react_on_rails/spec/dummy && RAILS_ENV="test" bundle exec rake react_on_rails:generate_packs
151151
- name: Detect dead code
152152
run: |
153153
yarn run knip --exclude binaries

.github/workflows/package-js-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ on:
99
paths-ignore:
1010
- '**.md'
1111
- 'docs/**'
12-
- 'lib/**'
13-
- 'spec/react_on_rails/**'
12+
- 'react_on_rails/lib/**'
13+
- 'react_on_rails/spec/react_on_rails/**'
1414
- 'react_on_rails_pro/**'
1515
workflow_dispatch:
1616
inputs:

.github/workflows/playwright.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,32 +61,32 @@ jobs:
6161
run: yarn install
6262

6363
- name: Install dummy app dependencies
64-
working-directory: spec/dummy
64+
working-directory: react_on_rails/spec/dummy
6565
run: |
6666
bundle install
6767
yarn install
6868
6969
- name: Install Playwright browsers
70-
working-directory: spec/dummy
70+
working-directory: react_on_rails/spec/dummy
7171
run: yarn playwright install --with-deps
7272

7373
- name: Generate React on Rails packs
74-
working-directory: spec/dummy
74+
working-directory: react_on_rails/spec/dummy
7575
env:
7676
RAILS_ENV: test
7777
run: bundle exec rake react_on_rails:generate_packs
7878

7979
- name: Build test assets
80-
working-directory: spec/dummy
80+
working-directory: react_on_rails/spec/dummy
8181
run: yarn run build:test
8282

8383
- name: Run Playwright tests
84-
working-directory: spec/dummy
84+
working-directory: react_on_rails/spec/dummy
8585
run: yarn run test:e2e
8686

8787
- uses: actions/upload-artifact@v4
8888
if: always()
8989
with:
9090
name: playwright-report
91-
path: spec/dummy/e2e/playwright-report/
91+
path: react_on_rails/spec/dummy/e2e/playwright-report/
9292
retention-days: 30

.github/workflows/pro-integration-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ on:
99
paths-ignore:
1010
- '**.md'
1111
- 'docs/**'
12-
- 'lib/**'
13-
- 'spec/**'
12+
- 'react_on_rails/lib/**'
13+
- 'react_on_rails/spec/**'
1414
- 'packages/react_on_rails/**'
1515
workflow_dispatch:
1616
inputs:

.github/workflows/pro-lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ on:
99
paths-ignore:
1010
- '**.md'
1111
- 'docs/**'
12-
- 'lib/**'
13-
- 'spec/**'
12+
- 'react_on_rails/lib/**'
13+
- 'react_on_rails/spec/**'
1414
- 'packages/react_on_rails/**'
1515
workflow_dispatch:
1616
inputs:

.github/workflows/pro-test-package-and-gem.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ on:
99
paths-ignore:
1010
- '**.md'
1111
- 'docs/**'
12-
- 'lib/**'
13-
- 'spec/**'
12+
- 'react_on_rails/lib/**'
13+
- 'react_on_rails/spec/**'
1414
- 'packages/react_on_rails/**'
1515
workflow_dispatch:
1616
inputs:

CONTRIBUTING.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,18 @@ It's critical to configure your IDE/editor to ignore certain directories. Otherw
4343
- /gen-examples
4444
- /packages/react-on-rails/lib
4545
- /node_modules
46-
- /spec/dummy/app/assets/webpack
47-
- /spec/dummy/log
48-
- /spec/dummy/node_modules
49-
- /spec/dummy/client/node_modules
50-
- /spec/dummy/tmp
51-
- /spec/react_on_rails/dummy-for-generators
46+
- /react_on_rails/spec/dummy/app/assets/webpack
47+
- /react_on_rails/spec/dummy/log
48+
- /react_on_rails/spec/dummy/node_modules
49+
- /react_on_rails/spec/dummy/client/node_modules
50+
- /react_on_rails/spec/dummy/tmp
51+
- /react_on_rails/spec/react_on_rails/dummy-for-generators
5252

5353
# Example apps
5454

55-
The [`spec/dummy` app](https://github.com/shakacode/react_on_rails/blob/master/spec/dummy) is an example of the various setup techniques you can use with the gem.
55+
The [`react_on_rails/spec/dummy` app](https://github.com/shakacode/react_on_rails/blob/master/react_on_rails/spec/dummy) is an example of the various setup techniques you can use with the gem.
5656

57-
There are also two such apps for React on Rails Pro: [one using the Node renderer](https://github.com/shakacode/react_on_rails/blob/master/react_on_rails_pro/spec/dummy) and [one using ExecJS](https://github.com/shakacode/react_on_rails/blob/master/react_on_rails_pro/spec/execjs-compatible-dummy).
57+
There are also two such apps for React on Rails Pro: [one using the Node renderer](https://github.com/shakacode/react_on_rails/blob/master/react_on_rails_pro/react_on_rails/spec/dummy) and [one using ExecJS](https://github.com/shakacode/react_on_rails/blob/master/react_on_rails_pro/spec/execjs-compatible-dummy).
5858

5959
When you add a new feature, consider adding an example demonstrating it to the example apps.
6060

@@ -124,19 +124,19 @@ When you run `yalc push`, you'll get an informative message
124124
```terminaloutput
125125
$ yalc push
126126
react-on-rails@12.0.0-12070fd1 published in store.
127-
Pushing react-on-rails@12.0.0 in /Users/justin/shakacode/react-on-rails/react_on_rails/spec/dummy
128-
Package react-on-rails@12.0.0-12070fd1 added ==> /Users/justin/shakacode/react-on-rails/react_on_rails/spec/dummy/node_modules/react-on-rails.
127+
Pushing react-on-rails@12.0.0 in /Users/justin/shakacode/react-on-rails/react_on_rails/react_on_rails/spec/dummy
128+
Package react-on-rails@12.0.0-12070fd1 added ==> /Users/justin/shakacode/react-on-rails/react_on_rails/react_on_rails/spec/dummy/node_modules/react-on-rails.
129129
Don't forget you may need to run yarn after adding packages with yalc to install/update dependencies/bin scripts.
130130
```
131131

132132
Of course, you can do the same with `react-on-rails-pro` and `react-on-rails-pro-node-renderer` packages.
133133

134-
This is the approach `spec/dummy` apps use, so you can also look at their implementation.
134+
This is the approach `react_on_rails/spec/dummy` apps use, so you can also look at their implementation.
135135

136136
### Example: Testing NPM changes with the dummy app
137137

138138
1. Add `console.log('Hello!')` to [clientStartup.ts, function render](https://github.com/shakacode/react_on_rails/blob/master/packages/react-on-rails/src/clientStartup.ts) in `/packages/react-on-rails/src/clientStartup.ts` to confirm we're getting an update to the node package client-side. Do the same for function `serverRenderReactComponent` in [/packages/react-on-rails/src/serverRenderReactComponent.ts](https://github.com/shakacode/react_on_rails/blob/master/packages/react-on-rails/src/serverRenderReactComponent.ts).
139-
2. Refresh the browser if the server is already running or start the server using `foreman start` from `react_on_rails/spec/dummy` and navigate to `http://localhost:3000/`. You will now see the `Hello!` message printed in the browser's console. If you did not see that message, then review the steps above for the workflow of making changes and pushing them via yalc.
139+
2. Refresh the browser if the server is already running or start the server using `foreman start` from `react_on_rails/react_on_rails/spec/dummy` and navigate to `http://localhost:3000/`. You will now see the `Hello!` message printed in the browser's console. If you did not see that message, then review the steps above for the workflow of making changes and pushing them via yalc.
140140

141141
## Git dependencies
142142

@@ -199,7 +199,7 @@ or the equivalent command for your package manager.
199199

200200
### Prereqs
201201

202-
After checking out the repo, making sure you have Ruby and Node version managers set up (such as rvm and nvm, or rbenv and nodenv, etc.), 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.
202+
After checking out the repo, making sure you have Ruby and Node version managers set up (such as rvm and nvm, or rbenv and nodenv, etc.), cd to `react_on_rails/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.
203203

204204
### Local Node Package
205205

@@ -224,8 +224,8 @@ yarn
224224
yarn build
225225
```
226226

227-
Or run this, which builds the Yarn package, then the Webpack files for `spec/dummy`, and runs tests in
228-
`spec/dummy`.
227+
Or run this, which builds the Yarn package, then the Webpack files for `react_on_rails/spec/dummy`, and runs tests in
228+
`react_on_rails/spec/dummy`.
229229

230230
```sh
231231
# Optionally change default capybara driver
@@ -253,10 +253,10 @@ cd react_on_rails/
253253
yarn run test
254254
```
255255

256-
### spec/dummy tests
256+
### react_on_rails/spec/dummy tests
257257

258258
```sh
259-
cd react_on_rails/spec/dummy
259+
cd react_on_rails/react_on_rails/spec/dummy
260260
rspec
261261
```
262262

@@ -309,7 +309,7 @@ To run the dummy app, it's **CRITICAL** to not just run `rails s`. You have to r
309309

310310
### RSpec Testing
311311

312-
Run `rake` for testing the gem and `spec/dummy`. Otherwise, the `rspec` command only works for testing within the sample apps, like `spec/dummy`.
312+
Run `rake` for testing the gem and `react_on_rails/spec/dummy`. Otherwise, the `rspec` command only works for testing within the sample apps, like `react_on_rails/spec/dummy`.
313313

314314
If you run `rspec` at the top level, you'll see this message: `require': cannot load such file -- rails_helper (LoadError)`
315315

@@ -794,7 +794,7 @@ You can run specific linting for directories or files by using `docker-compose r
794794
2 files require updating to update the Rubocop version:
795795

796796
1. `react_on_rails.gemspec`
797-
2. `spec/dummy/Gemfile`
797+
2. `react_on_rails/spec/dummy/Gemfile`
798798

799799
### Docker CI - Test and Linting
800800

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
source "https://rubygems.org"
44

55
# Specify your gem"s dependencies in react_on_rails.gemspec
6-
gemspec
6+
gemspec path: "react_on_rails"
77

88
eval_gemfile File.expand_path("./Gemfile.development_dependencies", __dir__)

0 commit comments

Comments
 (0)