refactor: migrate to screeps-api v2 and update actions to node 22
Test / Run Tests (push) Failing after 1s
Recompile dist/ on Renovate PR / recompile (pull_request) Failing after 0s
Test / Run Tests (pull_request) Failing after 0s
Philipp/Global-Workflows: Pre-commit Lint (Scoped) / pre-commit (pull_request) Failing after 1s

This commit is contained in:
2026-09-04 23:56:04 +02:00
parent d644b19b47
commit cfb97819ae
8 changed files with 68 additions and 33 deletions
+8 -4
View File
@@ -250,7 +250,7 @@ function sleep(ms) {
* Calls `onProgress(elapsed, targetTicks)` on every poll so the caller can
* log progress at whatever cadence it chooses.
*
* @param {import('screeps-api').ScreepsAPI} api
* @param {import('screeps-api').ScreepsHttpClient} api
* @param {number} startTick - Tick number recorded before monitoring started
* @param {number} targetTicks - Stop when (currentTick - startTick) >= this
* @param {string|undefined} shard - "shard0" for official, undefined for private
@@ -270,7 +270,9 @@ export async function pollUntilDone(
let elapsed = 0;
while (elapsed < targetTicks && !shouldStop()) {
await sleep(intervalMs);
const { time } = await api.time(shard);
const { time } = await (typeof api.gameTime === "function"
? api.gameTime(shard)
: api.time(shard));
elapsed = time - startTick;
onProgress(elapsed, targetTicks);
}
@@ -309,7 +311,7 @@ export async function pollUntilDone(
* 6. If logToFile=true: write buffered stdout to a temp file and upload artifact.
* 7. Return MonitorResult.
*
* @param {import('screeps-api').ScreepsAPI} api
* @param {import('screeps-api').ScreepsHttpClient} api
* @param {MonitorOptions} opts
* @returns {Promise<MonitorResult>}
*/
@@ -337,7 +339,9 @@ export async function monitorConsole(api, opts) {
let lastProgressTick = 0;
// Step 1: record starting tick
const { time: startTick } = await api.time(shard);
const { time: startTick } = await (typeof api.gameTime === "function"
? api.gameTime(shard)
: api.time(shard));
// Step 2: connect socket + subscribe
await api.socket.connect();