This file contains info for setting up the project.
We use:
- TypescriptToLua
- typed-factorio for type definitions
- vscode-factoriomod-debug for development
- Factorio test for testing
- gb-tstl-utils for some compiler-assisted utilities
[[CLAUDE.md]] is meant for bots, but it's nice for humans, too! Perhaps give it a skim.
Fork/clone this repo.
Recommended: install the vscode extension Factorio Mod Debug.
Checkout the main branch:
git checkout mainRun pnpm install to install dependencies.
Run pnpm run test:rebuild once. This will setup build scripts and other setup for development.
- On windows, you may need to enable developer mode to create symlinks.
Run tests once with pnpm run test.
Watch mode: run pnpm run watch and pnpm exec factorio-test run --watch separately.
You can also run pnpm exec factorio-test run --graphics to launch a graphical window with the same settings as the test does.
Tests will rerun automatically when using --watch.
Files that end in .test.ts are considered tests.
These are currently located in src/test or src/lib/test.
These are automatically picked up by a custom tstl-plugin to be registered with factorio-test.
These scripts generate some source files:
build:locale: generates alocale.d.tsfromsrc/locale/en. There is also scriptwatch:locale.build:gui-specs: Used for the factoriojsx framework (seesrc/lib/factoriojsx).build:tstlPlugin: Builds the TSTL plugin, which facilitates "storing" functions instorage. Seesrc/lib/references.tsto see how this is done.
If you edit input files, you may need to re-run these scripts.
The functionality provided by these scripts may become a separate project in the future.
Although this project is written in Typescript, the eventual output is Lua. As such, we do the following:
- This uses gb-tstl-utils; see there for more info.
- Use
==instead of===, and!=instead of!==. There is no difference in Lua. - Use
nilinstead ofundefined. Don't usenull.