Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
7745727
Phase 3: Prepare core package for workspace structure
AbanoubGhadban Sep 26, 2025
ce91f23
Fix CI failures: Update Knip config and test imports for workspace st…
AbanoubGhadban Sep 26, 2025
0182224
Fix package.json workspace configuration for publishing
AbanoubGhadban Sep 26, 2025
6f08b49
Fix workspace configuration for publishing and CI
AbanoubGhadban Sep 26, 2025
385df7f
Fix Knip configuration to ignore build output directories
AbanoubGhadban Sep 28, 2025
4417277
Fix ESLint configuration for workspace package imports
AbanoubGhadban Sep 28, 2025
3b34f34
Fix Jest configuration for workspace and testing library setup
AbanoubGhadban Sep 28, 2025
5fd223e
Fix Jest setupFilesAfterEnv path resolution for CI
AbanoubGhadban Sep 28, 2025
ef7c6e6
Update Gemfile.lock and package.json for path corrections
AbanoubGhadban Sep 28, 2025
4b94aba
Update script/convert for workspace structure
AbanoubGhadban Sep 28, 2025
8cf9138
Remove setupFilesAfterEnv from Jest configuration and clean up conver…
AbanoubGhadban Sep 28, 2025
ee4487a
Update CircleCI configuration to enhance caching strategy for node_mo…
AbanoubGhadban Sep 28, 2025
5eb784f
Update package.json to simplify link-source script by removing redund…
AbanoubGhadban Sep 28, 2025
a9e1e01
Update link-source script in package.json to target the correct direc…
AbanoubGhadban Sep 28, 2025
3250a03
Update build output path to workspace package directory
AbanoubGhadban Sep 28, 2025
660cab3
Complete workspace migration: move tests, scripts, and babel config
AbanoubGhadban Sep 28, 2025
eab8e2a
Refactor package.json scripts to utilize workspaces for improved comm…
AbanoubGhadban Sep 28, 2025
c1c6b45
Enhance package.json scripts for improved workspace management
AbanoubGhadban Sep 28, 2025
b34e161
Rename package to react-on-rails-workspace and streamline scripts in …
AbanoubGhadban Sep 28, 2025
946698d
Update CircleCI configuration to streamline caching for node_modules …
AbanoubGhadban Sep 28, 2025
a784eb6
Update Knip configuration and package.json scripts for improved path …
AbanoubGhadban Sep 28, 2025
87fe9cc
Revert unnecessary file extension changes
AbanoubGhadban Sep 29, 2025
3e992bc
Add global Jest configuration and refactor Knip settings
AbanoubGhadban Sep 29, 2025
20f2f0b
Update ESLint configuration to reflect new package structure
AbanoubGhadban Sep 29, 2025
dfc1275
Update configuration files to reflect package structure changes
AbanoubGhadban Sep 29, 2025
caf8d34
Update MONOREPO_MERGER_PLAN.md to reflect co-located test structure
AbanoubGhadban Sep 29, 2025
325e4e8
Update documentation and references to reflect new package structure
AbanoubGhadban Sep 29, 2025
e0d1365
Update test command in convert script for improved execution
AbanoubGhadban Sep 29, 2025
fd728b3
Update Knip configuration and package.json scripts for improved execu…
AbanoubGhadban Sep 29, 2025
0a97c1e
Update test command in package.json for improved execution
AbanoubGhadban Sep 29, 2025
86e0ab6
Update DIRECTORY_LICENSING.md to reflect new directory structure
AbanoubGhadban Sep 29, 2025
ceb15a6
Update DIRECTORY_LICENSING.md to reflect new directory structure and …
AbanoubGhadban Sep 29, 2025
4331ea1
Update CONTRIBUTING.md to correct link formatting
AbanoubGhadban Sep 29, 2025
40ccdb2
Update MONOREPO_MERGER_PLAN.md to specify new build output locations …
AbanoubGhadban Sep 29, 2025
c9c406f
Update MONOREPO_MERGER_PLAN.md and MONOREPO_MERGER_PLAN_REF.md to ref…
AbanoubGhadban Sep 29, 2025
804a88d
Update MONOREPO_MERGER_PLAN.md and MONOREPO_MERGER_PLAN_REF.md to ref…
AbanoubGhadban Sep 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/lint-js-and-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
yarn install --no-progress --no-emoji --frozen-lockfile
sudo yarn global add yalc
- name: yalc publish for react-on-rails
run: yalc publish
run: cd packages/react-on-rails && yalc publish
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Build before yalc publish to ensure lib exists

