Skip to content

Commit 215b78c

Browse files
committed
Initialize React site example
Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
0 parents  commit 215b78c

20 files changed

Lines changed: 2158 additions & 0 deletions

‎.copier-answers.yaml‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Changes here will be overwritten by Copier
2+
_commit: 63651ef
3+
_src_path: https://github.com/python-project-templates/base.git
4+
add_extension: site-react
5+
brand_name: Example
6+
github: python-project-templates
7+
project_description: A fast, accessible React website.
8+
project_name: javascript-template-site-react
9+
site_url: https://example.com
10+

‎.github/dependabot.yaml‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: 'github-actions'
4+
directory: '/'
5+
schedule:
6+
interval: 'monthly'
7+
labels:
8+
- 'part: github_actions'
9+
10+
- package-ecosystem: 'npm'
11+
directory: '/'
12+
schedule:
13+
interval: 'monthly'
14+
cooldown:
15+
default-days: 7
16+
labels:
17+
- 'lang: javascript'
18+
- 'part: dependencies'

‎.github/workflows/build.yaml‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Build Status
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags: [v*]
7+
pull_request:
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
19+
with:
20+
persist-credentials: false
21+
22+
- name: Setup Node.js
23+
uses: actions-ext/node/setup@b0536d87c5e92c924bc8667f566f620758280825
24+
with:
25+
version: 22.x
26+
js_folder: .
27+
- run: pnpm install
28+
- run: pnpm build
29+
- run: pnpm check
30+
- run: pnpm lint
31+
- run: pnpm test:unit
32+
- run: pnpm exec playwright install --with-deps chromium
33+
- run: pnpm test:e2e
34+
env:
35+
CI: '1'

‎.gitignore‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
node_modules
2+
/dist
3+
/coverage
4+
/playwright-report
5+
/test-results
6+
.env
7+
.env.*
8+
!.env.example
9+
.DS_Store

‎.oxfmtrc.json‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"printWidth": 120,
4+
"semi": true,
5+
"singleQuote": true,
6+
"tabWidth": 2,
7+
"trailingComma": "none",
8+
"sortPackageJson": false,
9+
"ignorePatterns": [".copier-answers.yaml", "coverage/**", "dist/**", "playwright-report/**", "test-results/**"]
10+
}

‎.oxlintrc.json‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"$schema": "./node_modules/oxlint/configuration_schema.json",
3+
"env": {
4+
"browser": true,
5+
"es6": true,
6+
"node": true
7+
}
8+
}

‎README.md‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Example
2+
3+
A fast, accessible React website.
4+
5+
## Develop
6+
7+
```bash
8+
pnpm install
9+
pnpm dev
10+
```
11+
12+
## Verify
13+
14+
```bash
15+
pnpm check
16+
pnpm lint
17+
pnpm test
18+
pnpm build
19+
```
20+
21+
The application uses React with Vite and TypeScript. Vitest covers component
22+
behavior, while Playwright and axe cover browser behavior and accessibility.

‎index.html‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<meta name="description" content="A fast, accessible React website." />
7+
<meta name="theme-color" content="#ffffff" />
8+
<meta property="og:site_name" content="Example" />
9+
<meta property="og:type" content="website" />
10+
<meta property="og:title" content="Example" />
11+
<meta property="og:description" content="A fast, accessible React website." />
12+
<meta property="og:url" content="https://example.com" />
13+
<link rel="canonical" href="https://example.com/" />
14+
<title>Example</title>
15+
</head>
16+
<body>
17+
<div id="root"></div>
18+
<script type="module" src="/src/main.tsx"></script>
19+
</body>
20+
</html>

‎package.json‎

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "javascript-template-site-react",
3+
"version": "0.1.0",
4+
"description": "A fast, accessible React website.",
5+
"private": true,
6+
"packageManager": "pnpm@11.9.0",
7+
"engines": {
8+
"node": ">=22"
9+
},
10+
"type": "module",
11+
"scripts": {
12+
"dev": "vite dev",
13+
"build": "vite build",
14+
"preview": "vite preview",
15+
"check": "tsc --noEmit",
16+
"lint": "oxlint . && oxfmt --check .",
17+
"fix": "oxlint --fix . && oxfmt --write .",
18+
"test": "pnpm test:unit && pnpm test:e2e",
19+
"test:unit": "vitest run",
20+
"test:e2e": "playwright test",
21+
"test:e2e:update": "playwright test --update-snapshots"
22+
},
23+
"dependencies": {
24+
"react": "^19.2.8",
25+
"react-dom": "^19.2.8"
26+
},
27+
"devDependencies": {
28+
"@axe-core/playwright": "^4.12.1",
29+
"@playwright/test": "^1.60.0",
30+
"@testing-library/jest-dom": "^7.0.1",
31+
"@testing-library/react": "^16.3.3",
32+
"@types/node": "^24.0.0",
33+
"@types/react": "^19.2.18",
34+
"@types/react-dom": "^19.2.5",
35+
"@vitejs/plugin-react": "^6.1.0",
36+
"jsdom": "^30.0.1",
37+
"oxfmt": "^0.63.0",
38+
"oxlint": "^1.78.0",
39+
"typescript": "^5.9.3",
40+
"vite": "^8.1.5",
41+
"vitest": "^4.1.8"
42+
}
43+
}

‎playwright.config.ts‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { defineConfig, devices } from '@playwright/test';
2+
3+
export default defineConfig({
4+
testDir: 'tests',
5+
fullyParallel: true,
6+
forbidOnly: !!process.env.CI,
7+
retries: process.env.CI ? 2 : 0,
8+
reporter: process.env.CI ? 'github' : 'list',
9+
use: {
10+
baseURL: 'http://127.0.0.1:4177',
11+
trace: 'retain-on-failure',
12+
screenshot: 'only-on-failure'
13+
},
14+
webServer: {
15+
command: 'vite build && vite preview --host 127.0.0.1 --port 4177 --strictPort',
16+
port: 4177,
17+
reuseExistingServer: !process.env.CI,
18+
timeout: 120_000
19+
},
20+
projects: [
21+
{
22+
name: 'desktop',
23+
use: { ...devices['Desktop Chrome'], viewport: { width: 1280, height: 800 } }
24+
}
25+
]
26+
});

0 commit comments

Comments
 (0)