Skip to content

Commit

Permalink
fix: Add special case for Serial Port binary (.node) modules (#415)
Browse files Browse the repository at this point in the history
Tested with prebuilds and compiling serialport from source
  • Loading branch information
RogerHardiman authored May 8, 2024
1 parent cb1e49d commit e001d05
Show file tree
Hide file tree
Showing 4 changed files with 255 additions and 0 deletions.
245 changes: 245 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
"saslprep": "^1.0.3",
"semver": "^7.5.2",
"sequelize": "^6.29.0",
"serialport": "^12.0.0",
"sharp": "^0.33.1",
"shiki": "^0.14.5",
"socket.io": "^2.4.0",
Expand Down
6 changes: 6 additions & 0 deletions src/utils/special-cases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ const specialCases: Record<string, (o: SpecialCaseOpts) => void> = {
emitAssetDirectory(resolve(dirname(id), 'runtime/'));
}
},
'@serialport/bindings-cpp'({ id, emitAssetDirectory }) {
if (id.endsWith('@serialport/bindings-cpp/dist/index.js')) {
emitAssetDirectory(resolve(dirname(id), '..', 'build', 'Release'));
emitAssetDirectory(resolve(dirname(id), '..', 'prebuilds'));
}
},
argon2({ id, emitAssetDirectory }) {
if (id.endsWith('argon2/argon2.js')) {
emitAssetDirectory(resolve(dirname(id), 'build', 'Release'));
Expand Down
3 changes: 3 additions & 0 deletions test/integration/serialport.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const { SerialPort} = require('serialport');

SerialPort.list();

0 comments on commit e001d05

Please sign in to comment.