The workflow publishes via yalc without building first. Insert a build step before publishing.

-      - name: yalc publish for react-on-rails
-        run: cd packages/react-on-rails && yalc publish
+      - name: Build package
+        run: yarn workspace react-on-rails build
+      - name: yalc publish for react-on-rails
+        run: cd packages/react-on-rails && yalc publish
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
run: cd packages/react-on-rails && yalc publish
- name: Build package
run: yarn workspace react-on-rails build
- name: yalc publish for react-on-rails
run: cd packages/react-on-rails && yalc publish
πŸ€– Prompt for AI Agents
.github/workflows/lint-js-and-ruby.yml around line 48: the workflow calls "cd
packages/react-on-rails && yalc publish" without building the package first;
update the job to run the package's build script before publishing (e.g., "cd
packages/react-on-rails && yarn install && yarn build" or the equivalent
npm/pnpm commands), ensuring the lib/dist output exists before invoking "yalc
publish".

- name: yalc add react-on-rails
run: cd spec/dummy && yalc add react-on-rails
- name: Install Node modules with Yarn for dummy app
Expand Down Expand Up @@ -81,12 +81,12 @@ jobs:
- name: Type-check TypeScript
run: yarn run type-check
- name: Pack for attw and publint
run: yarn pack -f react-on-rails.tgz
run: cd packages/react-on-rails && yarn pack -f react-on-rails.tgz
- name: Lint package types
# our package is ESM-only
run: yarn run attw react-on-rails.tgz --profile esm-only
run: yarn run attw packages/react-on-rails/react-on-rails.tgz --profile esm-only
- name: Lint package publishing
run: yarn run publint --strict react-on-rails.tgz
run: yarn run publint --strict packages/react-on-rails/react-on-rails.tgz
# We only download and run Actionlint if there is any difference in GitHub Action workflows
# https://github.com/rhysd/actionlint/blob/main/docs/usage.md#on-github-actions
- name: Check GitHub Action changes
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
yarn install --no-progress --no-emoji ${{ matrix.dependency-level == 'latest' && '--frozen-lockfile' || '' }}
sudo yarn global add yalc
- name: yalc publish for react-on-rails
run: yalc publish
run: cd packages/react-on-rails && yalc publish
- name: yalc add react-on-rails
run: cd spec/dummy && yalc add react-on-rails
- name: Install Node modules with Yarn for dummy app
Expand Down Expand Up @@ -159,7 +159,7 @@ jobs:
yarn install --no-progress --no-emoji ${{ matrix.dependency-level == 'latest' && '--frozen-lockfile' || '' }}
sudo yarn global add yalc
- name: yalc publish for react-on-rails
run: yalc publish
run: cd packages/react-on-rails && yalc publish
- name: yalc add react-on-rails
run: cd spec/dummy && yalc add react-on-rails
- name: Install Node modules with Yarn for dummy app
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ tmp/

node_modules

/node_package/lib
/packages/*/lib

yarn-debug.*
yarn-error.*
Expand Down
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ tmp/
coverage/
**/app/assets/webpack/
gen-examples/examples/*
node_package/lib/*
packages/*/lib/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Keep ignoring node_package/lib while builds still output there

PR states outDir remains node_package/lib; replacing the ignore with packages//lib/ drops coverage for node_package/lib and may format compiled artifacts. Add both patterns.

Apply:

