Skip to content

Commit

Permalink
feat: always unpack native node files (#8392)
Browse files Browse the repository at this point in the history
  • Loading branch information
beyondkmp authored Aug 6, 2024
1 parent 9dc0b49 commit 12c52a8
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/brown-singers-breathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"app-builder-lib": patch
---

Automatically place .node files into app.asar.unpack
2 changes: 1 addition & 1 deletion packages/app-builder-lib/src/asar/unpackDetector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function addValue(map: Map<string, Array<string>>, key: string, value: string) {
}

export function isLibOrExe(file: string): boolean {
return file.endsWith(".dll") || file.endsWith(".exe") || file.endsWith(".dylib") || file.endsWith(".so")
return file.endsWith(".dll") || file.endsWith(".exe") || file.endsWith(".dylib") || file.endsWith(".so") || file.endsWith(".node")
}

/** @internal */
Expand Down
56 changes: 55 additions & 1 deletion test/snapshots/BuildTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -907,30 +907,36 @@ Object {
"files": Object {
"LICENSE.md": Object {
"size": "<size>",
"unpacked": true,
},
"build": Object {
"files": Object {
"Release": Object {
"files": Object {
"keytar.node": Object {
"executable": true,
"size": "<size>",
"unpacked": true,
},
},
"unpacked": true,
},
},
},
"lib": Object {
"files": Object {
"keytar.js": Object {
"size": "<size>",
"unpacked": true,
},
},
"unpacked": true,
},
"package.json": Object {
"size": "<size>",
"unpacked": true,
},
},
"unpacked": true,
},
"mimic-response": Object {
"files": Object {
Expand Down Expand Up @@ -4853,6 +4859,54 @@ Object {
exports[`posix smart unpack 4`] = `
Array [
"app.asar",
"app.asar.unpacked/node_modules/keytar/LICENSE.md",
Object {
"content": "{
\\"main\\": \\"./lib/keytar.js\\",
\\"typings\\": \\"keytar.d.ts\\",
\\"name\\": \\"keytar\\",
\\"description\\": \\"Bindings to native Mac/Linux/Windows password APIs\\",
\\"version\\": \\"7.9.0\\",
\\"license\\": \\"MIT\\",
\\"repository\\": {
\\"type\\": \\"git\\",
\\"url\\": \\"https://github.com/atom/node-keytar.git\\"
},
\\"homepage\\": \\"http://atom.github.io/node-keytar\\",
\\"files\\": [
\\"lib\\",
\\"src\\",
\\"binding.gyp\\",
\\"keytar.d.ts\\"
],
\\"types\\": \\"./keytar.d.ts\\",
\\"devDependencies\\": {
\\"babel-core\\": \\"^6.26.3\\",
\\"babel-plugin-transform-async-to-generator\\": \\"^6.24.1\\",
\\"chai\\": \\"^4.2.0\\",
\\"mocha\\": \\"^9.2.0\\",
\\"node-cpplint\\": \\"~0.4.0\\",
\\"node-gyp\\": \\"^8.4.1\\",
\\"prebuild\\": \\"^11.0.2\\"
},
\\"dependencies\\": {
\\"node-addon-api\\": \\"^4.3.0\\",
\\"prebuild-install\\": \\"^7.0.1\\"
},
\\"binary\\": {
\\"napi_versions\\": [
3
]
},
\\"config\\": {
\\"runtime\\": \\"napi\\",
\\"target\\": 3
}
}",
"name": "app.asar.unpacked/node_modules/keytar/package.json",
},
"app.asar.unpacked/node_modules/keytar/lib/keytar.js",
"app.asar.unpacked/node_modules/keytar/build/Release/keytar.node",
]
`;

Expand Down

0 comments on commit 12c52a8

Please sign in to comment.