Development Setup - Eranziel/foundryvtt-lancer GitHub Wiki
Development prerequisites are npm and the FoundryVTT cli (@foundryvtt/foundryvtt-cli)
This guide is written with Linux in mind, although most steps are similar on Windows.
First, ensure you have npm installed. There are a few ways to do this, here's a handy guide for Debian based Linux.
Install packages and, optionally, fvtt
npm install -g @foundryvtt/foundryvtt-cli # Optional
npm clean-install
To update Node.js, you can follow this guide. Version 18 is the minimum requirement and can be confirmed by using the command node -v.
Link
In order for the project's build task to update the system files in your Foundry instance, you need to link the project's dist directory to your Foundry data directory (the one containing Config, Data, and Logs). The npm install will attempt to do this automatically based on your foundry cli configuration. The linking script can be rerun using npm run link. If this fails, you may not have your data directory set in the cli configuration, or the data directory may not exist yet.
Linking on Windows
Windows seems to think that creating symbolic links is dangerous, so this script must be run using an Administrator command prompt/Powershell.
Linking with Docker
You won't want to do this if you're running Foundry in a docker container--it doesn't handle externally-created links well. Instead, you can manually copy over the folder each time it's built, or link it from inside the container. To link, you'll need to make sure the repository lives somewhere accessible by the container.
Note that the way you build your container can make these commands vary a lot:
docker exec -it ${FOUNDRY_CONTAINER} bash
ln -s {PATH_TO_REPOSITORY}/dist {PATH_TO_FOUNDRY_FOLDER}/Data/systems/foundry
Build
Once you have your import process set up, you're ready to build.
To compile once, use the build script:
npm run build
To compile whenever a file changes, use the watch script:
npm run watch
To see all the tasks, use
npm run
Once a build is completed, files will be placed in the dist folder. If you also completed the link task mentioned above, they'll also be placed in your systems folder, and ready to use in Foundry!
Vite server
Once the system is built and linked, you can use the development server provided by Vite to test changes more easily.
To launch the server, make sure Foundry is running, then use
npm run serve
Your web browser will launch and connect to http://localhost:30001/ which will sit between your browser and Foundry, allowing it to quickly replace files that were changed and reload foundry, as well as hot reload any modules configured for it. More details can be found on the Foundry community wiki page.