Skip to content

Commit

Permalink
feat: migrating prebuild tools
Browse files Browse the repository at this point in the history
  • Loading branch information
JadlionHD committed Jul 6, 2024
1 parent dcc8a64 commit c29935b
Show file tree
Hide file tree
Showing 7 changed files with 1,656 additions and 2,537 deletions.
23 changes: 16 additions & 7 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,22 @@ jobs:
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 9
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm ci
- run: npm run build --if-present --build-from-source
- run: npm test
- run: npm run package
cache: "pnpm"

- run: pnpm ci
- run: pnpm install
- run: pnpm run build --if-present --build-from-source
- run: pnpm run test
20 changes: 8 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@ npm i growtopia.js
## Example

```js
const { Client, TextPacket, Peer } = require("growtopia.js");
import { Client, TextPacket, Peer } from "../../dist/index.js";

const client = new Client();
const client = new Client({
enet: {
ip: "0.0.0.0"
}
});

client.on("ready", () => {
console.log(
Expand All @@ -50,7 +54,9 @@ client.on("disconnect", (netID) => {
});

client.on("raw", (netID, data) => {
const peer = new Peer(client, netID);
console.log("raw", data);
console.log(peer.ping, peer.state);
});

client.on("action", (peer, data) => {
Expand All @@ -60,16 +66,6 @@ client.on("action", (peer, data) => {
}
});

client.on("tank", (peer, tank) => {
console.log(`Peer (${peer.data.netID}) tank`, { tank });
});

client.on("text", (peer, data) => {
console.log(peer.ping);

console.log(`Peer (${peer.data.netID}) text`, { data });
});

client.listen();
```

Expand Down
Loading

0 comments on commit c29935b

Please sign in to comment.