This commit is contained in:
parent
37f11a92f0
commit
530f1e9871
17
docs/FILE_STRUCTURE.md
Normal file
17
docs/FILE_STRUCTURE.md
Normal 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.
|
@ -5,4 +5,6 @@
|
||||
|
||||
[View Bridges](BRIDGES.md)
|
||||
|
||||
[View File Structure](FILE_STRUCTURE.md)
|
||||
|
||||
[View TypeDoc](https://jenkins.thebrokenrail.com/job/ScriptCraft/job/master/TypeDoc/)
|
@ -1,15 +1,10 @@
|
||||
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
|
||||
public String getModID() {
|
||||
public String getEntryPoint() {
|
||||
return "modid";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModIndex() {
|
||||
return "index.js";
|
||||
}
|
||||
}
|
@ -1,15 +1,10 @@
|
||||
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
|
||||
public String getModID() {
|
||||
public String getEntryPoint() {
|
||||
return "modid";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModIndex() {
|
||||
return "index.js";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user