Skip to content

Commit d4623ac

Browse files
committed
Initial commit
0 parents  commit d4623ac

20 files changed

Lines changed: 7147 additions & 0 deletions

.dockerignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
node_modules
2+
npm-debug.log
3+
.git
4+
.gitignore
5+
README.md
6+
.env
7+
.env.local
8+
.env.development
9+
.env.test
10+
.env.production
11+
dist
12+
coverage
13+
.vscode
14+
.idea
15+
*.log
16+
.DS_Store

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.github/workflows/test.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: test
2+
on: push
3+
jobs:
4+
build:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: code clone
8+
uses: actions/checkout@v2
9+
- name: setup node js
10+
uses: actions/setup-node@v6
11+
with:
12+
node-version: 20
13+
- name: test check
14+
run: npm test
15+
- name: build
16+
run : npm build

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

Dockerfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Multi-stage build for React Vite app
2+
3+
# Stage 1: Build stage
4+
FROM node:20-alpine AS builder
5+
6+
WORKDIR /app
7+
8+
# Copy package files
9+
COPY package*.json ./
10+
11+
# Install dependencies
12+
RUN npm ci
13+
14+
# Copy source code
15+
COPY . .
16+
17+
# Run tests
18+
RUN npm test -- --run
19+
20+
# Build the app
21+
RUN npm run build
22+
23+
# Stage 2: Production stage
24+
FROM nginx:alpine
25+
26+
# Copy built files from builder stage
27+
COPY --from=builder /app/dist /usr/share/nginx/html
28+
29+
# Copy custom nginx config (optional)
30+
COPY nginx.conf /etc/nginx/conf.d/default.conf
31+
32+
# Expose port 80
33+
EXPOSE 80
34+
35+
# Start nginx
36+
CMD ["nginx", "-g", "daemon off;"]

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# React + 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

eslint.config.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import js from '@eslint/js'
2+
import globals from 'globals'
3+
import react from 'eslint-plugin-react'
4+
import reactHooks from 'eslint-plugin-react-hooks'
5+
import reactRefresh from 'eslint-plugin-react-refresh'
6+
7+
export default [
8+
{ ignores: ['dist'] },
9+
{
10+
files: ['**/*.{js,jsx}'],
11+
languageOptions: {
12+
ecmaVersion: 2020,
13+
globals: globals.browser,
14+
parserOptions: {
15+
ecmaVersion: 'latest',
16+
ecmaFeatures: { jsx: true },
17+
sourceType: 'module',
18+
},
19+
},
20+
settings: { react: { version: '18.3' } },
21+
plugins: {
22+
react,
23+
'react-hooks': reactHooks,
24+
'react-refresh': reactRefresh,
25+
},
26+
rules: {
27+
...js.configs.recommended.rules,
28+
...react.configs.recommended.rules,
29+
...react.configs['jsx-runtime'].rules,
30+
...reactHooks.configs.recommended.rules,
31+
'react/jsx-no-target-blank': 'off',
32+
'react-refresh/only-export-components': [
33+
'warn',
34+
{ allowConstantExport: true },
35+
],
36+
},
37+
},
38+
]

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</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.jsx"></script>
12+
</body>
13+
</html>

nginx.conf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
server {
2+
listen 80;
3+
server_name localhost;
4+
root /usr/share/nginx/html;
5+
index index.html;
6+
7+
# Gzip compression
8+
gzip on;
9+
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
10+
11+
# Handle client-side routing
12+
location / {
13+
try_files $uri $uri/ /index.html;
14+
}
15+
16+
# Cache static assets
17+
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
18+
expires 1y;
19+
add_header Cache-Control "public, immutable";
20+
}
21+
22+
# Security headers
23+
add_header X-Frame-Options "SAMEORIGIN" always;
24+
add_header X-Content-Type-Options "nosniff" always;
25+
add_header X-XSS-Protection "1; mode=block" always;
26+
}

0 commit comments

Comments
 (0)