Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ jobs:

- name: Build test assets
working-directory: spec/dummy
run: yarn build:test
run: yarn run build:test

- name: Run Playwright tests
working-directory: spec/dummy
run: yarn test:e2e
run: yarn run test:e2e

- uses: actions/upload-artifact@v4
if: always()
Expand Down
23 changes: 4 additions & 19 deletions .github/workflows/pro-test-package-and-gem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,29 +218,14 @@ jobs:
path: react_on_rails_pro/node_modules
key: v4-pro-package-node-modules-cache-${{ hashFiles('react_on_rails_pro/yarn.lock') }}

- name: Remove old webpack bundles
run: |
rm -rf spec/dummy/public/webpack
rm -rf spec/dummy/ssr-generated

- id: get-sha
run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"

- name: Restore test webpack bundles from cache
uses: actions/cache@v4
with:
path: |
react_on_rails_pro/spec/dummy/public/webpack/test
react_on_rails_pro/spec/dummy/ssr-generated
key: v4-pro-dummy-app-webpack-bundle-${{ steps.get-sha.outputs.sha }}

- name: Install Node modules with Yarn for Pro package
working-directory: packages/react-on-rails-pro-node-renderer
run: |
sudo yarn global add yalc
yarn install --frozen-lockfile --no-progress --no-emoji

- name: Run JS unit tests for Pro package
run: yarn run nps test.ci
run: yarn workspace react-on-rails-pro-node-renderer run ci
env:
JEST_JUNIT_OUTPUT_DIR: ./jest
JEST_JUNIT_ADD_FILE_ATTRIBUTE: "true"
Expand All @@ -250,10 +235,10 @@ jobs:
if: always()
with:
name: pro-jest-results
path: react_on_rails_pro/jest
path: packages/react-on-rails-pro-node-renderer/jest

# RSpec tests for Pro package
rspec-package-specs:
rspec-gem-specs:
needs: detect-changes
if: |
!(
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ node_modules/
package.json
# Exclude pro package (has its own formatting)
react_on_rails_pro/
packages/react-on-rails-pro-node-renderer/tests/fixtures/projects
tmp/
coverage/
**/app/assets/webpack/
Expand Down
35 changes: 4 additions & 31 deletions knip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,6 @@ const config: KnipConfig = {
// SWC transpiler dependencies used in dummy apps
'@swc/core',
'swc-loader',
// Test dependencies used by child workspaces (packages/react-on-rails, packages/react-on-rails-pro)
'@testing-library/dom',
'@testing-library/jest-dom',
'@testing-library/react',
'@types/react-dom',
'create-react-class',
'jest-fetch-mock',
'prop-types',
'react',
'react-dom',
'redux',
],
},

Expand All @@ -70,8 +59,7 @@ const config: KnipConfig = {
entry: [
'src/ReactOnRailsProNodeRenderer.ts!',
'src/default-node-renderer.ts!',
'src/master.ts!',
'src/worker.ts!',
'src/integrations/*.ts!',
],
project: ['src/**/*.[jt]s{x,}!', 'tests/**/*.[jt]s{x,}', '!lib/**'],
ignore: [
Expand All @@ -84,11 +72,9 @@ const config: KnipConfig = {
'tests/httpRequestUtils.ts',
],
ignoreDependencies: [
// These are runtime dependencies needed for the package to work
// even though they may not be directly imported in the source
'react-on-rails-pro',
// Dev dependencies used only in tests
// Optional dependencies used in integrations
'@honeybadger-io/js',
'@sentry/*',
],
},

Expand Down Expand Up @@ -125,11 +111,6 @@ const config: KnipConfig = {
'src/RSCRoute.tsx:RSCRouteProps',
'src/streamServerRenderedReactComponent.ts:StreamingTrackers',
],
ignoreDependencies: [
// Test dependencies used only in tests
'@types/mock-fs',
'mock-fs',
],
},
'spec/dummy': {
entry: [
Expand Down Expand Up @@ -192,18 +173,10 @@ const config: KnipConfig = {
// Dependencies not detected in production mode (runtime injected or dynamic imports)
'@babel/runtime',
'mini-css-extract-plugin',
'css-loader',
'sass',
'sass-loader',
// Dependencies used dynamically by React on Rails
'create-react-class',
'react-helmet',
'@types/react-helmet',
'react-redux',
'react-router-dom',
],
},
},
ignoreExportsUsedInFile: true,
};

