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

feat: convert to typescript #158

Merged
merged 5 commits into from
Feb 14, 2022
Merged

feat: convert to typescript #158

merged 5 commits into from
Feb 14, 2022

Conversation

achingbrain
Copy link
Member

@achingbrain achingbrain commented Feb 5, 2022

  • Converts to typescript
  • Only named exports
  • No more CJS, only ESM
  • Runs tests on all supported environments
  • Adds auto-publish
  • Adds dependabot
  • Drops dependency on simple-peer as it has deps on Buffer, node streams, etc
  • Uses TrackedMaps for stream registry so we can see memory usage over time more clearly

BREAKING CHANGE: switch to named exports, ESM only

- Converts to typescript
- Only named exports
- No more CJS, only ESM
- Runs tests on all supported environments
- Adds auto-publish
- Adds dependabot
- Drops dependency on simple-peer as it has deps on Buffer, node streams, etc

BREAKING CHANGE: switch to named exports, ESM only
@achingbrain
Copy link
Member Author

achingbrain commented Feb 5, 2022

TODO:

  • Convert original stream tests

Copy link
Member

@mpetrunic mpetrunic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: how come aegir eslint or tsconfig doesn't enforce explicit return types. Feels like it could help readability?

src/encode.ts Outdated Show resolved Hide resolved
src/index.ts Show resolved Hide resolved
src/index.ts Outdated
/**
* Stream to ids map
*/
initiators: new Map<number, any>(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is value actually MuxedStream?

Copy link
Member Author

@achingbrain achingbrain Feb 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, well, a Stream rather than a MuxedStream now - the idea being the muxing should be transparent to the caller. I've updated the types for the map to reflect this.

src/index.ts Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
achingbrain and others added 2 commits February 13, 2022 09:10
Co-authored-by: Marin Petrunić <mpetrunic@users.noreply.github.com>
@achingbrain
Copy link
Member Author

Nitpick: how come aegir eslint or tsconfig doesn't enforce explicit return types. Feels like it could help readability?

It was a conscious choice to let tsc derive return types to cut down on verbosity.

That said I'm not averse to requiring return types though I'd like to leave that for the next breaking aegir release as we're quite a way down the ts conversion.

@mpetrunic
Copy link
Member

mpetrunic commented Feb 14, 2022

Nitpick: how come aegir eslint or tsconfig doesn't enforce explicit return types. Feels like it could help readability?

It was a conscious choice to let tsc derive return types to cut down on verbosity.

That said I'm not averse to requiring return types though I'd like to leave that for the next breaking aegir release as we're quite a way down the ts conversion.

Yeah totally fine leaving it for next release. Since I was looking at this code for the first time, I realized how hard is to dig down to figure out what is return type. That said it's not major problem because if you review in IDE, it can figure it out for you anyways.

btw sorry about double comments not sure how that happened 😅

@achingbrain achingbrain merged commit 0cf727a into master Feb 14, 2022
@achingbrain achingbrain deleted the feat/convert-to-typescript branch February 14, 2022 16:25
github-actions bot pushed a commit that referenced this pull request Feb 14, 2022
## [1.0.0](v0.10.7...v1.0.0) (2022-02-14)

### ⚠ BREAKING CHANGES

* switch to named exports, ESM only

Co-authored-by: Marin Petrunić <mpetrunic@users.noreply.github.com>

### Features

* convert to typescript ([#158](#158)) ([0cf727a](0cf727a))
@github-actions
Copy link

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants