1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 15:23:33 +00:00

Bundle the desktop_proxy file

This commit is contained in:
Daniel García
2024-07-08 16:31:40 +02:00
parent 004188fe60
commit b6c42f6aa6
3 changed files with 37 additions and 19 deletions

View File

@@ -4,3 +4,4 @@ index.node
**/.DS_Store
npm-debug.log*
*.node
dist

View File

@@ -25,32 +25,36 @@ if (!crossPlatform) {
let targets = [];
switch (process.platform) {
case "win32":
targets = ["i686-pc-windows-msvc", "x86_64-pc-windows-msvc", "aarch64-pc-windows-msvc"];
targets = [
["i686-pc-windows-msvc", 'ia32'],
["x86_64-pc-windows-msvc", 'x64'],
["aarch64-pc-windows-msvc", 'arm64']
];
break;
case "darwin":
targets = ["x86_64-apple-darwin", "aarch64-apple-darwin"];
targets = [
["x86_64-apple-darwin", 'x64'],
["aarch64-apple-darwin", 'arm64']
];
break;
default:
targets = ['x86_64-unknown-linux-musl'];
targets = [
['x86_64-unknown-linux-musl', 'x64']
];
process.env["PKG_CONFIG_ALLOW_CROSS"] = "1";
process.env["PKG_CONFIG_ALL_STATIC"] = "1";
break;
}
targets.forEach(target => {
fs.mkdirSync(path.join(__dirname, "dist"), { recursive: true });
targets.forEach(([target, nodeArch]) => {
buildNapiModule(target);
buildProxyBin(target);
const ext = process.platform === "win32" ? ".exe" : "";
fs.copyFileSync(path.join(__dirname, "target", target, "release", `desktop_proxy${ext}`), path.join(__dirname, "dist", `desktop_proxy.${process.platform}-${nodeArch}${ext}`));
});
if (process.platform === "darwin") {
fs.mkdirSync(path.join(__dirname, "target", "darwin-universal"), { recursive: true });
let command = `lipo -create -output ${path.join(__dirname, "target", "darwin-universal", "desktop_proxy")} `;
targets.forEach(target => {
command += `${path.join(__dirname, "target", target, "release", "desktop_proxy")} `;
});
child_process.execSync(command, { stdio: 'inherit', cwd: __dirname});
}

View File

@@ -11,7 +11,6 @@
"output": "dist",
"app": "build"
},
"afterSign": "scripts/after-sign.js",
"asarUnpack": ["**/*.node"],
"files": [
"**/*",
@@ -72,6 +71,12 @@
"CFBundleDevelopmentRegion": "en"
},
"singleArchFiles": "node_modules/@bitwarden/desktop-napi/desktop_napi.darwin-*.node",
"extraFiles": [
{
"from": "desktop_native/dist/desktop_proxy.${platform}-${arch}",
"to": "desktop_proxy"
}
],
"target": ["dmg", "zip"]
},
"win": {
@@ -83,16 +88,24 @@
"from": "../../node_modules/regedit/vbs",
"to": "regedit/vbs",
"filter": ["**/*"]
},
}
],
"extraFiles": [
{
"from": "desktop_native/target/release/desktop_proxy",
"to": "desktop_proxy"
"from": "desktop_native/dist/desktop_proxy.${platform}-${arch}.exe",
"to": "desktop_proxy.exe"
}
]
},
"linux": {
"category": "Utility",
"synopsis": "A secure and free password manager for all of your devices.",
"extraFiles": [
{
"from": "desktop_native/dist/desktop_proxy.${platform}-${arch}",
"to": "desktop_proxy"
}
],
"target": ["deb", "freebsd", "rpm", "AppImage", "snap"],
"desktop": {
"Name": "Bitwarden",