Skip to content

Commit

Permalink
Merge pull request #1605 from Spiteless/ts.vite_2024-03
Browse files Browse the repository at this point in the history
Ts.vite 2024 03 (Merge into new vite branch)
  • Loading branch information
trillium authored Mar 5, 2024
2 parents b9368c7 + 3aa212c commit e7ace9a
Show file tree
Hide file tree
Showing 85 changed files with 3,327 additions and 11,963 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/aws-frontend-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ jobs:
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.ref }}
- name: Checkout
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
Expand Down Expand Up @@ -109,5 +114,4 @@ jobs:
service: ${{ needs.setup_env.outputs.AWS_APPENV }}
cluster: ${{ env.AWS_SHARED_CLUSTER }}
wait-for-service-stability: true
wait-for-minutes: 5 minutes

wait-for-minutes: 5 minutes
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
18
6 changes: 3 additions & 3 deletions backend/Dockerfile.api
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
FROM node:14.11.0 AS api-development
FROM node:18.12.0 AS api-development
RUN mkdir /srv/backend
WORKDIR /srv/backend
RUN mkdir -p node_modules
COPY package.json yarn.lock ./
RUN yarn install --pure-lockfile
COPY . .

FROM node:14.11.0 AS api-test
FROM node:18.12.0 AS api-test
RUN mkdir /srv/backend
WORKDIR /srv/backend
COPY package.json yarn.lock ./
RUN yarn install --silent
RUN mkdir -p node_modules

FROM node:14.11.0-slim AS api-production
FROM node:18.12.0-slim AS api-production
EXPOSE 4000
USER node
WORKDIR /srv/backend
Expand Down
2 changes: 1 addition & 1 deletion backend/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14.11.0 AS api-development
FROM node:18.12.0 AS api-development
RUN mkdir /srv/backend
WORKDIR /srv/backend
RUN mkdir -p node_modules
Expand Down
4 changes: 2 additions & 2 deletions backend/Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM node:14.11.0 AS api-builder
FROM node:18.12.0 AS api-builder
RUN mkdir /srv/backend
WORKDIR /srv/backend
RUN mkdir -p node_modules
COPY package.json yarn.lock ./
RUN yarn install --pure-lockfile
COPY . .

FROM node:14.11.0-slim AS api-production
FROM node:18.12.0-slim AS api-production
EXPOSE 4000
USER node
WORKDIR /srv/backend
Expand Down
4 changes: 2 additions & 2 deletions client/Dockerfile.client
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM node:14.11.0 AS client-development
FROM node:18-alpine AS client-development
RUN mkdir /srv/client && chown node:node /srv/client
WORKDIR /srv/client
USER node
RUN mkdir -p node_modules
COPY --chown=node:node package.json package.json ./
RUN npm install --silent

FROM node:14.11.0-slim AS client-builder
FROM node:18.12.0-slim AS client-builder
USER node
WORKDIR /srv/client
COPY --from=client-development /srv/client/node_modules node_modules
Expand Down
2 changes: 1 addition & 1 deletion client/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14.11.0 AS client-development
FROM node:18-alpine AS client-development
RUN mkdir /srv/client && chown node:node /srv/client
WORKDIR /srv/client
USER node
Expand Down
6 changes: 3 additions & 3 deletions client/Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM node:14.11.0 AS node-modules-install
FROM node:18-alpine AS node-modules-install
RUN mkdir /srv/client && chown node:node /srv/client
WORKDIR /srv/client
USER node
RUN mkdir -p node_modules
COPY --chown=node:node package.json package.json ./
RUN npm install --silent
RUN npm install --no-update-notifier

FROM node:14.11.0-slim AS client-builder
FROM node:18-slim AS client-builder
USER node
WORKDIR /srv/client
COPY --from=node-modules-install /srv/client/node_modules node_modules
Expand Down
14 changes: 3 additions & 11 deletions client/public/index.html → client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
Expand All @@ -18,21 +18,13 @@
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<link rel="manifest" href="/manifest.json" />
<title>VRMS</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/index.jsx"></script>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
Expand Down
31 changes: 19 additions & 12 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@
"minimist": "^1.2.6",
"moment": "^2.29.2",
"moment-recur": "^1.0.7",
"react": "^16.13.1",
"react-datepicker": "^3.1.3",
"react-dom": "^16.13.1",
"react": "^18.2.0",
"react-datepicker": "^4.16.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.44.3",
"react-router-dom": "^5.1.2",
"react-scripts": "^3.4.1",
"validator": "^13.7.0"
"validator": "^13.7.0",
"vite-plugin-svgr": "^3.2.0"
},
"scripts": {
"start": "dotenv -e .env -e ../backend/.env -- cross-var cross-env PORT=%CLIENT_PORT% react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --watchAll=false",
"test:watch": "react-scripts test",
"eject": "react-scripts eject",
"vite": "vite",
"start": "dotenv -e .env -e ../backend/.env -- cross-var cross-env PORT=%CLIENT_PORT% vite",
"build": "vite build",
"test": "vitest",
"preview": "vite preview",
"heroku-postbuild": "npm run build"
},
"eslintConfig": {
Expand All @@ -55,6 +55,8 @@
"author": "sarL3y",
"license": "ISC",
"devDependencies": {
"@vitejs/plugin-react": "^4.0.3",
"@vitejs/plugin-react-swc": "^3.3.2",
"eslint-config-airbnb": "^18.2.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-config-prettier": "^6.11.0",
Expand All @@ -64,7 +66,12 @@
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-react-hooks": "^4.1.2",
"prettier": "^2.1.1",
"react-test-renderer": "^16.13.1",
"sass": "^1.49.7"
"react-test-renderer": "^18.2.0",
"sass": "^1.49.7",
"vite": "^4.4.4",
"vitest": "^0.33.0"
},
"engines": {
"node": "<=18.0.0"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
27 changes: 27 additions & 0 deletions client/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { defineConfig, loadEnv } from 'vite'
import react from '@vitejs/plugin-react-swc'
import svgr from "vite-plugin-svgr";

export default defineConfig(({ mode }) => {
// Load env file based on`mode in the current working directory.
const env = loadEnv(mode, process.cwd(), '');
return {
plugins: [
svgr(),
react(),
],
server: {
port: env.CLIENT_PORT,
proxy: {
'/api': {
target: env.REACT_APP_PROXY,
changeOrigin: true,
secure: false,
},
},
},
build: {
outDir: 'build',
},
};
});
Loading

0 comments on commit e7ace9a

Please sign in to comment.