Skip to content

Commit 5382b9d

Browse files
author
Luke
authored
Add test workspaces and examples to monorepo design (#149)
1 parent 50e8869 commit 5382b9d

File tree

13 files changed

+27107
-782
lines changed

13 files changed

+27107
-782
lines changed

package-lock.json

Lines changed: 27073 additions & 757 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@
2828
"private": true,
2929
"workspaces": [
3030
"packages/nakama-js",
31+
"packages/nakama-js-test",
32+
"packages/satori-js",
33+
"packages/satori-js-test",
34+
"packages/nakama-js-create-react-app-example",
35+
"packages/nakama-js-iife-example",
3136
"packages/nakama-js-protobuf",
32-
"packages/satori-js"
37+
"packages/nakama-js-webpack-example"
3338
]
3439
}

packages/nakama-js-test/client-group.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ describe('Group Tests', () => {
309309
expect(result.user_groups![0].group!.edge_count).toBe(2);
310310
});
311311

312-
it('should create closed, request to join, promote, then list user groups and see count affected', async () => {
312+
it('should create closed group, request to join, promote, then list user groups and see count affected', async () => {
313313
const page : Page = await createPage();
314314

315315
const customid1 = generateid();

packages/nakama-js-test/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
"private": true,
66
"license": "Apache-2.0",
77
"dependencies": {
8-
"@heroiclabs/nakama-js": "2.6.0",
9-
"@heroiclabs/nakama-js-protobuf": "1.3.0",
10-
"merge": "^2.1.1"
8+
"@heroiclabs/nakama-js": "file:../nakama-js",
9+
"@heroiclabs/nakama-js-protobuf": "file:../nakama-js-protobuf",
10+
"merge": "^2.1.1",
11+
"base64url": "3.0.1"
1112
},
1213
"devDependencies": {
1314
"@types/expect-puppeteer": "^4.4.5",

packages/nakama-js-webpack-example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"private": true,
66
"license": "Apache-2.0",
77
"dependencies": {
8-
"@heroiclabs/nakama-js": "2.5.0",
8+
"@heroiclabs/nakama-js": "file:../nakama-js",
99
"ts-loader": "^8.0.14",
1010
"webpack": "^5.12.2",
1111
"webpack-cli": "^4.3.1"

packages/nakama-js/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,12 @@ Ensure you are using Node v18>.
162162
163163
The codebase is multi-package monorepo written in TypeScript and can be built with [esbuild](https://github.com/evanw/esbuild). All dependencies are managed with NPM.
164164
165-
To build from source, install dependencies and build the `nakama-js` and `nakama-js-protobuf` subrepositories:
165+
To build from source, first install all workspace dependencies from the repository root with `npm install`.
166+
167+
Then to build a specific workspace, pass the `--workspace` flag to your build command, for example:
166168
167169
```shell
168-
npm install --workspace=@heroiclabs/nakama-js --include-workspace-root && npm run build --workspace=@heroiclabs/nakama-js
169-
npm install --workspace=@heroiclabs/nakama-js-protobuf --include-workspace-root && npm run build --workspace=@heroiclabs/nakama-js-protobuf
170+
npm run build --workspace=@heroiclabs/nakama-js
170171
```
171172
172173
### Run Tests

packages/nakama-js/dist/nakama-js.cjs.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3194,7 +3194,7 @@ var _DefaultSocket = class {
31943194
reject(evt);
31953195
this.adapter.close();
31963196
};
3197-
window.setTimeout(() => {
3197+
setTimeout(() => {
31983198
reject("The socket timed out when trying to connect.");
31993199
}, connectTimeoutMs);
32003200
});
@@ -3328,7 +3328,7 @@ var _DefaultSocket = class {
33283328
}
33293329
const cid = this.generatecid();
33303330
this.cIds[cid] = { resolve, reject };
3331-
window.setTimeout(() => {
3331+
setTimeout(() => {
33323332
reject("The socket timed out while waiting for a response.");
33333333
}, sendTimeout);
33343334
untypedMessage.cid = cid;
@@ -3548,7 +3548,7 @@ var _DefaultSocket = class {
35483548
}
35493549
return;
35503550
}
3551-
window.setTimeout(() => this.pingPong(), this._heartbeatTimeoutMs);
3551+
setTimeout(() => this.pingPong(), this._heartbeatTimeoutMs);
35523552
});
35533553
}
35543554
};

packages/nakama-js/dist/nakama-js.esm.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3168,7 +3168,7 @@ var _DefaultSocket = class {
31683168
reject(evt);
31693169
this.adapter.close();
31703170
};
3171-
window.setTimeout(() => {
3171+
setTimeout(() => {
31723172
reject("The socket timed out when trying to connect.");
31733173
}, connectTimeoutMs);
31743174
});
@@ -3302,7 +3302,7 @@ var _DefaultSocket = class {
33023302
}
33033303
const cid = this.generatecid();
33043304
this.cIds[cid] = { resolve, reject };
3305-
window.setTimeout(() => {
3305+
setTimeout(() => {
33063306
reject("The socket timed out while waiting for a response.");
33073307
}, sendTimeout);
33083308
untypedMessage.cid = cid;
@@ -3522,7 +3522,7 @@ var _DefaultSocket = class {
35223522
}
35233523
return;
35243524
}
3525-
window.setTimeout(() => this.pingPong(), this._heartbeatTimeoutMs);
3525+
setTimeout(() => this.pingPong(), this._heartbeatTimeoutMs);
35263526
});
35273527
}
35283528
};

packages/nakama-js/dist/nakama-js.iife.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3194,7 +3194,7 @@ var nakamajs = (() => {
31943194
reject(evt);
31953195
this.adapter.close();
31963196
};
3197-
window.setTimeout(() => {
3197+
setTimeout(() => {
31983198
reject("The socket timed out when trying to connect.");
31993199
}, connectTimeoutMs);
32003200
});
@@ -3328,7 +3328,7 @@ var nakamajs = (() => {
33283328
}
33293329
const cid = this.generatecid();
33303330
this.cIds[cid] = { resolve, reject };
3331-
window.setTimeout(() => {
3331+
setTimeout(() => {
33323332
reject("The socket timed out while waiting for a response.");
33333333
}, sendTimeout);
33343334
untypedMessage.cid = cid;
@@ -3548,7 +3548,7 @@ var nakamajs = (() => {
35483548
}
35493549
return;
35503550
}
3551-
window.setTimeout(() => this.pingPong(), this._heartbeatTimeoutMs);
3551+
setTimeout(() => this.pingPong(), this._heartbeatTimeoutMs);
35523552
});
35533553
}
35543554
};

packages/nakama-js/dist/nakama-js.umd.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3924,7 +3924,7 @@
39243924
reject(evt);
39253925
_this.adapter.close();
39263926
};
3927-
window.setTimeout(function () {
3927+
setTimeout(function () {
39283928
// if promise has resolved by now, the reject() is a no-op
39293929
reject("The socket timed out when trying to connect.");
39303930
}, connectTimeoutMs);
@@ -4066,7 +4066,7 @@
40664066
}
40674067
var cid = _this.generatecid();
40684068
_this.cIds[cid] = { resolve: resolve, reject: reject };
4069-
window.setTimeout(function () {
4069+
setTimeout(function () {
40704070
reject("The socket timed out while waiting for a response.");
40714071
}, sendTimeout);
40724072
/** Add id for promise executor. */
@@ -4396,7 +4396,7 @@
43964396
case 4:
43974397
// reuse the timeout as the interval for now.
43984398
// we can separate them out into separate values if needed later.
4399-
window.setTimeout(function () { return _this.pingPong(); }, this._heartbeatTimeoutMs);
4399+
setTimeout(function () { return _this.pingPong(); }, this._heartbeatTimeoutMs);
44004400
return [2 /*return*/];
44014401
}
44024402
});

0 commit comments

Comments
 (0)