Skip to content
This repository was archived by the owner on Jul 21, 2023. It is now read-only.

Commit 722b03a

Browse files
authored
docs: publish api docs (#201)
Updates project config to publish api docs
1 parent eb6e2cd commit 722b03a

File tree

3 files changed

+25
-9
lines changed

3 files changed

+25
-9
lines changed

.gitignore

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
node_modules
2-
package-lock.json
3-
coverage
4-
.nyc_output
5-
docs
2+
build
63
dist
7-
.coverage
4+
.docs
5+
.coverage
6+
node_modules
7+
package-lock.json
8+
yarn.lock

README.md

+16-2
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,21 @@
33
[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/)
44
[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io)
55
[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p-websockets.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-websockets)
6-
[![CI](https://img.shields.io/github/workflow/status/libp2p/js-libp2p-websockets/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/libp2p/js-libp2p-websockets/actions/workflows/js-test-and-release.yml)
6+
[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-websockets/js-test-and-release.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p-websockets/actions/workflows/js-test-and-release.yml?query=branch%3Amaster)
77

88
> JavaScript implementation of the WebSockets module that libp2p uses and that implements the interface-transport spec
99
1010
## Table of contents <!-- omit in toc -->
1111

1212
- [Install](#install)
13+
- [Browser `<script>` tag](#browser-script-tag)
1314
- [Usage](#usage)
1415
- [Constructor properties](#constructor-properties)
1516
- [Libp2p Usage Example](#libp2p-usage-example)
1617
- [API](#api)
1718
- [Transport](#transport)
1819
- [Connection](#connection)
20+
- [API Docs](#api-docs)
1921
- [License](#license)
2022
- [Contribute](#contribute)
2123

@@ -25,6 +27,14 @@
2527
$ npm i @libp2p/websockets
2628
```
2729

30+
### Browser `<script>` tag
31+
32+
Loading this module through a script tag will make it's exports available as `Libp2pWebsockets` in the global namespace.
33+
34+
```html
35+
<script src="https://unpkg.com/@libp2p/websockets/dist/index.min.js"></script>
36+
```
37+
2838
[![](https://raw.githubusercontent.com/libp2p/interface-transport/master/img/badge.png)](https://github.com/libp2p/interface-transport)
2939
[![](https://raw.githubusercontent.com/libp2p/interface-connection/master/img/badge.png)](https://github.com/libp2p/interface-connection)
3040

@@ -53,7 +63,7 @@ await node.dial('/ip4/127.0.0.1/tcp/9090/ws')
5363
| Name | Type | Description | Default |
5464
| -------- | -------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | ----------------------------------------------------------------------- |
5565
| upgrader | [`Upgrader`](https://github.com/libp2p/js-libp2p-interfaces/tree/master/packages/libp2p-interfaces/src/transport#upgrader) | connection upgrader object with `upgradeOutbound` and `upgradeInbound` | **REQUIRED** |
56-
| filter | `(multiaddrs: Array<Multiaddr>) => Array<Multiaddr>` | override transport addresses filter | **Browser:** DNS+WSS multiaddrs / **Node.js:** DNS+{WS, WSS} multiaddrs |
66+
| filter | `(multiaddrs: Array<Multiaddr>) => Array<Multiaddr>` | override transport addresses filter | **Browser:** DNS+WSS multiaddrs / **Node.js:** DNS+[WS, WSS] multiaddrs |
5767

5868
You can create your own address filters for this transports, or rely in the filters [provided](./src/filters.js).
5969

@@ -104,6 +114,10 @@ For more information see [libp2p/js-libp2p/doc/CONFIGURATION.md#customizing-tran
104114

105115
[![](https://raw.githubusercontent.com/libp2p/interface-connection/master/img/badge.png)](https://github.com/libp2p/interface-connection)
106116

117+
## API Docs
118+
119+
- <https://libp2p.github.io/js-libp2p-websockets>
120+
107121
## License
108122

109123
Licensed under either of

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
},
3939
"files": [
4040
"src",
41-
"dist/src",
41+
"dist",
4242
"!dist/test",
4343
"!**/*.tsbuildinfo"
4444
],
@@ -155,7 +155,8 @@
155155
"test:firefox-webworker": "aegir test -t webworker -f ./dist/test/browser.js -- --browser firefox",
156156
"test:node": "aegir test -t node -f ./dist/test/node.js --cov",
157157
"test:electron-main": "aegir test -t electron-main -f ./dist/test/node.js --cov",
158-
"release": "aegir release"
158+
"release": "aegir release",
159+
"docs": "aegir docs"
159160
},
160161
"dependencies": {
161162
"@libp2p/interface-connection": "^3.0.2",

0 commit comments

Comments
 (0)