@aidaspa/uts v1.0.3
UTS
Simple toolkit for working with TS and UnrealJS

Installation :mailbox:
npm i -g @aidaspa/uts
Or if you always want the latest version without installing
npx @aidaspa/uts
Upgrade to >= 1.0.0 :star2:
If you didn't use npx, please update to the latest version by running npm i -g @aidaspa/uts again.
This major release introduces a custom written babel plugin - babel-plugin-uts
In order to upgrade you simply need to run the init command again. This will install additional packages and create a .babelrc file as required for babel.
A breaking change: replace all export = {export} with export default {export}
Full list of changes can be seen in the release notes.
Why :question:
This package was built in order to help ease the development with UnrealJS - no weird class compilations, full typescript support, custom extension to support decorations (or the so called "macros") and a CLI tool to generate some boilerplate.
Philosophy :dizzy:
- There are 2 folders:
out/andsrc/. All source code lives in thesrc/directory, while the compiled code lives strictly in theout/directory - you should be targeting them when working with theJavascriptComponent in UE4. The folder structure inside theout/directory is always reflected from thesrc/ - There are 2 extensions:
.u.ts&.ts. The.u.tsextension contains any code that interfaces with theUnrealJSAPI. It is separated because of the differences when compiling normal TypeScript and this mess. Both file extensions are always compiled down to.js(.u.js) in theout/dir. .u.tsdecorators. This toolkit utilizes typescript decorators to annotate classes, properties and methods:@UCLASS(),@UPROPERTY(),@KEYBIND(). If you've done any c++ development with unreal before, you should be familiar with some of these.- Boilerplates. All
.u.tsare preferred to be generated via the CLI. - Any UnrealJS related class declaration must have a
@UCLASSdecorator specified - otherwise the.u.tscompiler will ignore it.
TODO
.u.tsfile extension- File Watcher
- CLI
@UFUNCTIONSupport- Use Babel to compile
.u.ts - CLI Template generation (third person, first person etc..)
The CLI :computer:
Initializing a project :bulb:
When initializing a fresh project after setting up the UnrealJS plugin you need to run:
uts init
This command will generate some additional typing files to support the decorators.
Creating .u.ts classes :pencil2:
Whenever you want to generate a .u.ts file you can run one of the following:
uts create:actor {ClassName}
Where {ClassName} can also include forward-slashes (/) to specify a directory.
Compiling source code :eyes:
After initializing the project you should fire up the babel file watcher with:
yarn run watch
This will watch all .ts and .u.ts files under src/ and compile them to out/.
Decorator Documentation :book:
@UCLASS(BlueprintComponent?)Shows the compiler which classes it should touch, it is required for all.u.tsclasses in order to compile properly. Declared above a class declaration. TheBlueprintComponentargument tells the compiler that this file should be loaded from UE4. Not required, but what this does is it cleans the code up a little bit.@UPROPERTY(Arg1)Just like in c++, can accept, as of right now, only one argument:EditAnywhereorVisibleAnywhere. Declared above class fields/properties.@KEYBIND(type: BindAxis, action: string)Creates a keybinding for a method, action is your UE4 configured keybinding.@KEYBIND(type: BindAction, action: string, event: IE_RELEASED | IE_PRESSED)@UFUNCTION(...args)Tells the compiler that the decorated method is an RPC....args:Reliable | Unreliable,Server | Client | NetMulticast
Examples :speech_balloon:
Here's a link to a gist containing code required to re-create the third person character in .u.ts:
Support, Feedback and Contributions :heart:
Having an issue? Feel free to open one here.
Want to contribute? PRs are always welcome no matter how big, but please make sure you follow linter rules defined in .eslintrc.js
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago