Improve Documentation
All checks were successful
ScriptCraft/pipeline/head This commit looks good

This commit is contained in:
TheBrokenRail 2020-05-24 14:18:21 -04:00
parent 37f11a92f0
commit 530f1e9871
4 changed files with 25 additions and 16 deletions

17
docs/FILE_STRUCTURE.md Normal file
View File

@ -0,0 +1,17 @@
# File Structure
```
Jar Root/
- scriptcraft
- JS or JSON files
```
## Recommended Source Structure
```
Source Root/
- ModID
- index.js/index.ts
- Other Modules
```
### Why is an index file necessary?
Because of the way module resolution in ScriptCraft works, you cannot load a module with ```import 'module-name';``` and no index file. Without an index file you would need to use ```import 'module-name/main';``` to load it and specify ```module-name/main``` as your entry-point.

View File

@ -5,4 +5,6 @@
[View Bridges](BRIDGES.md) [View Bridges](BRIDGES.md)
[View File Structure](FILE_STRUCTURE.md)
[View TypeDoc](https://jenkins.thebrokenrail.com/job/ScriptCraft/job/master/TypeDoc/) [View TypeDoc](https://jenkins.thebrokenrail.com/job/ScriptCraft/job/master/TypeDoc/)

View File

@ -1,15 +1,10 @@
package com.thebrokenrail.scriptcraft.example; package com.thebrokenrail.scriptcraft.example;
import com.thebrokenrail.scriptcraft.core.ScriptCraftEntrypoint; import com.thebrokenrail.scriptcraft.core.ScriptCraftEntryPoint;
public class JavaScriptExample implements ScriptCraftEntrypoint { public class JavaScriptExample implements ScriptCraftEntryPoint {
@Override @Override
public String getModID() { public String getEntryPoint() {
return "modid"; return "modid";
} }
@Override
public String getModIndex() {
return "index.js";
}
} }

View File

@ -1,15 +1,10 @@
package com.thebrokenrail.scriptcraft.example; package com.thebrokenrail.scriptcraft.example;
import com.thebrokenrail.scriptcraft.core.ScriptCraftEntrypoint; import com.thebrokenrail.scriptcraft.core.ScriptCraftEntryPoint;
public class TypeScriptExample implements ScriptCraftEntrypoint { public class TypeScriptExample implements ScriptCraftEntryPoint {
@Override @Override
public String getModID() { public String getEntryPoint() {
return "modid"; return "modid";
} }
@Override
public String getModIndex() {
return "index.js";
}
} }