mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 15:18:32 -06:00
adding file polling for windows machines
This commit is contained in:
@@ -10,6 +10,7 @@ services:
|
||||
environment:
|
||||
- storageDirectory=/app/storage
|
||||
- TZ=America/Denver
|
||||
# - FILE_POLLING=true
|
||||
volumes:
|
||||
- ~/projects/faculty/1430/2024-fall-alex/modules:/app/storage/UX
|
||||
- ~/projects/faculty/4850_AdvancedFE/2024-fall-alex/modules:/app/storage/advanced_frontend
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"@trpc/server": "11.0.0-rc.608",
|
||||
"@types/ws": "^8.5.13",
|
||||
"chokidar": "^4.0.1",
|
||||
"dotenv": "^16.4.5",
|
||||
"jsdom": "^25.0.0",
|
||||
"next": "^15.0.2",
|
||||
"react": "^18",
|
||||
@@ -32,7 +33,6 @@
|
||||
"@monaco-editor/loader": "^1.4.0",
|
||||
"@monaco-editor/react": "^4.6.0",
|
||||
"@testing-library/dom": "^10.4.0",
|
||||
"socket.io-client": "^4.8.1",
|
||||
"@testing-library/react": "^16.0.0",
|
||||
"@types/node": "^22",
|
||||
"@types/react": "^18",
|
||||
@@ -46,6 +46,7 @@
|
||||
"postcss": "^8",
|
||||
"react-error-boundary": "^4.0.13",
|
||||
"react-hot-toast": "^2.4.1",
|
||||
"socket.io-client": "^4.8.1",
|
||||
"tailwindcss": "^3.4.1",
|
||||
"typescript": "^5",
|
||||
"vitest": "^2.0.5",
|
||||
|
||||
15
nextjs/pnpm-lock.yaml
generated
15
nextjs/pnpm-lock.yaml
generated
@@ -29,6 +29,9 @@ importers:
|
||||
chokidar:
|
||||
specifier: ^4.0.1
|
||||
version: 4.0.1
|
||||
dotenv:
|
||||
specifier: ^16.4.5
|
||||
version: 16.4.5
|
||||
jsdom:
|
||||
specifier: ^25.0.0
|
||||
version: 25.0.1
|
||||
@@ -44,9 +47,6 @@ importers:
|
||||
socket.io:
|
||||
specifier: ^4.8.1
|
||||
version: 4.8.1
|
||||
socket.io-client:
|
||||
specifier: ^4.8.1
|
||||
version: 4.8.1
|
||||
superjson:
|
||||
specifier: ^2.2.1
|
||||
version: 2.2.1
|
||||
@@ -105,6 +105,9 @@ importers:
|
||||
react-hot-toast:
|
||||
specifier: ^2.4.1
|
||||
version: 2.4.1(csstype@3.1.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||
socket.io-client:
|
||||
specifier: ^4.8.1
|
||||
version: 4.8.1
|
||||
tailwindcss:
|
||||
specifier: ^3.4.1
|
||||
version: 3.4.14(ts-node@10.9.2(@types/node@22.9.0)(typescript@5.6.3))
|
||||
@@ -1256,6 +1259,10 @@ packages:
|
||||
dompurify@3.1.7:
|
||||
resolution: {integrity: sha512-VaTstWtsneJY8xzy7DekmYWEOZcmzIe3Qb3zPd4STve1OBTa+e+WmS1ITQec1fZYXI3HCsOZZiSMpG6oxoWMWQ==}
|
||||
|
||||
dotenv@16.4.5:
|
||||
resolution: {integrity: sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==}
|
||||
engines: {node: '>=12'}
|
||||
|
||||
eastasianwidth@0.2.0:
|
||||
resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==}
|
||||
|
||||
@@ -3801,6 +3808,8 @@ snapshots:
|
||||
|
||||
dompurify@3.1.7: {}
|
||||
|
||||
dotenv@16.4.5: {}
|
||||
|
||||
eastasianwidth@0.2.0: {}
|
||||
|
||||
electron-to-chromium@1.5.53: {}
|
||||
|
||||
@@ -31,6 +31,7 @@ const sampleCompose = `services:
|
||||
- .env # needs to have your CANVAS_TOKEN set
|
||||
environment:
|
||||
- TZ=America/Denver # prevents timezone issues for due dates
|
||||
# - FILE_POLLING=true # increases cpu usage, uncomment if source volumes are on ntfs
|
||||
volumes:
|
||||
- ~/projects/faculty/1430/2024-fall-alex/modules:/app/storage/UX
|
||||
- ~/projects/faculty/4850_AdvancedFE/2024-fall-alex/modules:/app/storage/advanced_frontend
|
||||
|
||||
@@ -3,6 +3,8 @@ import next from "next";
|
||||
import { Server } from "socket.io";
|
||||
import chokidar from "chokidar";
|
||||
import path from "path";
|
||||
import dotenv from "dotenv";
|
||||
dotenv.config();
|
||||
|
||||
const dev = process.env.NODE_ENV !== "production";
|
||||
const hostname = "localhost";
|
||||
@@ -14,12 +16,18 @@ const handler = app.getRequestHandler();
|
||||
|
||||
const folderToWatch = path.join(process.cwd(), "./storage", "/");
|
||||
console.log("watching folder", folderToWatch);
|
||||
const usePolling = process.env.FILE_POLLING === "true";
|
||||
console.log("FILE_POLLING:", usePolling);
|
||||
|
||||
const watcher = chokidar.watch(folderToWatch, {
|
||||
persistent: true,
|
||||
usePolling,
|
||||
});
|
||||
|
||||
app.prepare().then(() => {
|
||||
const httpServer = createServer(handler);
|
||||
|
||||
const io = new Server(httpServer);
|
||||
const watcher = chokidar.watch(folderToWatch, { persistent: true });
|
||||
|
||||
io.on("connection", (socket) => {
|
||||
console.log("websocket connection created");
|
||||
|
||||
Reference in New Issue
Block a user