This repository was archived by the owner on Oct 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
feat: bump aegir and add types #111
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| export = Bootstrap; | ||
| /** | ||
| * Emits 'peer' events on a regular interval for each peer in the provided list. | ||
| */ | ||
| declare class Bootstrap extends EventEmitter { | ||
| /** | ||
| * Constructs a new Bootstrap. | ||
| * | ||
| * @param {Object} options | ||
| * @param {Array<string>} options.list - the list of peer addresses in multi-address format | ||
| * @param {number} [options.interval] - the interval between emitting addresses in milliseconds (default: 10000) | ||
| * | ||
| */ | ||
| constructor(options?: { | ||
| list: Array<string>; | ||
| interval: number | undefined; | ||
| }); | ||
| _list: string[]; | ||
| _interval: number; | ||
| _timer: NodeJS.Timeout | null; | ||
| /** | ||
| * Start emitting events. | ||
| */ | ||
| start(): void; | ||
| /** | ||
| * Emit each address in the list as a PeerInfo. | ||
| */ | ||
| _discoverBootstrapPeers(): void; | ||
| /** | ||
| * Stop emitting events. | ||
| */ | ||
| stop(): void; | ||
| } | ||
| declare namespace Bootstrap { | ||
| export { tag }; | ||
| } | ||
| import { EventEmitter } from "node/events"; | ||
| declare var tag: string; | ||
| //# sourceMappingURL=index.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,8 +6,7 @@ const mafmt = require('mafmt') | |
| const { EventEmitter } = require('events') | ||
| const debug = require('debug') | ||
|
|
||
| const log = debug('libp2p:bootstrap') | ||
| log.error = debug('libp2p:bootstrap:error') | ||
| const error = debug('libp2p:bootstrap:error') | ||
|
||
|
|
||
| /** | ||
| * Emits 'peer' events on a regular interval for each peer in the provided list. | ||
|
|
@@ -21,7 +20,7 @@ class Bootstrap extends EventEmitter { | |
| * @param {number} [options.interval] - the interval between emitting addresses in milliseconds (default: 10000) | ||
acolytec3 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| * | ||
| */ | ||
| constructor (options = {}) { | ||
| constructor (options = { list: [] }) { | ||
| if (!options.list || !options.list.length) { | ||
| throw new Error('Bootstrap requires a list of peer addresses') | ||
| } | ||
|
|
@@ -55,7 +54,7 @@ class Bootstrap extends EventEmitter { | |
|
|
||
| this._list.forEach((candidate) => { | ||
| if (!mafmt.P2P.matches(candidate)) { | ||
| return log.error('Invalid multiaddr') | ||
| return error('Invalid multiaddr') | ||
| } | ||
|
|
||
| const ma = multiaddr(candidate) | ||
|
|
@@ -68,7 +67,7 @@ class Bootstrap extends EventEmitter { | |
| multiaddrs: [ma] | ||
| }) | ||
| } catch (err) { | ||
| log.error('Invalid bootstrap peer id', err) | ||
| error('Invalid bootstrap peer id', err) | ||
| } | ||
| }) | ||
| } | ||
|
|
@@ -77,7 +76,7 @@ class Bootstrap extends EventEmitter { | |
| * Stop emitting events. | ||
| */ | ||
| stop () { | ||
| clearInterval(this._timer) | ||
| if (this._timer) clearInterval(this._timer) | ||
| this._timer = null | ||
| } | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "extends": "aegir/src/config/tsconfig.aegir.json", | ||
| "compilerOptions": { | ||
| "outDir": "dist", | ||
| "baseUrl": "./", | ||
| "paths": { | ||
| "*": ["./types/*"] | ||
| } | ||
| }, | ||
| "include": [ | ||
| "types", | ||
| "test", // remove this line if you don't want to type-check tests | ||
| "src" | ||
| ] | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dist should be ignored. The dist folder will be created on the release script for publishing but should not be part of the repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So in this case, do we leave the package.json pointing to
dist/src/index.d.tseven though it's no longer included in my PR?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it will be created in the release and what is shipped to npm will include the dist folder