From 4477f4bdb7fda01fc4a17d85d3e372e81c396674 Mon Sep 17 00:00:00 2001 From: Alex Potsides Date: Fri, 16 Dec 2022 13:01:15 +0000 Subject: [PATCH] docs: publish api docs (#39) Updates project config to publish api docs --- .gitignore | 9 +++++---- README.md | 28 +++++++++++++++------------- package.json | 5 +++-- src/envelope/index.ts | 4 ++-- src/index.ts | 2 ++ 5 files changed, 27 insertions(+), 21 deletions(-) diff --git a/.gitignore b/.gitignore index db79d1f189..910f6339ea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ node_modules -coverage -.nyc_output +build +dist +.docs +.coverage +node_modules package-lock.json yarn.lock -docs -dist diff --git a/README.md b/README.md index 19e11c4922..b1bdf82073 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,16 @@ # @libp2p/peer-record [![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![IRC](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) [![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) [![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p-peer-record.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-peer-record) -[![CI](https://img.shields.io/github/workflow/status/libp2p/js-libp2p-interfaces/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/libp2p/js-libp2p-peer-record/actions/workflows/js-test-and-release.yml) +[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-peer-record/js-test-and-release.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p-peer-record/actions/workflows/js-test-and-release.yml?query=branch%3Amaster) > Used to transfer signed peer data across the network ## Table of contents - [Install](#install) + - [Browser ` +``` + ## Description Libp2p nodes need to store data in a public location (e.g. a DHT), or rely on potentially untrustworthy intermediaries to relay information over its lifetime. Accordingly, libp2p nodes need to be able to verify that the data came from a specific peer and that it hasn't been tampered with. @@ -163,15 +171,9 @@ When a subsystem wants to provide a record, it will get it from the AddressBook, - With the modular dialer, users should easily be able to configure precedence. With dialer v1, anything we do to prioritise dials is gonna be spaghetti and adhoc. With the modular dialer, you’d be able to specify the order of dials when instantiating the pipeline. - Multiple parallel dials. We already have the issue where new addresses aren't added to existing dials. -## Example +## API Docs -```JavaScript -import { trackedMap } from '@libp2p/tracked-map' - -const map = trackedMap({ metrics }) - -map.set('key', 'value') -``` +- ## License @@ -180,6 +182,6 @@ Licensed under either of - Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) - MIT ([LICENSE-MIT](LICENSE-MIT) / ) -## Contribute +## Contribution Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. diff --git a/package.json b/package.json index 5e9efe3745..2d9e16e9c1 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "types": "./dist/src/index.d.ts", "files": [ "src", - "dist/src", + "dist", "!dist/test", "!**/*.tsbuildinfo" ], @@ -142,7 +142,8 @@ "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": "aegir release" + "release": "aegir release", + "docs": "aegir docs" }, "dependencies": { "@libp2p/crypto": "^1.0.0", diff --git a/src/envelope/index.ts b/src/envelope/index.ts index fc10659a34..ffa6051b1a 100644 --- a/src/envelope/index.ts +++ b/src/envelope/index.ts @@ -10,7 +10,7 @@ import type { Record, Envelope } from '@libp2p/interface-record' import { Uint8ArrayList } from 'uint8arraylist' import { unsigned } from 'uint8-varint' -export interface EnvelopeInit { +export interface RecordEnvelopeInit { peerId: PeerId payloadType: Uint8Array payload: Uint8Array @@ -82,7 +82,7 @@ export class RecordEnvelope implements Envelope { * The Envelope is responsible for keeping an arbitrary signed record * by a libp2p peer. */ - constructor (init: EnvelopeInit) { + constructor (init: RecordEnvelopeInit) { const { peerId, payloadType, payload, signature } = init this.peerId = peerId diff --git a/src/index.ts b/src/index.ts index c05f140aaf..1cba7da4de 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,5 @@ export { RecordEnvelope } from './envelope/index.js' +export type { RecordEnvelopeInit } from './envelope/index.js' export { PeerRecord } from './peer-record/index.js' +export type { PeerRecordInit } from './peer-record/index.js'