Skip to content

Commit 5e2ca82

Browse files
committed
Add Vite example
1 parent ff22965 commit 5e2ca82

33 files changed

+5454
-1
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ jobs:
139139
fail-fast: false
140140
matrix:
141141
node: ['16.x']
142-
example: ['cra4', 'cra5', 'next']
142+
example: ['cra4', 'cra5', 'next', 'vite']
143143
defaults:
144144
run:
145145
working-directory: ./examples/publish-ci/${{ matrix.example }}

examples/publish-ci/vite/.gitignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
.yalc
15+
16+
# Editor directories and files
17+
.vscode/*
18+
!.vscode/extensions.json
19+
.idea
20+
.DS_Store
21+
*.suo
22+
*.ntvs*
23+
*.njsproj
24+
*.sln
25+
*.sw?
26+
27+
typesversions
28+
.cache
29+
.yarnrc
30+
.yarn/*
31+
!.yarn/patches
32+
!.yarn/releases
33+
!.yarn/plugins
34+
!.yarn/sdks
35+
!.yarn/versions
36+
.pnp.*
37+
*.tgz

examples/publish-ci/vite/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Vite + React + TS</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.tsx"></script>
12+
</body>
13+
</html>

examples/publish-ci/vite/package.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "rtk-esm-vite-normal",
3+
"private": true,
4+
"version": "0.0.0",
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite",
8+
"build": "tsc && vite build",
9+
"serve-app": "yarn serve -s dist",
10+
"test": "yarn playwright test",
11+
"format": "prettier --write \"./src/**/*.{ts,tsx}\" \"**/*.md\""
12+
},
13+
"dependencies": {
14+
"@reduxjs/toolkit": "^1.9.3",
15+
"msw": "^0.49.2",
16+
"react": "^18.2.0",
17+
"react-dom": "^18.2.0",
18+
"react-redux": "^8.0.5"
19+
},
20+
"devDependencies": {
21+
"@playwright/test": "^1.31.1",
22+
"@testing-library/jest-dom": "^5.16.5",
23+
"@testing-library/react": "^13.4.0",
24+
"@testing-library/user-event": "^14.4.3",
25+
"@types/jest": "^27.5.2",
26+
"@types/node": "^17.0.45",
27+
"@types/react": "^18.0.26",
28+
"@types/react-dom": "^18.0.10",
29+
"@vitejs/plugin-react": "^3.0.0",
30+
"playwright": "^1.31.1",
31+
"prettier": "^2.8.4",
32+
"serve": "^14.2.0",
33+
"typescript": "^4.9.4",
34+
"vite": "^4.0.0"
35+
},
36+
"msw": {
37+
"workerDirectory": "public"
38+
}
39+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { defineConfig } from '@playwright/test'
2+
export default defineConfig({
3+
webServer: {
4+
command: 'yarn serve-app',
5+
port: 3000,
6+
timeout: 120 * 1000,
7+
reuseExistingServer: !process.env.CI,
8+
},
9+
timeout: 120 * 1000,
10+
use: {
11+
headless: true,
12+
viewport: { width: 1280, height: 720 },
13+
ignoreHTTPSErrors: true,
14+
},
15+
testDir: 'tests/playwright/',
16+
})

0 commit comments

Comments
 (0)