diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml
new file mode 100644
index 0000000..7432438
--- /dev/null
+++ b/.github/workflows/publish-docs.yml
@@ -0,0 +1,23 @@
+# .github/workflows/publish-docs.yml
+name: publish-docs
+on:
+ push:
+ branches: ["master"]
+jobs:
+ status:
+ runs-on: ubuntu-latest
+ name: Publish docs to GitHub Pages
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-node@v4
+ with:
+ node-version: "22"
+ - run: npm i -g moonwave@latest
+ - name: Publish
+ run: |
+ git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
+ git config --global user.email "support+actions@github.com"
+ git config --global user.name "github-actions-bot"
+ moonwave build --publish
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..d788076
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,6 @@
+{
+ "[luau]": {
+ "editor.defaultFormatter": "JohnnyMorganz.stylua",
+ "editor.formatOnSave": true
+ }
+}
\ No newline at end of file
diff --git a/README.md b/README.md
index d040014..e57f62a 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,11 @@
# Networker
-A complete replacement for RemoteEvents
+A complete replacement for RemoteEvents allowing you to modify tables and call functions on a different run context effortlessly
-# Server
+## Examples
-```luau
+### Server
+
+```lua
local myService = {}
function myService:init()
@@ -25,12 +27,12 @@ end
return myService
```
-# Client
+### Client
-```luau
+```lua
local serviceClient = {}
local networker = Networker.client.new("myService", serviceClient)
-networker:fire("printTest")
+networker:fire("printTest") -- tell the server to call the printTest function
```
diff --git a/docs/intro.md b/docs/intro.md
new file mode 100644
index 0000000..d328985
--- /dev/null
+++ b/docs/intro.md
@@ -0,0 +1,22 @@
+---
+sidebar_position: 1
+---
+
+# Installation
+
+## Wally
+
+Add [leifstout/networker](https://wally.run/package/leifstout/networker?version=0.3.0) to your Wally configuration file.
+
+wally.toml
+```toml
+[package]
+name = "username/game"
+description = "An awesome game!"
+version = "0.1.0"
+registry = "https://github.com/UpliftGames/wally-index"
+realm = "shared"
+
+[dependencies]
+networker = "leifstout/networker@0.3.0"
+```
\ No newline at end of file
diff --git a/docs/usage.md b/docs/usage.md
new file mode 100644
index 0000000..34159bf
--- /dev/null
+++ b/docs/usage.md
@@ -0,0 +1,73 @@
+---
+sidebar_position: 2
+---
+
+# Basic Usage
+Networker allows you to call certain select server functions on the client. To start, you must create a *Networker.server* object
+
+main.server.luau
+
+```lua
+local Networker = require("path/to/networker")
+
+local module = {}
+
+local function module.printSomething(
+ self: typeof(module) -- networker always returns the module itself as the first parameter
+ player: Player, -- always the second parameter, the player who fired the function
+ ... -- arguments that the player sent
+)
+ print(`{player.Name} said "{...}"!`)
+end
+
+-- create a server networker object
+local networker = Networker.server.new(
+ "myScript", -- unique identifier
+ module, -- the module that the client will communicate with
+ { -- functions from the module which the client can access
+ printSomething,
+ }
+)
+
+
+-- tell all clients to call the setValue function with a 50 parameter
+networker:fireAll("setValue", 50)
+
+-- OR
+
+networker:setAll("myValue", 50)
+```
+You must then create a *Networker.client* object
+
+main.client.luau
+
+```lua
+local Networker = require("path/to/networker")
+
+local myClientModule = {
+ myValue = 0
+}
+
+function myClientModule.setValue(self: typeof(myClientModule), value: number)
+ self.myValue = value
+end
+
+-- create a client networker object
+local networker = Networker.client.new(
+ "myScript", -- same identifier we used on the server
+ myClientModule -- module that the server can communicate with
+)
+
+-- check when the server sets a value using :set or :setAll
+networker:getServerChangedSignal(
+ "myValue" -- key name
+):Connect(function(newVal)
+ print(`server set myValue to: {newVal}!`)
+end)
+
+-- tell the server to call the printSomething function with a "Hello there!" parameter
+networker:fire(
+ "printSomething", -- function name
+ "Hello there!"
+)
+```
\ No newline at end of file
diff --git a/moonwave.toml b/moonwave.toml
new file mode 100644
index 0000000..c50eed5
--- /dev/null
+++ b/moonwave.toml
@@ -0,0 +1,27 @@
+gitSourceBranch = "main"
+
+[[navbar.items]]
+href = "https://discord.com/invite/r3rVDatP7x"
+label = "Discord"
+position = "right"
+
+[[navbar.items]]
+href = "https://wally.run/package/leifstout/networker"
+label = "Wally"
+position = "right"
+
+[home]
+enabled = true
+includeReadme = false
+
+[[home.features]]
+title = "Ease of Use"
+description = "Networker abstracts RemoteEvents and RemoteFunctions behind a clean, method-based API."
+
+[[home.features]]
+title = "Selective Replication"
+description = "Messages can be sent to players based on many different conditions."
+
+[[home.features]]
+title = "Battle Tested"
+description = "Used in projects with 10M+ visits and 200K+ MAU"
\ No newline at end of file
diff --git a/src/NetworkerClient.luau b/src/NetworkerClient.luau
index f142523..c438a93 100644
--- a/src/NetworkerClient.luau
+++ b/src/NetworkerClient.luau
@@ -11,6 +11,7 @@ type RemotesContainer = NetworkerUtils.RemotesContainer
--[=[
NetworkerClient facilitates the communication of client-sided networking and handles server networking instructions
@class NetworkerClient
+ @client
]=]
local NetworkerClient = {}
NetworkerClient.__index = NetworkerClient
@@ -26,8 +27,8 @@ export type NetworkerClient = typeof(setmetatable(
))
--[=[
- Constructs a new NetworkerClient
- @param networkTag NetworkTag -- The unqiue tag of the networker
+ Constructs a new NetworkerClient
+ @param networkTag NetworkTag -- The unique tag of the networker
@param module {} -- The class or service the networker will be communicating with
@return NetworkerClient
]=]
@@ -135,4 +136,6 @@ function NetworkerClient.destroy(self: NetworkerClient): ()
end
end
+NetworkerClient.Destroy = NetworkerClient.destroy
+
return NetworkerClient
diff --git a/src/NetworkerServer.luau b/src/NetworkerServer.luau
index 9ac180e..8f66a99 100644
--- a/src/NetworkerServer.luau
+++ b/src/NetworkerServer.luau
@@ -19,6 +19,7 @@ type RemotesContainer = NetworkerUtils.RemotesContainer
--[=[
NetworkerServer facilitates the communication of server-sided networking and handles client networking requests
@class NetworkerServer
+ @server
]=]
local NetworkerServer = {}
NetworkerServer.__index = NetworkerServer
@@ -292,4 +293,7 @@ function NetworkerServer.destroy(self: NetworkerServer): ()
end
end
+-- Alias for :destroy()
+NetworkerServer.Destroy = NetworkerServer.destroy
+
return NetworkerServer