Updated monorepo building, dockerized

This commit is contained in:
2023-09-23 03:44:50 +03:00
parent b2603d385d
commit 6ab1de4420
17 changed files with 2507 additions and 55 deletions

View File

@@ -1,2 +0,0 @@
DATABASE_URL="postgresql://"
PORT=8081

View File

@@ -3,7 +3,6 @@
"version": "0.0.0",
"scripts": {
"build": "tsc && rollup --config rollup.config.js",
"prestart": "[[ -d dist ]] || pnpm run build",
"start": "node dist/index.js",
"dev": "rollup --config rollup.config.dev.js --watch"
},
@@ -16,8 +15,8 @@
"typescript": "^4.4.2"
},
"dependencies": {
"@roomruler/logger": "workspace:^0.0.0",
"@roomruler/messages": "workspace:^0.0.0",
"@roomruler/logger": "*",
"@roomruler/messages": "*",
"pg": "^8.7.1",
"reflect-metadata": "^0.1.13",
"typeorm": "^0.2.37",

View File

@@ -1,6 +0,0 @@
export const config = {
host: "",
username: "",
password: "",
database: "",
};

View File

@@ -1,19 +1,14 @@
import { Connection, createConnection } from "typeorm";
import fs from "fs";
import { Room } from "./model";
import { config } from "./config";
export { Room };
export const connect = () =>
createConnection({
...config,
url: process.env.DATABASE_URL,
type: "cockroachdb",
port: 26257,
ssl: {
ca: fs.readFileSync("certs/cc-ca.crt").toString(),
},
ssl: true,
synchronize: true,
logging: false,
entities: [Room],

View File

@@ -4,7 +4,6 @@
"scripts": {
"dev": "vite",
"start": "serve -s dist",
"prestart": "[[ -d dist ]] || pnpm run build",
"build": "vite build"
},
"devDependencies": {
@@ -16,7 +15,7 @@
},
"dependencies": {
"@material-ui/core": "^4.12.3",
"@roomruler/messages": "workspace:^0.0.0",
"@roomruler/messages": "*",
"immer": "^9.0.6",
"react": "^17.0.2",
"react-dom": "^17.0.2"

View File

@@ -1 +0,0 @@
export const WS_URL = "ws://localhost:8081";

View File

@@ -10,12 +10,11 @@ import {
isUpdateMessage,
UpdateMessage,
} from "@roomruler/messages";
import { WS_URL } from "./config";
import { RoomDisplay, RoomState } from "./types/room";
const Context = createContext<ContextValue | undefined>(undefined);
const ws = new WebSocket(WS_URL);
const ws = new WebSocket(import.meta.env.VITE_WS_URL || "ws://localhost:8081");
export const RoomContextProvider: FC = ({ children }) => {
const [state, setState] = useState<ContextData>(defaultState);