export default config;
24 changes: 21 additions & 3 deletions package-scripts.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
scripts:
test:
default:
description: Run all JS tests
script: jest
ci:
description: Run all JS tests in CI mode
# https://circleci.com/docs/collect-test-data/#jest
script: jest --ci --runInBand --reporters=default --reporters=jest-junit
debug:
description: Debug all JS tests
script: ndb jest --runInBand
check:
description: Run all checks
script: nps lint && nps format.listDifferent && nps test && nps check-typescript
check-typescript:
description: Check for TypeScript errors
script: nps "build --noEmit" && tsc --project ../packages/react-on-rails-pro-node-renderer/tests

lint:
description: Run all linters (eslint, tsc)
script: nps eslint
Expand All @@ -25,10 +43,10 @@ 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 lib/ReactOnRails.full.js ] ||
[ -f lib/ReactOnRails.full.js ] || [ -f lib/ReactOnRailsProNodeRenderer.js ] ||
(npm run build >/dev/null 2>&1 || true) &&
[ -f lib/ReactOnRails.full.js ] ||
{ echo 'Building react-on-rails seems to have failed!'; }
[ -f lib/ReactOnRails.full.js ] || [ -f lib/ReactOnRailsProNodeRenderer.js ] ||
{ echo 'Building this package seems to have failed!'; }

