mirror of
https://github.com/moeru-ai/airi-factorio.git
synced 2025-09-04 17:02:04 +00:00
chore(dx): create bootstrap script
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
# Factorio does not have stable support for arm64
|
||||
FROM factoriotools/factorio:2.0.30
|
||||
|
||||
ARG PNPM_VERSION=10.4.0
|
||||
ENV PNPM_VERSION=${PNPM_VERSION:-10.4.0}
|
||||
ARG PNPM_VERSION=10.13.1
|
||||
ENV PNPM_VERSION=${PNPM_VERSION:-10.13.1}
|
||||
# https://pnpm.io/docker
|
||||
ENV PNPM_HOME="/pnpm"
|
||||
ENV PATH="$PNPM_HOME:$PATH"
|
||||
|
||||
# install nodejs
|
||||
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
|
||||
RUN curl -fsSL https://deb.nodesource.com/setup_24.x | bash -
|
||||
RUN apt-get update && apt-get install -y nodejs git file curl ca-certificates
|
||||
RUN corepack enable
|
||||
|
||||
|
@@ -22,12 +22,15 @@
|
||||
"dev:packages": "pnpm -r --filter=./packages/* run dev",
|
||||
"lint": "eslint --cache .",
|
||||
"lint:fix": "eslint --cache --fix .",
|
||||
"typecheck": "pnpm -r --filter=./packages/* run typecheck"
|
||||
"typecheck": "pnpm -r --filter=./packages/* run typecheck",
|
||||
"bootstrap": "node scripts/bootstrap.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^4.17.0",
|
||||
"@antfu/ni": "^25.0.0",
|
||||
"@types/node": "24",
|
||||
"eslint": "^9.31.0",
|
||||
"execa": "^9.6.0",
|
||||
"lint-staged": "^16.1.2",
|
||||
"simple-git-hooks": "^2.13.0",
|
||||
"taze": "^19.1.0",
|
||||
|
@@ -76,16 +76,16 @@ export interface PlayerParametersWaiting {
|
||||
remaining_ticks: number
|
||||
}
|
||||
|
||||
export type PlayerParameters =
|
||||
| PlayerParametersWalkToEntity
|
||||
| PlayerParametersWalkingDirect
|
||||
| PlayerParametersMineEntity
|
||||
| PlayerParametersPlaceEntity
|
||||
| PlayerParametersMoveItems
|
||||
| PlayerParametersCraftItem
|
||||
| PlayerParametersAttackNearestEnemy
|
||||
| PlayerParametersResearchTechnology
|
||||
| PlayerParametersWaiting
|
||||
export type PlayerParameters
|
||||
= | PlayerParametersWalkToEntity
|
||||
| PlayerParametersWalkingDirect
|
||||
| PlayerParametersMineEntity
|
||||
| PlayerParametersPlaceEntity
|
||||
| PlayerParametersMoveItems
|
||||
| PlayerParametersCraftItem
|
||||
| PlayerParametersAttackNearestEnemy
|
||||
| PlayerParametersResearchTechnology
|
||||
| PlayerParametersWaiting
|
||||
|
||||
export interface PlayerState {
|
||||
task_state: TaskStates
|
||||
|
170
pnpm-lock.yaml
generated
170
pnpm-lock.yaml
generated
@@ -10,13 +10,19 @@ importers:
|
||||
devDependencies:
|
||||
'@antfu/eslint-config':
|
||||
specifier: ^4.17.0
|
||||
version: 4.17.0(@vue/compiler-sfc@3.5.13)(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3)(vitest@3.2.4(@types/debug@4.1.12)(@types/node@22.16.4)(jiti@2.4.2)(tsx@4.20.3)(yaml@2.8.0))
|
||||
version: 4.17.0(@vue/compiler-sfc@3.5.13)(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3)(vitest@3.2.4(@types/debug@4.1.12)(@types/node@24.0.14)(jiti@2.4.2)(tsx@4.20.3)(yaml@2.8.0))
|
||||
'@antfu/ni':
|
||||
specifier: ^25.0.0
|
||||
version: 25.0.0
|
||||
'@types/node':
|
||||
specifier: '24'
|
||||
version: 24.0.14
|
||||
eslint:
|
||||
specifier: ^9.31.0
|
||||
version: 9.31.0(jiti@2.4.2)
|
||||
execa:
|
||||
specifier: ^9.6.0
|
||||
version: 9.6.0
|
||||
lint-staged:
|
||||
specifier: ^16.1.2
|
||||
version: 16.1.2
|
||||
@@ -89,7 +95,7 @@ importers:
|
||||
devDependencies:
|
||||
'@antfu/eslint-config':
|
||||
specifier: ^4.17.0
|
||||
version: 4.17.0(@vue/compiler-sfc@3.5.13)(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3)(vitest@3.2.4(@types/debug@4.1.12)(@types/node@22.16.4)(jiti@2.4.2)(tsx@4.20.3)(yaml@2.8.0))
|
||||
version: 4.17.0(@vue/compiler-sfc@3.5.13)(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3)(vitest@3.2.4(@types/debug@4.1.12)(@types/node@24.0.14)(jiti@2.4.2)(tsx@4.20.3)(yaml@2.8.0))
|
||||
'@proj-airi/tstl-plugin-reload-factorio-mod':
|
||||
specifier: workspace:*
|
||||
version: link:../tstl-plugin-reload-factorio-mod
|
||||
@@ -905,6 +911,9 @@ packages:
|
||||
'@types/node@22.16.4':
|
||||
resolution: {integrity: sha512-PYRhNtZdm2wH/NT2k/oAJ6/f2VD2N2Dag0lGlx2vWgMSJXGNmlce5MiTQzoWAiIJtso30mjnfQCOKVH+kAQC/g==}
|
||||
|
||||
'@types/node@24.0.14':
|
||||
resolution: {integrity: sha512-4zXMWD91vBLGRtHK3YbIoFMia+1nqEz72coM42C5ETjnNCa/heoj7NT1G67iAfOqMmcfhuCZ4uNpyz8EjlAejw==}
|
||||
|
||||
'@types/resolve@1.20.2':
|
||||
resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==}
|
||||
|
||||
@@ -2849,6 +2858,9 @@ packages:
|
||||
undici-types@6.21.0:
|
||||
resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==}
|
||||
|
||||
undici-types@7.8.0:
|
||||
resolution: {integrity: sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==}
|
||||
|
||||
unicorn-magic@0.3.0:
|
||||
resolution: {integrity: sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA==}
|
||||
engines: {node: '>=18'}
|
||||
@@ -3115,6 +3127,52 @@ snapshots:
|
||||
- typescript
|
||||
- vitest
|
||||
|
||||
'@antfu/eslint-config@4.17.0(@vue/compiler-sfc@3.5.13)(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3)(vitest@3.2.4(@types/debug@4.1.12)(@types/node@24.0.14)(jiti@2.4.2)(tsx@4.20.3)(yaml@2.8.0))':
|
||||
dependencies:
|
||||
'@antfu/install-pkg': 1.1.0
|
||||
'@clack/prompts': 0.11.0
|
||||
'@eslint-community/eslint-plugin-eslint-comments': 4.5.0(eslint@9.31.0(jiti@2.4.2))
|
||||
'@eslint/markdown': 7.0.0
|
||||
'@stylistic/eslint-plugin': 5.2.0(eslint@9.31.0(jiti@2.4.2))
|
||||
'@typescript-eslint/eslint-plugin': 8.37.0(@typescript-eslint/parser@8.37.0(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3)
|
||||
'@typescript-eslint/parser': 8.37.0(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3)
|
||||
'@vitest/eslint-plugin': 1.3.4(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3)(vitest@3.2.4(@types/debug@4.1.12)(@types/node@24.0.14)(jiti@2.4.2)(tsx@4.20.3)(yaml@2.8.0))
|
||||
ansis: 4.1.0
|
||||
cac: 6.7.14
|
||||
eslint: 9.31.0(jiti@2.4.2)
|
||||
eslint-config-flat-gitignore: 2.1.0(eslint@9.31.0(jiti@2.4.2))
|
||||
eslint-flat-config-utils: 2.1.0
|
||||
eslint-merge-processors: 2.0.0(eslint@9.31.0(jiti@2.4.2))
|
||||
eslint-plugin-antfu: 3.1.1(eslint@9.31.0(jiti@2.4.2))
|
||||
eslint-plugin-command: 3.3.1(eslint@9.31.0(jiti@2.4.2))
|
||||
eslint-plugin-import-lite: 0.3.0(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3)
|
||||
eslint-plugin-jsdoc: 51.4.1(eslint@9.31.0(jiti@2.4.2))
|
||||
eslint-plugin-jsonc: 2.20.1(eslint@9.31.0(jiti@2.4.2))
|
||||
eslint-plugin-n: 17.21.0(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3)
|
||||
eslint-plugin-no-only-tests: 3.3.0
|
||||
eslint-plugin-perfectionist: 4.15.0(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3)
|
||||
eslint-plugin-pnpm: 1.0.0(eslint@9.31.0(jiti@2.4.2))
|
||||
eslint-plugin-regexp: 2.9.0(eslint@9.31.0(jiti@2.4.2))
|
||||
eslint-plugin-toml: 0.12.0(eslint@9.31.0(jiti@2.4.2))
|
||||
eslint-plugin-unicorn: 59.0.1(eslint@9.31.0(jiti@2.4.2))
|
||||
eslint-plugin-unused-imports: 4.1.4(@typescript-eslint/eslint-plugin@8.37.0(@typescript-eslint/parser@8.37.0(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.31.0(jiti@2.4.2))
|
||||
eslint-plugin-vue: 10.3.0(@typescript-eslint/parser@8.37.0(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.31.0(jiti@2.4.2))(vue-eslint-parser@10.2.0(eslint@9.31.0(jiti@2.4.2)))
|
||||
eslint-plugin-yml: 1.18.0(eslint@9.31.0(jiti@2.4.2))
|
||||
eslint-processor-vue-blocks: 2.0.0(@vue/compiler-sfc@3.5.13)(eslint@9.31.0(jiti@2.4.2))
|
||||
globals: 16.3.0
|
||||
jsonc-eslint-parser: 2.4.0
|
||||
local-pkg: 1.1.1
|
||||
parse-gitignore: 2.0.0
|
||||
toml-eslint-parser: 0.10.0
|
||||
vue-eslint-parser: 10.2.0(eslint@9.31.0(jiti@2.4.2))
|
||||
yaml-eslint-parser: 1.3.0
|
||||
transitivePeerDependencies:
|
||||
- '@eslint/json'
|
||||
- '@vue/compiler-sfc'
|
||||
- supports-color
|
||||
- typescript
|
||||
- vitest
|
||||
|
||||
'@antfu/install-pkg@1.1.0':
|
||||
dependencies:
|
||||
package-manager-detector: 1.3.0
|
||||
@@ -3619,6 +3677,10 @@ snapshots:
|
||||
dependencies:
|
||||
undici-types: 6.21.0
|
||||
|
||||
'@types/node@24.0.14':
|
||||
dependencies:
|
||||
undici-types: 7.8.0
|
||||
|
||||
'@types/resolve@1.20.2': {}
|
||||
|
||||
'@types/unist@3.0.3': {}
|
||||
@@ -3769,6 +3831,16 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@vitest/eslint-plugin@1.3.4(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3)(vitest@3.2.4(@types/debug@4.1.12)(@types/node@24.0.14)(jiti@2.4.2)(tsx@4.20.3)(yaml@2.8.0))':
|
||||
dependencies:
|
||||
'@typescript-eslint/utils': 8.32.1(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3)
|
||||
eslint: 9.31.0(jiti@2.4.2)
|
||||
optionalDependencies:
|
||||
typescript: 5.8.3
|
||||
vitest: 3.2.4(@types/debug@4.1.12)(@types/node@24.0.14)(jiti@2.4.2)(tsx@4.20.3)(yaml@2.8.0)
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@vitest/expect@3.2.4':
|
||||
dependencies:
|
||||
'@types/chai': 5.2.2
|
||||
@@ -3785,6 +3857,15 @@ snapshots:
|
||||
optionalDependencies:
|
||||
vite: 7.0.4(@types/node@22.16.4)(jiti@2.4.2)(tsx@4.20.3)(yaml@2.8.0)
|
||||
|
||||
'@vitest/mocker@3.2.4(vite@7.0.4(@types/node@24.0.14)(jiti@2.4.2)(tsx@4.20.3)(yaml@2.8.0))':
|
||||
dependencies:
|
||||
'@vitest/spy': 3.2.4
|
||||
estree-walker: 3.0.3
|
||||
magic-string: 0.30.17
|
||||
optionalDependencies:
|
||||
vite: 7.0.4(@types/node@24.0.14)(jiti@2.4.2)(tsx@4.20.3)(yaml@2.8.0)
|
||||
optional: true
|
||||
|
||||
'@vitest/pretty-format@3.2.4':
|
||||
dependencies:
|
||||
tinyrainbow: 2.0.0
|
||||
@@ -3833,7 +3914,7 @@ snapshots:
|
||||
'@vue/shared': 3.5.13
|
||||
estree-walker: 2.0.2
|
||||
magic-string: 0.30.17
|
||||
postcss: 8.5.3
|
||||
postcss: 8.5.6
|
||||
source-map-js: 1.2.1
|
||||
|
||||
'@vue/compiler-ssr@3.5.13':
|
||||
@@ -5885,6 +5966,8 @@ snapshots:
|
||||
|
||||
undici-types@6.21.0: {}
|
||||
|
||||
undici-types@7.8.0: {}
|
||||
|
||||
unicorn-magic@0.3.0: {}
|
||||
|
||||
unist-util-is@6.0.0:
|
||||
@@ -5947,6 +6030,28 @@ snapshots:
|
||||
- tsx
|
||||
- yaml
|
||||
|
||||
vite-node@3.2.4(@types/node@24.0.14)(jiti@2.4.2)(tsx@4.20.3)(yaml@2.8.0):
|
||||
dependencies:
|
||||
cac: 6.7.14
|
||||
debug: 4.4.1
|
||||
es-module-lexer: 1.7.0
|
||||
pathe: 2.0.3
|
||||
vite: 7.0.4(@types/node@24.0.14)(jiti@2.4.2)(tsx@4.20.3)(yaml@2.8.0)
|
||||
transitivePeerDependencies:
|
||||
- '@types/node'
|
||||
- jiti
|
||||
- less
|
||||
- lightningcss
|
||||
- sass
|
||||
- sass-embedded
|
||||
- stylus
|
||||
- sugarss
|
||||
- supports-color
|
||||
- terser
|
||||
- tsx
|
||||
- yaml
|
||||
optional: true
|
||||
|
||||
vite@7.0.4(@types/node@22.16.4)(jiti@2.4.2)(tsx@4.20.3)(yaml@2.8.0):
|
||||
dependencies:
|
||||
esbuild: 0.25.4
|
||||
@@ -5962,6 +6067,22 @@ snapshots:
|
||||
tsx: 4.20.3
|
||||
yaml: 2.8.0
|
||||
|
||||
vite@7.0.4(@types/node@24.0.14)(jiti@2.4.2)(tsx@4.20.3)(yaml@2.8.0):
|
||||
dependencies:
|
||||
esbuild: 0.25.4
|
||||
fdir: 6.4.6(picomatch@4.0.2)
|
||||
picomatch: 4.0.2
|
||||
postcss: 8.5.6
|
||||
rollup: 4.40.2
|
||||
tinyglobby: 0.2.14
|
||||
optionalDependencies:
|
||||
'@types/node': 24.0.14
|
||||
fsevents: 2.3.3
|
||||
jiti: 2.4.2
|
||||
tsx: 4.20.3
|
||||
yaml: 2.8.0
|
||||
optional: true
|
||||
|
||||
vitest@3.2.4(@types/debug@4.1.12)(@types/node@22.16.4)(jiti@2.4.2)(tsx@4.20.3)(yaml@2.8.0):
|
||||
dependencies:
|
||||
'@types/chai': 5.2.2
|
||||
@@ -6004,6 +6125,49 @@ snapshots:
|
||||
- tsx
|
||||
- yaml
|
||||
|
||||
vitest@3.2.4(@types/debug@4.1.12)(@types/node@24.0.14)(jiti@2.4.2)(tsx@4.20.3)(yaml@2.8.0):
|
||||
dependencies:
|
||||
'@types/chai': 5.2.2
|
||||
'@vitest/expect': 3.2.4
|
||||
'@vitest/mocker': 3.2.4(vite@7.0.4(@types/node@24.0.14)(jiti@2.4.2)(tsx@4.20.3)(yaml@2.8.0))
|
||||
'@vitest/pretty-format': 3.2.4
|
||||
'@vitest/runner': 3.2.4
|
||||
'@vitest/snapshot': 3.2.4
|
||||
'@vitest/spy': 3.2.4
|
||||
'@vitest/utils': 3.2.4
|
||||
chai: 5.2.0
|
||||
debug: 4.4.1
|
||||
expect-type: 1.2.1
|
||||
magic-string: 0.30.17
|
||||
pathe: 2.0.3
|
||||
picomatch: 4.0.2
|
||||
std-env: 3.9.0
|
||||
tinybench: 2.9.0
|
||||
tinyexec: 0.3.2
|
||||
tinyglobby: 0.2.14
|
||||
tinypool: 1.1.1
|
||||
tinyrainbow: 2.0.0
|
||||
vite: 7.0.4(@types/node@24.0.14)(jiti@2.4.2)(tsx@4.20.3)(yaml@2.8.0)
|
||||
vite-node: 3.2.4(@types/node@24.0.14)(jiti@2.4.2)(tsx@4.20.3)(yaml@2.8.0)
|
||||
why-is-node-running: 2.3.0
|
||||
optionalDependencies:
|
||||
'@types/debug': 4.1.12
|
||||
'@types/node': 24.0.14
|
||||
transitivePeerDependencies:
|
||||
- jiti
|
||||
- less
|
||||
- lightningcss
|
||||
- msw
|
||||
- sass
|
||||
- sass-embedded
|
||||
- stylus
|
||||
- sugarss
|
||||
- supports-color
|
||||
- terser
|
||||
- tsx
|
||||
- yaml
|
||||
optional: true
|
||||
|
||||
vue-eslint-parser@10.2.0(eslint@9.31.0(jiti@2.4.2)):
|
||||
dependencies:
|
||||
debug: 4.4.0
|
||||
|
48
scripts/bootstrap.ts
Normal file
48
scripts/bootstrap.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { copyFile, symlink, writeFile } from 'node:fs/promises'
|
||||
import { arch } from 'node:os'
|
||||
import { exit } from 'node:process'
|
||||
import { execa } from 'execa'
|
||||
|
||||
async function main() {
|
||||
await symlink(
|
||||
'/workspace/airi-factorio/packages/autorio/dist',
|
||||
'/opt/factorio/data/autorio',
|
||||
)
|
||||
console.log('Symlinked autorio/dist to /opt/factorio/data/autorio')
|
||||
|
||||
await copyFile(
|
||||
'packages/agent/.env.example',
|
||||
'packages/agent/.env.local',
|
||||
)
|
||||
|
||||
console.log('Copied agent/.env.example to agent/.env.local')
|
||||
|
||||
await writeFile(
|
||||
'packages/factorio-wrapper/.env.local',
|
||||
`FACTORIO_PATH='/opt/factorio/bin/x64/factorio'
|
||||
FACTORIO_SAVE_PATH='/opt/factorio/save.zip'
|
||||
FACTORIO_RCON_PASSWORD='123456'
|
||||
FACTORIO_RCON_PORT=27015
|
||||
|
||||
WS_SERVER_PORT=27016
|
||||
WS_SERVER_HOST='localhost'
|
||||
`,
|
||||
)
|
||||
|
||||
console.log('Generated factorio-wrapper/.env.local')
|
||||
console.log('Creating save file...\n\n===== Game output starts =====\n')
|
||||
|
||||
if (arch() === 'arm64') {
|
||||
await execa('box64', ['/opt/factorio/bin/x64/factorio', '--create', '/opt/factorio/save.zip'], { stdio: 'inherit' })
|
||||
}
|
||||
else {
|
||||
await execa('/opt/factorio/bin/x64/factorio', ['--create', '/opt/factorio/save.zip'], { stdio: 'inherit' })
|
||||
}
|
||||
|
||||
console.log('\n\n===== Game output ends =====\n\nCreated save file')
|
||||
}
|
||||
|
||||
main().catch((e) => {
|
||||
console.error(e)
|
||||
exit(1)
|
||||
})
|
Reference in New Issue
Block a user