Skip to content

Commit 1645604

Browse files
committed
1541: initial work on vite and upgrade node
1 parent ae4b93c commit 1645604

20 files changed

+2850
-11830
lines changed

vite-env.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="vite/client" />

docker-compose.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,18 @@ services:
2929
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
3030

3131
node:
32-
image: node:14
32+
image: node:20
3333
command: yarn start
3434
networks:
3535
- app
3636
working_dir: /app
37+
ports:
38+
- '3000'
3739
environment:
3840
- NODE_ENV=development
3941
volumes:
4042
- .:/app:delegated
4143
healthcheck:
42-
test: [ "CMD", "curl", "-f", "http://node:3000/tags" ]
4344
interval: 5s
4445
timeout: 10s
4546
retries: 3

index.html

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" href="/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<meta name="theme-color" content="#000000" />
8+
<!--
9+
manifest.json provides metadata used when your web app is installed on a
10+
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
11+
-->
12+
<link rel="manifest" href="/manifest.json" />
13+
<title>OS2Display admin</title>
14+
</head>
15+
<body class="bg-light">
16+
<noscript>You need to enable JavaScript to run this app.</noscript>
17+
<div id="root"></div>
18+
<script type="module" src="/src/index.jsx"></script>
19+
</body>
20+
</html>

package.json

