Skip to content

Commit

Permalink
only one dist/ssr/entry-server
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobbe committed Jun 6, 2024
1 parent 9b42fc6 commit c7d26ef
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 46 deletions.
10 changes: 5 additions & 5 deletions packages/ogimage-gen/src/OgImageMiddleware.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ describe('OgImageMiddleware', () => {
}

const expectedFilePath =
'/redwood-app/web/dist/server/ogImage/pages/Contact/ContactPage/ContactPage.og.mjs'
'/redwood-app/web/dist/ssr/ogImage/pages/Contact/ContactPage/ContactPage.og.mjs'

const tsxResult = middleware.getOgComponentPath(tsxRoute)
const jsxResult = middleware.getOgComponentPath(jsxRoute)
Expand Down Expand Up @@ -227,7 +227,7 @@ describe('OgImageMiddleware', () => {
// The memfs mocks don't seem to work for this file

vi.mock(
'/redwood-app/web/dist/server/ogImage/pages/Contact/ContactPage/ContactPage.og.mjs',
'/redwood-app/web/dist/ssr/ogImage/pages/Contact/ContactPage/ContactPage.og.mjs',
() => ({
data: () => 'mocked data function',
output: () => 'Mocked component render',
Expand Down Expand Up @@ -262,7 +262,7 @@ describe('OgImageMiddleware', () => {

// The memfs mocks don't seem to work for this file
vi.mock(
'/redwood-app/web/dist/server/ogImage/pages/HomePage/HomePage.og.mjs',
'/redwood-app/web/dist/ssr/ogImage/pages/HomePage/HomePage.og.mjs',
() => ({
data: () => 'mocked data function',
output: () => 'Mocked component render',
Expand All @@ -289,7 +289,7 @@ describe('OgImageMiddleware', () => {

// The memfs mocks don't seem to work for this file
vi.mock(
'/redwood-app/web/dist/server/ogImage/pages/HomePage/HomePage.og.mjs',
'/redwood-app/web/dist/ssr/ogImage/pages/HomePage/HomePage.og.mjs',
() => ({
data: () => 'mocked data function',
output: () => 'Mocked component render',
Expand All @@ -314,7 +314,7 @@ describe('OgImageMiddleware', () => {
// The memfs mocks don't seem to work for this file

vi.mock(
'/redwood-app/web/dist/server/ogImage/pages/Contact/ContactPage/ContactPage.og.mjs',
'/redwood-app/web/dist/ssr/ogImage/pages/Contact/ContactPage/ContactPage.og.mjs',
() => ({
data: () => 'mocked data function',
output: () => 'Mocked component render',
Expand Down
38 changes: 5 additions & 33 deletions packages/project-config/src/__tests__/paths.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,6 @@ describe('paths', () => {
'storybook.manager.js',
),
dist: path.join(FIXTURE_BASEDIR, 'web', 'dist'),
distEntryServer: path.join(
FIXTURE_BASEDIR,
'web',
'dist',
'ssr',
'entry.server.mjs',
),
distSsrEntryServer: path.join(
FIXTURE_BASEDIR,
'web',
Expand Down Expand Up @@ -426,12 +419,12 @@ describe('paths', () => {
'storybook.manager.js',
),
dist: path.join(FIXTURE_BASEDIR, 'web', 'dist'),
distEntryServer: path.join(
distSsrDocument: path.join(
FIXTURE_BASEDIR,
'web',
'dist',
'ssr',
'entry.server.mjs',
'Document.mjs',
),
distSsrEntryServer: path.join(
FIXTURE_BASEDIR,
Expand All @@ -440,13 +433,6 @@ describe('paths', () => {
'ssr',
'entry.server.mjs',
),
distSsrDocument: path.join(
FIXTURE_BASEDIR,
'web',
'dist',
'ssr',
'Document.mjs',
),
distRouteHooks: path.join(
FIXTURE_BASEDIR,
'web',
Expand Down Expand Up @@ -758,27 +744,20 @@ describe('paths', () => {
entryClient: null,
entryServer: null,
dist: path.join(FIXTURE_BASEDIR, 'web', 'dist'),
distEntryServer: path.join(
distSsrDocument: path.join(
FIXTURE_BASEDIR,
'web',
'dist',
'ssr',
'entry.server.mjs',
),
'Document.mjs',
), // this is constructed regardless of presence of src/Document
distSsrEntryServer: path.join(
FIXTURE_BASEDIR,
'web',
'dist',
'ssr',
'entry.server.mjs',
),
distSsrDocument: path.join(
FIXTURE_BASEDIR,
'web',
'dist',
'ssr',
'Document.mjs',
), // this is constructed regardless of presence of src/Document
distRouteHooks: path.join(
FIXTURE_BASEDIR,
'web',
Expand Down Expand Up @@ -1043,13 +1022,6 @@ describe('paths', () => {
'storybook.manager.js',
),
dist: path.join(FIXTURE_BASEDIR, 'web', 'dist'),
distEntryServer: path.join(
FIXTURE_BASEDIR,
'web',
'dist',
'ssr',
'entry.server.mjs',
),
distSsrEntryServer: path.join(
FIXTURE_BASEDIR,
'web',
Expand Down
7 changes: 4 additions & 3 deletions packages/project-config/src/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export interface WebPaths {
distClient: string
distRsc: string
distSsr: string
distEntryServer: string
distSsrDocument: string
distSsrEntryServer: string
distRouteHooks: string
Expand Down Expand Up @@ -247,9 +246,11 @@ export const getPaths = (BASE_DIR: string = getBaseDir()): Paths => {
distClient: path.join(BASE_DIR, PATH_WEB_DIR_DIST_CLIENT),
distRsc: path.join(BASE_DIR, PATH_WEB_DIR_DIST_RSC),
distSsr: path.join(BASE_DIR, PATH_WEB_DIR_DIST_SSR),
distEntryServer: path.join(BASE_DIR, PATH_WEB_DIR_DIST_SSR_ENTRY_SERVER),
distSsrDocument: path.join(BASE_DIR, PATH_WEB_DIR_DIST_SSR_DOCUMENT),
distSsrEntryServer: path.join(BASE_DIR, 'web/dist/ssr/entry.server.mjs'),
distSsrEntryServer: path.join(
BASE_DIR,
PATH_WEB_DIR_DIST_SSR_ENTRY_SERVER,
),
distRouteHooks: path.join(BASE_DIR, PATH_WEB_DIR_DIST_SSR_ROUTEHOOKS),
distRscEntries: path.join(BASE_DIR, PATH_WEB_DIR_DIST_RSC_ENTRIES),
routeManifest: path.join(BASE_DIR, PATH_WEB_DIR_ROUTE_MANIFEST),
Expand Down
10 changes: 5 additions & 5 deletions packages/vite/src/middleware/createMiddlewareRouter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ vi.mock('@redwoodjs/project-config', async () => {
web: {
base: 'C:\\proj\\web',
dist: 'C:\\proj\\web\\dist',
distEntryServer: 'C:\\proj\\web\\dist\\entry-server.mjs',
distSsrEntryServer: 'C:\\proj\\web\\dist\\ssr\\entry-server.mjs',
entryServer: 'C:\\proj\\web\\entry-server.tsx',
},
}
const mockUnixPaths = {
web: {
base: '/proj/web',
dist: '/proj/web/dist',
distEntryServer: '/proj/web/dist/entry-server.mjs',
distSsrEntryServer: '/proj/web/dist/ssr/entry-server.mjs',
entryServer: '/proj/web/entry-server.tsx',
},
}
Expand All @@ -30,19 +30,19 @@ vi.mock('@redwoodjs/project-config', async () => {
})

const distRegisterMwMock = vi.fn()
vi.mock('/proj/web/dist/entry-server.mjs', () => {
vi.mock('/proj/web/dist/ssr/entry-server.mjs', () => {
console.log('using unix mock')
return {
registerMiddleware: distRegisterMwMock,
}
})
vi.mock('/C:/proj/web/dist/entry-server.mjs', () => {
vi.mock('/C:/proj/web/dist/ssr/entry-server.mjs', () => {
console.log('using win32 mock')
return {
registerMiddleware: distRegisterMwMock,
}
})
vi.mock('/C:/proj/web/dist/entry-server.mjs', () => {
vi.mock('/C:/proj/web/dist/ssr/entry-server.mjs', () => {
return {
registerMiddleware: distRegisterMwMock,
}
Expand Down

0 comments on commit c7d26ef

Please sign in to comment.