- packages/*/lib/*
+node_package/lib/*
+packages/*/lib/*

Based on learnings.

πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
packages/*/lib/*
node_package/lib/*
packages/*/lib/*
πŸ€– Prompt for AI Agents
In .prettierignore around line 9, the current single pattern "packages/*/lib/*"
removes the existing ignore for node_package/lib and may cause compiled
artifacts to be formatted and coverage to drop; update the file to include both
patterns so compiled output remains ignored β€” add or preserve both
"packages/*/lib/*" and "node_package/lib" (or "node_package/lib/*") on separate
lines to ensure both locations are ignored.

spec/react_on_rails/dummy-for-generators/app/javascript/bundles/HelloWorld/*
bundle/
spec/dummy/lib/bs/**
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Changes since the last non-beta release.

#### Pro License Features

- **Core/Pro separation**: Moved Pro features into dedicated `lib/react_on_rails/pro/` and `node_package/src/pro/` directories with clear licensing boundaries [PR 1791](https://github.com/shakacode/react_on_rails/pull/1791) by [AbanoubGhadban](https://github.com/AbanoubGhadban)
- **Core/Pro separation**: Moved Pro features into dedicated `lib/react_on_rails/pro/` and `node_package/src/pro/` directories with clear licensing boundaries (now located at `packages/react-on-rails/src/pro/`) [PR 1791](https://github.com/shakacode/react_on_rails/pull/1791) by [AbanoubGhadban](https://github.com/AbanoubGhadban)
- **Runtime license validation**: Implemented Pro license gating with graceful fallback to core functionality when Pro license unavailable [PR 1791](https://github.com/shakacode/react_on_rails/pull/1791) by [AbanoubGhadban](https://github.com/AbanoubGhadban)
- **Enhanced immediate hydration**: Improved immediate hydration functionality with Pro license validation and warning badges [PR 1791](https://github.com/shakacode/react_on_rails/pull/1791) by [AbanoubGhadban](https://github.com/AbanoubGhadban)
- **License documentation**: Added NOTICE files in Pro directories referencing canonical `REACT-ON-RAILS-PRO-LICENSE.md` [PR 1791](https://github.com/shakacode/react_on_rails/pull/1791) by [AbanoubGhadban](https://github.com/AbanoubGhadban)
Expand Down Expand Up @@ -400,6 +400,8 @@ _Major bump because dropping support for Ruby 2.7 and deprecated `webpackConfigL
@ ./client/app/packs/client-bundle.js 5:0-42 32:0-23 35:0-21 59:0-26
```

_Note: The `node_package/lib/` path in these error examples is now `packages/react-on-rails/lib/` in the current structure._

Comment on lines +403 to +404
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Path note contradicts Phase 3 objective; keep output at node_package/lib

The note says errors now point to packages/react-on-rails/lib/, but Phase 3 preserves build output at node_package/lib/ for backward compatibility. Update the note accordingly to avoid confusing users and tools relying on that path.

-  _Note: The `node_package/lib/` path in these error examples is now `packages/react-on-rails/lib/` in the current structure._
+  _Note: The build output path remains `node_package/lib/` for backward compatibility in this phase._

Based on learnings.

πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
_Note: The `node_package/lib/` path in these error examples is now `packages/react-on-rails/lib/` in the current structure._
_Note: The build output path remains `node_package/lib/` for backward compatibility in this phase._
πŸ€– Prompt for AI Agents
CHANGELOG.md around lines 403-404: the note currently states the error path
changed to packages/react-on-rails/lib/, which contradicts Phase 3 objective to
preserve build output at node_package/lib/; update the sentence to state that
the error examples continue to point to node_package/lib/ (or clarify that
node_package/lib/ remains for backward compatibility) and remove or reword the
reference to packages/react-on-rails/lib/ so users and tools are not misled.

It can be safely [suppressed](https://webpack.js.org/configuration/other-options/#ignorewarnings) in your Webpack configuration.

### [13.0.2] - 2022-03-09
Expand Down
10 changes: 5 additions & 5 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Git hooks will automatically run linting on **all changed files (staged + unstag
- **Code Formatting**:
- Format code with Prettier: `rake autofix`
- Check formatting without fixing: `yarn start format.listDifferent`
- **Build**: `yarn run build` (compiles TypeScript to JavaScript in node_package/lib)
- **Build**: `yarn run build` (compiles TypeScript to JavaScript in packages/react-on-rails/lib)
- **Type checking**: `yarn run type-check`
- **⚠️ MANDATORY BEFORE GIT PUSH**: `bundle exec rubocop` and fix ALL violations + ensure trailing newlines
- Never run `npm` commands, only equivalent Yarn Classic ones
Expand Down Expand Up @@ -86,7 +86,7 @@ Git hooks will automatically run linting on **all changed files (staged + unstag
This project maintains both a Ruby gem and an NPM package:

- **Ruby gem**: Located in `lib/`, provides Rails integration and server-side rendering
- **NPM package**: Located in `node_package/src/`, provides client-side React integration
- **NPM package**: Located in `packages/react-on-rails/src/`, provides client-side React integration

### Core Components

Expand All @@ -98,7 +98,7 @@ This project maintains both a Ruby gem and an NPM package:
- **`engine.rb`**: Rails engine integration
- **Generators**: Located in `lib/generators/react_on_rails/`

#### JavaScript/TypeScript Side (`node_package/src/`)
#### JavaScript/TypeScript Side (`packages/react-on-rails/src/`)

- **`ReactOnRails.ts`**: Main entry point for client-side functionality
- **`serverRenderReactComponent.ts`**: Server-side rendering logic
Expand All @@ -108,7 +108,7 @@ This project maintains both a Ruby gem and an NPM package:
### Build System

- **Ruby**: Standard gemspec-based build
- **JavaScript**: TypeScript compilation to `node_package/lib/`
- **JavaScript**: TypeScript compilation to `packages/react-on-rails/lib/`
- **Testing**: Jest for JS, RSpec for Ruby
- **Linting**: ESLint for JS/TS, RuboCop for Ruby

Expand All @@ -130,6 +130,6 @@ This project maintains both a Ruby gem and an NPM package:

Exclude these directories to prevent IDE slowdowns:

- `/coverage`, `/tmp`, `/gen-examples`, `/node_package/lib`
- `/coverage`, `/tmp`, `/gen-examples`, `/packages/react-on-rails/lib`
- `/node_modules`, `/spec/dummy/node_modules`, `/spec/dummy/tmp`
- `/spec/dummy/app/assets/webpack`, `/spec/dummy/log`
2 changes: 1 addition & 1 deletion CODING_AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ Use `gh pr create` with:
When analyzing codebases, ignore these directories to avoid confusion:

- `/coverage`, `/tmp`, `/gen-examples`
- `/node_package/lib`, `/node_modules`
- `/packages/react-on-rails/lib`, `/node_modules`
- `/spec/dummy/app/assets/webpack`
- `/spec/dummy/log`, `/spec/dummy/node_modules`, `/spec/dummy/tmp`
- `/spec/react_on_rails/dummy-for-generators`
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ It's critical to configure your IDE/editor to ignore certain directories. Otherw
- /coverage
- /tmp
- /gen-examples
- /node_package/lib
- /packages/react-on-rails/lib
- /node_modules
Comment on lines 40 to 44
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟑 Minor

Restore /node_package/lib in the ignore list.

The TypeScript build still writes compiled output to node_package/lib, so removing that entry means IDEs will index a large generated tree again. Please keep ignoring /node_package/lib (and add the new workspace path if needed) so local tooling stays performant.

πŸ€– Prompt for AI Agents
In CONTRIBUTING.md around lines 40 to 44, the repo's ignore list removed the
generated TypeScript output path causing IDEs to index large compiled trees;
restore the /node_package/lib entry (and add any new workspace equivalent if
your workspace uses a different top-level package path) back into the list of
ignored paths so compiled artifacts (e.g., node_package/lib) are not
tracked/indexed by local tooling.

- /spec/dummy/app/assets/webpack
- /spec/dummy/log
Expand Down Expand Up @@ -121,7 +121,7 @@ Don't forget you may need to run yarn after adding packages with yalc to install

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

1. Add `console.log('Hello!')` to [clientStartup.ts, function render](https://github.com/shakacode/react_on_rails/blob/master/node_package/src/clientStartup.ts in `/node_package/src/clientStartup.js` to confirm we're getting an update to the node package client side. Do the same for function `serverRenderReactComponent` in `/node_package/src/serverRenderReactComponent.ts`.
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).
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:5000/`. 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.

# Development Setup for Gem and Node Package Contributors
Expand All @@ -134,7 +134,7 @@ After checking out the repo, making sure you have Ruby and Node version managers

### Local Node Package

Note, the example and dummy apps will use your local `node_packages` folder as the `react-on-rails` node package. This will also be done automatically for you via the `rake examples:gen_all` rake task.
Note, the example and dummy apps will use your local `packages/react-on-rails` folder as the `react-on-rails` node package. This will also be done automatically for you via the `rake examples:gen_all` rake task.

_Side note: It's critical to use the alias section of the Webpack config to avoid a double inclusion error. This has already been done for you in the example and dummy apps, but for reference:_

Expand Down
8 changes: 4 additions & 4 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ This repository contains code under two different licenses:
The following directories and all their contents are licensed under the **MIT License** (see full text below):

- `lib/react_on_rails/` (excluding `lib/react_on_rails/pro/`)
- `node_package/src/` (excluding `node_package/src/pro/`)
- `node_package/lib/` (excluding `node_package/lib/pro/`)
- `packages/react-on-rails/` (excluding `packages/react-on-rails/src/pro/`)
- `packages/react-on-rails/lib/` (excluding `packages/react-on-rails/lib/pro/`)
- All other directories in this repository not explicitly listed as Pro-licensed

### Pro Licensed Code

The following directories and all their contents are licensed under the **React on Rails Pro License**:

- `lib/react_on_rails/pro/`
- `node_package/src/pro/`
- `node_package/lib/pro/`
- `packages/react-on-rails/src/pro/`
- `packages/react-on-rails/lib/pro/`
- `react_on_rails_pro/` (entire directory)

See [REACT-ON-RAILS-PRO-LICENSE.md](./REACT-ON-RAILS-PRO-LICENSE.md) for complete Pro license terms.
Expand Down
17 changes: 7 additions & 10 deletions docs/DIRECTORY_LICENSING.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ After the monorepo merger, the unified repository will have clear directory-base

```
react_on_rails/ (monorepo root)
β”œβ”€β”€ lib/react_on_rails/ # Core Ruby code
β”œβ”€β”€ packages/react-on-rails/ # Core NPM package
β”œβ”€β”€ spec/ruby/react_on_rails/ # Core Ruby tests
β”œβ”€β”€ spec/packages/react-on-rails/ # Core JS tests
β”œβ”€β”€ lib/react_on_rails/ # Core Ruby code (including specs)
β”œβ”€β”€ packages/react-on-rails/ # Core NPM package (including tests)
β”œβ”€β”€ spec/ # Monorepo-level integration tests
β”‚ └── dummy/ # Rails dummy app for testing
β”œβ”€β”€ docs/ # Shared documentation
β”œβ”€β”€ tools/ # Shared development tools
β”œβ”€β”€ .github/ # Unified GitHub workflows
Expand All @@ -62,12 +62,9 @@ react_on_rails/ (monorepo root)

```
react_on_rails/ (monorepo root)
β”œβ”€β”€ lib/react_on_rails_pro/ # Pro Ruby code
β”œβ”€β”€ packages/react-on-rails-pro/ # Pro NPM package
β”œβ”€β”€ packages/react-on-rails-pro-node-renderer/ # Pro Node renderer
β”œβ”€β”€ spec/ruby/react_on_rails_pro/ # Pro Ruby tests
β”œβ”€β”€ spec/packages/react-on-rails-pro/ # Pro JS tests
└── spec/packages/react-on-rails-pro-node-renderer/ # Pro Node renderer tests
β”œβ”€β”€ lib/react_on_rails_pro/ # Pro Ruby code (including specs)
β”œβ”€β”€ packages/react-on-rails-pro/ # Pro NPM package (including tests)
└── packages/react-on-rails-pro-node-renderer/ # Pro Node renderer (including tests)
```

## License Compliance Rules
Expand Down
Loading
Loading