diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 554a22d..96fd3f2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,6 +1,6 @@ # Node.js -# Build a general Node.js project with npm. +# Build React app # Add steps that analyze code, save build artifacts, deploy, and more: # https://docs.microsoft.com/azure/devops/pipelines/languages/javascript @@ -8,16 +8,30 @@ trigger: - main pool: - vmImage: ubuntu-latest # examples of other options:'macOS-10.15','windows-latest' - + vmImage: ubuntu-latest steps: - task: NodeTool@0 inputs: - versionSpec: '10.x' + versionSpec: '18.x' displayName: 'Install Node.js' -- script: | - npm install - npm run build - displayName: 'npm install and build' +- task: Bash@3 + inputs: + targetType: 'inline' + workingDirectory: '$(System.DefaultWorkingDirectory)/react-app' + script: | + echo "Node version:" + node -v + echo "NPM version:" + npm -v + echo "Cleaning installation..." + rm -rf node_modules package-lock.json + npm cache clean --force + echo "Installing dependencies..." + npm install --legacy-peer-deps --force + echo "Installing specific ajv version..." + npm install ajv@8.12.0 ajv-keywords@5.1.0 --legacy-peer-deps --force + echo "Building React app..." + CI=true GENERATE_SOURCEMAP=false npm run build + displayName: 'Build React app' diff --git a/react-app/.eslintrc.json b/react-app/.eslintrc.json index 44a91c8..40e3d0f 100644 --- a/react-app/.eslintrc.json +++ b/react-app/.eslintrc.json @@ -22,10 +22,14 @@ ] }, "plugins": ["react", "import", "jsx-a11y"], - "parser": "babel-eslint", + "parser": "@babel/eslint-parser", "parserOptions": { "ecmaVersion": 2018, "sourceType": "module", + "requireConfigFile": false, + "babelOptions": { + "presets": ["@babel/preset-react"] + }, "ecmaFeatures": { "jsx": true } diff --git a/react-app/package.json b/react-app/package.json index c5e394c..f8ed069 100644 --- a/react-app/package.json +++ b/react-app/package.json @@ -21,20 +21,24 @@ ], "proxy": "http://localhost:7071/", "dependencies": { - "@fortawesome/fontawesome-free": "^5.15.2", - "axios": "^0.21.1", - "bulma": "^0.9.2", - "node-sass": "^5.0.0", - "react": "^17.0.2", - "react-dom": "^17.0.2", - "react-redux": "^7.2.4", - "react-router-dom": "^5.2.0", - "react-scripts": "^4.0.3", - "redux": "^4.1.0", - "redux-saga": "^1.1.3", - "redux-thunk": "^2.3.0" + "@fortawesome/fontawesome-free": "^5.15.4", + "axios": "^1.6.2", + "bulma": "^0.9.4", + "sass": "^1.69.5", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-redux": "^8.1.3", + "react-router-dom": "^6.20.0", + "react-scripts": "5.0.1", + "redux": "^4.2.1", + "redux-saga": "^1.2.3", + "redux-thunk": "^2.4.2", + "ajv": "^8.12.0", + "ajv-keywords": "^5.1.0" }, "devDependencies": { + "@babel/core": "^7.23.3", + "@babel/eslint-parser": "^7.23.3", "eslint-config-airbnb": "^18.2.1", "eslint-config-prettier": "^8.3.0", "eslint-plugin-import": "^2.23.4", diff --git a/react-app/src/App.js b/react-app/src/App.js index f997da4..57730ab 100644 --- a/react-app/src/App.js +++ b/react-app/src/App.js @@ -1,36 +1,31 @@ -import React, { Component, lazy, Suspense } from 'react'; +import React, { lazy, Suspense } from 'react'; import 'bulma/css/bulma.css'; import './styles.scss'; -import { Redirect, Route, Switch } from 'react-router-dom'; -import { withRouter } from 'react-router'; +import { Navigate, Route, Routes } from 'react-router-dom'; import { HeaderBar, NavBar, NotFound } from './components'; import About from './About'; -const Products = withRouter( - lazy(() => import(/* webpackChunkName: "products" */ './products/Products')) -); +const Products = lazy(() => import(/* webpackChunkName: "products" */ './products/Products')); -class App extends Component { - render() { - return ( -
- -
- -
- Loading...
}> - - - - - - - - -
+function App() { + return ( +
+ +
+ +
+ Loading...
}> + + } /> + } /> + } /> + } /> + + +
- ); - } + + ); } export default App; diff --git a/react-app/src/components/NavBar.js b/react-app/src/components/NavBar.js index fe22104..adfacdd 100644 --- a/react-app/src/components/NavBar.js +++ b/react-app/src/components/NavBar.js @@ -5,10 +5,10 @@ const NavBar = (props) => (