Skip to content

Commit

Permalink
Merge branch 'main' into tobbe-rehackt-0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobbe committed Apr 26, 2024
2 parents d2701eb + a2a4a02 commit ecdb77f
Show file tree
Hide file tree
Showing 126 changed files with 35 additions and 29 deletions.
3 changes: 3 additions & 0 deletions .changesets/10520.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- feat(eslint): Disable restricted $api imports for entryserver (#10520) by @dac09

With the introduction of middleware, it's pretty common to import things from the $api side. This is a non-issue as entry.server.{jsx,tsx} is not part of the client bundle we generate.
4 changes: 2 additions & 2 deletions .github/actions/detect-changes/cases/rsc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ export function rscChanged(changedFiles){
changedFile.startsWith('tasks/smoke-tests/rsa/') ||
changedFile.startsWith('tasks/smoke-tests/basePlaywright.config.ts') ||
changedFile.startsWith('.github/actions/set-up-rsa-project/') ||
changedFile.startsWith('.github/actions/set-up-rsc-external-packages-project/') ||
changedFile.startsWith('.github/actions/set-up-rsc-kitchen-sink-project/') ||
changedFile.startsWith('.github/actions/set-up-rsc-project/') ||
changedFile.startsWith('packages/internal/') ||
changedFile.startsWith('packages/project-config/') ||
changedFile.startsWith('packages/web/') ||
changedFile.startsWith('packages/vite/') ||
changedFile.startsWith('__fixtures__/test-project-rsa') ||
changedFile.startsWith('__fixtures__/test-project-rsc-external-packages')
changedFile.startsWith('__fixtures__/test-project-rsc-kitchen-sink')
) {
console.log('RSC change detected:', changedFile)
return true
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
This action copies a RW project with Streaming SSR and RSC support already set
up. It's used for RSC smoke tests.

It copies the `__fixtures__/test-project-rsc-external-packages-and-cells`
It copies the `__fixtures__/test-project-rsc-kitchen-sink`
project, runs `yarn install` and `project:copy`. Finally it builds the rw app.

## Testing/running locally

Go into the github actions folder
`cd .github/actions/set-up-rsc-external-packages-and-cells-project`
`cd .github/actions/set-up-rsc-kitchen-sink-project`

Then run the following command to execute the action
`node setUpRscExternalPackagesProjectLocally.mjs`
`node setUpRscKitchenSinkProjectLocally.mjs`

## Design

The main logic of the action is in the `../actionsLib.mjs` file. To be able to
run that code both on GitHub and locally it uses dependency injection. The
injection is done by `setupRscExternalPackagesProjectLocally.mjs` for when you
injection is done by `setupRscKitchenSinkProjectLocally.mjs` for when you
want to run the action on your own machine and by
`setupRscExternalPackagesProjectGitHib.mjs` when it's triggered by GitHub CI.
`setupRscKitchenSinkProjectGitHib.mjs` when it's triggered by GitHub CI.

When doing further changes to the code here it's very important to keep the
DI scripts as light on logic as possible. Ideally all logic is kept to
Expand Down
10 changes: 10 additions & 0 deletions .github/actions/set-up-rsc-kitchen-sink-project/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Set up RSC kitchen sink test project from fixture
description: Sets up an RSC project that tests all-the-things

runs:
using: node20
main: 'setUpRscKitchenSinkProjectGitHub.mjs'

outputs:
test-project-path:
description: Path to the test project
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "set-up-rsc-external-packages-and-cells-project",
"name": "set-up-rsc-kitchen-sink-project",
"version": "0.0.0",
"private": true,
"type": "module"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import core from '@actions/core'

import { createExecWithEnvInCwd, setUpRscTestProject } from '../actionsLib.mjs'

const testProjectAndFixtureName = 'test-project-rsc-external-packages-and-cells'
const testProjectAndFixtureName = 'test-project-rsc-kitchen-sink'
const testProjectPath = path.join(
path.dirname(process.cwd()),
testProjectAndFixtureName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function getExecaOptions(cwd, env = {}) {
}
}

const testProjectAndFixtureName = 'test-project-rsc-external-packages-and-cells'
const testProjectAndFixtureName = 'test-project-rsc-kitchen-sink'

const testProjectPath = path.join(
os.tmpdir(),
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -496,18 +496,18 @@ jobs:
REDWOOD_TEST_PROJECT_PATH: ${{ steps.set-up-rsa-project.outputs.test-project-path }}
REDWOOD_DISABLE_TELEMETRY: 1

- name: 🌲 Set up RSC external packages and Cells smoke test
id: set-up-rsc-external-packages-and-cells-project
uses: ./.github/actions/set-up-rsc-external-packages-and-cells-project
- name: 🌲 Set up RSC Kitchen Sink smoke test
id: set-up-rsc-kitchen-sink-project
uses: ./.github/actions/set-up-rsc-kitchen-sink-project
env:
REDWOOD_DISABLE_TELEMETRY: 1
YARN_ENABLE_IMMUTABLE_INSTALLS: false

- name: 🐘 Run RSC external packages and cells smoke tests
working-directory: tasks/smoke-tests/rsc-external-packages-and-cells
- name: 🐘 Run RSC Kitchen Sink smoke tests
working-directory: tasks/smoke-tests/rsc-kitchen-sink
run: npx playwright test
env:
REDWOOD_TEST_PROJECT_PATH: ${{ steps.set-up-rsc-external-packages-and-cells-project.outputs.test-project-path }}
REDWOOD_TEST_PROJECT_PATH: ${{ steps.set-up-rsc-kitchen-sink-project.outputs.test-project-path }}
REDWOOD_DISABLE_TELEMETRY: 1

rsc-smoke-tests-skip:
Expand Down
5 changes: 4 additions & 1 deletion packages/eslint-config/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,10 @@ module.exports = {
},
},
{
files: ['web/src/**/*.routeHooks.{js,ts}'],
files: [
'web/src/**/*.routeHooks.{js,ts}',
'web/src/entry.server.{jsx,tsx}',
],
rules: { 'no-restricted-imports': 'off' },
},
],
Expand Down
4 changes: 2 additions & 2 deletions packages/vite/src/clientSsr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,13 @@ export function renderFromDist<TProps extends Record<string, any>>(
get(_target, encodedId: string) {
console.log('Proxy get encodedId', encodedId)
const [filePath, name] = encodedId.split('#') as [string, string]
// filePath /Users/tobbe/tmp/test-project-rsc-external-packages-and-cells/web/dist/rsc/assets/rsc-AboutCounter.tsx-1.mjs
// filePath /Users/tobbe/tmp/test-project-rsc-kitchen-sink/web/dist/rsc/assets/rsc-AboutCounter.tsx-1.mjs
// name AboutCounter

const id = resolveClientEntryForProd(filePath, clientEntries)

console.log('clientSsr.ts::Proxy id', id)
// id /Users/tobbe/tmp/test-project-rsc-external-packages-and-cells/web/dist/client/assets/rsc-AboutCounter.tsx-1-4kTKU8GC.mjs
// id /Users/tobbe/tmp/test-project-rsc-kitchen-sink/web/dist/client/assets/rsc-AboutCounter.tsx-1-4kTKU8GC.mjs
return { id, chunks: [id], name, async: true }
},
},
Expand Down

0 comments on commit ecdb77f

Please sign in to comment.