diff --git a/Makefile b/Makefile index 10cd5e5..aeddb47 100644 --- a/Makefile +++ b/Makefile @@ -14,17 +14,19 @@ $(SITE_DIR): docker run \ -v $$(pwd)/src:/usr/src/app/src \ -v $$(pwd)/public:/usr/src/app/public \ + -v $$(pwd)/index.html:/usr/src/app/index.html \ + -v $$(pwd)/vite.config.mjs:/usr/src/app/vite.config.mjs \ -v $$(pwd)/package.json:/usr/src/app/package.json \ -v $$(pwd)/$(SITE_DIR):/usr/src/app/$(SITE_DIR) \ -e CURRENT_UID=$(CURRENT_UID) \ - -w /usr/src/app node:12-alpine \ - sh -c 'npm install && REACT_APP_VERSION=$(VERSION) npm run build && chown -R $$CURRENT_UID: $(SITE_DIR)' + -w /usr/src/app node:18-alpine \ + sh -c 'npm install && VITE_VERSION=$(VERSION) npm run build && chown -R $$CURRENT_UID: $(SITE_DIR)' start: docker run \ -p $(PORT):3000 \ -v `pwd`:/usr/src/app \ - -w /usr/src/app node:14-alpine \ + -w /usr/src/app node:18-alpine \ sh -c 'npm install --silent && npm run build && npm install -g serve && serve -s $(SITE_DIR) -p 3000' release: $(SITE_DIR) diff --git a/README.md b/README.md index e1eb783..864d8ea 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ NeoFS status monitoring page using React framework under the hood - make - docker -- node.js +- node (`18+`) - python ## Make instructions diff --git a/index.html b/index.html new file mode 100644 index 0000000..68c62be --- /dev/null +++ b/index.html @@ -0,0 +1,36 @@ + + + + NeoFS Status + + + + + + + + + + + + + + + + + + +
+ + + + + + diff --git a/package.json b/package.json index 9d3e59b..4bd663a 100644 --- a/package.json +++ b/package.json @@ -3,25 +3,18 @@ "version": "1.0.0", "private": true, "dependencies": { - "@types/react": "^18.2.39", - "@types/react-dom": "^18.2.17", + "@types/react": "^19.0.8", + "@types/react-dom": "^19.0.3", "bulma": "^0.9.4", - "react": "^17.0.2", + "react": "^19.0.0", "react-bulma-components": "^4.1.0", - "react-dom": "^17.0.2", + "react-dom": "^19.0.0", "react-router-dom": "^6.10.0" }, "scripts": { - "start": "REACT_APP_VERSION=$(make version) GENERATE_SOURCEMAP=false react-scripts start", - "build": "BUILD_PATH='./status.fs.neo.org' GENERATE_SOURCEMAP=false react-scripts build", - "test": "react-scripts test", - "eject": "react-scripts eject" - }, - "eslintConfig": { - "extends": [ - "react-app", - "react-app/jest" - ] + "dev": "VITE_VERSION=$(make version) vite", + "build": "vite build", + "preview": "vite preview" }, "browserslist": [ ">0.2%", @@ -29,7 +22,8 @@ "not op_mini all" ], "devDependencies": { - "react-scripts": "^5.0.1", - "typescript": "^3.2.1" + "@vitejs/plugin-react": "^4.3.4", + "typescript": "^5.7.3", + "vite": "^6.1.0" } } diff --git a/public/index.html b/public/index.html deleted file mode 100644 index 33dbd8c..0000000 --- a/public/index.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - NeoFS Status - - - - - - - - - - - - - - - - - - - -
- - - - - - diff --git a/src/App.tsx b/src/App.tsx index e3470dd..3c68bda 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,3 +1,4 @@ +/// import React, { useEffect, useState } from 'react'; import { Link, Route, Routes, Navigate, useLocation } from "react-router-dom"; import { @@ -114,7 +115,7 @@ export const App = () => { - + { subtitle style={{ textAlign: 'center', fontSize: '.75rem' }} > - {process.env.REACT_APP_VERSION} + {import.meta.env.VITE_VERSION} diff --git a/src/index.tsx b/src/index.tsx deleted file mode 100644 index e5a10ef..0000000 --- a/src/index.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import React from 'react'; -import ReactDOM from 'react-dom'; -import { BrowserRouter } from 'react-router-dom'; -import { App } from './App.tsx'; - -ReactDOM.render( - - - - - , - document.getElementById('root') -); diff --git a/src/main.tsx b/src/main.tsx new file mode 100644 index 0000000..dcdc892 --- /dev/null +++ b/src/main.tsx @@ -0,0 +1,12 @@ +import React, { StrictMode } from 'react'; +import { createRoot } from 'react-dom/client'; +import { App } from './App.tsx'; +import { BrowserRouter } from "react-router-dom"; + +createRoot(document.getElementById('root') as HTMLElement).render( + + + + + , +) diff --git a/vite.config.mjs b/vite.config.mjs new file mode 100644 index 0000000..d981ed5 --- /dev/null +++ b/vite.config.mjs @@ -0,0 +1,13 @@ +import { defineConfig } from 'vite'; +import react from '@vitejs/plugin-react'; + +export default defineConfig({ + plugins: [react()], + server: { + port: 3000, + }, + build: { + sourcemap: false, + outDir: 'status.fs.neo.org', + }, +});