diff --git a/.github/workflows/lint-js-and-ruby.yml b/.github/workflows/lint-js-and-ruby.yml index 16a25d5794..3a73e72f05 100644 --- a/.github/workflows/lint-js-and-ruby.yml +++ b/.github/workflows/lint-js-and-ruby.yml @@ -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 - name: yalc add react-on-rails run: cd spec/dummy && yalc add react-on-rails - name: Install Node modules with Yarn for dummy app @@ -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 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4326a02704..798b17c4dd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 @@ -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 diff --git a/.gitignore b/.gitignore index aac5c06f93..6fda4a45de 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,7 @@ tmp/ node_modules -/node_package/lib +/packages/*/lib yarn-debug.* yarn-error.* diff --git a/.prettierignore b/.prettierignore index 2fa50fab1b..d236d6b53c 100644 --- a/.prettierignore +++ b/.prettierignore @@ -6,7 +6,7 @@ tmp/ coverage/ **/app/assets/webpack/ gen-examples/examples/* -node_package/lib/* +packages/*/lib/* spec/react_on_rails/dummy-for-generators/app/javascript/bundles/HelloWorld/* bundle/ spec/dummy/lib/bs/** diff --git a/CHANGELOG.md b/CHANGELOG.md index 434eaa66ad..58f6d3c220 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) @@ -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._ + It can be safely [suppressed](https://webpack.js.org/configuration/other-options/#ignorewarnings) in your Webpack configuration. ### [13.0.2] - 2022-03-09 diff --git a/CLAUDE.md b/CLAUDE.md index 70047aac3c..749b7e1dc3 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -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 @@ -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 @@ -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 @@ -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 @@ -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` diff --git a/CODING_AGENTS.md b/CODING_AGENTS.md index 8c150a9106..a78ce07b69 100644 --- a/CODING_AGENTS.md +++ b/CODING_AGENTS.md @@ -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` diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a9809e306b..37874ea65b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 - /spec/dummy/app/assets/webpack - /spec/dummy/log @@ -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 @@ -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:_ diff --git a/LICENSE.md b/LICENSE.md index 0465e9c39c..ae1a97b728 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -12,8 +12,8 @@ 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 @@ -21,8 +21,8 @@ The following directories and all their contents are licensed under the **MIT Li 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. diff --git a/docs/DIRECTORY_LICENSING.md b/docs/DIRECTORY_LICENSING.md index 191edaff1d..8c1d3dcd03 100644 --- a/docs/DIRECTORY_LICENSING.md +++ b/docs/DIRECTORY_LICENSING.md @@ -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 @@ -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 diff --git a/docs/MONOREPO_MERGER_PLAN.md b/docs/MONOREPO_MERGER_PLAN.md index 823a4a6eb3..4f33ab1360 100644 --- a/docs/MONOREPO_MERGER_PLAN.md +++ b/docs/MONOREPO_MERGER_PLAN.md @@ -28,7 +28,7 @@ This document provides the complete implementation plan for merging the `react_o ### Timeline -**Estimated Duration:** 4-5 weeks across 7 phases +**Estimated Duration:** 5-6 weeks across 8 phases ## Current State Analysis @@ -70,19 +70,18 @@ react_on_rails_pro/ react_on_rails/ (monorepo root) ├── lib/ │ ├── react_on_rails/ # Core Ruby (MIT) +│ │ └── spec/ # Core Ruby specs │ └── react_on_rails_pro/ # Pro Ruby (Pro license) +│ └── spec/ # Pro Ruby specs ├── packages/ # NPM packages (yarn workspace) │ ├── react-on-rails/ # Core JS/TS (MIT) +│ │ └── tests/ # Core JS/TS tests │ ├── react-on-rails-pro/ # Pro JS/TS (Pro license) +│ │ └── tests/ # Pro JS/TS tests │ └── react-on-rails-pro-node-renderer/ # Pro node renderer -├── spec/ -│ ├── ruby/ # Ruby specs organized by package -│ │ ├── react_on_rails/ -│ │ └── react_on_rails_pro/ -│ └── packages/ # JS specs organized by package -│ ├── react-on-rails/ -│ ├── react-on-rails-pro/ -│ └── react-on-rails-pro-node-renderer/ +│ └── tests/ # Pro node renderer tests +├── spec/ # Monorepo-level integration tests +│ └── dummy/ # Rails dummy app for testing ├── tools/ # Shared development tools ├── docs/ # Unified documentation ├── react_on_rails.gemspec # Core gem @@ -300,21 +299,22 @@ After the initial merge, the following CI adjustments may be needed: **Tasks:** -- [ ] Create `packages/react-on-rails/` directory -- [ ] Move `node_package/src/` to `packages/react-on-rails/src/` (excluding pro/ subdirectory) -- [ ] Create `packages/react-on-rails/package.json` with correct configuration -- [ ] Update root `package.json` to workspace manager (packages/react-on-rails only) -- [ ] Update build scripts and import paths -- [ ] Update TypeScript configurations -- [ ] Keep `react_on_rails_pro/` directory unchanged -- [ ] Update CI to build via workspace -- [ ] Update LICENSE.md to include new package path +- [x] Create `packages/react-on-rails/` directory +- [x] Move `node_package/src/` to `packages/react-on-rails/src/` (excluding pro/ subdirectory) +- [x] Create `packages/react-on-rails/package.json` with correct configuration +- [x] Update root `package.json` to workspace manager (packages/react-on-rails only) +- [x] Update build scripts and import paths +- [x] Update TypeScript configurations (build output moves from `node_package/lib/` to `packages/react-on-rails/lib/`) +- [x] Move core JS tests to `packages/react-on-rails/tests/` +- [x] Keep `react_on_rails_pro/` directory unchanged +- [x] Update CI to build via workspace +- [x] Update LICENSE.md to include new package path **License Compliance:** -- [ ] **CRITICAL: Verify NO pro files moved to MIT-licensed core package** -- [ ] Ensure `packages/react-on-rails/src/` contains ONLY MIT-licensed code -- [ ] Update LICENSE.md to reflect new paths: +- [x] **CRITICAL: Verify NO pro files moved to MIT-licensed core package** +- [x] Ensure `packages/react-on-rails/src/` contains ONLY MIT-licensed code +- [x] Update LICENSE.md to reflect new paths: ```md ## MIT License applies to: @@ -336,53 +336,53 @@ After the initial merge, the following CI adjustments may be needed: - When moving core files to `packages/react-on-rails/`, carefully verify that no pro files (especially from `node_package/src/pro/`) accidentally get moved to the MIT-licensed directory - Update LICENSE.md to reflect the new `packages/react-on-rails/` path - Ensure workspace configuration only includes core package initially +- **Build Output Location Change**: Starting from this phase, TypeScript compilation output will be at `packages/react-on-rails/lib/` instead of `node_package/lib/` --- -#### PR #4: Prepare Pro Package for Workspace Structure +#### PR #4: Split JS Pro Code to Separate Package -**Branch:** `prepare-pro-workspace` +**Branch:** `split-js-pro-package` **Objectives:** -- Extract pro NPM packages to workspace structure -- Create separate pro packages -- Establish full workspace configuration +- Extract pro JS features from react-on-rails package to separate react-on-rails-pro package +- Establish proper licensing boundaries for JS packages +- Maintain functionality while separating concerns **Tasks:** -- [ ] Move `react_on_rails_pro/packages/node-renderer/` to `packages/react-on-rails-pro-node-renderer/` -- [ ] Extract pro JS features from `node_package/src/pro/` to `packages/react-on-rails-pro/src/` -- [ ] Create individual `package.json` files for both pro packages: - - `packages/react-on-rails-pro/package.json` with `"license": "UNLICENSED"` - - `packages/react-on-rails-pro-node-renderer/package.json` with `"license": "UNLICENSED"` -- [ ] Update root workspace to include all 3 NPM packages -- [ ] Update CI to test all packages -- [ ] Setup proper dependencies between packages -- [ ] Move JS specs to organized structure +- [ ] Extract pro JS features from `packages/react-on-rails/src/pro/` to `packages/react-on-rails-pro/src/` +- [ ] Create `packages/react-on-rails-pro/package.json` with `"license": "UNLICENSED"` +- [ ] Move pro JS tests from `packages/react-on-rails/tests/` to `packages/react-on-rails-pro/tests/` +- [ ] Update root workspace to include `packages/react-on-rails-pro` +- [ ] Setup proper dependencies between core and pro packages +- [ ] Update build configurations (pro package output will be at `packages/react-on-rails-pro/lib/`) +- [ ] Update TypeScript configurations for both packages +- [ ] Remove pro/ directory from `packages/react-on-rails/src/` **License Compliance:** -- [ ] **CRITICAL: Update LICENSE.md for new pro directory paths:** +- [ ] **CRITICAL: Update LICENSE.md to remove pro code from MIT package:** ```md ## MIT License applies to: - - `lib/react_on_rails/` - - `packages/react-on-rails/` + - `lib/react_on_rails/` (including specs) + - `packages/react-on-rails/` (including tests) - NOW EXCLUDES pro/ subdirectory ## React on Rails Pro License applies to: - - `lib/react_on_rails_pro/` - - `packages/react-on-rails-pro/` (NEW) - - `packages/react-on-rails-pro-node-renderer/` (NEW) + - `lib/react_on_rails_pro/` (including specs) + - `packages/react-on-rails-pro/` (including tests) (NEW) - `react_on_rails_pro/` (remaining files) ``` - [ ] Add Pro license headers to moved files -- [ ] Verify all pro packages have `"license": "UNLICENSED"` in package.json +- [ ] Verify react-on-rails-pro package has `"license": "UNLICENSED"` in package.json +- [ ] Verify react-on-rails package no longer contains pro code -**Success Criteria:** ✅ All CI checks pass + All pro files properly licensed + License paths updated + All 3 NPM packages build +**Success Criteria:** ✅ All CI checks pass + Pro JS code cleanly separated + License boundaries established + Both NPM packages build independently **Estimated Duration:** 3-4 days @@ -390,17 +390,68 @@ After the initial merge, the following CI adjustments may be needed: **Developer Notes:** -- This is a critical step for license compliance! -- When creating new pro directories (`packages/react-on-rails-pro/` and `packages/react-on-rails-pro-node-renderer/`), immediately update LICENSE.md to include these new paths +- This is a critical step for license compliance and package separation! +- When creating `packages/react-on-rails-pro/` directory, immediately update LICENSE.md to include this new path - Ensure all moved pro files retain their Pro license headers -- Verify new package.json files have `"license": "UNLICENSED"` -- Test all workspace commands thoroughly +- Verify new package.json has `"license": "UNLICENSED"` +- **Build Output Location**: Pro package will now output to `packages/react-on-rails-pro/lib/` +- After moving pro code, verify react-on-rails package is purely MIT-licensed +- Test both packages build independently via workspace commands --- -### Phase 4: Final Monorepo Restructuring +#### PR #5: Add Pro Node Renderer Package + +**Branch:** `add-pro-node-renderer` + +**Objectives:** + +- Extract pro node-renderer to separate workspace package +- Complete NPM package workspace structure +- Establish all 3 NPM packages + +**Tasks:** -#### PR #5: Restructure Ruby Gems to Final Layout +- [ ] Move `react_on_rails_pro/packages/node-renderer/` to `packages/react-on-rails-pro-node-renderer/` +- [ ] Create `packages/react-on-rails-pro-node-renderer/package.json` with `"license": "UNLICENSED"` +- [ ] Move node-renderer tests to `packages/react-on-rails-pro-node-renderer/tests/` +- [ ] Update root workspace to include all 3 NPM packages +- [ ] Update CI to test all packages +- [ ] Update build configurations (node-renderer output will be at `packages/react-on-rails-pro-node-renderer/lib/`) + +**License Compliance:** + +- [ ] **CRITICAL: Update LICENSE.md for node-renderer package:** + + ```md + ## React on Rails Pro License applies to: + + - `lib/react_on_rails_pro/` (including specs) + - `packages/react-on-rails-pro/` (including tests) + - `packages/react-on-rails-pro-node-renderer/` (including tests) (NEW) + - `react_on_rails_pro/` (remaining files) + ``` + +- [ ] Verify node-renderer package has `"license": "UNLICENSED"` in package.json + +**Success Criteria:** ✅ All CI checks pass + All 3 NPM packages build + Complete workspace structure established + +**Estimated Duration:** 2-3 days + +**Risk Level:** Medium (straightforward package extraction) + +**Developer Notes:** + +- This completes the NPM package workspace structure +- **Build Output Location**: Node-renderer package will output to `packages/react-on-rails-pro-node-renderer/lib/` +- Test all three packages build independently via workspace commands +- Verify workspace commands work for all packages + +--- + +### Phase 6: Final Monorepo Restructuring + +#### PR #6: Restructure Ruby Gems to Final Layout **Branch:** `restructure-ruby-gems` @@ -414,13 +465,10 @@ After the initial merge, the following CI adjustments may be needed: - [ ] Move `react_on_rails_pro/lib/react_on_rails_pro/` to `lib/react_on_rails_pro/` - [ ] Move `react_on_rails_pro/react_on_rails_pro.gemspec` to root as `react_on_rails_pro.gemspec` -- [ ] Move all Ruby specs to organized structure: - - `spec/ruby/react_on_rails/` (core specs) - - `spec/ruby/react_on_rails_pro/` (pro specs) -- [ ] Move JS specs to organized structure: - - `spec/packages/react-on-rails/` - - `spec/packages/react-on-rails-pro/` - - `spec/packages/react-on-rails-pro-node-renderer/` +- [ ] Move Ruby specs to gem directories: + - Core specs: `lib/react_on_rails/spec/` (or keep existing `spec/` location) + - Pro specs: `lib/react_on_rails_pro/spec/` +- [ ] JS tests remain in package directories (already handled in previous phases) - [ ] Update root `Gemfile` to include both gemspecs - [ ] Remove empty `react_on_rails_pro/` directory - [ ] Update all require paths in Ruby code @@ -433,19 +481,14 @@ After the initial merge, the following CI adjustments may be needed: ```md ## MIT License applies to: - - `lib/react_on_rails/` - - `packages/react-on-rails/` - - `spec/ruby/react_on_rails/` - - `spec/packages/react-on-rails/` + - `lib/react_on_rails/` (including specs) + - `packages/react-on-rails/` (including tests) ## React on Rails Pro License applies to: - - `lib/react_on_rails_pro/` - - `packages/react-on-rails-pro/` - - `packages/react-on-rails-pro-node-renderer/` - - `spec/ruby/react_on_rails_pro/` - - `spec/packages/react-on-rails-pro/` - - `spec/packages/react-on-rails-pro-node-renderer/` + - `lib/react_on_rails_pro/` (including specs) + - `packages/react-on-rails-pro/` (including tests) + - `packages/react-on-rails-pro-node-renderer/` (including tests) ``` - [ ] Update both gemspec files with correct license: @@ -473,9 +516,9 @@ After the initial merge, the following CI adjustments may be needed: --- -### Phase 5: CI/CD & Tooling Unification +### Phase 7: CI/CD & Tooling Unification -#### PR #6: Unify CI/CD Configuration +#### PR #7: Unify CI/CD Configuration **Branch:** `unify-cicd` @@ -539,9 +582,9 @@ After the initial merge, the following CI adjustments may be needed: --- -### Phase 6: Documentation & Polish +### Phase 8: Documentation & Polish -#### PR #7: Update Documentation & Examples +#### PR #8: Update Documentation & Examples **Branch:** `update-docs-examples` @@ -579,14 +622,14 @@ After the initial merge, the following CI adjustments may be needed: - `react_on_rails` Ruby gem - `react-on-rails` NPM package - - Core functionality in `lib/react_on_rails/` and `packages/react-on-rails/` + - Core functionality in `lib/react_on_rails/` and `packages/react-on-rails/` (including tests/specs) ### Pro Licensed (Subscription Required for Production): - `react_on_rails_pro` Ruby gem - `react-on-rails-pro` NPM package - `react-on-rails-pro-node-renderer` NPM package - - Pro functionality in `lib/react_on_rails_pro/` and `packages/react-on-rails-pro*/` + - Pro functionality in `lib/react_on_rails_pro/` and `packages/react-on-rails-pro*/` (including tests/specs) See [LICENSE.md](LICENSE.md) and [REACT-ON-RAILS-PRO-LICENSE.md](REACT-ON-RAILS-PRO-LICENSE.md) ``` @@ -615,7 +658,7 @@ After the initial merge, the following CI adjustments may be needed: 1. **Directory Classification:** - - **MIT Licensed:** `lib/react_on_rails/`, `packages/react-on-rails/`, core specs + - **MIT Licensed:** `lib/react_on_rails/` (including specs), `packages/react-on-rails/` (including tests) - **Pro Licensed:** All directories explicitly listed in LICENSE.md under "React on Rails Pro License" 2. **LICENSE.md Updates:** @@ -643,16 +686,11 @@ PRO_DIRECTORIES = %w[ lib/react_on_rails_pro packages/react-on-rails-pro packages/react-on-rails-pro-node-renderer - spec/ruby/react_on_rails_pro - spec/packages/react-on-rails-pro - spec/packages/react-on-rails-pro-node-renderer ].freeze MIT_DIRECTORIES = %w[ lib/react_on_rails packages/react-on-rails - spec/ruby/react_on_rails - spec/packages/react-on-rails ].freeze def check_pro_license_headers diff --git a/docs/MONOREPO_MERGER_PLAN_REF.md b/docs/MONOREPO_MERGER_PLAN_REF.md index 1296989f92..b8248c70f3 100644 --- a/docs/MONOREPO_MERGER_PLAN_REF.md +++ b/docs/MONOREPO_MERGER_PLAN_REF.md @@ -4,13 +4,13 @@ The complete React on Rails Monorepo Merger Plan is located at: **[docs/MONOREPO_MERGER_PLAN.md](./MONOREPO_MERGER_PLAN.md)** -This plan outlines the 7-phase implementation for merging the `react_on_rails` and `react_on_rails_pro` repositories into a unified monorepo while maintaining: +This plan outlines the 8-phase implementation for merging the `react_on_rails` and `react_on_rails_pro` repositories into a unified monorepo while maintaining: - Separate package identities (2 Ruby gems + 3 NPM packages) - Proper license compliance (MIT vs Pro) - Complete git history preservation - CI integrity at every step -**Status:** Phase 2 - Git Subtree Merger (Complete) ✅ +**Status:** Phase 3 - Prepare Core Package for Workspace Structure (Complete) ✅ For implementation details, progress tracking, and specific tasks, refer to the main plan document. diff --git a/docs/additional-details/manual-installation-overview.md b/docs/additional-details/manual-installation-overview.md index 1e3d2f1209..027c4c55b7 100644 --- a/docs/additional-details/manual-installation-overview.md +++ b/docs/additional-details/manual-installation-overview.md @@ -13,7 +13,7 @@ The only requirements within this directory for basic React on Rails integration 1. Your Webpack configuration files: 1. Create outputs in a directory like `/public/webpack`, which is customizable in your `config/initializers/react_on_rails.rb`. 1. Provide server rendering if you wish to use that feature. -1. Your JavaScript code "registers" any components and stores per the ReactOnRails APIs of ReactOnRails.register(components) and ReactOnRails.registerStore(stores). See [our JavaScript API docs](../api/javascript-api.md) and the [React on Rails source](https://github.com/shakacode/react_on_rails/tree/master/node_package/src/ReactOnRails.client.ts). +1. Your JavaScript code "registers" any components and stores per the ReactOnRails APIs of ReactOnRails.register(components) and ReactOnRails.registerStore(stores). See [our JavaScript API docs](../api/javascript-api.md) and the [React on Rails source](https://github.com/shakacode/react_on_rails/tree/master/packages/react-on-rails/src/ReactOnRails.client.ts). 1. Set your registration file as an "entry" point in your Webpack configs. 1. Configure scripts in `client/package.json` as shown in the example apps. These are used for building your Webpack assets. Also do this for your top-level `package.json`. diff --git a/docs/api/javascript-api.md b/docs/api/javascript-api.md index e17d9cfc30..3aedab38ca 100644 --- a/docs/api/javascript-api.md +++ b/docs/api/javascript-api.md @@ -18,7 +18,7 @@ If you are using [jquery-ujs](https://github.com/rails/jquery-ujs) for AJAX call ## API -The best source of docs is the `interface ReactOnRails` in [types/index.ts](https://github.com/shakacode/react_on_rails/blob/master/node_package/src/types/index.ts). Here's a quick summary. No guarantees that this won't be outdated! +The best source of docs is the `interface ReactOnRails` in [types/index.ts](https://github.com/shakacode/react_on_rails/blob/master/packages/react-on-rails/src/types/index.ts). Here's a quick summary. No guarantees that this won't be outdated! ```js /** diff --git a/docs/contributor-info/releasing.md b/docs/contributor-info/releasing.md index e2a5ea68e3..3887d6cb9d 100644 --- a/docs/contributor-info/releasing.md +++ b/docs/contributor-info/releasing.md @@ -58,7 +58,7 @@ index aa7b000..af8761e 100644 - "version": "2.0.2", + "version": "2.1.0", "description": "react-on-rails JavaScript for react_on_rails Ruby gem", - "main": "node_package/lib/ReactOnRails.js", + "main": "packages/react-on-rails/lib/ReactOnRails.js", "directories": { diff --git a/spec/dummy/Gemfile.lock b/spec/dummy/Gemfile.lock index 8ef51df..4489bfe 100644 diff --git a/docs/javascript/render-functions.md b/docs/javascript/render-functions.md index a73a543d1a..f5fba5fa0e 100644 --- a/docs/javascript/render-functions.md +++ b/docs/javascript/render-functions.md @@ -123,7 +123,7 @@ const MyComponent = (props, _railsContext) => { ## Important Rendering Behavior -Take a look at [serverRenderReactComponent.test.ts](https://github.com/shakacode/react_on_rails/blob/master/node_package/tests/serverRenderReactComponent.test.ts): +Take a look at [serverRenderReactComponent.test.ts](https://github.com/shakacode/react_on_rails/blob/master/packages/react-on-rails/tests/serverRenderReactComponent.test.ts): 1. **Direct String Returns Don't Work** - Returning a raw HTML string directly from a render function causes an error. Always wrap HTML strings in `{ renderedHtml: '...' }`. diff --git a/eslint.config.ts b/eslint.config.ts index 417827fa5a..bb33b5918b 100644 --- a/eslint.config.ts +++ b/eslint.config.ts @@ -19,7 +19,7 @@ const config = tsEslint.config([ includeIgnoreFile(path.resolve(__dirname, '.gitignore')), globalIgnores([ // compiled code - 'node_package/lib/', + 'packages/*/lib/', // pro package (has its own linting) 'react_on_rails_pro/', // used for tests only @@ -145,7 +145,13 @@ const config = tsEslint.config([ }, }, { - files: ['node_package/**/*'], + files: ['packages/**/*'], + rules: { + 'import/extensions': ['error', 'ignorePackages'], + }, + }, + { + files: ['packages/react-on-rails/src/**/*'], rules: { 'import/extensions': ['error', 'ignorePackages'], }, @@ -176,7 +182,7 @@ const config = tsEslint.config([ languageOptions: { parserOptions: { projectService: { - allowDefaultProject: ['eslint.config.ts', 'knip.ts', 'node_package/tests/*.test.{ts,tsx}'], + allowDefaultProject: ['eslint.config.ts', 'knip.ts', 'packages/*/tests/*.test.{ts,tsx}'], // Needed because `import * as ... from` instead of `import ... from` doesn't work in this file // for some imports. defaultProject: 'tsconfig.eslint.json', @@ -211,7 +217,7 @@ const config = tsEslint.config([ }, }, { - files: ['node_package/tests/**', '**/*.test.{js,jsx,ts,tsx}'], + files: ['packages/*/tests/**', '**/*.test.{js,jsx,ts,tsx}'], extends: [ jest.configs['flat/recommended'], diff --git a/jest.config.base.js b/jest.config.base.js new file mode 100644 index 0000000000..b944bce28c --- /dev/null +++ b/jest.config.base.js @@ -0,0 +1,27 @@ +import { createJsWithTsPreset } from 'ts-jest'; + +// Global Jest configuration for the monorepo +// Contains common settings that all packages inherit +export default { + // === TypeScript Configuration === + // ts-jest preset with custom TypeScript settings + ...createJsWithTsPreset({ + tsconfig: { + // Relative imports in our TS code include `.ts` extensions. + // When compiling the package, TS rewrites them to `.js`, + // but ts-jest runs on the original code where the `.js` files don't exist, + // so this setting needs to be disabled here. + rewriteRelativeImportExtensions: false, + }, + }), + + // === Test Environment Configuration === + testEnvironment: 'jsdom', + + // === Common Test Patterns === + // Default test pattern - packages can override this + testMatch: ['**/?(*.)+(spec|test).[jt]s?(x)'], + + // === Common Module File Extensions === + moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'json'], +}; diff --git a/jest.config.js b/jest.config.js deleted file mode 100644 index fcf1d7d372..0000000000 --- a/jest.config.js +++ /dev/null @@ -1,26 +0,0 @@ -import { createJsWithTsPreset } from 'ts-jest'; - -const nodeVersion = parseInt(process.version.slice(1), 10); - -export default { - ...createJsWithTsPreset({ - tsconfig: { - // Relative imports in our TS code include `.ts` extensions. - // When compiling the package, TS rewrites them to `.js`, - // but ts-jest runs on the original code where the `.js` files don't exist, - // so this setting needs to be disabled here. - rewriteRelativeImportExtensions: false, - }, - }), - testEnvironment: 'jsdom', - setupFiles: ['/node_package/tests/jest.setup.js'], - // React Server Components tests require React 19 and only run with Node version 18 (`newest` in our CI matrix) - moduleNameMapper: - nodeVersion < 18 - ? { - 'react-on-rails-rsc/client': '/node_package/tests/emptyForTesting.js', - '^@testing-library/dom$': '/node_package/tests/emptyForTesting.js', - '^@testing-library/react$': '/node_package/tests/emptyForTesting.js', - } - : {}, -}; diff --git a/knip.ts b/knip.ts index ebaea3f1da..5abeb34a38 100644 --- a/knip.ts +++ b/knip.ts @@ -3,52 +3,19 @@ import type { KnipConfig } from 'knip'; const config: KnipConfig = { // ! at the end means files are used in production workspaces: { + // Root workspace - manages the monorepo and global tooling '.': { - entry: [ - 'node_package/src/ReactOnRails.node.ts!', - 'node_package/src/pro/ReactOnRailsRSC.ts!', - 'node_package/src/pro/registerServerComponent/client.tsx!', - 'node_package/src/pro/registerServerComponent/server.tsx!', - 'node_package/src/pro/registerServerComponent/server.rsc.ts!', - 'node_package/src/pro/wrapServerComponentRenderer/server.tsx!', - 'node_package/src/pro/wrapServerComponentRenderer/server.rsc.tsx!', - 'node_package/src/pro/RSCRoute.tsx!', - 'node_package/src/pro/ServerComponentFetchError.ts!', - 'node_package/src/pro/getReactServerComponent.server.ts!', - 'node_package/src/pro/transformRSCNodeStream.ts!', - 'node_package/src/loadJsonFile.ts!', - 'eslint.config.ts', - ], - project: [ - 'node_package/src/**/*.[jt]s{x,}!', - 'node_package/tests/**/*.[jt]s{x,}', - '!react_on_rails_pro/**', - ], - babel: { - config: ['node_package/babel.config.js'], - }, - ignore: [ - 'node_package/tests/emptyForTesting.js', - // Pro features exported for external consumption - 'node_package/src/pro/streamServerRenderedReactComponent.ts:transformRenderStreamChunksToResultObject', - 'node_package/src/pro/streamServerRenderedReactComponent.ts:streamServerRenderedComponent', - 'node_package/src/pro/ServerComponentFetchError.ts:isServerComponentFetchError', - 'node_package/src/pro/RSCRoute.tsx:RSCRouteProps', - 'node_package/src/pro/streamServerRenderedReactComponent.ts:StreamingTrackers', - // Exclude entire pro directory - it has its own package.json with dependencies - 'react_on_rails_pro/**', - ], + entry: ['eslint.config.ts'], + project: ['*.{js,mjs,ts}'], ignoreBinaries: [ - // Knip fails to detect it's declared in devDependencies + // Has to be installed globally + 'yalc', 'nps', - // local scripts - 'node_package/scripts/.*', ], + ignore: ['react_on_rails_pro/**'], ignoreDependencies: [ // Required for TypeScript compilation, but we don't depend on Turbolinks itself. '@types/turbolinks', - // Keep this even though knip doesn't detect usage - '@babel/preset-typescript', // The Knip ESLint plugin fails to detect these are transitively required by a config, // though we don't actually use its rules anywhere. '@babel/eslint-parser', @@ -69,6 +36,39 @@ const config: KnipConfig = { 'react-on-rails-rsc', ], }, + + // React on Rails core package workspace + 'packages/react-on-rails': { + entry: [ + 'src/ReactOnRails.node.ts!', + 'src/pro/ReactOnRailsRSC.ts!', + 'src/pro/registerServerComponent/client.tsx!', + 'src/pro/registerServerComponent/server.tsx!', + 'src/pro/registerServerComponent/server.rsc.ts!', + 'src/pro/wrapServerComponentRenderer/server.tsx!', + 'src/pro/wrapServerComponentRenderer/server.rsc.tsx!', + 'src/pro/RSCRoute.tsx!', + 'src/pro/ServerComponentFetchError.ts!', + 'src/pro/getReactServerComponent.server.ts!', + 'src/pro/transformRSCNodeStream.ts!', + 'src/loadJsonFile.ts!', + ], + project: ['src/**/*.[jt]s{x,}!', 'tests/**/*.[jt]s{x,}', '!lib/**'], + ignore: [ + 'tests/emptyForTesting.js', + // Jest setup and test utilities - not detected by Jest plugin in workspace setup + 'tests/jest.setup.js', + 'tests/testUtils.js', + // Build output directories that should be ignored + 'lib/**', + // Pro features exported for external consumption + 'src/pro/streamServerRenderedReactComponent.ts:transformRenderStreamChunksToResultObject', + 'src/pro/streamServerRenderedReactComponent.ts:streamServerRenderedComponent', + 'src/pro/ServerComponentFetchError.ts:isServerComponentFetchError', + 'src/pro/RSCRoute.tsx:RSCRouteProps', + 'src/pro/streamServerRenderedReactComponent.ts:StreamingTrackers', + ], + }, 'spec/dummy': { entry: [ 'app/assets/config/manifest.js!', diff --git a/lib/react_on_rails/helper.rb b/lib/react_on_rails/helper.rb index 40c3898871..da6dd8995b 100644 --- a/lib/react_on_rails/helper.rb +++ b/lib/react_on_rails/helper.rb @@ -366,7 +366,7 @@ def json_safe_and_pretty(hash_or_string) # # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity def rails_context(server_side: true) - # ALERT: Keep in sync with node_package/src/types/index.ts for the properties of RailsContext + # ALERT: Keep in sync with packages/react-on-rails/src/types/index.ts for the properties of RailsContext @rails_context ||= begin result = { componentRegistryTimeout: ReactOnRails.configuration.component_registry_timeout, diff --git a/package-scripts.yml b/package-scripts.yml index 09d91dc838..26657f1441 100644 --- a/package-scripts.yml +++ b/package-scripts.yml @@ -25,9 +25,9 @@ scripts: # 3. Check if the project is built now; # 4. If it failed, print an error message (still follow https://docs.npmjs.com/cli/v8/using-npm/scripts#best-practices). script: > - [ -f node_package/lib/ReactOnRails.full.js ] || + [ -f packages/react-on-rails/lib/ReactOnRails.full.js ] || (npm run build >/dev/null 2>&1 || true) && - [ -f node_package/lib/ReactOnRails.full.js ] || + [ -f packages/react-on-rails/lib/ReactOnRails.full.js ] || { echo 'Building react-on-rails seems to have failed!'; } format: diff --git a/package.json b/package.json index 8836b63ff5..49afa72403 100644 --- a/package.json +++ b/package.json @@ -1,30 +1,12 @@ { - "name": "react-on-rails", + "name": "react-on-rails-workspace", "version": "16.1.1", - "description": "react-on-rails JavaScript for react_on_rails Ruby gem", - "main": "node_package/lib/ReactOnRails.full.js", + "description": "react-on-rails monorepo workspace manager", + "private": true, "type": "module", - "exports": { - ".": { - "react-server": "./node_package/lib/pro/ReactOnRailsRSC.js", - "node": "./node_package/lib/ReactOnRails.node.js", - "default": "./node_package/lib/ReactOnRails.full.js" - }, - "./client": "./node_package/lib/ReactOnRails.client.js", - "./registerServerComponent/client": "./node_package/lib/pro/registerServerComponent/client.js", - "./registerServerComponent/server": { - "react-server": "./node_package/lib/pro/registerServerComponent/server.rsc.js", - "default": "./node_package/lib/pro/registerServerComponent/server.js" - }, - "./wrapServerComponentRenderer/client": "./node_package/lib/pro/wrapServerComponentRenderer/client.js", - "./wrapServerComponentRenderer/server": { - "react-server": "./node_package/lib/pro/wrapServerComponentRenderer/server.rsc.js", - "default": "./node_package/lib/pro/wrapServerComponentRenderer/server.js" - }, - "./RSCRoute": "./node_package/lib/pro/RSCRoute.js", - "./RSCProvider": "./node_package/lib/pro/RSCProvider.js", - "./ServerComponentFetchError": "./node_package/lib/pro/ServerComponentFetchError.js" - }, + "workspaces": [ + "packages/react-on-rails" + ], "directories": { "doc": "docs" }, @@ -75,34 +57,21 @@ "typescript": "^5.8.3", "typescript-eslint": "^8.35.0" }, - "peerDependencies": { - "react": ">= 16", - "react-dom": ">= 16", - "react-on-rails-rsc": "19.0.2" - }, - "peerDependenciesMeta": { - "react-on-rails-rsc": { - "optional": true - } - }, - "files": [ - "node_package/lib" - ], "scripts": { - "test": "jest node_package/tests", - "clean": "rm -rf node_package/lib", + "test": "yarn workspaces run test", + "clean": "yarn workspaces run clean", "start": "nps", - "prepack": "nps build.prepack", - "prepare": "nps build.prepack", - "prepublishOnly": "yarn run build", - "build": "yarn run clean && yarn run tsc --declaration", - "build-watch": "yarn run clean && yarn run tsc --watch", + "build": "yarn workspaces run build", + "build-watch": "yarn workspaces run build-watch", "lint": "nps eslint", - "check": "yarn run lint && yarn run test && yarn run type-check", - "type-check": "yarn run tsc --noEmit --noErrorTruncation", - "release:patch": "node_package/scripts/release patch", - "release:minor": "node_package/scripts/release minor", - "release:major": "node_package/scripts/release major", + "check": "yarn run lint && yarn workspaces run check", + "type-check": "yarn workspaces run type-check", + "yalc:publish": "yarn workspaces run yalc:publish", + "yalc": "yarn workspaces run yalc", + "publish": "yarn workspaces run publish", + "release:patch": "yarn workspaces run release:patch", + "release:minor": "yarn workspaces run release:minor", + "release:major": "yarn workspaces run release:major", "postinstall": "test -f .lefthook.yml && test -d .git && command -v bundle >/dev/null 2>&1 && bundle exec lefthook install || true" }, "repository": { diff --git a/node_package/babel.config.js b/packages/react-on-rails/babel.config.js similarity index 100% rename from node_package/babel.config.js rename to packages/react-on-rails/babel.config.js diff --git a/packages/react-on-rails/jest.config.js b/packages/react-on-rails/jest.config.js new file mode 100644 index 0000000000..57e7f54977 --- /dev/null +++ b/packages/react-on-rails/jest.config.js @@ -0,0 +1,31 @@ +// eslint-disable-next-line import/no-relative-packages +import rootConfig from '../../jest.config.base.js'; + +const nodeVersion = parseInt(process.version.slice(1), 10); + +// Package-specific Jest configuration +// Inherits from root jest.config.mjs and adds package-specific settings +export default { + // Inherit all settings from root + ...rootConfig, + + // Override: Package-specific test directory + testMatch: ['/tests/**/?(*.)+(spec|test).[jt]s?(x)'], + + // Package-specific: Jest setup files + setupFiles: ['/tests/jest.setup.js'], + + // Package-specific: Module name mapping for React Server Components + // Only mock modules on Node versions < 18 where RSC features aren't available + moduleNameMapper: + nodeVersion < 18 + ? { + 'react-on-rails-rsc/client': '/tests/emptyForTesting.js', + '^@testing-library/dom$': '/tests/emptyForTesting.js', + '^@testing-library/react$': '/tests/emptyForTesting.js', + } + : {}, + + // Set root directory to current package + rootDir: '.', +}; diff --git a/packages/react-on-rails/package.json b/packages/react-on-rails/package.json new file mode 100644 index 0000000000..f13dfa1d12 --- /dev/null +++ b/packages/react-on-rails/package.json @@ -0,0 +1,74 @@ +{ + "name": "react-on-rails", + "version": "16.1.1", + "description": "react-on-rails JavaScript for react_on_rails Ruby gem", + "main": "lib/ReactOnRails.full.js", + "type": "module", + "scripts": { + "build": "yarn run clean && yarn run tsc --declaration", + "build-watch": "yarn run clean && yarn run tsc --watch", + "clean": "rm -rf ./lib", + "test": "jest tests", + "type-check": "yarn run tsc --noEmit --noErrorTruncation", + "prepack": "nps build.prepack", + "prepare": "nps build.prepack", + "prepublishOnly": "yarn run build", + "yalc:publish": "yalc publish", + "yalc": "yalc", + "release:patch": "./scripts/release patch", + "release:minor": "./scripts/release minor", + "release:major": "./scripts/release major" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/shakacode/react_on_rails.git" + }, + "keywords": [ + "react", + "webpack", + "JavaScript", + "Ruby", + "on", + "Rails" + ], + "author": "justin.gordon@gmail.com", + "license": "SEE LICENSE IN LICENSE.md", + "exports": { + ".": { + "react-server": "./lib/pro/ReactOnRailsRSC.js", + "node": "./lib/ReactOnRails.node.js", + "default": "./lib/ReactOnRails.full.js" + }, + "./client": "./lib/ReactOnRails.client.js", + "./registerServerComponent/client": "./lib/pro/registerServerComponent/client.js", + "./registerServerComponent/server": { + "react-server": "./lib/pro/registerServerComponent/server.rsc.js", + "default": "./lib/pro/registerServerComponent/server.js" + }, + "./wrapServerComponentRenderer/client": "./lib/pro/wrapServerComponentRenderer/client.js", + "./wrapServerComponentRenderer/server": { + "react-server": "./lib/pro/wrapServerComponentRenderer/server.rsc.js", + "default": "./lib/pro/wrapServerComponentRenderer/server.js" + }, + "./RSCRoute": "./lib/pro/RSCRoute.js", + "./RSCProvider": "./lib/pro/RSCProvider.js", + "./ServerComponentFetchError": "./lib/pro/ServerComponentFetchError.js" + }, + "peerDependencies": { + "react": ">= 16", + "react-dom": ">= 16", + "react-on-rails-rsc": "19.0.2" + }, + "peerDependenciesMeta": { + "react-on-rails-rsc": { + "optional": true + } + }, + "files": [ + "lib" + ], + "bugs": { + "url": "https://github.com/shakacode/react_on_rails/issues" + }, + "homepage": "https://github.com/shakacode/react_on_rails#readme" +} diff --git a/node_package/scripts/release b/packages/react-on-rails/scripts/release old mode 100755 new mode 100644 similarity index 100% rename from node_package/scripts/release rename to packages/react-on-rails/scripts/release diff --git a/node_package/scripts/symlink-node-package b/packages/react-on-rails/scripts/symlink-node-package old mode 100755 new mode 100644 similarity index 100% rename from node_package/scripts/symlink-node-package rename to packages/react-on-rails/scripts/symlink-node-package diff --git a/node_package/src/Authenticity.ts b/packages/react-on-rails/src/Authenticity.ts similarity index 100% rename from node_package/src/Authenticity.ts rename to packages/react-on-rails/src/Authenticity.ts diff --git a/node_package/src/ReactDOMServer.cts b/packages/react-on-rails/src/ReactDOMServer.cts similarity index 100% rename from node_package/src/ReactDOMServer.cts rename to packages/react-on-rails/src/ReactDOMServer.cts diff --git a/node_package/src/ReactOnRails.client.ts b/packages/react-on-rails/src/ReactOnRails.client.ts similarity index 100% rename from node_package/src/ReactOnRails.client.ts rename to packages/react-on-rails/src/ReactOnRails.client.ts diff --git a/node_package/src/ReactOnRails.full.ts b/packages/react-on-rails/src/ReactOnRails.full.ts similarity index 100% rename from node_package/src/ReactOnRails.full.ts rename to packages/react-on-rails/src/ReactOnRails.full.ts diff --git a/node_package/src/ReactOnRails.node.ts b/packages/react-on-rails/src/ReactOnRails.node.ts similarity index 100% rename from node_package/src/ReactOnRails.node.ts rename to packages/react-on-rails/src/ReactOnRails.node.ts diff --git a/node_package/src/RenderUtils.ts b/packages/react-on-rails/src/RenderUtils.ts similarity index 100% rename from node_package/src/RenderUtils.ts rename to packages/react-on-rails/src/RenderUtils.ts diff --git a/node_package/src/buildConsoleReplay.ts b/packages/react-on-rails/src/buildConsoleReplay.ts similarity index 100% rename from node_package/src/buildConsoleReplay.ts rename to packages/react-on-rails/src/buildConsoleReplay.ts diff --git a/node_package/src/clientStartup.ts b/packages/react-on-rails/src/clientStartup.ts similarity index 100% rename from node_package/src/clientStartup.ts rename to packages/react-on-rails/src/clientStartup.ts diff --git a/node_package/src/context.ts b/packages/react-on-rails/src/context.ts similarity index 100% rename from node_package/src/context.ts rename to packages/react-on-rails/src/context.ts diff --git a/node_package/src/createReactOutput.ts b/packages/react-on-rails/src/createReactOutput.ts similarity index 100% rename from node_package/src/createReactOutput.ts rename to packages/react-on-rails/src/createReactOutput.ts diff --git a/node_package/src/handleError.ts b/packages/react-on-rails/src/handleError.ts similarity index 100% rename from node_package/src/handleError.ts rename to packages/react-on-rails/src/handleError.ts diff --git a/node_package/src/isRenderFunction.ts b/packages/react-on-rails/src/isRenderFunction.ts similarity index 100% rename from node_package/src/isRenderFunction.ts rename to packages/react-on-rails/src/isRenderFunction.ts diff --git a/node_package/src/isServerRenderResult.ts b/packages/react-on-rails/src/isServerRenderResult.ts similarity index 100% rename from node_package/src/isServerRenderResult.ts rename to packages/react-on-rails/src/isServerRenderResult.ts diff --git a/node_package/src/loadJsonFile.ts b/packages/react-on-rails/src/loadJsonFile.ts similarity index 100% rename from node_package/src/loadJsonFile.ts rename to packages/react-on-rails/src/loadJsonFile.ts diff --git a/node_package/src/pageLifecycle.ts b/packages/react-on-rails/src/pageLifecycle.ts similarity index 100% rename from node_package/src/pageLifecycle.ts rename to packages/react-on-rails/src/pageLifecycle.ts diff --git a/node_package/src/pro/CallbackRegistry.ts b/packages/react-on-rails/src/pro/CallbackRegistry.ts similarity index 100% rename from node_package/src/pro/CallbackRegistry.ts rename to packages/react-on-rails/src/pro/CallbackRegistry.ts diff --git a/node_package/src/pro/ClientSideRenderer.ts b/packages/react-on-rails/src/pro/ClientSideRenderer.ts similarity index 100% rename from node_package/src/pro/ClientSideRenderer.ts rename to packages/react-on-rails/src/pro/ClientSideRenderer.ts diff --git a/node_package/src/pro/ComponentRegistry.ts b/packages/react-on-rails/src/pro/ComponentRegistry.ts similarity index 100% rename from node_package/src/pro/ComponentRegistry.ts rename to packages/react-on-rails/src/pro/ComponentRegistry.ts diff --git a/node_package/src/pro/NOTICE b/packages/react-on-rails/src/pro/NOTICE similarity index 100% rename from node_package/src/pro/NOTICE rename to packages/react-on-rails/src/pro/NOTICE diff --git a/node_package/src/pro/PostSSRHookTracker.ts b/packages/react-on-rails/src/pro/PostSSRHookTracker.ts similarity index 100% rename from node_package/src/pro/PostSSRHookTracker.ts rename to packages/react-on-rails/src/pro/PostSSRHookTracker.ts diff --git a/node_package/src/pro/RSCProvider.tsx b/packages/react-on-rails/src/pro/RSCProvider.tsx similarity index 100% rename from node_package/src/pro/RSCProvider.tsx rename to packages/react-on-rails/src/pro/RSCProvider.tsx diff --git a/node_package/src/pro/RSCRequestTracker.ts b/packages/react-on-rails/src/pro/RSCRequestTracker.ts similarity index 100% rename from node_package/src/pro/RSCRequestTracker.ts rename to packages/react-on-rails/src/pro/RSCRequestTracker.ts diff --git a/node_package/src/pro/RSCRoute.tsx b/packages/react-on-rails/src/pro/RSCRoute.tsx similarity index 100% rename from node_package/src/pro/RSCRoute.tsx rename to packages/react-on-rails/src/pro/RSCRoute.tsx diff --git a/node_package/src/pro/ReactOnRailsRSC.ts b/packages/react-on-rails/src/pro/ReactOnRailsRSC.ts similarity index 100% rename from node_package/src/pro/ReactOnRailsRSC.ts rename to packages/react-on-rails/src/pro/ReactOnRailsRSC.ts diff --git a/node_package/src/pro/ServerComponentFetchError.ts b/packages/react-on-rails/src/pro/ServerComponentFetchError.ts similarity index 100% rename from node_package/src/pro/ServerComponentFetchError.ts rename to packages/react-on-rails/src/pro/ServerComponentFetchError.ts diff --git a/node_package/src/pro/StoreRegistry.ts b/packages/react-on-rails/src/pro/StoreRegistry.ts similarity index 100% rename from node_package/src/pro/StoreRegistry.ts rename to packages/react-on-rails/src/pro/StoreRegistry.ts diff --git a/node_package/src/pro/getReactServerComponent.client.ts b/packages/react-on-rails/src/pro/getReactServerComponent.client.ts similarity index 100% rename from node_package/src/pro/getReactServerComponent.client.ts rename to packages/react-on-rails/src/pro/getReactServerComponent.client.ts diff --git a/node_package/src/pro/getReactServerComponent.server.ts b/packages/react-on-rails/src/pro/getReactServerComponent.server.ts similarity index 100% rename from node_package/src/pro/getReactServerComponent.server.ts rename to packages/react-on-rails/src/pro/getReactServerComponent.server.ts diff --git a/node_package/src/pro/injectRSCPayload.ts b/packages/react-on-rails/src/pro/injectRSCPayload.ts similarity index 100% rename from node_package/src/pro/injectRSCPayload.ts rename to packages/react-on-rails/src/pro/injectRSCPayload.ts diff --git a/node_package/src/pro/registerServerComponent/client.tsx b/packages/react-on-rails/src/pro/registerServerComponent/client.tsx similarity index 100% rename from node_package/src/pro/registerServerComponent/client.tsx rename to packages/react-on-rails/src/pro/registerServerComponent/client.tsx diff --git a/node_package/src/pro/registerServerComponent/server.rsc.ts b/packages/react-on-rails/src/pro/registerServerComponent/server.rsc.ts similarity index 100% rename from node_package/src/pro/registerServerComponent/server.rsc.ts rename to packages/react-on-rails/src/pro/registerServerComponent/server.rsc.ts diff --git a/node_package/src/pro/registerServerComponent/server.tsx b/packages/react-on-rails/src/pro/registerServerComponent/server.tsx similarity index 100% rename from node_package/src/pro/registerServerComponent/server.tsx rename to packages/react-on-rails/src/pro/registerServerComponent/server.tsx diff --git a/node_package/src/pro/streamServerRenderedReactComponent.ts b/packages/react-on-rails/src/pro/streamServerRenderedReactComponent.ts similarity index 100% rename from node_package/src/pro/streamServerRenderedReactComponent.ts rename to packages/react-on-rails/src/pro/streamServerRenderedReactComponent.ts diff --git a/node_package/src/pro/transformRSCNodeStream.ts b/packages/react-on-rails/src/pro/transformRSCNodeStream.ts similarity index 100% rename from node_package/src/pro/transformRSCNodeStream.ts rename to packages/react-on-rails/src/pro/transformRSCNodeStream.ts diff --git a/node_package/src/pro/transformRSCStreamAndReplayConsoleLogs.ts b/packages/react-on-rails/src/pro/transformRSCStreamAndReplayConsoleLogs.ts similarity index 100% rename from node_package/src/pro/transformRSCStreamAndReplayConsoleLogs.ts rename to packages/react-on-rails/src/pro/transformRSCStreamAndReplayConsoleLogs.ts diff --git a/node_package/src/pro/wrapServerComponentRenderer/client.tsx b/packages/react-on-rails/src/pro/wrapServerComponentRenderer/client.tsx similarity index 100% rename from node_package/src/pro/wrapServerComponentRenderer/client.tsx rename to packages/react-on-rails/src/pro/wrapServerComponentRenderer/client.tsx diff --git a/node_package/src/pro/wrapServerComponentRenderer/server.rsc.tsx b/packages/react-on-rails/src/pro/wrapServerComponentRenderer/server.rsc.tsx similarity index 100% rename from node_package/src/pro/wrapServerComponentRenderer/server.rsc.tsx rename to packages/react-on-rails/src/pro/wrapServerComponentRenderer/server.rsc.tsx diff --git a/node_package/src/pro/wrapServerComponentRenderer/server.tsx b/packages/react-on-rails/src/pro/wrapServerComponentRenderer/server.tsx similarity index 100% rename from node_package/src/pro/wrapServerComponentRenderer/server.tsx rename to packages/react-on-rails/src/pro/wrapServerComponentRenderer/server.tsx diff --git a/node_package/src/reactApis.cts b/packages/react-on-rails/src/reactApis.cts similarity index 100% rename from node_package/src/reactApis.cts rename to packages/react-on-rails/src/reactApis.cts diff --git a/node_package/src/reactHydrateOrRender.ts b/packages/react-on-rails/src/reactHydrateOrRender.ts similarity index 100% rename from node_package/src/reactHydrateOrRender.ts rename to packages/react-on-rails/src/reactHydrateOrRender.ts diff --git a/node_package/src/scriptSanitizedVal.ts b/packages/react-on-rails/src/scriptSanitizedVal.ts similarity index 100% rename from node_package/src/scriptSanitizedVal.ts rename to packages/react-on-rails/src/scriptSanitizedVal.ts diff --git a/node_package/src/serverRenderReactComponent.ts b/packages/react-on-rails/src/serverRenderReactComponent.ts similarity index 100% rename from node_package/src/serverRenderReactComponent.ts rename to packages/react-on-rails/src/serverRenderReactComponent.ts diff --git a/node_package/src/serverRenderUtils.ts b/packages/react-on-rails/src/serverRenderUtils.ts similarity index 100% rename from node_package/src/serverRenderUtils.ts rename to packages/react-on-rails/src/serverRenderUtils.ts diff --git a/node_package/src/turbolinksUtils.ts b/packages/react-on-rails/src/turbolinksUtils.ts similarity index 100% rename from node_package/src/turbolinksUtils.ts rename to packages/react-on-rails/src/turbolinksUtils.ts diff --git a/node_package/src/types/index.ts b/packages/react-on-rails/src/types/index.ts similarity index 100% rename from node_package/src/types/index.ts rename to packages/react-on-rails/src/types/index.ts diff --git a/node_package/src/utils.ts b/packages/react-on-rails/src/utils.ts similarity index 100% rename from node_package/src/utils.ts rename to packages/react-on-rails/src/utils.ts diff --git a/node_package/tests/Authenticity.test.js b/packages/react-on-rails/tests/Authenticity.test.js similarity index 100% rename from node_package/tests/Authenticity.test.js rename to packages/react-on-rails/tests/Authenticity.test.js diff --git a/node_package/tests/ComponentRegistry.test.js b/packages/react-on-rails/tests/ComponentRegistry.test.js similarity index 100% rename from node_package/tests/ComponentRegistry.test.js rename to packages/react-on-rails/tests/ComponentRegistry.test.js diff --git a/node_package/tests/ReactOnRails.test.jsx b/packages/react-on-rails/tests/ReactOnRails.test.jsx similarity index 100% rename from node_package/tests/ReactOnRails.test.jsx rename to packages/react-on-rails/tests/ReactOnRails.test.jsx diff --git a/node_package/tests/StoreRegistry.test.js b/packages/react-on-rails/tests/StoreRegistry.test.js similarity index 100% rename from node_package/tests/StoreRegistry.test.js rename to packages/react-on-rails/tests/StoreRegistry.test.js diff --git a/node_package/tests/SuspenseHydration.test.tsx b/packages/react-on-rails/tests/SuspenseHydration.test.tsx similarity index 100% rename from node_package/tests/SuspenseHydration.test.tsx rename to packages/react-on-rails/tests/SuspenseHydration.test.tsx diff --git a/node_package/tests/buildConsoleReplay.test.js b/packages/react-on-rails/tests/buildConsoleReplay.test.js similarity index 100% rename from node_package/tests/buildConsoleReplay.test.js rename to packages/react-on-rails/tests/buildConsoleReplay.test.js diff --git a/node_package/tests/emptyForTesting.js b/packages/react-on-rails/tests/emptyForTesting.js similarity index 100% rename from node_package/tests/emptyForTesting.js rename to packages/react-on-rails/tests/emptyForTesting.js diff --git a/node_package/tests/fixtures/rsc-payloads/simple-shell-with-async-component/chunk1.json b/packages/react-on-rails/tests/fixtures/rsc-payloads/simple-shell-with-async-component/chunk1.json similarity index 100% rename from node_package/tests/fixtures/rsc-payloads/simple-shell-with-async-component/chunk1.json rename to packages/react-on-rails/tests/fixtures/rsc-payloads/simple-shell-with-async-component/chunk1.json diff --git a/node_package/tests/fixtures/rsc-payloads/simple-shell-with-async-component/chunk2.json b/packages/react-on-rails/tests/fixtures/rsc-payloads/simple-shell-with-async-component/chunk2.json similarity index 100% rename from node_package/tests/fixtures/rsc-payloads/simple-shell-with-async-component/chunk2.json rename to packages/react-on-rails/tests/fixtures/rsc-payloads/simple-shell-with-async-component/chunk2.json diff --git a/node_package/tests/injectRSCPayload.test.ts b/packages/react-on-rails/tests/injectRSCPayload.test.ts similarity index 100% rename from node_package/tests/injectRSCPayload.test.ts rename to packages/react-on-rails/tests/injectRSCPayload.test.ts diff --git a/node_package/tests/jest.setup.js b/packages/react-on-rails/tests/jest.setup.js similarity index 100% rename from node_package/tests/jest.setup.js rename to packages/react-on-rails/tests/jest.setup.js diff --git a/node_package/tests/pageLifecycle.test.js b/packages/react-on-rails/tests/pageLifecycle.test.js similarity index 100% rename from node_package/tests/pageLifecycle.test.js rename to packages/react-on-rails/tests/pageLifecycle.test.js diff --git a/node_package/tests/registerServerComponent.client.test.jsx b/packages/react-on-rails/tests/registerServerComponent.client.test.jsx similarity index 100% rename from node_package/tests/registerServerComponent.client.test.jsx rename to packages/react-on-rails/tests/registerServerComponent.client.test.jsx diff --git a/node_package/tests/renderFunction.test.jsx b/packages/react-on-rails/tests/renderFunction.test.jsx similarity index 100% rename from node_package/tests/renderFunction.test.jsx rename to packages/react-on-rails/tests/renderFunction.test.jsx diff --git a/node_package/tests/scriptSanitizedVal.test.js b/packages/react-on-rails/tests/scriptSanitizedVal.test.js similarity index 100% rename from node_package/tests/scriptSanitizedVal.test.js rename to packages/react-on-rails/tests/scriptSanitizedVal.test.js diff --git a/node_package/tests/serverRenderReactComponent.test.ts b/packages/react-on-rails/tests/serverRenderReactComponent.test.ts similarity index 100% rename from node_package/tests/serverRenderReactComponent.test.ts rename to packages/react-on-rails/tests/serverRenderReactComponent.test.ts diff --git a/node_package/tests/streamServerRenderedReactComponent.test.jsx b/packages/react-on-rails/tests/streamServerRenderedReactComponent.test.jsx similarity index 100% rename from node_package/tests/streamServerRenderedReactComponent.test.jsx rename to packages/react-on-rails/tests/streamServerRenderedReactComponent.test.jsx diff --git a/node_package/tests/testUtils.js b/packages/react-on-rails/tests/testUtils.js similarity index 100% rename from node_package/tests/testUtils.js rename to packages/react-on-rails/tests/testUtils.js diff --git a/node_package/tests/utils.test.js b/packages/react-on-rails/tests/utils.test.js similarity index 100% rename from node_package/tests/utils.test.js rename to packages/react-on-rails/tests/utils.test.js diff --git a/react_on_rails.gemspec b/react_on_rails.gemspec index b4a8c9bd61..566c452425 100644 --- a/react_on_rails.gemspec +++ b/react_on_rails.gemspec @@ -17,7 +17,7 @@ Gem::Specification.new do |s| s.license = "MIT" s.files = `git ls-files -z`.split("\x0").reject do |f| - f.match(%r{^(docs|test|spec|features|gen-examples|tmp|node_modules|node_package|coverage|rakelib|script)/}) || + f.match(%r{^(docs|test|spec|features|gen-examples|tmp|node_modules|packages|coverage|rakelib|script)/}) || f.match(%r{^(jest\.config\.js|book\.json|package\.json|package-scripts\.yml|yarn\.lock|\..*)}) end s.bindir = "exe" diff --git a/react_on_rails_pro/package.json b/react_on_rails_pro/package.json index baf240ec7a..476562820b 100644 --- a/react_on_rails_pro/package.json +++ b/react_on_rails_pro/package.json @@ -116,7 +116,7 @@ "scripts": { "preinstall": "yarn run link-source && yalc add --link react-on-rails", "postinstall": "test -f post-yarn-install.local && ./post-yarn-install.local || true", - "link-source": "cd ../ && yarn && yalc publish", + "link-source": "cd ../packages/react-on-rails && yarn && yalc publish", "test": "nps test", "prepack": "nps build.prepack", "prepare": "nps build.prepack", diff --git a/react_on_rails_pro/spec/dummy/Gemfile.lock b/react_on_rails_pro/spec/dummy/Gemfile.lock index eca778a605..3655722068 100644 --- a/react_on_rails_pro/spec/dummy/Gemfile.lock +++ b/react_on_rails_pro/spec/dummy/Gemfile.lock @@ -6,17 +6,6 @@ GIT byebug (~> 11.0) pry (>= 0.13, < 0.15) -PATH - remote: ../.. - specs: - react_on_rails_pro (4.0.0) - addressable - connection_pool - execjs (~> 2.9) - httpx (~> 1.5) - rainbow - react_on_rails (>= 16.0.0) - PATH remote: ../../.. specs: @@ -28,6 +17,17 @@ PATH rainbow (~> 3.0) shakapacker (>= 6.0) +PATH + remote: ../.. + specs: + react_on_rails_pro (4.0.0) + addressable + connection_pool + execjs (~> 2.9) + httpx (~> 1.5) + rainbow + react_on_rails (>= 16.0.0) + GEM remote: https://rubygems.org/ specs: diff --git a/react_on_rails_pro/spec/execjs-compatible-dummy/package.json b/react_on_rails_pro/spec/execjs-compatible-dummy/package.json index 410f865ecd..7eab87e733 100644 --- a/react_on_rails_pro/spec/execjs-compatible-dummy/package.json +++ b/react_on_rails_pro/spec/execjs-compatible-dummy/package.json @@ -40,7 +40,7 @@ }, "scripts": { "preinstall": "yarn run link-source && yalc add --link react-on-rails", - "link-source": "cd ../../.. && yarn && yalc publish" + "link-source": "cd ../../.. && yarn && cd packages/react-on-rails && yalc publish" }, "devDependencies": { "@pmmmwh/react-refresh-webpack-plugin": "^0.5.15", diff --git a/script/convert b/script/convert index d834ba6eb5..e94e21e9fa 100755 --- a/script/convert +++ b/script/convert @@ -22,6 +22,7 @@ gsub_file_content("../Gemfile.development_dependencies", /gem "shakapacker", "[^ gsub_file_content("../spec/dummy/package.json", /"shakapacker": "[^"]*",/, '"shakapacker": "8.2.0",') # The below packages don't work on the oldest supported Node version and aren't needed there anyway +# Note: All dev dependencies remain in root package.json even after workspace migration gsub_file_content("../package.json", /"[^"]*eslint[^"]*": "[^"]*",?/, "") gsub_file_content("../package.json", /"globals": "[^"]*",/, "") gsub_file_content("../package.json", /"knip": "[^"]*",/, "") @@ -38,9 +39,9 @@ gsub_file_content("../package.json", /"react-dom": "[^"]*",/, '"react-dom": "18. gsub_file_content("../spec/dummy/package.json", /"react": "[^"]*",/, '"react": "18.0.0",') gsub_file_content("../spec/dummy/package.json", /"react-dom": "[^"]*",/, '"react-dom": "18.0.0",') gsub_file_content( - "../package.json", - "jest node_package/tests", - 'jest node_package/tests --testPathIgnorePatterns=\".*(RSC|stream|' \ + "../packages/react-on-rails/package.json", + "jest tests", + 'jest tests --testPathIgnorePatterns=\".*(RSC|stream|' \ 'registerServerComponent|serverRenderReactComponent|SuspenseHydration).*\"' ) # Keep modern JSX transform for React 18+ diff --git a/spec/dummy/package.json b/spec/dummy/package.json index ff8e8a3cce..d21f58cf0d 100644 --- a/spec/dummy/package.json +++ b/spec/dummy/package.json @@ -66,7 +66,7 @@ }, "scripts": { "preinstall": "yarn run link-source && yalc add --link react-on-rails", - "link-source": "cd ../.. && yarn run build && yalc publish", + "link-source": "cd ../.. && yarn run build && cd packages/react-on-rails && yalc publish", "lint": "cd ../.. && yarn run lint", "format": "cd ../.. && yarn run nps format", "test:js": "yarn run jest ./tests", diff --git a/tsconfig.json b/tsconfig.json index bb45d547f4..2318e1e3b7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,13 +7,13 @@ "jsx": "react-jsx", "lib": ["dom", "es2020"], "noImplicitAny": true, - "outDir": "node_package/lib", + "outDir": "packages/react-on-rails/lib", "allowImportingTsExtensions": true, "rewriteRelativeImportExtensions": true, "strict": true, "incremental": true, "target": "es2020", - "typeRoots": ["./node_modules/@types", "./node_package/types"] + "typeRoots": ["./node_modules/@types"] }, - "include": ["node_package/src/**/*", "node_package/types/**/*"] + "include": ["packages/react-on-rails/src/**/*"] }