Skip to content

Commit e001d05

Browse files
fix: Add special case for Serial Port binary (.node) modules (#415)
Tested with prebuilds and compiling serialport from source
1 parent cb1e49d commit e001d05

4 files changed

Lines changed: 255 additions & 0 deletions

File tree

package-lock.json

Lines changed: 245 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@
120120
"saslprep": "^1.0.3",
121121
"semver": "^7.5.2",
122122
"sequelize": "^6.29.0",
123+
"serialport": "^12.0.0",
123124
"sharp": "^0.33.1",
124125
"shiki": "^0.14.5",
125126
"socket.io": "^2.4.0",

src/utils/special-cases.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ const specialCases: Record<string, (o: SpecialCaseOpts) => void> = {
1212
emitAssetDirectory(resolve(dirname(id), 'runtime/'));
1313
}
1414
},
15+
'@serialport/bindings-cpp'({ id, emitAssetDirectory }) {
16+
if (id.endsWith('@serialport/bindings-cpp/dist/index.js')) {
17+
emitAssetDirectory(resolve(dirname(id), '..', 'build', 'Release'));
18+
emitAssetDirectory(resolve(dirname(id), '..', 'prebuilds'));
19+
}
20+
},
1521
argon2({ id, emitAssetDirectory }) {
1622
if (id.endsWith('argon2/argon2.js')) {
1723
emitAssetDirectory(resolve(dirname(id), 'build', 'Release'));

test/integration/serialport.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const { SerialPort} = require('serialport');
2+
3+
SerialPort.list();

0 commit comments

Comments
 (0)