diff --git a/.github/workflows/js-test-and-release.yml b/.github/workflows/js-test-and-release.yml index 2c7a14b..35d87d1 100644 --- a/.github/workflows/js-test-and-release.yml +++ b/.github/workflows/js-test-and-release.yml @@ -3,7 +3,7 @@ name: test & maybe release on: push: branches: - - master + - main pull_request: workflow_dispatch: diff --git a/README.md b/README.md index 4180c5f..9164037 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) [![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/protons.svg?style=flat-square)](https://codecov.io/gh/ipfs/protons) -[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/protons/js-test-and-release.yml?branch=master\&style=flat-square)](https://github.com/ipfs/protons/actions/workflows/js-test-and-release.yml?query=branch%3Amaster) +[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/protons/js-test-and-release.yml?branch=main\&style=flat-square)](https://github.com/ipfs/protons/actions/workflows/js-test-and-release.yml?query=branch%3Amain) > Protobuf to ts transpiler diff --git a/packages/protons-benchmark/README.md b/packages/protons-benchmark/README.md index e9ba641..1613ca7 100644 --- a/packages/protons-benchmark/README.md +++ b/packages/protons-benchmark/README.md @@ -3,7 +3,7 @@ [![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) [![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/protons.svg?style=flat-square)](https://codecov.io/gh/ipfs/protons) -[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/protons/js-test-and-release.yml?branch=master\&style=flat-square)](https://github.com/ipfs/protons/actions/workflows/js-test-and-release.yml?query=branch%3Amaster) +[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/protons/js-test-and-release.yml?branch=main\&style=flat-square)](https://github.com/ipfs/protons/actions/workflows/js-test-and-release.yml?query=branch%3Amain) > Protobuf to ts transpiler diff --git a/packages/protons-benchmark/package.json b/packages/protons-benchmark/package.json index 925ca33..f472fb9 100644 --- a/packages/protons-benchmark/package.json +++ b/packages/protons-benchmark/package.json @@ -57,7 +57,7 @@ "protons": "^7.0.0", "protons-runtime": "^5.0.0", "uint8arraylist": "^2.4.3", - "uint8arrays": "^4.0.2" + "uint8arrays": "^4.0.6" }, "private": true } diff --git a/packages/protons-benchmark/src/decode.ts b/packages/protons-benchmark/src/decode.ts deleted file mode 100644 index 1506b7b..0000000 --- a/packages/protons-benchmark/src/decode.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* eslint-disable no-console */ - -/* -$ node dist/src/index.js -$ npx playwright-test dist/src/index.js --runner benchmark -*/ - -import Benchmark from 'benchmark' -import { decodeTest as pbjsDecodeTest } from './pbjs/bench.js' -import { Test as ProtobufjsTest } from './protobufjs/bench.js' -import { Test as ProtonsTest } from './protons/bench.js' - -const message = { - meh: { - lol: 'sdkljfoee', - b: { - tmp: { - baz: 2309292 - } - } - }, - hello: 3493822, - foo: 'derp derp derp', - payload: Uint8Array.from([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) -} - -const buf = ProtonsTest.encode(message).subarray() - -new Benchmark.Suite() - .add('pbjs', () => { - pbjsDecodeTest(buf) - }) - .add('protons', () => { - ProtonsTest.decode(buf) - }) - .add('protobufjs', () => { - ProtobufjsTest.decode(buf) - }) - .on('error', (err: Error) => { - console.error(err) - }) - .on('cycle', (event: any) => { - console.info(String(event.target)) - }) - .on('complete', function () { - // @ts-expect-error types are wrong - console.info(`Fastest is ${this.filter('fastest').map('name')}`) - }) - // run async - .run({ async: true }) diff --git a/packages/protons-benchmark/src/encode.ts b/packages/protons-benchmark/src/encode.ts deleted file mode 100644 index 6218836..0000000 --- a/packages/protons-benchmark/src/encode.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* eslint-disable no-console */ - -/* -$ node dist/src/index.js -$ npx playwright-test dist/src/index.js --runner benchmark -*/ - -import Benchmark from 'benchmark' -import { encodeTest as pbjsEncodeTest } from './pbjs/bench.js' -import { Test as ProtobufjsTest } from './protobufjs/bench.js' -import { Test as ProtonsTest } from './protons/bench.js' - -const message = { - meh: { - lol: 'sdkljfoee', - b: { - tmp: { - baz: 2309292 - } - } - }, - hello: 3493822, - foo: 'derp derp derp', - payload: Uint8Array.from([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) -} - -new Benchmark.Suite() - .add('pbjs', () => { - pbjsEncodeTest(message) - }) - .add('protons', () => { - ProtonsTest.encode(message) - }) - .add('protobufjs', () => { - ProtobufjsTest.encode(message).finish() - }) - .on('error', (err: Error) => { - console.error(err) - }) - .on('cycle', (event: any) => { - console.info(String(event.target)) - }) - .on('complete', function () { - // @ts-expect-error types are wrong - console.info(`Fastest is ${this.filter('fastest').map('name')}`) - }) - // run async - .run({ async: true }) diff --git a/packages/protons-benchmark/src/rpc.proto b/packages/protons-benchmark/src/rpc.proto deleted file mode 100644 index eb1a81d..0000000 --- a/packages/protons-benchmark/src/rpc.proto +++ /dev/null @@ -1,52 +0,0 @@ -syntax = "proto3"; - -message RPC { - repeated SubOpts subscriptions = 1; - repeated Message messages = 2; - optional ControlMessage control = 3; - - message SubOpts { - optional bool subscribe = 1; // subscribe or unsubcribe - optional string topic = 2; - } - - message Message { - optional bytes from = 1; - optional bytes data = 2; - optional bytes seqno = 3; - string topic = 4; - optional bytes signature = 5; - optional bytes key = 6; - } - - message ControlMessage { - repeated ControlIHave ihave = 1; - repeated ControlIWant iwant = 2; - repeated ControlGraft graft = 3; - repeated ControlPrune prune = 4; - } - - message ControlIHave { - optional string topicID = 1; - repeated bytes messageIDs = 2; - } - - message ControlIWant { - repeated bytes messageIDs = 1; - } - - message ControlGraft { - optional string topicID = 1; - } - - message ControlPrune { - optional string topicID = 1; - repeated PeerInfo peers = 2; - optional uint64 backoff = 3; - } - - message PeerInfo { - optional bytes peerID = 1; - optional bytes signedPeerRecord = 2; - } -} diff --git a/packages/protons-benchmark/src/rpc.ts b/packages/protons-benchmark/src/rpc.ts deleted file mode 100644 index c5af0f3..0000000 --- a/packages/protons-benchmark/src/rpc.ts +++ /dev/null @@ -1,49 +0,0 @@ -/* eslint-disable no-console */ - -/* -$ node dist/src/index.js -$ npx playwright-test dist/src/index.js --runner benchmark -*/ - -import Benchmark from 'benchmark' -import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import { RPC as ProtobufjsRPC } from './protobufjs/rpc.js' -import { RPC as ProtonsRPC } from './protons/rpc.js' - -const rpc = { - subscriptions: [], - messages: [ - { - topic: 'topic1', - // typical Attestation - data: uint8ArrayFromString( - 'e40000000a000000000000000a00000000000000a45c8daa336e17a150300afd4c717313c84f291754c51a378f20958083c5fa070a00000000000000a45c8daa336e17a150300afd4c717313c84f291754c51a378f20958083c5fa070a00000000000000a45c8daa336e17a150300afd4c717313c84f291754c51a378f20958083c5fa0795d2ef8ae4e2b4d1e5b3d5ce47b518e3db2c8c4d082e4498805ac2a686c69f248761b78437db2927470c1e77ede9c18606110faacbcbe4f13052bde7f7eff6aab09edf7bc4929fda2230f943aba2c47b6f940d350cb20c76fad4a8d40e2f3f1f01', - 'hex' - ), - signature: Uint8Array.from(Array.from({ length: 96 }, () => 100)) - } - ], - control: undefined -} - -const bytes = ProtobufjsRPC.encode(rpc).finish() - -new Benchmark.Suite() - .add('protons', () => { - ProtonsRPC.decode(bytes) - }) - .add('protobufjs', () => { - ProtobufjsRPC.decode(bytes) - }) - .on('error', (err: Error) => { - console.error(err) - }) - .on('cycle', (event: any) => { - console.info(String(event.target)) - }) - .on('complete', function () { - // @ts-expect-error types are wrong - console.info(`Fastest is ${this.filter('fastest').map('name')}`) - }) - // run async - .run({ async: true }) diff --git a/packages/protons-runtime/README.md b/packages/protons-runtime/README.md index 1d11b22..7ac1608 100644 --- a/packages/protons-runtime/README.md +++ b/packages/protons-runtime/README.md @@ -3,7 +3,7 @@ [![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) [![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/protons.svg?style=flat-square)](https://codecov.io/gh/ipfs/protons) -[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/protons/js-test-and-release.yml?branch=master\&style=flat-square)](https://github.com/ipfs/protons/actions/workflows/js-test-and-release.yml?query=branch%3Amaster) +[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/protons/js-test-and-release.yml?branch=main\&style=flat-square)](https://github.com/ipfs/protons/actions/workflows/js-test-and-release.yml?query=branch%3Amain) > Shared code to make your bundle smaller when running protons in your app diff --git a/packages/protons-runtime/package.json b/packages/protons-runtime/package.json index 2359912..ed81e5b 100644 --- a/packages/protons-runtime/package.json +++ b/packages/protons-runtime/package.json @@ -34,7 +34,7 @@ }, "release": { "branches": [ - "master" + "main" ], "plugins": [ [ diff --git a/packages/protons/README.md b/packages/protons/README.md index a0780ae..4d1a1db 100644 --- a/packages/protons/README.md +++ b/packages/protons/README.md @@ -3,7 +3,7 @@ [![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) [![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/protons.svg?style=flat-square)](https://codecov.io/gh/ipfs/protons) -[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/protons/js-test-and-release.yml?branch=master\&style=flat-square)](https://github.com/ipfs/protons/actions/workflows/js-test-and-release.yml?query=branch%3Amaster) +[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/protons/js-test-and-release.yml?branch=main\&style=flat-square)](https://github.com/ipfs/protons/actions/workflows/js-test-and-release.yml?query=branch%3Amain) > Protobuf to ts transpiler diff --git a/packages/protons/package.json b/packages/protons/package.json index 06e9652..174de77 100644 --- a/packages/protons/package.json +++ b/packages/protons/package.json @@ -37,7 +37,7 @@ }, "release": { "branches": [ - "master" + "main" ], "plugins": [ [