-
-
Notifications
You must be signed in to change notification settings - Fork 129
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
chore: create monorepo e2e spec #1079
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ffe0478
chore: create monorepo e2e spec
rmarscher 7412111
Add monorepo packageDir param to startApp e2e util
rmarscher b13053a
Merge remote-tracking branch 'origin/main' into chore/monorepo-spec
rmarscher 503be50
Prettier
rmarscher 63d1e33
eslint ignore import error
rmarscher 3bc75dc
Fix tests
rmarscher 358f71d
Incorporate #1101
rmarscher b8863c0
Prettier
rmarscher 3593a4e
Add packageManager to monorepo test name
rmarscher f9efa60
Use join instead of string concat
rmarscher 91db8bb
Delete e2e/fixtures/monorepo/packages/waku-project/.gitignore
dai-shi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "monorepo", | ||
"private": true, | ||
"workspaces": [ | ||
"packages/*" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "waku-project", | ||
"version": "0.0.0", | ||
"type": "module", | ||
"private": true, | ||
"scripts": { | ||
"dev": "waku dev", | ||
"build": "waku build", | ||
"start": "waku start" | ||
}, | ||
"dependencies": { | ||
"react": "19.0.0", | ||
"react-dom": "19.0.0", | ||
"react-server-dom-webpack": "19.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "19.0.1", | ||
"@types/react-dom": "19.0.2", | ||
"autoprefixer": "10.4.20", | ||
"tailwindcss": "3.4.16", | ||
"typescript": "5.7.2" | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
e2e/fixtures/monorepo/packages/waku-project/postcss.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** @type {import('postcss-load-config').Config} */ | ||
export default { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
}, | ||
}; |
Binary file added
BIN
+5.58 KB
e2e/fixtures/monorepo/packages/waku-project/public/images/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions
21
e2e/fixtures/monorepo/packages/waku-project/src/components/counter.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use client'; | ||
|
||
import { useState } from 'react'; // eslint-disable-line import/no-unresolved | ||
|
||
export const Counter = () => { | ||
const [count, setCount] = useState(0); | ||
|
||
const handleIncrement = () => setCount((c) => c + 1); | ||
|
||
return ( | ||
<section className="border-blue-400 -mx-4 mt-4 rounded border border-dashed p-4"> | ||
<div>Count: {count}</div> | ||
<button | ||
onClick={handleIncrement} | ||
className="rounded-sm bg-black px-2 py-0.5 text-sm text-white" | ||
> | ||
Increment | ||
</button> | ||
</section> | ||
); | ||
}; |
18 changes: 18 additions & 0 deletions
18
e2e/fixtures/monorepo/packages/waku-project/src/components/footer.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export const Footer = () => { | ||
return ( | ||
<footer className="p-6 lg:fixed lg:bottom-0 lg:left-0"> | ||
<div> | ||
visit{' '} | ||
<a | ||
href="https://waku.gg/" | ||
target="_blank" | ||
rel="noreferrer" | ||
className="mt-4 inline-block underline" | ||
> | ||
waku.gg | ||
</a>{' '} | ||
to learn more | ||
</div> | ||
</footer> | ||
); | ||
}; |
11 changes: 11 additions & 0 deletions
11
e2e/fixtures/monorepo/packages/waku-project/src/components/header.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Link } from 'waku'; | ||
|
||
export const Header = () => { | ||
return ( | ||
<header className="flex items-center gap-4 p-6 lg:fixed lg:left-0 lg:top-0"> | ||
<h2 className="text-lg font-bold tracking-tight"> | ||
<Link to="/">Waku starter</Link> | ||
</h2> | ||
</header> | ||
); | ||
}; |
39 changes: 39 additions & 0 deletions
39
e2e/fixtures/monorepo/packages/waku-project/src/pages/_layout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import '../styles.css'; | ||
|
||
import type { ReactNode } from 'react'; | ||
|
||
import { Header } from '../components/header'; | ||
import { Footer } from '../components/footer'; | ||
|
||
type RootLayoutProps = { children: ReactNode }; | ||
|
||
export default async function RootLayout({ children }: RootLayoutProps) { | ||
const data = await getData(); | ||
|
||
return ( | ||
<div className="font-['Nunito']"> | ||
<meta name="description" content={data.description} /> | ||
<link rel="icon" type="image/png" href={data.icon} /> | ||
<Header /> | ||
<main className="m-6 flex items-center *:min-h-64 *:min-w-64 lg:m-0 lg:min-h-svh lg:justify-center"> | ||
{children} | ||
</main> | ||
<Footer /> | ||
</div> | ||
); | ||
} | ||
|
||
const getData = async () => { | ||
const data = { | ||
description: 'An internet website!', | ||
icon: '/images/favicon.png', | ||
}; | ||
|
||
return data; | ||
}; | ||
|
||
export const getConfig = async () => { | ||
return { | ||
render: 'static', | ||
} as const; | ||
}; |
32 changes: 32 additions & 0 deletions
32
e2e/fixtures/monorepo/packages/waku-project/src/pages/about.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Link } from 'waku'; | ||
|
||
export default async function AboutPage() { | ||
const data = await getData(); | ||
|
||
return ( | ||
<div> | ||
<title>{data.title}</title> | ||
<h1 className="text-4xl font-bold tracking-tight">{data.headline}</h1> | ||
<p>{data.body}</p> | ||
<Link to="/" className="mt-4 inline-block underline"> | ||
Return home | ||
</Link> | ||
</div> | ||
); | ||
} | ||
|
||
const getData = async () => { | ||
const data = { | ||
title: 'About', | ||
headline: 'About Waku', | ||
body: 'The minimal React framework', | ||
}; | ||
|
||
return data; | ||
}; | ||
|
||
export const getConfig = async () => { | ||
return { | ||
render: 'static', | ||
} as const; | ||
}; |
37 changes: 37 additions & 0 deletions
37
e2e/fixtures/monorepo/packages/waku-project/src/pages/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Link } from 'waku'; | ||
|
||
import { Counter } from '../components/counter'; | ||
|
||
export default async function HomePage() { | ||
const data = await getData(); | ||
|
||
return ( | ||
<div> | ||
<title>{data.title}</title> | ||
<h1 className="text-4xl font-bold tracking-tight" data-testid="header"> | ||
{data.headline} | ||
</h1> | ||
<p>{data.body}</p> | ||
<Counter /> | ||
<Link to="/about" className="mt-4 inline-block underline"> | ||
About page | ||
</Link> | ||
</div> | ||
); | ||
} | ||
|
||
const getData = async () => { | ||
const data = { | ||
title: 'Waku', | ||
headline: 'Waku', | ||
body: 'Hello world!', | ||
}; | ||
|
||
return data; | ||
}; | ||
|
||
export const getConfig = async () => { | ||
return { | ||
render: 'static', | ||
} as const; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@import url('https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,400;0,700;1,400;1,700&display=swap'); | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; |
4 changes: 4 additions & 0 deletions
4
e2e/fixtures/monorepo/packages/waku-project/tailwind.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/** @type {import('tailwindcss').Config} */ | ||
export default { | ||
content: ['./src/**/*.{js,jsx,ts,tsx}'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"compilerOptions": { | ||
"composite": true, | ||
"strict": true, | ||
"target": "esnext", | ||
"downlevelIteration": true, | ||
"esModuleInterop": true, | ||
"module": "esnext", | ||
"moduleResolution": "bundler", | ||
"skipLibCheck": true, | ||
"noUncheckedIndexedAccess": true, | ||
"exactOptionalPropertyTypes": true, | ||
"types": ["react/experimental"], | ||
"jsx": "react-jsx", | ||
"rootDir": "./src", | ||
"outDir": "./dist" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { expect } from '@playwright/test'; | ||
|
||
import { test, prepareStandaloneSetup } from './utils.js'; | ||
|
||
const startApp = prepareStandaloneSetup('monorepo'); | ||
|
||
for (const mode of ['DEV', 'PRD'] as const) { | ||
for (const packageManager of ['npm', 'pnpm', 'yarn'] as const) { | ||
test.describe(`${packageManager} monorepo: ${mode}`, () => { | ||
let port: number; | ||
let stopApp: () => Promise<void>; | ||
test.beforeAll(async () => { | ||
({ port, stopApp } = await startApp( | ||
mode, | ||
packageManager, | ||
'packages/waku-project', | ||
)); | ||
}); | ||
test.afterAll(async () => { | ||
await stopApp(); | ||
}); | ||
|
||
test('renders the home page', async ({ page }) => { | ||
await page.goto(`http://localhost:${port}`); | ||
await expect(page.getByTestId('header')).toHaveText('Waku'); | ||
}); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Make it consistent with L186. Either use
join
for both, or use string concatenation for both. L209 too.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.
Yeah, thanks. Updated L186 to
join
.