Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
d-roak committed Oct 30, 2024
2 parents 5e8b7f1 + c59081a commit 98edd64
Show file tree
Hide file tree
Showing 24 changed files with 294 additions and 135 deletions.
6 changes: 5 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
interval: daily
ignore:
- dependency-name: "*"
# ignore patch and minor
update-types: [version-update:semver-patch, version-update:semver-minor]
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @d-roak @JanLewDev @elielnfinic @trungnotchung @winprn @hoangquocvietuet
10 changes: 5 additions & 5 deletions examples/canvas/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ts-topology-examples-canvas",
"version": "0.2.0",
"version": "0.2.1-0",
"license": "MIT",
"scripts": {
"build": "vite build",
Expand All @@ -9,10 +9,10 @@
"start": "ts-node ./src/index.ts"
},
"dependencies": {
"@topology-foundation/blueprints": "0.2.0",
"@topology-foundation/network": "0.2.0",
"@topology-foundation/node": "0.2.0",
"@topology-foundation/object": "0.2.0",
"@topology-foundation/blueprints": "0.2.1-0",
"@topology-foundation/network": "0.2.1-0",
"@topology-foundation/node": "0.2.1-0",
"@topology-foundation/object": "0.2.1-0",
"crypto-browserify": "^3.12.0",
"process": "^0.11.10",
"stream-browserify": "^3.0.0",
Expand Down
10 changes: 5 additions & 5 deletions examples/chat/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "topology-example-chat",
"version": "0.2.0",
"version": "0.2.1-0",
"description": "Topology Protocol Chat Example",
"main": "src/index.ts",
"repository": "https://github.com/topology-foundation/ts-topology.git",
Expand All @@ -13,10 +13,10 @@
"start": "ts-node ./src/index.ts"
},
"dependencies": {
"@topology-foundation/blueprints": "0.2.0",
"@topology-foundation/network": "0.2.0",
"@topology-foundation/node": "0.2.0",
"@topology-foundation/object": "0.2.0",
"@topology-foundation/blueprints": "0.2.1-0",
"@topology-foundation/network": "0.2.1-0",
"@topology-foundation/node": "0.2.1-0",
"@topology-foundation/object": "0.2.1-0",
"assemblyscript": "^0.27.29",
"crypto-browserify": "^3.12.0",
"process": "^0.11.10",
Expand Down
8 changes: 4 additions & 4 deletions examples/grid/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "topology-example-grid",
"version": "0.2.0",
"version": "0.2.1-0",
"description": "Topology Protocol Grid Exmaple",
"main": "src/index.ts",
"repository": "https://github.com/topology-foundation/ts-topology.git",
Expand All @@ -13,9 +13,9 @@
"start": "ts-node ./src/index.ts"
},
"dependencies": {
"@topology-foundation/network": "0.2.0",
"@topology-foundation/node": "0.2.0",
"@topology-foundation/object": "0.2.0",
"@topology-foundation/network": "0.2.1-0",
"@topology-foundation/node": "0.2.1-0",
"@topology-foundation/object": "0.2.1-0",
"assemblyscript": "^0.27.29",
"crypto-browserify": "^3.12.0",
"memfs": "^4.11.1",
Expand Down
10 changes: 5 additions & 5 deletions examples/local-bootstrap/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "topology-example-localdev",
"version": "0.2.0",
"version": "0.2.1-0",
"description": "Topology Protocol Local Dev Example",
"main": "src/index.ts",
"repository": "https://github.com/topology-foundation/ts-topology.git",
Expand All @@ -13,10 +13,10 @@
"start": "ts-node ./src/index.ts"
},
"dependencies": {
"@topology-foundation/blueprints": "0.2.0",
"@topology-foundation/network": "0.2.0",
"@topology-foundation/node": "0.2.0",
"@topology-foundation/object": "0.2.0",
"@topology-foundation/blueprints": "0.2.1-0",
"@topology-foundation/network": "0.2.1-0",
"@topology-foundation/node": "0.2.1-0",
"@topology-foundation/object": "0.2.1-0",
"assemblyscript": "^0.27.29",
"crypto-browserify": "^3.12.0",
"process": "^0.11.10",
Expand Down
112 changes: 56 additions & 56 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
{
"name": "ts-topology",
"description": "The official TypeScript implementation of Topology Protocol",
"version": "0.2.0",
"license": "MIT",
"homepage": "https://topology.gg/",
"repository": {
"type": "git",
"url": "git+https://github.com/topology-foundation/ts-topology.git"
},
"bugs": {
"url": "https://github.com/topology-foundation/ts-topology/issues"
},
"workspaces": [
"packages/*",
"examples/*"
],
"scripts": {
"bench": "vitest bench",
"biome-check": "biome check",
"clean": "pnpm --filter '@topology-foundation/*' clean",
"docs": "typedoc",
"postinstall": "pnpm --filter '@topology-foundation/*' build",
"proto-gen": "pnpm proto-gen:object && pnpm proto-gen:network",
"proto-gen:object": "buf generate packages/object/src/proto -o packages/object/src/proto",
"proto-gen:network": "buf generate packages/network/src/proto -o packages/network/src/proto",
"release": "release-it",
"test": "vitest"
},
"devDependencies": {
"@biomejs/biome": "^1.8.3",
"@release-it-plugins/workspaces": "^4.2.0",
"@types/node": "^22.5.4",
"assemblyscript": "^0.27.29",
"release-it": "^17.6.0",
"ts-proto": "^2.2.4",
"typedoc": "^0.26.6",
"typescript": "^5.5.4",
"vite": "^5.4.9",
"vite-tsconfig-paths": "^5.0.1",
"vitest": "^2.1.1"
},
"private": true,
"release-it": {
"plugins": {
"@release-it-plugins/workspaces": {
"publish": false
}
},
"npm": false,
"git": {
"commitMessage": "chore: release v${version}"
},
"github": {
"release": true
}
}
"name": "ts-topology",
"description": "The official TypeScript implementation of Topology Protocol",
"version": "0.2.1-0",
"license": "MIT",
"homepage": "https://topology.gg/",
"repository": {
"type": "git",
"url": "git+https://github.com/topology-foundation/ts-topology.git"
},
"bugs": {
"url": "https://github.com/topology-foundation/ts-topology/issues"
},
"workspaces": [
"packages/*",
"examples/*"
],
"scripts": {
"bench": "vitest bench",
"biome-check": "biome check",
"clean": "pnpm --filter '@topology-foundation/*' clean",
"docs": "typedoc",
"postinstall": "pnpm --filter '@topology-foundation/*' build",
"proto-gen": "pnpm proto-gen:object && pnpm proto-gen:network",
"proto-gen:object": "buf generate packages/object/src/proto -o packages/object/src/proto",
"proto-gen:network": "buf generate packages/network/src/proto -o packages/network/src/proto",
"release": "release-it",
"test": "vitest"
},
"devDependencies": {
"@biomejs/biome": "^1.8.3",
"@release-it-plugins/workspaces": "^4.2.0",
"@types/node": "^22.5.4",
"assemblyscript": "^0.27.29",
"release-it": "^17.6.0",
"ts-proto": "^2.2.4",
"typedoc": "^0.26.6",
"typescript": "^5.5.4",
"vite": "^5.4.9",
"vite-tsconfig-paths": "^5.0.1",
"vitest": "^2.1.1"
},
"private": true,
"release-it": {
"plugins": {
"@release-it-plugins/workspaces": {
"publish": false
}
},
"npm": false,
"git": {
"commitMessage": "chore: release v${version}"
},
"github": {
"release": true
}
}
}
4 changes: 2 additions & 2 deletions packages/blueprints/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@topology-foundation/blueprints",
"version": "0.2.0",
"version": "0.2.1-0",
"license": "MIT",
"repository": {
"type": "git",
Expand Down Expand Up @@ -34,7 +34,7 @@
"test": "vitest"
},
"devDependencies": {
"@topology-foundation/object": "0.2.0",
"@topology-foundation/object": "0.2.1-0",
"assemblyscript": "^0.27.29"
},
"dependencies": {
Expand Down
31 changes: 31 additions & 0 deletions packages/logger/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Topology Logger

This package makes it easy to log messages in a structured way.

## Usage

This package is intended to be used as a dependency for the Topology Protocol. However, you can use it as a standalone package. For that, you can install it using:

```bash
# yarn
yarn add @topology-foundation/logger

# npm
npm install @topology-foundation/logger
```

### Build

To build the package, you can run:

```bash
yarn build
```

### Tests

To run the tests, you can run:

```bash
yarn test
```
33 changes: 33 additions & 0 deletions packages/logger/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "@topology-foundation/logger",
"version": "0.2.1-0",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/topology-foundation/ts-topology.git"
},
"type": "module",
"types": "./dist/src/index.d.ts",
"files": [
"src",
"dist",
"!dist/test",
"!**/*.tsbuildinfo"
],
"exports": {
".": {
"types": "./dist/src/index.d.ts",
"import": "./dist/src/index.js"
}
},
"scripts": {
"build": "tsc -b",
"clean": "rm -rf dist/ node_modules/",
"prepack": "tsc -b",
"test": "vitest"
},
"dependencies": {
"loglevel": "^1.9.2",
"loglevel-plugin-prefix": "^0.8.4"
}
}
28 changes: 28 additions & 0 deletions packages/logger/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import loglevel from "loglevel";
import prefix from "loglevel-plugin-prefix";

