Skip to content

Commit

Permalink
test: reproduce error with monorepo and ui library
Browse files Browse the repository at this point in the history
  • Loading branch information
pmelab committed Apr 28, 2024
1 parent 738ea78 commit 4576453
Show file tree
Hide file tree
Showing 9 changed files with 152 additions and 1 deletion.
1 change: 1 addition & 0 deletions e2e/fixtures/ui-library/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export function LibraryComponent(): JSX.Element;
6 changes: 6 additions & 0 deletions e2e/fixtures/ui-library/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'use client';
import { createElement } from 'react';

export function LibraryComponent() {
return createElement('div', null, 'Library component');
}
19 changes: 19 additions & 0 deletions e2e/fixtures/ui-library/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "ui-library",
"version": "1.0.0",
"description": "",
"type": "module",
"main": "index.js",
"types": "index.d.ts",
"keywords": [],
"author": "",
"license": "ISC",
"peerDependencies": {
"react": "19.0.0-canary-e3ebcd54b-20240405",
"react-dom": "19.0.0-canary-e3ebcd54b-20240405"
},
"devDependencies": {
"@types/react": "18.2.74",
"@types/react-dom": "18.2.24"
}
}
1 change: 1 addition & 0 deletions e2e/fixtures/use-ui-library/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Example that uses a UI library in the same monorepo
24 changes: 24 additions & 0 deletions e2e/fixtures/use-ui-library/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "ssr-target-bundle",
"version": "0.1.0",
"type": "module",
"private": true,
"scripts": {
"dev": "waku dev",
"build": "waku build",
"start": "waku start"
},
"dependencies": {
"react": "19.0.0-canary-e3ebcd54b-20240405",
"react-dom": "19.0.0-canary-e3ebcd54b-20240405",
"react-server-dom-webpack": "19.0.0-canary-e3ebcd54b-20240405",
"react-textarea-autosize": "8.5.3",
"waku": "workspace:*",
"ui-library": "workspace:*"
},
"devDependencies": {
"@types/react": "18.2.74",
"@types/react-dom": "18.2.24",
"typescript": "5.4.4"
}
}
11 changes: 11 additions & 0 deletions e2e/fixtures/use-ui-library/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { LibraryComponent } from 'ui-library';

export default async function Test() {
return <LibraryComponent />;
}

export async function getConfig() {
return {
render: 'static',
};
}
17 changes: 17 additions & 0 deletions e2e/fixtures/use-ui-library/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"composite": true,
"strict": true,
"target": "esnext",
"downlevelIteration": true,
"esModuleInterop": true,
"module": "nodenext",
"skipLibCheck": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
"types": ["react/experimental"],
"jsx": "react-jsx",
"rootDir": "./src",
"outDir": "./dist"
}
}
25 changes: 25 additions & 0 deletions e2e/use-ui-library.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { execSync } from 'node:child_process';
import { fileURLToPath } from 'node:url';
import { test } from './utils.js';
import { rm } from 'node:fs/promises';

const waku = fileURLToPath(
new URL('../packages/waku/dist/cli.js', import.meta.url),
);

const cwd = fileURLToPath(
new URL('./fixtures/use-ui-library', import.meta.url),
);

test.describe(`apps with external ui libraries`, () => {
test.beforeAll('remove cache', async () => {
await rm(`${cwd}/dist`, {
recursive: true,
force: true,
});
});

test('build successfully', async () => {
execSync(`node ${waku} build`, { cwd });
});
});
49 changes: 48 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4576453

Please sign in to comment.