Skip to content

🐺 Werewolves Assistant Web is a Nuxt Web App using the Werewolves Assistant API. It helps you, the game master, to manage your games of Werewolves Of Millers Hollow.

License

Notifications You must be signed in to change notification settings

antoinezanardi/werewolves-assistant-web-next

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo


TypeScript Nuxt TailwindCSS

⚙️ Build Workflow 🚀 Deploy To Production Workflow

GitHub release semantic-release: conventional commits GitHub license DependenciesKnown Vulnerabilities

Tests count Covered Statements Scenarios Mutation testing badge

Technical Debt Duplicated Lines (%) Code Smells

📋 Table of Contents

  1. 🐺 What is this app ?
  2. Production and development links
  3. 🃏 Available roles
  4. 📸 Screenshots
  5. 🔨 Installation
  6. 🚀 Build
  7. 🐳 Docker
  8. 💯 Tests
  9. 🌿 Env variables
  10. ☑️ Code analysis and consistency
  11. 📈 Releases & Changelog
  12. 🐙 GitHub Actions
  13. Misc commands
  14. ©️ License
  15. ❤️ Contributors

Werewolves Assistant Web is a Nuxt Web App using the Werewolves Assistant API. It helps you, the game master, to manage your games of Werewolves Of Millers Hollow.

Note

This is the next version of the deprecated Werewolves Assistant Web. It is maintained with the Werewolves Assistant API.

🤔 Want to know more about this awesome project ? Check out the dedicated about page.

🌐 Production

The production version of this Web App is available at werewolves-assistant.com.

It uses the Production Werewolves Assistant API.

The production server is updated automatically with the latest version of the Web App when a new release is created. (When a new tag is pushed on the main branch)

🛠️ Development

The development version of this Web App is available at preprod.werewolves-assistant.com.

It uses the Preprod Werewolves Assistant API.

The development server is updated automatically when a commit is pushed on the develop branch.


Werewolf

Big Bad Wolf

Accursed Wolf-Father

White Werewolf

Villager

Villager-Villager

Seer

Cupid

Witch

Hunter

Little Girl

Defender

Elder

Scapegoat

Idiot

Two Sisters

Three Brothers

Fox

Bear Tamer

Stuttering Judge

Rusty Sword Knight

Wild Child

Wolf-Hound

Thief

Angel

Pied Piper

Scandalmonger

Prejudiced Manipulator

Actor

Devoted Servant
🏠 Home Page

Home page

❓ About Page

About page

🤼 Game Lobby Page
🤼 Game Lobby Page without players

Game Lobby Page without players

🤼 Game Lobby Page with 40 players

Game Lobby Page with 40 players

🃏 Game Lobby Role Picker without picked role

Game Lobby Role Picker without picked role

🃏 Game Lobby Role Picker with picked role

Game Lobby Role Picker with picked role

⚙️ Game Lobby Options Hub

Game Lobby Options Hub

🃏🃏🃏️ Game Lobby Additional Cards Manager without cards

Game Lobby Additional Cards Manager without cards

🃏🃏🃏️ Game Lobby Additional Cards Manager with 5 cards

Game Lobby Additional Cards Manager with 5 cards

🎲 Game Page
🕹️ Game Playgrounds
🐺 Accursed Wolf-Father infects Playground

Accursed Wolf-Father infects Playground

🎭 Actor chooses card Playground

Actor chooses card Playground

🐺 👹 Big Bad Wolf eats Playground

Big Bad Wolf eats Playground

😵‍💫 Charmed people meet each other Playground

Charmed people meet each other Playground

👼 Cupid charms Playground

Cupid charms Playground

🛡️ Defender protects Playground

Defender protects Playground

🦊 Fox sniffs Playground

Fox sniffs Playground

🔫 Hunter shoots Playground

Hunter shoots Playground

💞 Lovers meet each other Playground

Lovers meet each other Playground

🪈 Pied Piper charms Playground

Pied Piper charms Playground

🐦‍⬛ Scandalmonger marks Playground

Scandalmonger marks Playground

🐐 Scapegoat bans voting Playground

