Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: typescript everything #2406

Merged
merged 22 commits into from
Feb 3, 2022
Merged

feat: typescript everything #2406

merged 22 commits into from
Feb 3, 2022

Conversation

reconbot
Copy link
Member

@reconbot reconbot commented Feb 1, 2022

This is a huge pr, trying to get anything to convert to typescript piecemeal was very very frustrating and most of the conversions are straight copies.

However

  • Big changes to @serialport/stream
  • Big resultant downstream changes to serialport
  • Hardware tests now only require a loopback port and they all pass (from bindings-cpp up to stream, still working on serialport)

Full change log

  • Typscript types are now available for all packages
  • Serialport no longer supports Node 10
  • bindings-abstract is now bindings-interface and it's in it's own repo (bindings-cpp relies on it and having a cyclic dependency on the monorepo was hard)
  • baudRate on serialport and @serialport/stream packages is no longer defaulted to 9600
  • All packages now have named exports
  • Bindings have moved from @serialport/bindings to @serialport/bindings-cpp they are shipped with - prebuildify and no longer require a download.
  • @serialport/bindings-cpp now leverages N-API and shouldn't need to be upgraded for every node release.
  • baudRate is now required
  • bindings and mock bindings now have a new interface with bindings-cpp
  • stream no longer has a list method
  • serialport package no longer has a static bindings property on it's class (now a subsclass of SerialPortStream)

This is the first commit with composit projects and project references
- Typscript types are now available for all packages
- Serialport no longer supports Node 10
- `baudRate` on `serialport` and `@serialport/stream` packages is no longer defaulted to 9600
- All parser packages now have named exports
- Bindings have moved from `@serialport/bindings` to `@serialport/bindings-cpp` they are shipped with `prebuildify` and no longer require a download.
- `@serialport/bindings-cpp` now leverages N-API and shouldn't need to be upgraded for every node release.
- baudRate is now required
- bindings and mock bindings now have a new interface with bindings-cpp
- stream no longer has a list method
- serialport package no longer has a static bindings property

TODO
- stop bits are incorrect from a bindings level to the port
Copy link
Contributor

@HipsterBrown HipsterBrown left a comment

Choose a reason for hiding this comment

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

I know this is still in draft. Just a quick look. Overall changes don't look too bad, mostly annoying in the tests to assert the runtime checks 😄

packages/list/lib/index.ts Outdated Show resolved Hide resolved
packages/list/lib/index.ts Outdated Show resolved Hide resolved
packages/parser-byte-length/lib/index.test.ts Outdated Show resolved Hide resolved
packages/parser-byte-length/lib/index.ts Outdated Show resolved Hide resolved
stuck on the 2k write test on an arduino - it seems to crash the poor thing, the mock bindings deal just fine. I'm going to copy the test into the bindings cpp repo becasue it's eiother an issue ther or with my hardware.

mock binding now can give smaller read responses even if there is available data (much like a real port)

find find-arduino too
@reconbot reconbot marked this pull request as ready for review February 2, 2022 13:46
@reconbot reconbot mentioned this pull request Feb 3, 2022
15 tasks
"test:watch": "mocha -w",
"test": "nyc --reporter=html --reporter=text --reporter lcovonly mocha",
"typecheck": "tsc"
"typecheck": "lerna exec tsc"
Copy link
Member Author

Choose a reason for hiding this comment

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

I think this is better not sure -it's fast so nbd either way

@@ -47,7 +58,7 @@ class SlipDecoder extends Transform {
}

if (this.escape) {
if (byte === this.opts.ESC_START) {
if (byte === this.opts.ESC_START && this.opts.START) {
Copy link
Member Author

Choose a reason for hiding this comment

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

this is really the only functional change in parsers - it doesn't break tests and the code doesn't make sense or typecheck without it

packages/repl/lib/index.ts Outdated Show resolved Hide resolved
packages/repl/package.json Outdated Show resolved Hide resolved
packages/serialport/lib/index.ts Show resolved Hide resolved
packages/stream/tsconfig-build.json Outdated Show resolved Hide resolved
@reconbot reconbot merged commit 7ae6e51 into master Feb 3, 2022
@reconbot reconbot deleted the reconbot/typescript4 branch February 3, 2022 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants