diff --git a/.gitignore b/.gitignore index 6af4543..5afd3cb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .idea node_modules/* client/certs/ +client/dist/ .vscode/launch.json package-lock.json diff --git a/client/config/customCards.js b/client/src/config/customCards.js similarity index 100% rename from client/config/customCards.js rename to client/src/config/customCards.js diff --git a/client/config/defaultCards.js b/client/src/config/defaultCards.js similarity index 100% rename from client/config/defaultCards.js rename to client/src/config/defaultCards.js diff --git a/client/config/globals.js b/client/src/config/globals.js similarity index 100% rename from client/config/globals.js rename to client/src/config/globals.js diff --git a/client/images/GitHub-Mark-32px.png b/client/src/images/GitHub-Mark-32px.png similarity index 100% rename from client/images/GitHub-Mark-32px.png rename to client/src/images/GitHub-Mark-32px.png diff --git a/client/images/GitHub-Mark-Light-32px.png b/client/src/images/GitHub-Mark-Light-32px.png similarity index 100% rename from client/images/GitHub-Mark-Light-32px.png rename to client/src/images/GitHub-Mark-Light-32px.png diff --git a/client/images/Werewolf.png b/client/src/images/Werewolf.png similarity index 100% rename from client/images/Werewolf.png rename to client/src/images/Werewolf.png diff --git a/client/images/Werewolf_Small.png b/client/src/images/Werewolf_Small.png similarity index 100% rename from client/images/Werewolf_Small.png rename to client/src/images/Werewolf_Small.png diff --git a/client/images/clock.svg b/client/src/images/clock.svg similarity index 100% rename from client/images/clock.svg rename to client/src/images/clock.svg diff --git a/client/images/copy.svg b/client/src/images/copy.svg similarity index 100% rename from client/images/copy.svg rename to client/src/images/copy.svg diff --git a/client/images/email.svg b/client/src/images/email.svg similarity index 100% rename from client/images/email.svg rename to client/src/images/email.svg diff --git a/client/images/eye.svg b/client/src/images/eye.svg similarity index 100% rename from client/images/eye.svg rename to client/src/images/eye.svg diff --git a/client/images/info.svg b/client/src/images/info.svg similarity index 100% rename from client/images/info.svg rename to client/src/images/info.svg diff --git a/client/images/logo.gif b/client/src/images/logo.gif similarity index 100% rename from client/images/logo.gif rename to client/src/images/logo.gif diff --git a/client/images/logo_cropped.gif b/client/src/images/logo_cropped.gif similarity index 100% rename from client/images/logo_cropped.gif rename to client/src/images/logo_cropped.gif diff --git a/client/images/pause-button.svg b/client/src/images/pause-button.svg similarity index 100% rename from client/images/pause-button.svg rename to client/src/images/pause-button.svg diff --git a/client/images/person.svg b/client/src/images/person.svg similarity index 100% rename from client/images/person.svg rename to client/src/images/person.svg diff --git a/client/images/play-button.svg b/client/src/images/play-button.svg similarity index 100% rename from client/images/play-button.svg rename to client/src/images/play-button.svg diff --git a/client/images/roles/Double-BlindMinion.png b/client/src/images/roles/Double-BlindMinion.png similarity index 100% rename from client/images/roles/Double-BlindMinion.png rename to client/src/images/roles/Double-BlindMinion.png diff --git a/client/images/roles/DreamWolf.png b/client/src/images/roles/DreamWolf.png similarity index 100% rename from client/images/roles/DreamWolf.png rename to client/src/images/roles/DreamWolf.png diff --git a/client/images/roles/Hunter.png b/client/src/images/roles/Hunter.png similarity index 100% rename from client/images/roles/Hunter.png rename to client/src/images/roles/Hunter.png diff --git a/client/images/roles/KnowingMinion.png b/client/src/images/roles/KnowingMinion.png similarity index 100% rename from client/images/roles/KnowingMinion.png rename to client/src/images/roles/KnowingMinion.png diff --git a/client/images/roles/Mason.png b/client/src/images/roles/Mason.png similarity index 100% rename from client/images/roles/Mason.png rename to client/src/images/roles/Mason.png diff --git a/client/images/roles/Seer.png b/client/src/images/roles/Seer.png similarity index 100% rename from client/images/roles/Seer.png rename to client/src/images/roles/Seer.png diff --git a/client/images/roles/Shadow.png b/client/src/images/roles/Shadow.png similarity index 100% rename from client/images/roles/Shadow.png rename to client/src/images/roles/Shadow.png diff --git a/client/images/roles/Sorcerer.png b/client/src/images/roles/Sorcerer.png similarity index 100% rename from client/images/roles/Sorcerer.png rename to client/src/images/roles/Sorcerer.png diff --git a/client/images/roles/Villager-2.png b/client/src/images/roles/Villager-2.png similarity index 100% rename from client/images/roles/Villager-2.png rename to client/src/images/roles/Villager-2.png diff --git a/client/images/roles/Villager.png b/client/src/images/roles/Villager.png similarity index 100% rename from client/images/roles/Villager.png rename to client/src/images/roles/Villager.png diff --git a/client/images/roles/Werewolf.png b/client/src/images/roles/Werewolf.png similarity index 100% rename from client/images/roles/Werewolf.png rename to client/src/images/roles/Werewolf.png diff --git a/client/images/tombstone.png b/client/src/images/tombstone.png similarity index 100% rename from client/images/tombstone.png rename to client/src/images/tombstone.png diff --git a/client/images/vanilla_js.png b/client/src/images/vanilla_js.png similarity index 100% rename from client/images/vanilla_js.png rename to client/src/images/vanilla_js.png diff --git a/client/images/x.svg b/client/src/images/x.svg similarity index 100% rename from client/images/x.svg rename to client/src/images/x.svg diff --git a/client/model/Game.js b/client/src/model/Game.js similarity index 100% rename from client/model/Game.js rename to client/src/model/Game.js diff --git a/client/modules/DeckStateManager.js b/client/src/modules/DeckStateManager.js similarity index 100% rename from client/modules/DeckStateManager.js rename to client/src/modules/DeckStateManager.js diff --git a/client/modules/GameCreationStepManager.js b/client/src/modules/GameCreationStepManager.js similarity index 100% rename from client/modules/GameCreationStepManager.js rename to client/src/modules/GameCreationStepManager.js diff --git a/client/modules/GameStateRenderer.js b/client/src/modules/GameStateRenderer.js similarity index 100% rename from client/modules/GameStateRenderer.js rename to client/src/modules/GameStateRenderer.js diff --git a/client/modules/GameTimerManager.js b/client/src/modules/GameTimerManager.js similarity index 100% rename from client/modules/GameTimerManager.js rename to client/src/modules/GameTimerManager.js diff --git a/client/modules/ModalManager.js b/client/src/modules/ModalManager.js similarity index 100% rename from client/modules/ModalManager.js rename to client/src/modules/ModalManager.js diff --git a/client/modules/StateBucket.js b/client/src/modules/StateBucket.js similarity index 100% rename from client/modules/StateBucket.js rename to client/src/modules/StateBucket.js diff --git a/client/modules/Templates.js b/client/src/modules/Templates.js similarity index 100% rename from client/modules/Templates.js rename to client/src/modules/Templates.js diff --git a/client/modules/Timer.js b/client/src/modules/Timer.js similarity index 100% rename from client/modules/Timer.js rename to client/src/modules/Timer.js diff --git a/client/modules/Toast.js b/client/src/modules/Toast.js similarity index 100% rename from client/modules/Toast.js rename to client/src/modules/Toast.js diff --git a/client/modules/UserUtility.js b/client/src/modules/UserUtility.js similarity index 100% rename from client/modules/UserUtility.js rename to client/src/modules/UserUtility.js diff --git a/client/modules/XHRUtility.js b/client/src/modules/XHRUtility.js similarity index 100% rename from client/modules/XHRUtility.js rename to client/src/modules/XHRUtility.js diff --git a/client/scripts/create.js b/client/src/scripts/create.js similarity index 86% rename from client/scripts/create.js rename to client/src/scripts/create.js index 10992ca..5b1ae6d 100644 --- a/client/scripts/create.js +++ b/client/src/scripts/create.js @@ -1,11 +1,9 @@ import { defaultCards } from "../config/defaultCards.js"; import { customCards } from "../config/customCards.js"; import { DeckStateManager } from "../modules/DeckStateManager.js"; -import { XHRUtility } from "../modules/XHRUtility.js"; -import { Game } from "../model/Game.js"; import { GameCreationStepManager } from "../modules/GameCreationStepManager.js"; -export const create = () => { +const create = () => { let deckManager = new DeckStateManager(); let gameCreationStepManager = new GameCreationStepManager(deckManager); loadDefaultCards(deckManager); @@ -32,3 +30,9 @@ function loadCustomRoles(deckManager) { }); deckManager.customRoleOptions = customCards; } + +if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { + module.exports = create; +} else { + create(); +} diff --git a/client/scripts/game.js b/client/src/scripts/game.js similarity index 98% rename from client/scripts/game.js rename to client/src/scripts/game.js index 940bc19..cd3fdaa 100644 --- a/client/scripts/game.js +++ b/client/src/scripts/game.js @@ -6,8 +6,9 @@ import {cancelCurrentToast, toast} from "../modules/Toast.js"; import {GameTimerManager} from "../modules/GameTimerManager.js"; import {ModalManager} from "../modules/ModalManager.js"; import {stateBucket} from "../modules/StateBucket.js"; +import { io } from 'socket.io-client'; -export const game = () => { +const game = () => { let timerWorker; const socket = io('/in-game'); socket.on('disconnect', () => { @@ -18,7 +19,7 @@ export const game = () => { }); socket.on('connect', () => { socket.emit(globals.COMMANDS.GET_ENVIRONMENT, function(returnedEnvironment) { - timerWorker = new Worker('../modules/Timer.js'); + timerWorker = new Worker(new URL('../modules/Timer.js', import.meta.url)); prepareGamePage(returnedEnvironment, socket, timerWorker); }); }) @@ -366,3 +367,9 @@ function activateRoleInfoButton(deck) { ModalManager.displayModal('role-info-modal', 'role-info-modal-background', 'close-role-info-modal-button'); }); } + +if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { + module.exports = game; +} else { + game(); +} diff --git a/client/scripts/home.js b/client/src/scripts/home.js similarity index 88% rename from client/scripts/home.js rename to client/src/scripts/home.js index f30de66..65664a7 100644 --- a/client/scripts/home.js +++ b/client/src/scripts/home.js @@ -1,7 +1,7 @@ import { XHRUtility } from "../modules/XHRUtility.js"; import { toast } from "../modules/Toast.js"; -export const home = () => { +const home = () => { document.getElementById("join-form").onsubmit = (e) => { e.preventDefault(); let userCode = document.getElementById("room-code").value; @@ -39,3 +39,9 @@ function attemptToJoinGame(code) { }); } +if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { + module.exports = home; +} else { + home(); +} + diff --git a/client/styles/GLOBAL.css b/client/src/styles/GLOBAL.css similarity index 100% rename from client/styles/GLOBAL.css rename to client/src/styles/GLOBAL.css diff --git a/client/styles/create.css b/client/src/styles/create.css similarity index 100% rename from client/styles/create.css rename to client/src/styles/create.css diff --git a/client/styles/game.css b/client/src/styles/game.css similarity index 99% rename from client/styles/game.css rename to client/src/styles/game.css index bd39355..5e227f1 100644 --- a/client/styles/game.css +++ b/client/src/styles/game.css @@ -533,7 +533,7 @@ label[for='moderator'] { #game-link:hover { background-color: #26282a; - border: 1px solid #d7d7d7; + border: 2px solid #d7d7d7; } .reveal-role-button { diff --git a/client/styles/home.css b/client/src/styles/home.css similarity index 100% rename from client/styles/home.css rename to client/src/styles/home.css diff --git a/client/styles/modal.css b/client/src/styles/modal.css similarity index 100% rename from client/styles/modal.css rename to client/src/styles/modal.css diff --git a/client/views/404.html b/client/src/views/404.html similarity index 89% rename from client/views/404.html rename to client/src/views/404.html index a543e48..a4ef610 100644 --- a/client/views/404.html +++ b/client/src/views/404.html @@ -16,9 +16,6 @@ - - - - + - + diff --git a/client/views/home.html b/client/src/views/home.html similarity index 95% rename from client/views/home.html rename to client/src/views/home.html index 2b67249..4da82f4 100644 --- a/client/views/home.html +++ b/client/src/views/home.html @@ -48,10 +48,7 @@

Werewolf created by Andrew Plotkin

- +