{"id":27468,"library":"transpiler-ls","title":"TranspilerLS","description":"TranspilerLS is a TypeScript-to-LeekScript transpiler for the LeekWars programming game. Version 0.4.0 compiles TypeScript code written in a specific project structure into LeekWars-compatible scripts, supporting keyword mappings (e.g., const to var, === to ==), for..of to for..in conversion, template literal transformation, console.log to debug conversion, and enum flattening. It automates login and script upload via environment variables. Release cadence is irregular. Differentiators: it handles LeekWars-specific built-ins (LS object) and enforces a project convention for globals. Requires Node >=10.4.0; ships TypeScript types.","status":"active","version":"0.4.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript"],"install":[{"cmd":"npm install transpiler-ls","lang":"bash","label":"npm"},{"cmd":"yarn add transpiler-ls","lang":"bash","label":"yarn"},{"cmd":"pnpm add transpiler-ls","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used for type checking and transpilation","package":"typescript","optional":false}],"imports":[{"note":"LS is the global namespace for LeekWars functions, not imported.","wrong":"abs(1)","symbol":"LS","correct":"LS.abs(1)"},{"note":"Enums are exported as named exports from the enums file.","wrong":"import CELL_TYPE from './globaux/enums'","symbol":"CELL_TYPE","correct":"import { CELL_TYPE } from './globaux/enums'"},{"note":"Environment variables must be read via process.env.","wrong":"ENABLE_SAVE","symbol":"ENABLE_SAVE","correct":"process.env.ENABLE_SAVE"}],"quickstart":{"code":"// 1. Create src/editor/main.ts with content:\nimport { CELL_TYPE } from './globaux/enums';\nconst x: number = LS.abs(-5);\nconsole.log(x);\n\n// 2. Set .env:\nLOGIN=my_login\nPASSWORD=my_password\nFILE_NAME=MyAI\nENABLE_SAVE=0\nABSOLUTE_PATH_TO_SOURCES=dist/main.js\nABSOLUTE_PATH_TO_ENUMS=dist/enums.js\nPRINT_TO_CONSOLE=1\n\n// 3. Run:\nnpm run start:dev","lang":"typescript","description":"Demonstrates basic setup: a TypeScript file using LS and enum, environment config, and transpilation command."},"warnings":[{"fix":"Place all source files under src/editor/","message":"All TypeScript files must be inside src/editor/; files outside are ignored.","severity":"gotcha","affected_versions":">=0.0"},{"fix":"Create the AI file on LeekWars website first, then specify its name.","message":"The FILE_NAME environment variable refers to an existing LeekWars AI file; it is not created automatically.","severity":"gotcha","affected_versions":">=0.0"},{"fix":"Avoid multi-line template literals in TypeScript source.","message":"Template literals are only converted on a single line; multi-line template literals will break.","severity":"gotcha","affected_versions":">=0.0"},{"fix":"Use string concatenation if passing multiple values.","message":"console.log is transformed into debug() with concatenation; it does not support multiple arguments like console.log.","severity":"gotcha","affected_versions":">=0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run npm install typescript --save-dev","cause":"Dev dependency typescript is not installed.","error":"Error: Cannot find module 'typescript'"},{"fix":"Check .env file and ensure LOGIN and PASSWORD are set correctly.","cause":"Missing or incorrect LOGIN/PASSWORD in .env.","error":"Login failed: invalid credentials"},{"fix":"Create the AI on LeekWars website first.","cause":"The AI file specified in FILE_NAME does not exist on LeekWars.","error":"File 'MyAI' not found. Please create it on LeekWars."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}