Scapegoat bans voting Playground

🔮 Seer looks Playground

Seer looks Playground

🎖️ Sheriff delegates Playground

Sheriff delegates Playground

🎖️ Sheriff settles votes Playground

Sheriff settles votes Playground

⚖️️ Stuttering Judge Requests Another Vote Playground

Stuttering Judge Requests Another Vote Playground

🎖️ Survivors elect the Sheriff Playground

Survivors elect the Sheriff Playground

👺 Thief chooses card Playground

Thief chooses card Playground

👨‍👨‍👦 Three Brothers meet each other Playground

Three Brothers meet each other Playground

👯‍ Two Sisters meet each other Playground

Two Sisters meet each other Playground

🐺 Werewolves eat Playground

Werewolves eat Playground

🦴🐺 White Werewolf eats Playground

White Werewolf eats Playground

🐒 Wild Child chooses model Playground

Wild Child chooses model Playground

🪄 Witch uses life potion Playground

Witch uses life potion Playground

🪄 Witch uses death potion Playground

Witch uses death potion Playground

🪄 Witch out of potions Playground

Witch out of potions Playground

🐕 Wolf-Hound chooses side Playground

Wolf-Hound chooses side Playground

🤷 Game Playground without targets

Game Playground without targets

🌟 Game Events
🎬 Game Starts Event

Game Starts Event

🌙 Game Phase Event

Game Phase Event

❓ Game not found

Game not found

❌ Game canceled

Game canceled

🏆 Game Victory Page
🪽 Game won by Angel

Game won by Angel

💞 Game won by Lovers

Game won by Lovers

💞👼 Game won by Lovers and Cupid

Game won by Lovers and Cupid

🧑🏻‍🌾 Game won by Villagers

Game won by Villagers

🐺 Game won by Werewolves

Game won by Werewolves

☠️ Game won by nobody

Game won by nobody

🪈 Game won by Pied Piper

Game won by Pied Piper

🐺 🦴 Game won by White Werewolf

Game won by White Werewolf

❓ Page not found

Page not found

To install this project, you will need to have on your machine :

Node PNPM

We recommend to use the node version specified in the .nvmrc file. At least, you'll need to have version 23 installed as mentioned in package.json file.

Tip

If you don't have pnpm installed, you can still use npm for all commands below, but we recommend to use pnpm for faster and more reliable installations.

Then, run the following commands :

# Install dependencies and Husky hooks
pnpm install

# Run the app in dev mode
pnpm run dev

The above command will start the app in development mode and watch for changes on local.

In order to build the app for production, run the following command :

# Build the app
pnpm run build

This app is Docker ready !

The Dockerfile is available at the root of the project. It uses a multi-stage build to optimize the image size.

You can run the whole project (including MongoDB and the Werewolves Assistant API) with the following command :

# Run the whole project with `develop` tags for the API and the Web app
pnpm run docker:preproduction-example:start

# Run the whole project with `latest` tags for the API and the Web app
pnpm run docker:production-example:start

Tip

The docker-compose.yml file used for the preproduction example stated above is available here. The docker-compose.yml file used for the production example stated above is available here.

🏷️ Docker Tags

Because of the Nuxt pre-rendering feature, environment variables are injected at build time on some pages. Therefore, multiple tags are created when pushing to develop and main branches.

⛵️ When pushing to develop branch

  • antoinezanardi/werewolves-assistant-web-next:preprod-fr : Pre-rendered app with French language and calling the Werewolves Assistant API deployed from develop branch ("https://preprod.api.werewolves-assistant.com")
  • antoinezanardi/werewolves-assistant-web-next:preprod-en : Pre-rendered app with English language and calling the Werewolves Assistant API deployed from develop branch ("https://preprod.api.werewolves-assistant.com")
  • antoinezanardi/werewolves-assistant-web-next:local-preprod-fr : Pre-rendered app with French language and calling the Werewolves Assistant API running locally ("http://localhost:9292")
  • antoinezanardi/werewolves-assistant-web-next:local-preprod-en : Pre-rendered app with English language and calling the Werewolves Assistant API running locally ("http://localhost:9292")

🚀 When pushing to main branch

  • antoinezanardi/werewolves-assistant-web-next:prod-fr-latest : Pre-rendered app with French language from latest release and calling the Werewolves Assistant API deployed from main branch ("https://api.werewolves-assistant.com")
  • antoinezanardi/werewolves-assistant-web-next:prod-en-latest : Pre-rendered app with English language from latest release and calling the Werewolves Assistant API deployed from main branch ("https://api.werewolves-assistant.com")
  • antoinezanardi/werewolves-assistant-web-next:local-prod-fr-latest : Pre-rendered app with French language from latest release and calling the Werewolves Assistant API running locally ("http://localhost:9191")
  • antoinezanardi/werewolves-assistant-web-next:local-prod-en-latest : Pre-rendered app with English language from latest release and calling the Werewolves Assistant API running locally ("http://localhost:9191")

When pushing to main branch, a new release is created with the version number from the package.json file. Then, all above tags for prod are also created with the version number instead of latest.

🔖 Which one to choose ?

For your tests, you must choose the local prefixed tags when you want to test the app with the API running locally.

  • If you want to test the app with the latest features, you can use the preprod tags.
  • If you want to test the app with the latest release, you can use the prod tags.

Not prefixed tags like preprod-fr or prod-en are exclusively used for the preproduction and production environments.

🧪 Unit tests

Vitest

Tests count

Covered Statements

Covered Branches

Covered Functions

Covered Lines

⚗️ E2E / Acceptance tests

Playwright

Cucumber

Scenarios

E2E tests are written in Gherkin language around Playwright functions and are available in the features directory.

Note

🏞️ Screenshots for visual regression tests for each platform (linux / darwin) are available in the screenshots directory.

👽 Mutant testing

Stryker

Mutation testing badge

▶️ Commands

Important

Before testing, you must follow the installation steps.

Then, run one of the following commands :

# Assure you started Werewolves Assistant sandbox API docker containers before running tests
pnpm run docker:sandbox-api:start

# Run unit tests with coverage
pnpm run test:unit:cov

# Run unit tests only on staged files (run on pre-commit)
pnpm run test:unit:staged

# Before running e2e tests, you must prepare them
pnpm run test:cucumber:prepare

# Run all e2e acceptance tests and generate a HTML report
pnpm run test:cucumber

# Run shard-X tagged e2e acceptance tests and generate a HTML report (Every feature file is tagged with a shard number)
pnpm run test:cucumber:shard-1
pnpm run test:cucumber:shard-2
pnpm run test:cucumber:shard-3
pnpm run test:cucumber:shard-4
pnpm run test:cucumber:shard-5
pnpm run test:cucumber:shard-6
pnpm run test:cucumber:shard-7
pnpm run test:cucumber:shard-8

# Run e2e acceptance tests without screenshots comparison and generate a HTML report
pnpm run test:cucumber:skip-screenshots-comparison

# Generate a HTML report from the last e2e tests run (implied by the previous command)
pnpm run test:cucumber:html-report

# Run all mutant tests with coverage
pnpm run test:stryker

# Run mutant tests with coverage from scratch (without using the incremental file)
pnpm run test:stryker:force

# Run mutant tests only on a specific shard of the project
pnpm run test:stryker:components
pnpm run test:stryker:composables
pnpm run test:stryker:layouts
pnpm run test:stryker:pages
pnpm run test:stryker:stores
pnpm run test:stryker:utils

# Run all of the above shards commands one after the other
pnpm run test:stryker:all-shards

Environnement files are available in the env directory.

Tip

You can create a .env file in this directory to override the default values when starting the API locally with pnpm run dev command.

Environment variables are :

