Skip to content

Latest commit

 

History

History
64 lines (39 loc) · 2.64 KB

Contributing.md

File metadata and controls

64 lines (39 loc) · 2.64 KB

Contributing

This file contains info for setting up and contributing to this project.

We usen

Setup

Fork/clone this repo. Open this project in vscode, and install the vscode extension Factorio Mod Debug.

Checkout the main branch:

git checkout main

Run npm install to install dependencies.

Run npm run test once. This will run some build scripts and other setup for development.

  • On windows, you may need to enable developer mode to create symlinks.

Development

Run npm run watch to watch for changes.

Launch the Test run vscode launch configuration or Test debug, which is slower but allows debugging.

Tests will automatically re-run each time the project is rebuilt.

This rerun mechanism works using a combination of the tstlPlugin and logic in src/test/test-init.ts.

Testing

Files that end in .test.ts are considered tests, and will be run by factorio-test. These are currently located in src/test or src/lib/test.

This project strives to have as high test coverage as possible.

Scripts

These scripts are used to generate some files:

  • build:locale: generateds a locale.d.ts from src/locale. There is also watch:locale script for this.
  • build:gui-specs: Used for the factoriojsx framework (see src/lib/factoriojsx).
  • build:tstlPlugin: Builds the TSTL plugin which facilitates "storing" functions in global (in a consistent way). See src/lib/references.ts to see how this is done.

If you edit the corresponding files, you may need to re-run these scripts.

The functionality provided by these scripts may become a separate project in the future.

Style

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, and double equals is easier to read.
  • Use nil as a shorthand for, and instead of undefined. Don't use null.