Skip to content

Commit

Permalink
chore(rsc): update paths and CI (#10196)
Browse files Browse the repository at this point in the history
This PR extracts out the non Vite v5 related changes from
#10167. That one is proving
difficult (the SSR smoke test keeps failing—`entry.server.mjs` isn't in
dist, but `entry.client.mjs` is 🤔) and I don't want some of these
changes to have to wait since they're unrelated.
  • Loading branch information
jtoar committed Mar 11, 2024
1 parent bc1a953 commit 90b8479
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 23 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,10 @@ jobs:
REDWOOD_TEST_PROJECT_PATH: ${{ steps.set-up-rsc-project.outputs.rsc-project-path }}
REDWOOD_DISABLE_TELEMETRY: 1

# TODO(jtoar): This workflow times out on Windows. It looks as if the dev server starts up ok,
# but it doesn't seem like the browser is rendering what it should be.
- name: 🐘 Run RSC dev smoke tests
if: matrix.os == 'ubuntu-latest'
working-directory: tasks/smoke-tests/rsc-dev
run: npx playwright test
env:
Expand Down Expand Up @@ -683,7 +686,7 @@ jobs:

- name: Build for production
working-directory: ${{ steps.set-up-test-project.outputs.test-project-path }}
run: yarn rw build --no-prerender
run: yarn rw build --no-prerender --verbose
env:
REDWOOD_DISABLE_TELEMETRY: 1

Expand Down
16 changes: 8 additions & 8 deletions packages/project-config/src/__tests__/paths.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ describe('paths', () => {
'web',
'dist',
'server',
'entry.server.js',
'entry.server.mjs',
),
distRouteHooks: path.join(
FIXTURE_BASEDIR,
Expand All @@ -163,7 +163,7 @@ describe('paths', () => {
'web',
'dist',
'server',
'Document.js',
'Document.mjs',
),
distRscEntries: path.join(
FIXTURE_BASEDIR,
Expand Down Expand Up @@ -423,14 +423,14 @@ describe('paths', () => {
'web',
'dist',
'server',
'entry.server.js',
'entry.server.mjs',
),
distDocumentServer: path.join(
FIXTURE_BASEDIR,
'web',
'dist',
'server',
'Document.js',
'Document.mjs',
),
distRouteHooks: path.join(
FIXTURE_BASEDIR,
Expand Down Expand Up @@ -749,14 +749,14 @@ describe('paths', () => {
'web',
'dist',
'server',
'entry.server.js',
'entry.server.mjs',
),
distDocumentServer: path.join(
FIXTURE_BASEDIR,
'web',
'dist',
'server',
'Document.js',
'Document.mjs',
), // this is constructed regardless of presence of src/Document
distRouteHooks: path.join(
FIXTURE_BASEDIR,
Expand Down Expand Up @@ -1026,14 +1026,14 @@ describe('paths', () => {
'web',
'dist',
'server',
'entry.server.js',
'entry.server.mjs',
),
distDocumentServer: path.join(
FIXTURE_BASEDIR,
'web',
'dist',
'server',
'Document.js',
'Document.mjs',
),
distRouteHooks: path.join(
FIXTURE_BASEDIR,
Expand Down
20 changes: 6 additions & 14 deletions packages/project-config/src/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,8 @@ const PATH_WEB_DIR_DIST_CLIENT = 'web/dist/client'
const PATH_WEB_DIR_DIST_RSC = 'web/dist/rsc'
const PATH_WEB_DIR_DIST_SERVER = 'web/dist/server'

// Don't specify extension, handled by resolve file
const PATH_WEB_DIR_DIST_SERVER_ENTRY_SERVER = 'web/dist/server/entry.server'
const PATH_WEB_DIR_DIST_DOCUMENT = 'web/dist/server/Document'
const PATH_WEB_DIR_DIST_SERVER_ENTRY_SERVER = 'web/dist/server/entry.server.mjs'
const PATH_WEB_DIR_DIST_DOCUMENT = 'web/dist/server/Document.mjs'

const PATH_WEB_DIR_DIST_SERVER_ROUTEHOOKS = 'web/dist/server/routeHooks'
const PATH_WEB_DIR_DIST_RSC_ENTRIES = 'web/dist/rsc/entries.mjs'
Expand Down Expand Up @@ -248,12 +247,11 @@ export const getPaths = (BASE_DIR: string = getBaseDir()): Paths => {
distRsc: path.join(BASE_DIR, PATH_WEB_DIR_DIST_RSC),
distServer: path.join(BASE_DIR, PATH_WEB_DIR_DIST_SERVER),
// Allow for the possibility of a .mjs file
distEntryServer: mjsOrJs(
path.join(BASE_DIR, PATH_WEB_DIR_DIST_SERVER_ENTRY_SERVER),
),
distDocumentServer: mjsOrJs(
path.join(BASE_DIR, PATH_WEB_DIR_DIST_DOCUMENT),
distEntryServer: path.join(
BASE_DIR,
PATH_WEB_DIR_DIST_SERVER_ENTRY_SERVER,
),
distDocumentServer: path.join(BASE_DIR, PATH_WEB_DIR_DIST_DOCUMENT),
distRouteHooks: path.join(BASE_DIR, PATH_WEB_DIR_DIST_SERVER_ROUTEHOOKS),
distRscEntries: path.join(BASE_DIR, PATH_WEB_DIR_DIST_RSC_ENTRIES),
routeManifest: path.join(BASE_DIR, PATH_WEB_DIR_ROUTE_MANIFEST),
Expand Down Expand Up @@ -433,9 +431,3 @@ export function projectIsEsm() {

return true
}

/** Default to JS path, but if MJS exists, use it instead */
const mjsOrJs = (filePath: string) => {
const mjsPath = resolveFile(filePath, ['.mjs'])
return mjsPath ? mjsPath : filePath + '.js'
}

0 comments on commit 90b8479

Please sign in to comment.