Skip to content

Latest commit

 

History

History
executable file
·
90 lines (71 loc) · 6.81 KB

development-environment.md

File metadata and controls

executable file
·
90 lines (71 loc) · 6.81 KB

Development Environment

Overview

There are a few options for running Playnite-Web for local development. The options are:

  • via Docker and the included dev container (includes everything you need to run and develop).
  • directly on your development machine (requires installing required tooling such as Node.js, yarn, etc.).
  • via a GitHub codespace.

Setup: Directly on Local Machine (preferred)

Directly: Required Software

Install the following software on your local development machine:

  1. git
  2. Bash (this guide assumes a bash shell)
  3. vscode
  4. Docker (for Mongodb and MQTT dependencies)
  5. Node.js@>=20.9.0 (recommend using nvm to manage Node.js installations)
  6. yarn@^4.0.0
    • With Node.js installed, run corepack enable && corepack prepare --activate yarn@^4.0.0 && yarn set version berry
  7. Run yarn nx run devenv:prepare to ensure consistent developer experience with GraphQL, formatting, etc.

Directly: Preparing Codebase

  1. Fork the playnite-web repo
  2. Clone your forked repo to your local development machine.
  3. Open the repo in vscode.
  4. Run yarn
  5. Run yarn nx run playnite-web-app:start and navigate to https://localhost:3000
    • Note that MQTT and Mongo will be started via docker automatically.
    • Mongo will restore a default database if no database already exists (if there are no files in .data/mongodb).
    • Note MQTT currently starts with no username/password configured.
  6. [Optional]: override environment variables when running locally via cp apps/playnite-web/local.env apps/playnite-web/overrides.env
    • REMEMBER: do not commit overrides.env or sensitive information in local.env.

Running Locally

Application Command Notes
Playnite-Web App yarn nx run playnite-web-app:start Run Playnite-Web application locally. Navigate to https://localhost:3000 in a browser. Environment variables are pulled from ./apps/playnite-web/local.env.
Playnite-Web App yarn nx run playnite-web-app:test/components Run component tests for development.
Playnite-Web App yarn nx run playnite-web-app:test/components/visual Run visual regression component tests for development.
Playnite-Web App yarn nx run playnite-web-app:test/components/visual/update Run visual regression tests with intention to update a baseline screenshot.
Playnite-Web App yarn nx run playnite-web-app:test/e2e Run end-to-end (e2e) tests for development (including visual regression capabilities). A consistent database restored along with consistent game assets. This ensures a reliable data set to test against.
Playnite-Web App yarn nx run playnite-web-app:test/e2e/update Run end-to-end (e2e) tests with intention to update a baseline screenshot.
Playnite-Web App yarn nx run playnite-web-app:test/**/ci Suffix any test target with /ci to run the tests in CI mode; the same as what is run in CI.

Setup: Devcontainer (milage may vary)

Devcontainer: Required Software

Install the following software on your local development machine:

  1. git
  2. Bash (this guide assumes a bash shell)
  3. vscode
  4. Docker
  5. vscode Devcontainers extension
  6. XServer (for running Cypress tests in container).
    • For OSX, recommend: XQuartz
    • For Windows, still need a recommendation.

Devcontainer: Preparing Codebase

  1. Fork the playnite-web repo
  2. Clone your forked repo to your local development machine.
  3. Open the repo in vscode.
  4. Run yarn
  5. Ensure your XServer application is running (if running Cypress tests).
    • Ensure your XServer is configured to Authenticate and Allow Connections from network clients
  6. Once in vscode, Devcontainers: Rebuild and Reopen in container.
    • This can be done via the command palette (Cmd + Shift + P/Ctrl + Shift + P) and typing in Rebuild and reopen in container.
    • This will build a docker image based on the repo's .devcontainer/Dockerfile, start, and then open the repo in that container.

Note that MongoDB and Mosquitto (MQTT) are already setup and installed for localhost when using a devcontainer. See the ./local.env file for their connection details.