switch to vite

feature/#23
SavelyG 2025-01-31 10:56:52 +00:00
parent e9fbc9bdc4
commit 01f0be9cdd
18 changed files with 1826 additions and 13422 deletions

View File

@ -1 +0,0 @@
node_modules

26
.gitignore vendored Normal file → Executable file
View File

@ -1 +1,27 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
*.les*
node_modules node_modules

6
Dockerfile Normal file → Executable file
View File

@ -1,11 +1,11 @@
FROM node:22.13.0 FROM node:22.13.0
WORKDIR /var/www/trust-module WORKDIR /app
COPY package.json package-lock.json ./ COPY package.json package-lock.json vite.config.js eslint.config.js ./
RUN npm install RUN npm install
COPY . . COPY . .
ENTRYPOINT ["npm", "start"] ENTRYPOINT ["npm", "run", "dev"]

6
README.md Normal file → Executable file
View File

@ -1,3 +1,3 @@
### Запуск проекта Запуск проекта
- ```docker build -t <image_name> .``` docker build -t <image_name> .
- ```docker run --rm --name <unique-name> -v $(pwd)/src/:/var/www/trust-module/src -v $(pwd)/public/:/var/www/trust-module/public -p <hostPort>:<containerPort> <image_name>:latest``` docker run --rm -it --name <unique-name> -v $(pwd)/src/:/app/src -v $(pwd)/public/:/app/public -p <hostPort>:5173 <image_name>:latest

38
eslint.config.js Executable file
View File

@ -0,0 +1,38 @@
import js from '@eslint/js'
import globals from 'globals'
import react from 'eslint-plugin-react'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
export default [
{ ignores: ['dist'] },
{
files: ['**/*.{js,jsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
ecmaVersion: 'latest',
ecmaFeatures: { jsx: true },
sourceType: 'module',
},
},
settings: { react: { version: '18.3' } },
plugins: {
react,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...js.configs.recommended.rules,
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
...reactHooks.configs.recommended.rules,
'react/jsx-no-target-blank': 'off',
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
},
]

13
index.html Executable file
View File

@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/system_monitor_icon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Модуль доверия</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>

14948
package-lock.json generated Normal file → Executable file

File diff suppressed because it is too large Load Diff

43
package.json Normal file → Executable file
View File

@ -1,33 +1,28 @@
{ {
"name": "trust_module", "name": "trust-module",
"version": "0.1.0",
"private": true, "private": true,
"version": "0.0.0",
"type": "module",
"scripts": { "scripts": {
"start": "./node_modules/.bin/react-scripts start", "dev": "vite --port 5173",
"build": "./node_modules/.bin/react-scripts build", "build": "vite build",
"test": "./node_modules/.bin/react-scripts test", "lint": "eslint .",
"eject": "./node_modules/.bin/react-scripts eject" "preview": "vite preview"
}, },
"dependencies": { "dependencies": {
"react": "^18.2.0", "react": "^18.3.1",
"react-dom": "^18.2.0", "react-dom": "^18.3.1"
"react-scripts": "^5.0.1"
}, },
"devDependencies": { "devDependencies": {
"autoprefixer": "^10.4.20", "@eslint/js": "^9.17.0",
"postcss": "^8.5.1", "@types/react": "^18.3.18",
"postcss-cli": "^11.0.0" "@types/react-dom": "^18.3.5",
}, "@vitejs/plugin-react": "^4.3.4",
"browserslist": { "eslint": "^9.17.0",
"production": [ "eslint-plugin-react": "^7.37.2",
">0.2%", "eslint-plugin-react-hooks": "^5.0.0",
"not dead", "eslint-plugin-react-refresh": "^0.4.16",
"not op_mini all" "globals": "^15.14.0",
], "vite": "^6.0.5"
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
} }
} }

View File

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>React App</title>
</head>
<body>
<div id="root"></div> <!-- Здесь появится наше React-приложение -->
</body>
</html>

View File

@ -0,0 +1,15 @@
<svg
width="100" height="100"
viewBox="0 0 100 100"
xmlns="http://www.w3.org/2000/svg"
fill="none" stroke="black" stroke-width="5" stroke-linecap="round" stroke-linejoin="round">
<!-- Окружность -->
<circle cx="50" cy="50" r="45" stroke="#4CAF50" stroke-width="5" fill="none" />
<!-- График нагрузки -->
<polyline points="20,70 35,40 50,60 65,30 80,50" stroke="#4CAF50" stroke-width="5" fill="none" />
<!-- Крестик в центре, символизирующий мониторинг -->
<line x1="45" y1="45" x2="55" y2="55" stroke="#4CAF50" stroke-width="4" />
<line x1="55" y1="45" x2="45" y2="55" stroke="#4CAF50" stroke-width="4" />
</svg>

After

Width:  |  Height:  |  Size: 729 B

42
src/App.css Executable file
View File

@ -0,0 +1,42 @@
#root {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}
.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafbaa);
}
@keyframes logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@media (prefers-reduced-motion: no-preference) {
a:nth-of-type(2) .logo {
animation: logo-spin infinite 20s linear;
}
}
.card {
padding: 2em;
}
.read-the-docs {
color: #888;
}

2
src/App.js → src/App.jsx Normal file → Executable file
View File

@ -1,5 +1,5 @@
import React from "react"; import React from "react";
import SidebarMenu from "./components/SidebarMenu"; // Импорт компонента бокового меню import SidebarMenu from "./SidebarMenu/SidebarMenu"; // Импорт компонента бокового меню
function App() { function App() {
return ( return (

68
src/index.css Executable file
View File

@ -0,0 +1,68 @@
:root {
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;
color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
}
body {
margin: 0;
display: flex;
place-items: center;
min-width: 320px;
min-height: 100vh;
}
h1 {
font-size: 3.2em;
line-height: 1.1;
}
button {
border-radius: 8px;
border: 1px solid transparent;
padding: 0.6em 1.2em;
font-size: 1em;
font-weight: 500;
font-family: inherit;
background-color: #1a1a1a;
cursor: pointer;
transition: border-color 0.25s;
}
button:hover {
border-color: #646cff;
}
button:focus,
button:focus-visible {
outline: 4px auto -webkit-focus-ring-color;
}
@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #ffffff;
}
a:hover {
color: #747bff;
}
button {
background-color: #f9f9f9;
}
}

View File

@ -1,6 +0,0 @@
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";
const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(<App />);

10
src/main.jsx Executable file
View File

@ -0,0 +1,10 @@
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import App from './App.jsx'
createRoot(document.getElementById('root')).render(
<StrictMode>
<App />
</StrictMode>,
)

10
vite.config.js Executable file
View File

@ -0,0 +1,10 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
server: {
host: true
}
})