Resolve clusterio through CLUSTERIO rather than in ci only

The library path was injected by the workflow, so an editor opened on
this repo could not resolve `modules/clusterio/*`. It now comes from
the environment in both places.

It cannot be written relative to this repo: emmylua does not normalise
`..` in a library path, and an absolute path containing `..` fails the
same way, so the location has to come from outside.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
bbassie
2026-08-07 16:04:16 +00:00
co-authored by Claude Opus 5
parent 619ed4b39f
commit d495a345d6
3 changed files with 7 additions and 3 deletions
+2
View File
@@ -6,6 +6,8 @@
}, },
"workspace": { "workspace": {
"$comment-moduleMap": "Replaces the fmtk --clusterio-modules plugin, rewrites each file's own module path rather than the require string", "$comment-moduleMap": "Replaces the fmtk --clusterio-modules plugin, rewrites each file's own module path rather than the require string",
"$comment-library": "clusterio is outside this repo, set CLUSTERIO to your checkout. The factorio typedefs come from .luarc.json, which the factoriomod-debug extension manages",
"library": [ "$CLUSTERIO/packages/host" ],
"ignoreDir": [ ".github", "web", "dist", "factorio" ], "ignoreDir": [ ".github", "web", "dist", "factorio" ],
"ignoreGlobs": [ "**/node_modules/**", "**/dist/**" ], "ignoreGlobs": [ "**/node_modules/**", "**/dist/**" ],
"moduleMap": [ "moduleMap": [
+4 -3
View File
@@ -6,6 +6,7 @@ on:
env: env:
EMMYLUA_CHECK_VERSION: "0.24.0" EMMYLUA_CHECK_VERSION: "0.24.0"
CLUSTERIO: ${{ github.workspace }}/.clusterio
jobs: jobs:
lint: lint:
@@ -36,9 +37,9 @@ jobs:
- name: Run Lint Report - name: Run Lint Report
shell: bash shell: bash
run: | run: |
# Library paths are machine specific, so they are merged in rather than committed # The typedefs are generated per run, clusterio comes from CLUSTERIO above
jq -n --arg lib "$RUNNER_TEMP/factorio/library" --arg clusterio "$PWD/.clusterio/packages/host" \ jq -n --arg lib "$RUNNER_TEMP/factorio/library" \
'{ workspace: { library: [ $lib, $clusterio ], ignoreGlobs: [ ".clusterio/**" ] } }' \ '{ workspace: { library: [ $lib ], ignoreGlobs: [ ".clusterio/**" ] } }' \
> "$RUNNER_TEMP/ci.emmyrc.json" > "$RUNNER_TEMP/ci.emmyrc.json"
# Exits non zero on error severity, so the gate below is used instead # Exits non zero on error severity, so the gate below is used instead
+1
View File
@@ -5,6 +5,7 @@ All are welcome to make bug reports, feature requests, and pull requests for our
For developers wanting to add features please follow these guidelines: For developers wanting to add features please follow these guidelines:
- All lua code is documented using ldoc. - All lua code is documented using ldoc.
- Set `CLUSTERIO` to your clusterio checkout, the lint needs it to resolve `modules/clusterio/*`. emmylua does not normalise `..` in a library path, so it cannot be written relative to this repo.
- Lua is checked with [emmylua](https://github.com/EmmyLuaLs/emmylua-analyzer-rust), configured by `.emmyrc.json`. Install the EmmyLua extension rather than sumneko, and let the factoriomod-debug extension write your machine local library paths to `.luarc.json`, which is git ignored. Note that an inline cast must be written `--[[@as T]]`, the spaced form is not parsed. - Lua is checked with [emmylua](https://github.com/EmmyLuaLs/emmylua-analyzer-rust), configured by `.emmyrc.json`. Install the EmmyLua extension rather than sumneko, and let the factoriomod-debug extension write your machine local library paths to `.luarc.json`, which is git ignored. Note that an inline cast must be written `--[[@as T]]`, the spaced form is not parsed.
- Changes should be made on your own fork and merged into `main` through a pull request. - Changes should be made on your own fork and merged into `main` through a pull request.
- Each pull request should be limited to one feature or a few bug fixes and link to the related issue page. - Each pull request should be limited to one feature or a few bug fixes and link to the related issue page.