Write and compile TypeScript into MTASA-compatible Lua code.
A documentation in your IDE. Types safety. Linting.
Features
This boilerplate requires NodeJS (at least 14.x) to be installed. If you already have NodeJS installed, skip this step.
Installation for Windows.
Installation for Linux:
Debian or Ubuntu
apt install nodejs
Arch or Manjaro
pacman -S nodejs
Open console (What?) and execute the command
npm version
Open terminal in the parent folder of your new project and run folowwing command:
npx mtasa-lua-utils new-project
|- .idea/ Configs for WebStorm
|- .github/ Configs for GitHub
|- .vscode/ Configs for VSCode
|- node_modules/ Modules for NodeJS (autogenerated directory)
|- src/ Directory with TypeScript resources
|- TypeScriptResource/ Example Resource
|- types/ Directory with additional types
|- mtasa-meta.yml Description for all resources (meta.xml analog)
Command:
npm run build
Always running the command to build the resource is annoying. Below there are possible solutions to simplify it.
Ctrl+Mouse Hover
is the shortcut to show documentation window.
Ctrl+Shift+Space
is the shortcut to show function's parameters.
Use Ctrl+Shift+B
and select npm: build
task to compilte the resource.
Plugin Trigger Task On Save should be installed.
Configuration provided in .vscode/settings.json and will be enabled by default.
Plugin YAML should be installed.
Provides helpful tips for mtasa-meta.yml
file.
Ctrl+Q
is the shortcut to show documentation window.
Ctrl+P
is the shortcut to highlight function's parameters.
NOTE: In the current version configuration should have been loaded by default.
In the top right corner press Edit Configurations
.
Press Add New Configuration
(Plus icon), select npm
and select build in Scripts
field.
Now you can press Shift+F10
to compile your resource.
NOTE: In the current version file watcher should have been loaded by default.
Compile can be executed after file saving.
Open Settings
-> Tools
-> File watchers
.
Add new file watcher for TypeScript files in project scope.
Put npm into the Script
field and run build into the Srguments
field.
Thus, saving after editing TypeScript files triggers compilation.