Skip to content

Commit 4fecdac

Browse files
LekoArtsjacekradko
andauthored
chore(react-router): Add library mode E2E test (#4808)
Co-authored-by: Jacek <[email protected]>
1 parent a9234f2 commit 4fecdac

38 files changed

+384
-410
lines changed

integration/constants.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ export const constants = {
5656
* The version of the dependency to use, controlled programmatically.
5757
*/
5858
E2E_REACT_DOM_VERSION: process.env.E2E_REACT_DOM_VERSION,
59-
/**
60-
* The version of the dependency to use, controlled programmatically.
61-
*/
62-
E2E_REMIX_VERSION: process.env.E2E_REMIX_VERSION,
6359
/**
6460
* The version of the dependency to use, controlled programmatically.
6561
*/

integration/presets/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { next } from './next';
88
import { nuxt } from './nuxt';
99
import { react } from './react';
1010
import { reactRouter } from './react-router';
11-
import { remix } from './remix';
1211
import { tanstack } from './tanstack';
1312

1413
export const appConfigs = {
@@ -17,7 +16,6 @@ export const appConfigs = {
1716
longRunningApps: createLongRunningApps(),
1817
next,
1918
react,
20-
remix,
2119
elements,
2220
expo,
2321
astro,

integration/presets/longRunningApps.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { next } from './next';
99
import { nuxt } from './nuxt';
1010
import { react } from './react';
1111
import { reactRouter } from './react-router';
12-
import { remix } from './remix';
1312
import { tanstack } from './tanstack';
1413
import { vue } from './vue';
1514

@@ -24,7 +23,6 @@ export const createLongRunningApps = () => {
2423
{ id: 'react.vite.withEmailCodes', config: react.vite, env: envs.withEmailCodes },
2524
{ id: 'react.vite.withEmailCodes_persist_client', config: react.vite, env: envs.withEmailCodes_destroy_client },
2625
{ id: 'react.vite.withEmailLinks', config: react.vite, env: envs.withEmailLinks },
27-
{ id: 'remix.node.withEmailCodes', config: remix.remixNode, env: envs.withEmailCodes },
2826
{ id: 'next.appRouter.withEmailCodes', config: next.appRouter, env: envs.withEmailCodes },
2927
{
3028
id: 'next.appRouter.withEmailCodes_persist_client',

integration/presets/react-router.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ const reactRouterNode = applicationConfig()
1313
.addScript('serve', 'pnpm start')
1414
.addDependency('@clerk/react-router', constants.E2E_CLERK_VERSION || linkPackage('react-router'));
1515

16+
const reactRouterLibrary = applicationConfig()
17+
.setName('react-router-library')
18+
.useTemplate(templates['react-router-library'])
19+
.setEnvFormatter('public', key => `VITE_${key}`)
20+
.addScript('setup', 'pnpm install')
21+
.addScript('dev', 'pnpm dev')
22+
.addScript('build', 'pnpm build')
23+
.addScript('serve', 'pnpm preview')
24+
.addDependency('@clerk/react-router', constants.E2E_CLERK_VERSION || linkPackage('react-router'));
25+
1626
export const reactRouter = {
1727
reactRouterNode,
28+
reactRouterLibrary,
1829
} as const;

integration/presets/remix.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

integration/templates/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export const templates = {
99
'react-cra': resolve(__dirname, './react-cra'),
1010
'react-vite': resolve(__dirname, './react-vite'),
1111
'express-vite': resolve(__dirname, './express-vite'),
12-
'remix-node': resolve(__dirname, './remix-node'),
1312
'elements-next': resolve(__dirname, './elements-next'),
1413
'astro-node': resolve(__dirname, './astro-node'),
1514
'astro-hybrid': resolve(__dirname, './astro-hybrid'),
@@ -19,6 +18,7 @@ export const templates = {
1918
'vue-vite': resolve(__dirname, './vue-vite'),
2019
'nuxt-node': resolve(__dirname, './nuxt-node'),
2120
'react-router-node': resolve(__dirname, './react-router-node'),
21+
'react-router-library': resolve(__dirname, './react-router-library'),
2222
} as const;
2323

2424
if (new Set([...Object.values(templates)]).size !== Object.values(templates).length) {
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# React + TypeScript + Vite
2+
3+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4+
5+
Currently, two official plugins are available:
6+
7+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
8+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9+
10+
## Expanding the ESLint configuration
11+
12+
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
13+
14+
- Configure the top-level `parserOptions` property like this:
15+
16+
```js
17+
export default tseslint.config({
18+
languageOptions: {
19+
// other options...
20+
parserOptions: {
21+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
22+
tsconfigRootDir: import.meta.dirname,
23+
},
24+
},
25+
});
26+
```
27+
28+
- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
29+
- Optionally add `...tseslint.configs.stylisticTypeChecked`
30+
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:
31+
32+
```js
33+
// eslint.config.js
34+
import react from 'eslint-plugin-react';
35+
36+
export default tseslint.config({
37+
// Set the react version
38+
settings: { react: { version: '18.3' } },
39+
plugins: {
40+
// Add the react plugin
41+
react,
42+
},
43+
rules: {
44+
// other rules...
45+
// Enable its recommended rules
46+
...react.configs.recommended.rules,
47+
...react.configs['jsx-runtime'].rules,
48+
},
49+
});
50+
```
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link
6+
rel="icon"
7+
type="image/svg+xml"
8+
href="/vite.svg"
9+
/>
10+
<meta
11+
name="viewport"
12+
content="width=device-width, initial-scale=1.0"
13+
/>
14+
<title>Vite + React + TS</title>
15+
</head>
16+
<body>
17+
<div id="root"></div>
18+
<script
19+
type="module"
20+
src="/src/main.tsx"
21+
></script>
22+
</body>
23+
</html>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "react-router-library",
3+
"version": "0.0.0",
4+
"private": true,
5+
"type": "module",
6+
"scripts": {
7+
"build": "tsc -b && vite build",
8+
"dev": "vite --port $PORT",
9+
"preview": "vite preview --port $PORT"
10+
},
11+
"dependencies": {
12+
"@clerk/react-router": "^0.1.2",
13+
"react": "^18.3.1",
14+
"react-dom": "^18.3.1",
15+
"react-router": "^7.0.2"
16+
},
17+
"devDependencies": {
18+
"@types/react": "^18.3.12",
19+
"@types/react-dom": "^18.3.1",
20+
"@vitejs/plugin-react": "^4.3.4",
21+
"globals": "^15.12.0",
22+
"typescript": "~5.6.2",
23+
"vite": "^6.0.1"
24+
}
25+
}
Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)