Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Commit

Permalink
fix: swap protobufjs for protons (#145)
Browse files Browse the repository at this point in the history
Also upgrades aegir to the latest version and removes config boilerplate.
  • Loading branch information
achingbrain committed Apr 8, 2022
1 parent 9a8f4be commit 4be91ec
Show file tree
Hide file tree
Showing 10 changed files with 239 additions and 2,696 deletions.
6 changes: 2 additions & 4 deletions .aegir.cjs → .aegir.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
'use strict'

/** @type {import('aegir').PartialOptions} */
module.exports = {
export default {
build: {
bundlesizeMax: '143KB',
bundlesizeMax: '109KB',
}
}
17 changes: 0 additions & 17 deletions benchmarks/README.md

This file was deleted.

78 changes: 0 additions & 78 deletions benchmarks/index.cjs

This file was deleted.

27 changes: 0 additions & 27 deletions benchmarks/utils.cjs

This file was deleted.

43 changes: 21 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,38 +127,37 @@
]
},
"scripts": {
"clean": "aegir clean",
"lint": "aegir lint",
"dep-check": "aegir dep-check dist/src/**/*.js dist/test/**/*.js",
"build": "tsc && npm run build:copy-proto-files",
"build:copy-proto-files": "mkdirp dist/src/message && cp src/message/*.js src/message/*.d.ts dist/src/message",
"generate": "npm run generate:proto && npm run generate:proto-types",
"generate:proto": "pbjs -t static-module -w es6 -r libp2p-floodsub --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/message/rpc.js ./src/message/rpc.proto",
"generate:proto-types": "pbts -o src/message/rpc.d.ts src/message/rpc.js",
"pretest": "npm run build",
"dep-check": "aegir dep-check",
"build": "aegir build",
"generate": "protons ./src/message/rpc.proto",
"test": "aegir test -f dist/test",
"test:chrome": "npm run test -- -t browser --cov",
"test:chrome-webworker": "npm run test -- -t webworker",
"test:firefox": "npm run test -- -t browser -- --browser firefox",
"test:firefox-webworker": "npm run test -- -t webworker -- --browser firefox",
"test:node": "npm run test -- -t node --cov",
"test:electron-main": "npm run test -- -t electron-main",
"release": "semantic-release"
"test:chrome": "aegir test -t browser --cov",
"test:chrome-webworker": "aegir test -t webworker",
"test:firefox": "aegir test -t browser -- --browser firefox",
"test:firefox-webworker": "aegir test -t webworker -- --browser firefox",
"test:node": "aegir test -t node --cov",
"test:electron-main": "aegir test -t electron-main",
"release": "npm run release"
},
"dependencies": {
"@libp2p/interfaces": "^1.3.18",
"@libp2p/logger": "^1.1.2",
"@libp2p/pubsub": "^1.2.12",
"protobufjs": "^6.11.2",
"@libp2p/interfaces": "^1.3.20",
"@libp2p/logger": "^1.1.3",
"@libp2p/pubsub": "^1.2.14",
"protons-runtime": "^1.0.2",
"uint8arrays": "^3.0.0"
},
"devDependencies": {
"@libp2p/interface-compliance-tests": "^1.1.19",
"@libp2p/peer-id": "^1.1.8",
"@libp2p/peer-id-factory": "^1.0.8",
"@libp2p/interface-compliance-tests": "^1.1.21",
"@libp2p/peer-collections": "^1.0.1",
"@libp2p/peer-id": "^1.1.9",
"@libp2p/peer-id-factory": "^1.0.9",
"@multiformats/multiaddr": "^10.1.8",
"aegir": "^36.1.3",
"aegir": "^37.0.7",
"multiformats": "^9.4.5",
"p-wait-for": "^4.1.0",
"protons": "^3.0.2",
"sinon": "^13.0.1",
"wherearewe": "^1.0.0"
}
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ export class FloodSub extends PubSubBaseProtocol implements PubSub {
* Encode an RPC object into a Uint8Array
*/
encodeRpc (rpc: PubSubRPC): Uint8Array {
return RPC.encode(rpc).finish()
return RPC.encode(rpc)
}

decodeMessage (bytes: Uint8Array): PubSubRPCMessage {
return RPC.Message.decode(bytes)
}

encodeMessage (rpc: PubSubRPCMessage): Uint8Array {
return RPC.Message.encode(rpc).finish()
return RPC.Message.encode(rpc)
}

/**
Expand Down
Loading

0 comments on commit 4be91ec

Please sign in to comment.