This repository is designed to make it easier to write Battlefield (BF) Rule Editor scripts in TypeScript.
It provides the following features:
- When you push to GitHub, ESLint automatically checks your code syntax.
- Running
bun run buildcombines multiple .ts files into a single .ts file.- The BF Portal Rule Editor only accepts a single TypeScript file.
bfportal-vitest-mockandvitestare already installed, so you can easily use unit tests.
If you have questions or feedback, feel free to contact me on the PlumRice Discord server 😄
Please use the appropriate thread/channel for discussions related to this project.
- Install Bun. On Windows, open PowerShell and run the official installer:
powershell -c "irm bun.sh/install.ps1|iex"After installation, restart your terminal and check that Bun is available:
bun --versionhttps://bun.com/docs/installation
- Download this repository.
- Place the PortalSDK/code folder from the official Battlefield 6 SDK into the code directory of this project.
- Run the command
bun install.
- Write your program in the mods folder.
- After you finish coding, run the command
bun run build. - Upload
dist/Script.tsanddist/String.jsonto the BF Portal Rule Editor.
Add the strings you want to include in dist/String.json.
This project uses the bfportal-vitest-mock package. For how to install and use it, please refer to the section below.
https://github.com/link1345/bfportal-vitest-mock
Run tests with:
bun test