Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cra to vite #31

Merged
merged 12 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_PROXY_URL=https://dev.internalapi.biip.lt/zuvinimasnew/api
32 changes: 0 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,38 +29,6 @@ jobs:
- name: Build
run: yarn run build

eslint:
name: ESLint
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
security-events: write
actions: read
contents: read

steps:
- uses: actions/checkout@v3

- name: Set up Node
uses: actions/setup-node@v3
with:
node-version-file: package.json
cache: yarn

- name: Install dependencies
run: yarn install --immutable --immutable-cache --check-cache

- name: Run ESLint
run: yarn run lint:sarif
continue-on-error: true

- name: Upload ESLint analysis results to GitHub
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: eslint-results.sarif
wait-for-processing: true
category: ESLint

validate-docker-build:
name: Validate if docker image builds
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy-development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ jobs:
enable-sentry: true
build-args: |
NODE_ENV=development
REACT_APP_SENTRY_DSN=https://0385edf7f78f4ad4a511abae516ae3e8@sentry.biip.lt/7
REACT_APP_MAPS_HOST=https://dev.maps.biip.lt
VITE_SENTRY_DSN=https://0385edf7f78f4ad4a511abae516ae3e8@sentry.biip.lt/7
VITE_MAPS_HOST=https://dev.maps.biip.lt
4 changes: 2 additions & 2 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ jobs:
enable-sentry: true
build-args: |
NODE_ENV=production
REACT_APP_SENTRY_DSN=https://0385edf7f78f4ad4a511abae516ae3e8@sentry.biip.lt/7
REACT_APP_MAPS_HOST=https://maps.biip.lt
VITE_SENTRY_DSN=https://0385edf7f78f4ad4a511abae516ae3e8@sentry.biip.lt/7
VITE_MAPS_HOST=https://maps.biip.lt
4 changes: 2 additions & 2 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ jobs:
enable-sentry: true
build-args: |
NODE_ENV=production
REACT_APP_SENTRY_DSN=https://0385edf7f78f4ad4a511abae516ae3e8@sentry.biip.lt/7
REACT_APP_MAPS_HOST=https://staging.maps.biip.lt
VITE_SENTRY_DSN=https://0385edf7f78f4ad4a511abae516ae3e8@sentry.biip.lt/7
VITE_MAPS_HOST=https://staging.maps.biip.lt
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ COPY . .
# Docker build args and environment variables
ARG ENVIRONMENT
ARG VERSION
ARG REACT_APP_ENVIRONMENT=${ENVIRONMENT}
ARG REACT_APP_VERSION=${VERSION}
ARG VITE_ENVIRONMENT=${ENVIRONMENT}
ARG VITE_VERSION=${VERSION}

# Set env variables
ARG REACT_APP_MAPS_HOST=
ARG REACT_APP_SENTRY_DSN=
ARG VITE_MAPS_HOST=
ARG VITE_SENTRY_DSN=
ARG NODE_ENV=production

# Build and cleanup
Expand All @@ -40,4 +40,4 @@ HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 CMD wget -
COPY ./caddy/Caddyfile /etc/caddy/Caddyfile

# Copy built files from the build stage
COPY --from=build /app/build /srv
COPY --from=build /app/dist /srv
31 changes: 31 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="/biip-favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:ital,wght@0,400;0,700;1,400;1,700&family=Plus+Jakarta+Sans:wght@500&display=swap"
rel="stylesheet"
/>
<meta name="description" content="Žuvinimo aplikacija" />
<link rel="apple-touch-icon" href="/biip-favicon.png" />

<link rel="manifest" href="/manifest.json" />
<script
async
data-cfasync="false"
src="https://d29l98y0pmei9d.cloudfront.net/js/widget.min.js?k=Y2xpZW50SWQ9NTkwOSZob3N0TmFtZT1hbS5zdXBwb3J0aGVyby5pbw=="
></script>

