TheBrokenRail
fbd01d2821
Some checks failed
ScriptCraft/pipeline/head There was a failure building this commit
26 lines
1.2 KiB
Markdown
26 lines
1.2 KiB
Markdown
# Architecture
|
|
|
|
## JavaScript
|
|
Inside the JAR, JS source files are in ```<JAR Root>/scriptcraft```, and inside a typical Gradle project they are in ```src/main/resources/scriptcraft```.
|
|
|
|
### External Libraries
|
|
An external libraries API can be accessed using an ```import``` statement.
|
|
|
|
## TypeScript
|
|
TypeScript-based projects use thw ```com.thebrokenrail.scriptcraft``` Gradle plugin, this plugin will handle installing TypeScript and download any API type declarations. The TypeScript root using this Gradle plugin is at ```src/main/ts```.
|
|
|
|
### External Libraries
|
|
To access an external libraries' API in addition to an ```import``` statement, the TypeScript compiler must have access to the external libraries' type declarations. The ScriptCraft Gradle plugin generates and downloads these using JAR files called API JARs.
|
|
|
|
To generate an API JAr from your project, run ```./gradlew apiJar```, or add the ```apiJar``` task to your Maven publication.
|
|
|
|
To add an API JAR to your project, add it to the ```typescript``` configuration in your ```dependencies``` block.
|
|
|
|
#### API JAR File Structure
|
|
```
|
|
- API JAR Root
|
|
- src/
|
|
- Source Root
|
|
- types/
|
|
- File structure of node_modules/@types
|
|
``` |