Name Description Required Default value Limitations
NUXT_PUBLIC_WEREWOLVES_ASSISTANT_API_BASE_URL URL of the Werewolves Assistant API Must be a valid URL
NUXT_WEREWOLVES_ASSISTANT_API_KEY API key for the Werewolves Assistant API Must be a valid key
NUXT_PUBLIC_DEFAULT_LOCALE Locale used when starting the app en Must be either en or fr
NUXT_PUBLIC_CONTACT_EMAIL Contact email for the app Must be a valid email address
SKIP_SCREENSHOTS_COMPARISON_TESTS In E2E tests, skip all screenshots comparisons, not used in production false Must be either true or false
NUXT_SITE_URL Used for SEO, base URL for the site Must be a valid URL
NUXT_SITE_NAME Used for SEO, name of the site (Used in titles) Must be a valid string
NUXT_SITE_ENV Used for SEO and indexing, environment of the site Must be a either production or development
NUXT_SITE_DESCRIPTION Used for SEO and indexing, description of the site Must be a valid string

🔍 Code linting & formatting

ESLint

In order to keep the code clean, consistent and free of bad TS practices, more than 300 ESLint rules are activated !

Note

Complete list of all enabled rules is available in the eslintrc.config.js file.

▶️ Commands

Important

Before linting, you must follow the installation steps.

Then, run one of the following commands :

# Lint 
pnpm run lint

# Lint and fix
pnpm run lint:fix

# Lint and fix only on staged files (runs on pre-commit)
pnpm run lint:staged:fix

# Inspect ESLint config with @eslint/config-inspector
pnpm run lint:inspect-config

🥇 Project quality scanner

Multiple tools are set up to maintain the best code quality and to prevent vulnerabilities :

CodeQL

Note

You can check the CodeQL analysis report here.

SonarCloud

Note

SonarCloud summary is available here.

Coverage Duplicated Lines (%) Quality Gate Status

Technical Debt Vulnerabilities Code Smells

Reliability Rating Security Rating Bugs

Releases on main branch are generated and published automatically by :

Semantic Release

It uses the conventional commit strategy.

Each change when a new release comes up is listed in the CHANGELOG.md file.

Tip

Also, you can keep up with changes by watching releases via the Watch GitHub button at the top of this page.

This project uses GitHub Actions to automate some boring tasks.

Note

You can find all the workflows in the .github/workflows directory.

🎢 Workflows

Name Description & Status Triggered on
⚙️ Build Various checks for app health, code quality and tests coverage

⚙️ Build Workflow
push on develop and all pull requests to develop
🔃 Lint PR Name Into Develop Workflow Checks if pull request name respects conventionnal-commit rules

🔃 Lint PR Name Into Develop Workflow
pull-request created or updated
🔃️ Upsert PR Release Workflow Creates or updates pull request to main depending on commits on develop since last release

🔃️ Upsert PR Release Workflow
push on develop
🏷️ Release Creation Workflow Creates a new release using semantic-release with tag and updated changelog

🏷️ Release Creation Workflow
push on main
🚀 Deploy To Production Workflow Deploys app with last tag version to Docker Hub and GCP

🚀 Deploy To Production Workflow
tag-creation
👽 Run Stryker Mutant Tests and Push Incremental Reports Workflow Runs Stryker mutant tests and pushes incremental reports

👽 Run Stryker Mutant Tests and Push Incremental Reports Workflow
workflow_dispatch

🌳 Animated tree visualisation of the project's evolution with Gource

# Please ensure that `gource` is installed on your system.
pnpm run gource

🔀 Create git branch with a conventional name

pnpm run script:create-branch

⤴️ Create pull request against the develop branch from current branch

pnpm run script:create-pull-request

💠 Check that all acceptance features have an associated shard

pnpm run script:check-acceptance-features-shard

📸 Download all screenshots from the acceptance tests from a GitHub action

pnpm run script:download-acceptance-screenshots

🏺 Check that generated unit tests coverage file content is valid

pnpm run script:check-unit-tests-coverage-file-content

📣 To all IntelliJ IDEs users (IntelliJ, Webstorm, PHPStorm, etc.)

All the above commands are available in the .run directory at the root of the project.

Tip

You can add them as run configurations in your IDE.

This project is licensed under the MIT License.

Warning

If you want to contribute to this project, please read the contribution guide.

Thank you to all the contributors:


Daniel Roe

Alexander Lichter