export interface LoggerOptions {
level?: loglevel.LogLevelDesc;
}

export class Logger {
private log: loglevel.Logger;
// biome-ignore lint/suspicious/noExplicitAny: Do this to allow any method to be called on the logger
[key: string]: any;

constructor(context: string, config?: LoggerOptions) {
this.log = loglevel.getLogger(context);
this.log.setLevel(config?.level || "info");
prefix.reg(loglevel);
prefix.apply(this.log, {
template: "%n",
});

for (const method of Object.keys(this.log)) {
const logMethod = this.log[method as keyof loglevel.Logger];
if (typeof logMethod === "function") {
this[method as string] = logMethod.bind(this.log);
}
}
}
}
7 changes: 7 additions & 0 deletions packages/logger/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src/**/*.ts"]
}
6 changes: 6 additions & 0 deletions packages/logger/typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://typedoc.org/schema.json",
"includeVersion": true,
"entryPoints": ["src/index.ts"],
"readme": "README.md"
}
3 changes: 2 additions & 1 deletion packages/network/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@topology-foundation/network",
"version": "0.2.0",
"version": "0.2.1-0",
"license": "MIT",
"repository": {
"type": "git",
Expand Down Expand Up @@ -49,6 +49,7 @@
"@libp2p/websockets": "^9.0.7",
"@libp2p/webtransport": "^5.0.9",
"@multiformats/multiaddr": "^12.3.1",
"@topology-foundation/logger": "^0.2.1-0",
"it-length-prefixed": "^9.1.0",
"it-map": "^3.1.1",
"it-pipe": "^3.0.1",
Expand Down
Loading

0 comments on commit 98edd64

Please sign in to comment.