+7-8
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"@hello-pangea/dnd": "^16.0.0",
1212
"@paciolan/remote-component": "^2.11.0",
1313
"@reduxjs/toolkit": "^1.6.1",
14+
"@vitejs/plugin-react": "^4.3.0",
1415
"bootstrap": "^5.0.2",
1516
"dayjs": "^1.10.7",
1617
"dompurify": "^2.3.3",
@@ -21,7 +22,6 @@
2122
"prop-types": "^15.7.2",
2223
"query-string": "^7.1.1",
2324
"react": "^18.2.0",
24-
"react-app-rewired": "^2.1.8",
2525
"react-bootstrap": "^1.6.1",
2626
"react-color-palette": "^6.1.0",
2727
"react-dayjs": "^0.3.2",
@@ -40,7 +40,8 @@
4040
"react-toastify": "^8.1.0",
4141
"rrule": "^2.7.2",
4242
"typescript": "^4.4.2",
43-
"ulid": "^2.3.0"
43+
"ulid": "^2.3.0",
44+
"vite": "^5.2.11"
4445
},
4546
"scripts": {
4647
"lint:js": "eslint --ext .js --ext .jsx ./src",
@@ -49,10 +50,9 @@
4950
"lint:scss:fix": "stylelint --fix \"./src/**/*.scss\"",
5051
"check-coding-standards": "yarn lint:js && yarn lint:scss",
5152
"apply-coding-standards": "yarn lint:js:fix && yarn lint:scss:fix",
52-
"start": "react-app-rewired start",
53-
"build": "react-app-rewired build",
54-
"test": "react-app-rewired test",
55-
"eject": "react-scripts eject"
53+
"start": "vite --host 0.0.0.0",
54+
"build": "vite build",
55+
"preview": "vite preview"
5656
},
5757
"eslintConfig": {
5858
"extends": [
@@ -85,8 +85,7 @@
8585
"eslint-plugin-react-hooks": "^4.2.0",
8686
"prettier": "2.3.2",
8787
"prettier-plugin-jsdoc": "^0.3.24",
88-
"react-scripts": "4.0.3",
89-
"sass": "^1.35.2",
88+
"sass": "^1.77.2",
9089
"stylelint": "^13.13.1",
9190
"stylelint-config-prettier": "^8.0.2",
9291
"stylelint-config-recommended-scss": "^4.3.0",

public/index.html

-38
This file was deleted.

src/app.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ import AuthHandler from "./auth-handler";
3636
import LoadingComponent from "./components/util/loading-component/loading-component";
3737
import ModalProvider from "./context/modal-context/modal-provider";
3838
import UsersList from "./components/users/users-list";
39-
import "react-toastify/dist/ReactToastify.css";
40-
import "./app.scss";
4139
import ActivationCodeList from "./components/activation-code/activation-code-list";
4240
import ActivationCodeCreate from "./components/activation-code/activation-code-create";
4341
import ActivationCodeActivate from "./components/activation-code/activation-code-activate";
4442
import ConfigLoader from "./config-loader";
43+
import "react-toastify/dist/ReactToastify.css";
44+
import "./app.scss";
4545

4646
/**
4747
* App component.

src/app.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import "~bootstrap/scss/bootstrap";
1+
@import "bootstrap/scss/bootstrap";
22

33
html {
44
height: -webkit-fill-available;

src/components/media/media-list.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import "~bootstrap/scss/bootstrap/";
1+
@import "../../../node_modules/bootstrap/scss/bootstrap/";
22

33
.media-item {
44
img {

src/components/navigation/nav-items/nav-items.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@use "sass:math";
2-
@import "~bootstrap/scss/bootstrap/";
2+
@import "../../../../node_modules/bootstrap/scss/bootstrap/";
33

44
.nav-item {
55
.nav-link {

src/components/navigation/sidebar/sidebar.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import "~bootstrap/scss/bootstrap/";
1+
@import "../../../../node_modules/bootstrap/scss/bootstrap/";
22

33
.sidebar-nav {
44
&.nav-dark {

src/components/screen/util/grid-generation-and-select.jsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { React, useState } from "react";
22
import PropTypes from "prop-types";
33
import { Tabs, Tab, Alert } from "react-bootstrap";
4-
import { createGridArea, createGrid } from "os2display-grid-generator";
4+
// import { createGridArea, createGrid } from "os2display-grid-generator";
55
import { useTranslation } from "react-i18next";
66
import { uniqWith } from "lodash";
77
import idFromUrl from "../../util/helpers/id-from-url";
@@ -35,7 +35,7 @@ function GridGenerationAndSelect({
3535
const configColumns = grid?.columns || 1;
3636
const configRows = grid?.rows || 1;
3737
const gridTemplateAreas = {
38-
gridTemplateAreas: createGrid(configColumns, configRows),
38+
// gridTemplateAreas: createGrid(configColumns, configRows),
3939
};
4040

4141
/**
@@ -105,7 +105,7 @@ function GridGenerationAndSelect({
105105
? "grid-item selected"
106106
: "grid-item "
107107
}
108-
style={{ gridArea: createGridArea(data.gridArea) }}
108+
// style={{ gridArea: createGridArea(data.gridArea) }}
109109
>
110110
{data.title}
111111
</div>

src/components/slide/preview/remote-component-wrapper.jsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { React, useEffect, useState } from "react";
22
import { Button } from "react-bootstrap";
33
import PropTypes from "prop-types";
44
import { useTranslation } from "react-i18next";
5-
import { useRemoteComponent } from "./remote-component-helper";
5+
// import { useRemoteComponent } from "./remote-component-helper";
66
import ErrorBoundary from "../../../error-boundary";
77
import "./remote-component-wrapper.scss";
88

@@ -32,7 +32,7 @@ function RemoteComponentWrapper({
3232
}) {
3333
const { t } = useTranslation("common");
3434
const [remoteComponentSlide, setRemoteComponentSlide] = useState(null);
35-
const [loading, err, Component] = useRemoteComponent(url);
35+
// const [loading, err, Component] = useRemoteComponent(url);
3636
const [runId, setRunId] = useState("");
3737

3838
/** Create remoteComponentSlide from slide and mediaData */
@@ -101,7 +101,7 @@ function RemoteComponentWrapper({
101101
id="EXE-ID-PREVIEW"
102102
>
103103
<ErrorBoundary errorText="remote-component.error-boundary-text">
104-
{loading && <div />}
104+
{/* {loading && <div />}
105105
{!loading && err == null && remoteComponentSlide && Component && (
106106
<Component
107107
slide={remoteComponentSlide}
@@ -110,7 +110,7 @@ function RemoteComponentWrapper({
110110
slideDone={() => {}}
111111
executionId="EXE-ID-PREVIEW"
112112
/>
113-
)}
113+
)} */}
114114
</ErrorBoundary>
115115
</div>
116116
</div>

src/components/util/drag-and-drop-table/drag-and-drop-table.scss

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
@import "~bootstrap/scss/bootstrap/";
1+
@import "../../../../node_modules/bootstrap/scss/bootstrap/";
2+
23
.table-draggable-grip {
34
&:hover {
45
color: $primary;

src/components/util/image-uploader/image-uploader.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import ImageUploading from "react-images-uploading";
44
import { Button } from "react-bootstrap";
55
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
66
import { faImage } from "@fortawesome/free-solid-svg-icons";
7-
import "./image-uploader.scss";
87
import { useTranslation } from "react-i18next";
98
import Image from "./image";
109
import MediaModal from "../../media-modal/media-modal";
1110
import useModal from "../../../context/modal-context/modal-context-hook";
11+
import "./image-uploader.scss";
1212

1313
/**
1414
* @param {object} props The props.

src/components/util/image-uploader/image-uploader.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import "~bootstrap/scss/bootstrap/";
1+
@import "../../../../node_modules/bootstrap/scss/bootstrap/";
22

33
.drag-drop-area {
44
height: 150px;

src/config-loader.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const ConfigLoader = {
1111
if (configData !== null) {
1212
resolve(configData);
1313
} else {
14-
fetch("/admin/config.json")
14+
fetch("/config.json")
1515
.then((response) => response.json())
1616
.then((data) => {
1717
configData = data;
File renamed without changes.

src/react-app-env.d.ts

-1
This file was deleted.

vite.config.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { defineConfig } from "vite";
2+
import react from "@vitejs/plugin-react";
3+
import path from 'path';
4+
5+
export default defineConfig({
6+
base: "/",
7+
plugins: [react()],
8+
server: {
9+
strictPort: true,
10+
port: 3000,
11+
host: "localhost",
12+
},
13+
});

0 commit comments

Comments
 (0)