- 🐺 What is this app ?
- ✨ Production and development links
- 🃏 Available roles
- 📸 Screenshots
- 🔨 Installation
- 🚀 Build
- 🐳 Docker
- 💯 Tests
- 🌿 Env variables
- ☑️ Code analysis and consistency
- 📈 Releases & Changelog
- 🐙 GitHub Actions
- ✨ Misc commands
- ©️ License
- ❤️ 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.
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)
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.
🤼 Game Lobby Page
🎲 Game Page
🕹️ Game Playgrounds
🏆 Game Victory Page
To install this project, you will need to have on your machine :
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.
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.
antoinezanardi/werewolves-assistant-web-next:preprod-fr
: Pre-rendered app with French language and calling the Werewolves Assistant API deployed fromdevelop
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 fromdevelop
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"
)
antoinezanardi/werewolves-assistant-web-next:prod-fr-latest
: Pre-rendered app with French language from latest release and calling the Werewolves Assistant API deployed frommain
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 frommain
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
.
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.
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.
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 |
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.
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
Multiple tools are set up to maintain the best code quality and to prevent vulnerabilities :
Note
You can check the CodeQL analysis report here.
Note
SonarCloud summary is available here.
Releases on main branch are generated and published automatically by :
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.
Name | Description & Status | Triggered on |
---|---|---|
⚙️ Build | Various checks for app health, code quality and tests coverage |
push on develop and all pull requests to develop |
🔃 Lint PR Name Into Develop Workflow | Checks if pull request name respects conventionnal-commit rules |
pull-request created or updated |
🔃️ Upsert PR Release Workflow | Creates or updates pull request to main depending on commits on develop since last release |
push on develop |
🏷️ Release Creation Workflow | Creates a new release using semantic-release with tag and updated changelog |
push on main |
🚀 Deploy To Production Workflow | Deploys app with last tag version to Docker Hub and GCP |
tag-creation |
👽 Run Stryker Mutant Tests and Push Incremental Reports Workflow | Runs Stryker mutant tests and pushes incremental reports |
workflow_dispatch |
🌳 Animated tree visualisation of the project's evolution with Gource
# Please ensure that `gource` is installed on your system.
pnpm run gource
pnpm run script:create-branch
pnpm run script:create-pull-request
pnpm run script:check-acceptance-features-shard
pnpm run script:download-acceptance-screenshots
pnpm run script:check-unit-tests-coverage-file-content
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 |