-
-
Notifications
You must be signed in to change notification settings - Fork 638
Phase 3: Prepare core package for workspace structure #1830
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 12 commits
7745727
ce91f23
0182224
6f08b49
385df7f
4417277
3b34f34
5fd223e
ef7c6e6
4b94aba
8cf9138
ee4487a
5eb784f
a9e1e01
3250a03
660cab3
eab8e2a
c1c6b45
b34e161
946698d
a784eb6
87fe9cc
3e992bc
20f2f0b
dfc1275
caf8d34
325e4e8
e0d1365
fd728b3
0a97c1e
86e0ab6
ceb15a6
4331ea1
40ccdb2
c9c406f
804a88d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -84,13 +84,13 @@ aliases: | |||||||||
| - &restore-package-node-modules-cache | ||||||||||
| name: Restore cached node_modules directory (Pro) | ||||||||||
| keys: | ||||||||||
| - v4-pro-package-node-modules-cache-{{ checksum "react_on_rails_pro/yarn.lock" }} | ||||||||||
| - v4-pro-package-node-modules-cache-{{ checksum "react_on_rails_pro/yarn.lock" }}-{{ checksum "yarn.lock" }} | ||||||||||
|
|
||||||||||
| # Restore spec/dummy/node_modules dir from cache using yarn.lock checksum as a key. | ||||||||||
| - &restore-dummy-app-node-modules-cache | ||||||||||
| name: Restore cached spec/dummy/node_modules directory (Pro) | ||||||||||
| keys: | ||||||||||
| - v4-pro-dummy-app-node-modules-cache-{{ checksum "react_on_rails_pro/spec/dummy/yarn.lock" }} | ||||||||||
| - v4-pro-dummy-app-node-modules-cache-{{ checksum "react_on_rails_pro/spec/dummy/yarn.lock" }}-{{ checksum "yarn.lock" }} | ||||||||||
|
||||||||||
| - v4-pro-dummy-app-node-modules-cache-{{ checksum "react_on_rails_pro/spec/dummy/yarn.lock" }}-{{ checksum "yarn.lock" }} | |
| - save_cache: | |
| # (other save_cache fields like `paths:` here) | |
| key: v4-pro-dummy-app-node-modules-cache-{{ checksum "react_on_rails_pro/spec/dummy/yarn.lock" }}-{{ checksum "yarn.lock" }} |
π€ Prompt for AI Agents
In .circleci/config.yml around line 93, the dummy app restore key includes the
suffix {{ checksum "yarn.lock" }} but the corresponding save_cache key (around
line 182) does not; update the save_cache key to include the same {{ checksum
"yarn.lock" }} suffix (matching the dummy app path and global yarn.lock
checksums used in the restore key) so the saved dummy app node_modules cache can
be restored correctly.
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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 | ||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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
Suggested change
π€ Prompt for AI Agents |
||||||||||||
| - 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 | ||||||||||||
|
|
||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ tmp/ | |
| node_modules | ||
|
|
||
| /node_package/lib | ||
| /packages/*/lib | ||
|
|
||
| yarn-debug.* | ||
| yarn-error.* | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,36 +5,40 @@ const config: KnipConfig = { | |
| workspaces: { | ||
| '.': { | ||
| 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!', | ||
| 'packages/react-on-rails/src/ReactOnRails.node.ts!', | ||
| 'packages/react-on-rails/src/pro/ReactOnRailsRSC.ts!', | ||
| 'packages/react-on-rails/src/pro/registerServerComponent/client.tsx!', | ||
| 'packages/react-on-rails/src/pro/registerServerComponent/server.tsx!', | ||
| 'packages/react-on-rails/src/pro/registerServerComponent/server.rsc.ts!', | ||
| 'packages/react-on-rails/src/pro/wrapServerComponentRenderer/server.tsx!', | ||
| 'packages/react-on-rails/src/pro/wrapServerComponentRenderer/server.rsc.tsx!', | ||
| 'packages/react-on-rails/src/pro/RSCRoute.tsx!', | ||
| 'packages/react-on-rails/src/pro/ServerComponentFetchError.ts!', | ||
| 'packages/react-on-rails/src/pro/getReactServerComponent.server.ts!', | ||
| 'packages/react-on-rails/src/pro/transformRSCNodeStream.ts!', | ||
| 'packages/react-on-rails/src/loadJsonFile.ts!', | ||
| 'eslint.config.ts', | ||
| ], | ||
| project: [ | ||
| 'node_package/src/**/*.[jt]s{x,}!', | ||
| 'packages/react-on-rails/src/**/*.[jt]s{x,}!', | ||
| 'node_package/tests/**/*.[jt]s{x,}', | ||
| '!react_on_rails_pro/**', | ||
| '!packages/react-on-rails/lib/**', | ||
| ], | ||
|
||
| babel: { | ||
| config: ['node_package/babel.config.js'], | ||
| }, | ||
| ignore: [ | ||
| 'node_package/tests/emptyForTesting.js', | ||
| // Build output directories that should be ignored | ||
| 'packages/react-on-rails/lib/**', | ||
| 'node_package/lib/**', | ||
| // 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', | ||
| 'packages/react-on-rails/src/pro/streamServerRenderedReactComponent.ts:transformRenderStreamChunksToResultObject', | ||
| 'packages/react-on-rails/src/pro/streamServerRenderedReactComponent.ts:streamServerRenderedComponent', | ||
| 'packages/react-on-rails/src/pro/ServerComponentFetchError.ts:isServerComponentFetchError', | ||
| 'packages/react-on-rails/src/pro/RSCRoute.tsx:RSCRouteProps', | ||
| 'packages/react-on-rails/src/pro/streamServerRenderedReactComponent.ts:StreamingTrackers', | ||
| // Exclude entire pro directory - it has its own package.json with dependencies | ||
| 'react_on_rails_pro/**', | ||
| ], | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,7 +4,7 @@ | |||||
| import { createStore } from 'redux'; | ||||||
| import * as React from 'react'; | ||||||
| import * as createReactClass from 'create-react-class'; | ||||||
| import ReactOnRails from '../src/ReactOnRails.client.ts'; | ||||||
| import ReactOnRails from '../../packages/react-on-rails/src/ReactOnRails.client.ts'; | ||||||
|
||||||
| import ReactOnRails from '../../packages/react-on-rails/src/ReactOnRails.client.ts'; | |
| import ReactOnRails from 'react-on-rails/src/ReactOnRails.client.ts'; |
π§° Tools
πͺ ESLint
[error] 7-7: Relative import from another package is not allowed. Use react-on-rails/src/ReactOnRails.client.ts instead of ../../packages/react-on-rails/src/ReactOnRails.client.ts
(import/no-relative-packages)
π€ Prompt for AI Agents
In node_package/tests/ReactOnRails.test.jsx around line 7, replace the
cross-package relative import
"../../packages/react-on-rails/src/ReactOnRails.client.ts" with the published
package alias (e.g. import ReactOnRails from 'react-on-rails') to satisfy
import/no-relative-packages; update any other files using
../../packages/react-on-rails/... to the same package alias and run ESLint to
verify the violation is resolved.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,7 +1,7 @@ | ||||||||||||||||||||
| import { Readable, PassThrough } from 'stream'; | ||||||||||||||||||||
| import { RailsContextWithServerStreamingCapabilities } from '../src/types/index.ts'; | ||||||||||||||||||||
| import injectRSCPayload from '../src/pro/injectRSCPayload.ts'; | ||||||||||||||||||||
| import RSCRequestTracker from '../src/pro/RSCRequestTracker.ts'; | ||||||||||||||||||||
| import { RailsContextWithServerStreamingCapabilities } from '../../packages/react-on-rails/src/types/index.ts'; | ||||||||||||||||||||
| import injectRSCPayload from '../../packages/react-on-rails/src/pro/injectRSCPayload.ts'; | ||||||||||||||||||||
| import RSCRequestTracker from '../../packages/react-on-rails/src/pro/RSCRequestTracker.ts'; | ||||||||||||||||||||
|
||||||||||||||||||||
| import { RailsContextWithServerStreamingCapabilities } from '../../packages/react-on-rails/src/types/index.ts'; | |
| import injectRSCPayload from '../../packages/react-on-rails/src/pro/injectRSCPayload.ts'; | |
| import RSCRequestTracker from '../../packages/react-on-rails/src/pro/RSCRequestTracker.ts'; | |
| // node_package/tests/injectRSCPayload.test.ts | |
| -import { RailsContextWithServerStreamingCapabilities } from '../../packages/react-on-rails/src/types/index.ts'; | |
| -import injectRSCPayload from '../../packages/react-on-rails/src/pro/injectRSCPayload.ts'; | |
| import { RailsContextWithServerStreamingCapabilities } from 'react-on-rails/src/types/index.ts'; | |
| import injectRSCPayload from 'react-on-rails/src/pro/injectRSCPayload.ts'; | |
| import RSCRequestTracker from 'react-on-rails/src/pro/RSCRequestTracker.ts'; |
π§° Tools
πͺ ESLint
[error] 2-2: Relative import from another package is not allowed. Use react-on-rails/src/types/index.ts instead of ../../packages/react-on-rails/src/types/index.ts
(import/no-relative-packages)
[error] 3-3: Relative import from another package is not allowed. Use react-on-rails/src/pro/injectRSCPayload.ts instead of ../../packages/react-on-rails/src/pro/injectRSCPayload.ts
(import/no-relative-packages)
[error] 4-4: Relative import from another package is not allowed. Use react-on-rails/src/pro/RSCRequestTracker.ts instead of ../../packages/react-on-rails/src/pro/RSCRequestTracker.ts
(import/no-relative-packages)
π€ Prompt for AI Agents
In node_package/tests/injectRSCPayload.test.ts lines 2-4, the test currently
imports three modules via cross-package relative paths which violate the lint
rule; replace the three relative imports with the package's published workspace
alias (the react-on-rails package entry points) so the imports read from the
package name (e.g., react-on-rails or its scoped workspace name) instead of
'../../packages/react-on-rails/src/...', updating all three imports to use the
package alias.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -23,11 +23,11 @@ if (typeof window !== 'undefined') { | |||||||||||||||||||||||||||
| // Node's fetch and polyfills like jest-fetch-mock return Node's Readable stream, | ||||||||||||||||||||||||||||
| // so we convert it to a web-standard ReadableStream for consistency | ||||||||||||||||||||||||||||
| // Note: Node's Readable stream exists in node 'stream' built-in module, can be imported as `import { Readable } from 'stream'` | ||||||||||||||||||||||||||||
| jest.mock('../src/utils', () => ({ | ||||||||||||||||||||||||||||
| ...jest.requireActual('../src/utils'), | ||||||||||||||||||||||||||||
| jest.mock('../../packages/react-on-rails/src/utils', () => ({ | ||||||||||||||||||||||||||||
| ...jest.requireActual('../../packages/react-on-rails/src/utils'), | ||||||||||||||||||||||||||||
| fetch: (...args) => | ||||||||||||||||||||||||||||
| jest | ||||||||||||||||||||||||||||
| .requireActual('../src/utils') | ||||||||||||||||||||||||||||
| .requireActual('../../packages/react-on-rails/src/utils') | ||||||||||||||||||||||||||||
| .fetch(...args) | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
| jest.mock('../../packages/react-on-rails/src/utils', () => ({ | |
| ...jest.requireActual('../../packages/react-on-rails/src/utils'), | |
| fetch: (...args) => | |
| jest | |
| .requireActual('../src/utils') | |
| .requireActual('../../packages/react-on-rails/src/utils') | |
| .fetch(...args) | |
| jest.mock('react-on-rails/src/utils', () => ({ | |
| ...jest.requireActual('react-on-rails/src/utils'), | |
| fetch: (...args) => | |
| jest | |
| .requireActual('react-on-rails/src/utils') | |
| .fetch(...args) |
π€ Prompt for AI Agents
In node_package/tests/jest.setup.js around lines 26-31, the jest.mock and
jest.requireActual calls use forbidden relative paths like
'../../packages/react-on-rails/src/utils'; update those paths to use the
repository's configured package alias (the package import name used in
tsconfig/webpack/jest moduleNameMapper, e.g. 'react-on-rails/src/utils' or the
exact alias your project uses) for both jest.mock and jest.requireActual calls,
and scan other test files for any remaining '../../packages/...' usages and
replace them with the same alias so ESLint passes.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ | |
| import * as React from 'react'; | ||
| import * as createReactClass from 'create-react-class'; | ||
|
|
||
| import isRenderFunction from '../src/isRenderFunction.ts'; | ||
| import isRenderFunction from '../../packages/react-on-rails/src/isRenderFunction.ts'; | ||
|
||
|
|
||
| describe('isRenderFunction', () => { | ||
| it('returns false for a ES5 React Component', () => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,13 @@ | ||
| import * as React from 'react'; | ||
| import serverRenderReactComponent from '../src/serverRenderReactComponent.ts'; | ||
| import * as ComponentRegistry from '../src/pro/ComponentRegistry.ts'; | ||
| import serverRenderReactComponent from '../../packages/react-on-rails/src/serverRenderReactComponent.ts'; | ||
| import * as ComponentRegistry from '../../packages/react-on-rails/src/pro/ComponentRegistry.ts'; | ||
|
||
| import type { | ||
| RenderParams, | ||
| RenderResult, | ||
| RailsContext, | ||
| RenderFunction, | ||
| RenderFunctionResult, | ||
| } from '../src/types/index.ts'; | ||
| } from '../../packages/react-on-rails/src/types/index.ts'; | ||
|
|
||
| const assertIsString: (value: unknown) => asserts value is string = (value: unknown) => { | ||
| if (typeof value !== 'string') { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,9 +4,9 @@ | |||||||||||||
|
|
||||||||||||||
| import * as React from 'react'; | ||||||||||||||
| import * as PropTypes from 'prop-types'; | ||||||||||||||
| import streamServerRenderedReactComponent from '../src/pro/streamServerRenderedReactComponent.ts'; | ||||||||||||||
| import * as ComponentRegistry from '../src/pro/ComponentRegistry.ts'; | ||||||||||||||
| import ReactOnRails from '../src/ReactOnRails.node.ts'; | ||||||||||||||
| import streamServerRenderedReactComponent from '../../packages/react-on-rails/src/pro/streamServerRenderedReactComponent.ts'; | ||||||||||||||
| import * as ComponentRegistry from '../../packages/react-on-rails/src/pro/ComponentRegistry.ts'; | ||||||||||||||
| import ReactOnRails from '../../packages/react-on-rails/src/ReactOnRails.node.ts'; | ||||||||||||||
|
||||||||||||||
| import streamServerRenderedReactComponent from '../../packages/react-on-rails/src/pro/streamServerRenderedReactComponent.ts'; | |
| import * as ComponentRegistry from '../../packages/react-on-rails/src/pro/ComponentRegistry.ts'; | |
| import ReactOnRails from '../../packages/react-on-rails/src/ReactOnRails.node.ts'; | |
| import streamServerRenderedReactComponent from 'react-on-rails/src/pro/streamServerRenderedReactComponent.ts'; | |
| import * as ComponentRegistry from 'react-on-rails/src/pro/ComponentRegistry.ts'; | |
| import ReactOnRails from 'react-on-rails/src/ReactOnRails.node.ts'; |
π§° Tools
πͺ ESLint
[error] 7-7: Relative import from another package is not allowed. Use react-on-rails/src/pro/streamServerRenderedReactComponent.ts instead of ../../packages/react-on-rails/src/pro/streamServerRenderedReactComponent.ts
(import/no-relative-packages)
[error] 8-8: Relative import from another package is not allowed. Use react-on-rails/src/pro/ComponentRegistry.ts instead of ../../packages/react-on-rails/src/pro/ComponentRegistry.ts
(import/no-relative-packages)
[error] 9-9: Relative import from another package is not allowed. Use react-on-rails/src/ReactOnRails.node.ts instead of ../../packages/react-on-rails/src/ReactOnRails.node.ts
(import/no-relative-packages)
π€ Prompt for AI Agents
In node_package/tests/streamServerRenderedReactComponent.test.jsx around lines
7-9, the test imports use relative paths into packages which triggers
import/no-relative-packages; update each import to reference the workspace
package entrypoint instead (use the package name defined in that package's
package.json), e.g. replace the three relative imports with imports from the
workspace package name (pointing to the pro entry points exported by the
package) so tests import via the package alias rather than ../../packages/...,
and save the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cache restore/save key mismatch breaks reuse
You added the root
yarn.lockchecksum to the restore key, but the correspondingsave_cachekey (line 166) still omits it. CircleCI wonβt hit the cache because the keys no longer match, so every job will reinstall node_modules from scratch. Please update the save key to include the same checksum suffix.π Committable suggestion
π€ Prompt for AI Agents