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

fix: make serialport module optional #1841

Merged
merged 1 commit into from
Dec 9, 2024
Merged

Conversation

tkurki
Copy link
Member

@tkurki tkurki commented Dec 3, 2024

serialport module has been optional, as it is platform specific and its install may fail but otherwise the server would be in working order.

However when converting serialports.js to ts using import had made it a hard dependency - the server would not start without it, even if npm install had completed without errors but without serialport still installed.

Use dynamic require to load it so that even if the module is missing the server starts.

@tkurki tkurki added the fix label Dec 3, 2024
@tkurki tkurki requested review from sbender9 and panaaj December 8, 2024 17:03
serialport module has been optional, as it is platform specific and
its install may fail but otherwise the server would be in working order.

However when converting serialports.js to ts using import had made
it a hard dependency - the server would not start without it,
even if npm install had completed without errors but without
serialport still installed.

Use dynamic require to load it so that even if the module
is missing the server starts.
@tkurki tkurki force-pushed the fix-make-serialport-optional branch from f451cea to bf35d33 Compare December 9, 2024 19:38
@tkurki tkurki merged commit 434bc01 into master Dec 9, 2024
3 checks passed
@tkurki tkurki deleted the fix-make-serialport-optional branch December 9, 2024 19:38
naugehyde pushed a commit to naugehyde/signalk-server-nextgen that referenced this pull request Dec 14, 2024
serialport module has been optional, as it is platform specific and
its install may fail but otherwise the server would be in working order.

However when converting serialports.js to ts using import had made
it a hard dependency - the server would not start without it,
even if npm install had completed without errors but without
serialport still installed.

Use dynamic require to load it so that even if the module
is missing the server starts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants