You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is also `npm run autogen` which uses ProtoBuf's protoc to populate the generated code directory `proto_ts` based on `*.proto` files in src. Don't forget to run this step before `build` any time you make a change to any of the `*.proto` files.
Contributions are welcome! The libp2p implementation in JavaScript is a work in progress. As such, there's a few things you can do right now to help out:
79
112
80
-
-[Check out the existing issues](//github.com/little-bear-labs//js-libp2p-webrtc/issues).
113
+
-[Check out the existing issues](//github.com/little-bear-labs/js-libp2p-webrtc/issues).
81
114
-**Perform code reviews**.
82
115
-**Add tests**. There can never be enough tests.
83
116
- Go through the modules and **check out existing issues**. This is especially useful for modules in active development. Some knowledge of IPFS/libp2p may be required, as well as the infrastructure behind it - for instance, you may need to read up on p2p and more complex operations like muxing to be able to help technically.
@@ -86,8 +119,6 @@ Please be aware that all interactions related to libp2p are subject to the IPFS
86
119
87
120
Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.
88
121
89
-
## Development
90
-
91
122
This module leans heavily on (Aegir)[https://github.com/ipfs/aegir] for most of the `package.json` scripts.
92
123
93
124
### Build
@@ -99,6 +130,30 @@ npm run build
99
130
100
131
The build will be located in the `/dist` folder.
101
132
133
+
### Protocol Buffers
134
+
135
+
There is also `npm run generate:proto` script that uses protoc to populate the generated code directory `proto_ts` based on `*.proto` files in src. Don't forget to run this step before `build` any time you make a change to any of the `*.proto` files.
136
+
137
+
### Test
138
+
139
+
To run all tests:
140
+
141
+
```shell
142
+
npm test
143
+
```
144
+
145
+
To run tests for Chome only:
146
+
147
+
```shell
148
+
npm run test:chrome
149
+
```
150
+
151
+
To run tests for Firefox only:
152
+
153
+
```shell
154
+
npm run test:firefox
155
+
```
156
+
102
157
### Lint
103
158
Aegir is also used to lint the code, which follows the [Standard](https://github.com/standard/standard) JS linter.
104
159
The VS Code plugin for this standard is located at https://marketplace.visualstudio.com/items?itemName=standard.vscode-standard.
This example leverages the [vite bundler](https://vitejs.dev/) to compile and serve the libp2p code in the browser. You can use other bundlers such as Webpack, but we will not be covering them here.
4
+
5
+
## Running the Go Server
6
+
7
+
To run the Go LibP2P WebRTC server:
8
+
9
+
```shell
10
+
npm run go-libp2p-server
11
+
```
12
+
13
+
Copy the multiaddress in the output.
14
+
15
+
## Running the Example
16
+
17
+
In a separate console tab, install dependencies and start the Vite server:
18
+
19
+
```shell
20
+
npm i && npm run start
21
+
```
22
+
23
+
The browser window will automatically open.
24
+
Using the copied multiaddress from the Go server, paste it into the `Server MultiAddress` input and click the `Connect` button.
25
+
Once the peer is connected, click the message section will appear. Enter a message and click the `Send` button.
0 commit comments