<title>Žuvinimas</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
39 changes: 39 additions & 0 deletions manifest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
export const manifestForPlugIn = {
registerType: "prompt",
includeAssests: ["favicon.ico", "apple-touc-icon.png", "masked-icon.svg"],
manifest: {
short_name: "Įžuvinimas",
name: "BĮIP Įžuvinimas",
icons: [
{
src: "b-icon.png",
sizes: "64x64 32x32 24x24 16x16",
type: "image/png"
},
{
src: "b-icon.png",
type: "image/png",
sizes: "192x192"
},
{
src: "b-icon.png",
type: "image/png",
sizes: "512x512"
}
],
theme_color: "#171717",
background_color: "#0a1353",
display: "standalone",
scope: "/",
start_url: "/",
orientation: "portrait"
},
workbox: {
runtimeCaching: [
{
urlPattern: /\.(png|jpg|jpeg|svg|gif)$/,
handler: "CacheFirst"
}
]
}
};
59 changes: 35 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "frontend",
"name": "biip-zuvinimas-web",
"version": "0.1.0",
"proxy": "https://dev.internalapi.biip.lt/zuvinimasnew",
"private": true,
"prettier": "@aplinkosministerija/biip-prettier-config",
"dependencies": {
"@material-ui/core": "^4.12.4",
"@reduxjs/toolkit": "^1.9.3",
Expand All @@ -14,9 +14,14 @@
"@types/node": "^17.0.45",
"@types/react": "^18.0.33",
"@types/react-dom": "^18.0.11",
"@typescript-eslint/eslint-plugin": "^6.13.1",
"@typescript-eslint/parser": "^6.13.1",
"@vitejs/plugin-react": "^4.2.0",
"@vitejs/plugin-react-swc": "^3.5.0",
"axios": "^1.3.5",
"date-fns": "^2.29.3",
"date-fns-tz": "^2.0.0",
"eslint-plugin-react-hooks": "^4.6.0",
"formik": "^2.2.9",
"leaflet": "^1.9.3",
"lodash": "^4.17.21",
Expand All @@ -33,13 +38,17 @@
"react-resize-detector": "^8.0.4",
"react-router": "^6.10.0",
"react-router-dom": "^6.10.0",
"react-scripts": "5.0.1",
"react-signature-canvas": "^1.0.6",
"react-toastify": "^9.1.2",
"redux-persist": "^6.0.0",
"styled-components": "^5.3.9",
"typescript": "^4.9.5",
"universal-cookie": "^4.0.4",
"vite": "^5.0.4",
"vite-plugin-pwa": "^0.17.2",
"vite-plugin-svgr": "^4.2.0",
"vite-tsconfig-paths": "^4.2.1",
"vitest": "^0.34.6",
"web-vitals": "^2.1.4",
"workbox-background-sync": "^6.5.4",
"workbox-broadcast-update": "^6.5.4",
Expand All @@ -56,27 +65,16 @@
"yup": "^1.0.2"
},
"scripts": {
"start": "export PORT=8080 && react-scripts start",
"start-win": "set PORT=8080 && react-scripts start",
"test": "vitest",
"start": "vite --port 8080",
"build": "tsc && vite build",
"serve": "vite preview",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"lint:sarif": "set SARIF_ESLINT_EMBED=true && yarn run lint --format @microsoft/eslint-formatter-sarif --output-file eslint-results.sarif",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"prepare": "husky install"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"prettier --write",
"eslint"
],
"*.{md,html,css}": "prettier --write"
"extends": "@aplinkosministerija/eslint-config-biip-react"
},
"browserslist": {
"production": [
Expand All @@ -91,15 +89,28 @@
]
},
"devDependencies": {
"@aplinkosministerija/biip-prettier-config": "^1.1.0",
"@aplinkosministerija/eslint-config-biip-react": "^1.0.0",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@microsoft/eslint-formatter-sarif": "^3.0.0",
"@types/lodash": "^4.14.192",
"@types/react-datepicker": "^4.10.0",
"@types/styled-components": "^5.1.26",
"husky": "^8.0.0",
"@types/react-datepicker": "^4.4.1",
"@types/react-google-recaptcha": "^2.1.5",
"@types/styled-components": "^5.1.25",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react-refresh": "^0.4.4",
"husky": "^8.0.3",
"lint-staged": "^15.0.2",
"prettier": "3.0.3"
"prettier": "^2.6.2"
},
"engines": {
"node": ">=20.0.0 <21.0.0"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"prettier --write",
"eslint"
],
"*.{md,html,css}": "prettier --write"
}
}
48 changes: 0 additions & 48 deletions public/index.html

This file was deleted.

25 changes: 0 additions & 25 deletions public/manifest.json

This file was deleted.

20 changes: 0 additions & 20 deletions src/components/buttons/ButtonsGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,6 @@ const Container = styled.div`
}
`;

const LabelContainer = styled.div`
display: flex;
flex-direction: column;
align-items: center;
align-items: flex-start;
padding-bottom: 4px;
`;

const Label = styled.div`
font-size: 1.4rem;
color: #231f20;
`;

const StyledButton = styled.button<{
left: boolean;
right: boolean;
Expand Down Expand Up @@ -113,11 +100,4 @@ const StyledButton = styled.button<{
border-bottom-right-radius: ${({ right }) => (right ? "4px" : 0)};
`;

const ErrorMessage = styled.label`
position: relative;
color: ${({ theme }) => theme.colors.error};
font-size: 1.4rem;
margin-left: 8px;
`;

export default ButtonsGroup;
1 change: 0 additions & 1 deletion src/components/buttons/IconLink.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { eachYearOfInterval } from "date-fns/esm";
import styled from "styled-components";
import Icon from "../other/Icon";

Expand Down
Loading
Loading