format:
default:
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@babel/preset-react": "^7.26.3",
"@babel/preset-typescript": "^7.27.1",
"@eslint/compat": "^1.2.7",
"@jest/globals": "^29.7.0",
"@swc/core": "^1.15.0",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.3",
Expand Down Expand Up @@ -66,10 +67,10 @@
"scripts": {
"test": "yarn workspaces run test",
"clean": "yarn workspaces run clean",
"start": "nps",
"start": "yarn run nps",
"build": "yarn workspace react-on-rails run build && yarn workspace react-on-rails-pro run build && yarn workspace react-on-rails-pro-node-renderer run build",
"build-watch": "yarn workspaces run build-watch",
"lint": "nps eslint",
"lint": "yarn run nps eslint",
"lint:scss": "stylelint \"spec/dummy/app/assets/stylesheets/**/*.scss\" \"spec/dummy/client/**/*.scss\"",
"check": "yarn run lint && yarn workspaces run check",
"type-check": "yarn workspaces run type-check",
Expand Down
122 changes: 81 additions & 41 deletions packages/react-on-rails-pro-node-renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,69 +3,61 @@
"version": "16.2.0-beta.11",
"protocolVersion": "2.0.0",
"description": "React on Rails Pro Node Renderer for server-side rendering",
"type": "module",
"main": "lib/ReactOnRailsProNodeRenderer.js",
"scripts": {
"build": "yarn run clean && tsc --project src",
"build-watch": "yarn run clean && tsc --project src --watch",
"clean": "rm -rf ./lib",
"test": "jest tests",
"type-check": "tsc --project src --noEmit --noErrorTruncation",
"prepack": "yarn run build",
"prepare": "yarn run build",
"prepublishOnly": "yarn run build",
"yalc:publish": "yalc publish",
"yalc": "yalc"
"directories": {
"doc": "docs"
},
"repository": {
"type": "git",
"url": "git+https://github.com/shakacode/react_on_rails.git"
"exports": {
".": {
"types": "./lib/ReactOnRailsProNodeRenderer.d.ts",
"default": "./lib/ReactOnRailsProNodeRenderer.js"
},
"./integrations/*": {
"types": "./lib/integrations/*.d.ts",
"default": "./lib/integrations/*.js"
},
"./package.json": "./package.json"
},
"resolutions": {
"sentry-testkit/body-parser": "npm:empty-npm-package@1.0.0",
"sentry-testkit/express": "npm:empty-npm-package@1.0.0"
},
"keywords": [
"react",
"react-on-rails",
"node-renderer",
"server-side-rendering",
"ssr"
],
"author": "justin.gordon@gmail.com",
"license": "UNLICENSED",
"dependencies": {
"@fastify/formbody": "^7.4.0 || ^8.0.2",
"@fastify/multipart": "^8.3.1 || ^9.0.3",
"fastify": "^4.29.0 || ^5.2.1",
"fs-extra": "^11.2.0",
"jsonwebtoken": "^9.0.2",
"lockfile": "^1.0.4",
"pino": "^9.0.0",
"pino-pretty": "^13.0.0",
"react-on-rails": "16.2.0-beta.11",
"react-on-rails-pro": "16.2.0-beta.11"
"pino": "^9.0.0"
},
"devDependencies": {
"@babel/core": "^7.26.10",
"@babel/eslint-parser": "^7.27.0",
"@babel/preset-react": "^7.26.3",
"@honeybadger-io/js": "^6.10.1",
"@jest/globals": "^29.7.0",
"@sentry/node": "^7.120.0",
"@sentry/types": "^7.120.0",
"@tsconfig/node14": "^14.1.2",
"@types/fs-extra": "^11.0.4",
"@types/jest": "^29.5.12",
"@types/jsonwebtoken": "^9.0.10",
"@types/lockfile": "^1.0.4",
"@types/node": "^20.0.0",
"@types/touch": "^3.1.5",
"babel-jest": "^29.7.0",
"form-auto-content": "^3.2.1",
"form-data": "^4.0.1",
"jsdom": "^16.5.0",
"node-html-parser": "^7.0.1",
"nps": "^5.9.12",
"pino-pretty": "^13.0.0",
"react-on-rails": "./packages/react-on-rails",
"redis": "^5.0.1",
"sentry-testkit": "^5.0.6",
"touch": "^3.1.0"
"touch": "^3.1.0",
"typescript": "^5.4.3"
},
"peerDependencies": {
"@honeybadger-io/js": ">=4.0.0",
"@sentry/node": ">=5.0.0 <9.0.0",
"@sentry/tracing": ">=5.0.0",
"react": ">= 16",
"react-dom": ">= 16"
"@sentry/tracing": ">=5.0.0"
},
"peerDependenciesMeta": {
"@honeybadger-io/js": {
Expand All @@ -78,12 +70,60 @@
"optional": true
}
},
"files": [
"lib/**/*.js",
"lib/**/*.d.ts"
"scripts": {
"build": "yarn run clean && yarn run tsc --project src/tsconfig.json",
"build-watch": "yarn run clean && yarn run tsc --watch --project src/tsconfig.json",
"clean": "rm -rf ./lib",
"ci": "jest --ci --runInBand --reporters=default --reporters=jest-junit",
"developing": "nps node-renderer.debug",
"test": "jest tests",
"type-check": "yarn run tsc --noEmit --noErrorTruncation --project src/tsconfig.json",
"prepack": "nps build.prepack",
"prepare": "nps build.prepack",
"prepublishOnly": "yarn run build",
"yalc:publish": "yalc publish",
"yalc": "yalc"
},
"repository": {
"type": "git",
"url": "git+https://github.com/shakacode/react_on_rails.git"
},
"keywords": [
"react",
"webpack",
"JavaScript",
"Ruby",
"on",
"Rails"
],
"author": "justin@shakacode.com",
"license": "UNLICENSED",
"bugs": {
"url": "https://github.com/shakacode/react_on_rails/issues"
},
"homepage": "https://github.com/shakacode/react_on_rails#readme"
"homepage": "https://github.com/shakacode/react_on_rails/tree/master/packages/react-on-rails-pro-node-renderer#readme",
"jest": {
"clearMocks": true,
"moduleNameMapper": {
"^(\\.{1,2}/.*)\\.js$": "$1"
},
"resetModules": true,
"resetMocks": true,
"roots": [
"."
],
"setupFiles": [
"./tests/helper.ts"
],
"testEnvironment": "node",
"transform": {
"^.+\\.[jt]sx?$": "babel-jest"
}
},
"husky": {
"hooks": {
"pre-commit": "yalc check"
}
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import cluster from 'cluster';
import fastifyPackageJson from 'fastify/package.json' with { type: 'json' };
import fastifyPackageJson from 'fastify/package.json';
import { Config, buildConfig } from './shared/configBuilder.js';

const { version: fastifyVersion } = fastifyPackageJson;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export {
addNotifier,
error,
message,
Notifier,
ErrorNotifier,
MessageNotifier,
} from '../shared/errorReporter.js';
export {
setupTracing,
Expand Down
Loading
Loading