Registry / devops / transpiler-ls

transpiler-ls

JSON →
library0.4.0jsnpmunverified

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.

npm install transpiler-ls
INSTALL
IMPORT
SIG · TRANSPILER-LS
T
transpiler-ls
devopsjavascriptv0.4.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

LS
LS.abs(1)
abs(1)
LS is the global namespace for LeekWars functions, not imported.
CELL_TYPE
import { CELL_TYPE } from './globaux/enums'
import CELL_TYPE from './globaux/enums'
Enums are exported as named exports from the enums file.
ENABLE_SAVE
process.env.ENABLE_SAVE
ENABLE_SAVE
Environment variables must be read via process.env.

Demonstrates basic setup: a TypeScript file using LS and enum, environment config, and transpilation command.

// 1. Create src/editor/main.ts with content: import { CELL_TYPE } from './globaux/enums'; const x: number = LS.abs(-5); console.log(x); // 2. Set .env: LOGIN=my_login PASSWORD=my_password FILE_NAME=MyAI ENABLE_SAVE=0 ABSOLUTE_PATH_TO_SOURCES=dist/main.js ABSOLUTE_PATH_TO_ENUMS=dist/enums.js PRINT_TO_CONSOLE=1 // 3. Run: npm run start:dev
transpiler-ls --version
Debug
Known issues
gotchaAll TypeScript files must be inside src/editor/; files outside are ignored.
fix
Place all source files under src/editor/
affects: >=0.0
gotchaThe FILE_NAME environment variable refers to an existing LeekWars AI file; it is not created automatically.
fix
Create the AI file on LeekWars website first, then specify its name.
affects: >=0.0
gotchaTemplate literals are only converted on a single line; multi-line template literals will break.
fix
Avoid multi-line template literals in TypeScript source.
affects: >=0.0
gotchaconsole.log is transformed into debug() with concatenation; it does not support multiple arguments like console.log.
fix
Use string concatenation if passing multiple values.
affects: >=0.0
Errors
Common errors & fixes
Error: Cannot find module 'typescript'
Dev dependency typescript is not installed.
fix
Run npm install typescript --save-dev
Login failed: invalid credentials
Missing or incorrect LOGIN/PASSWORD in .env.
fix
Check .env file and ensure LOGIN and PASSWORD are set correctly.
File 'MyAI' not found. Please create it on LeekWars.
The AI file specified in FILE_NAME does not exist on LeekWars.
fix
Create the AI on LeekWars website first.
Upgrade
Version history
0.4.0latest on npm
Audit
Dependencies
typescriptrequiredUsed for type checking and transpilation
Agent activity
31 hits · last 30 days
node
24
OpenAI (training)
2
Resources
transpiler-ls — npm install transpiler-ls · libregistry