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 **/.DS_Store
npm-debug.log* npm-debug.log*
*.node *.node
dist

View File

@@ -25,32 +25,36 @@ if (!crossPlatform) {
let targets = []; let targets = [];
switch (process.platform) { switch (process.platform) {
case "win32": 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; break;
case "darwin": case "darwin":
targets = ["x86_64-apple-darwin", "aarch64-apple-darwin"]; targets = [
["x86_64-apple-darwin", 'x64'],
["aarch64-apple-darwin", 'arm64']
];
break; break;
default: 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_ALLOW_CROSS"] = "1";
process.env["PKG_CONFIG_ALL_STATIC"] = "1"; process.env["PKG_CONFIG_ALL_STATIC"] = "1";
break; break;
} }
targets.forEach(target => { fs.mkdirSync(path.join(__dirname, "dist"), { recursive: true });
targets.forEach(([target, nodeArch]) => {
buildNapiModule(target); buildNapiModule(target);
buildProxyBin(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", "output": "dist",
"app": "build" "app": "build"
}, },
"afterSign": "scripts/after-sign.js",
"asarUnpack": ["**/*.node"], "asarUnpack": ["**/*.node"],
"files": [ "files": [
"**/*", "**/*",
@@ -72,6 +71,12 @@
"CFBundleDevelopmentRegion": "en" "CFBundleDevelopmentRegion": "en"
}, },
"singleArchFiles": "node_modules/@bitwarden/desktop-napi/desktop_napi.darwin-*.node", "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"] "target": ["dmg", "zip"]
}, },
"win": { "win": {
@@ -83,16 +88,24 @@
"from": "../../node_modules/regedit/vbs", "from": "../../node_modules/regedit/vbs",
"to": "regedit/vbs", "to": "regedit/vbs",
"filter": ["**/*"] "filter": ["**/*"]
}, }
],
"extraFiles": [
{ {
"from": "desktop_native/target/release/desktop_proxy", "from": "desktop_native/dist/desktop_proxy.${platform}-${arch}.exe",
"to": "desktop_proxy" "to": "desktop_proxy.exe"
} }
] ]
}, },
"linux": { "linux": {
"category": "Utility", "category": "Utility",
"synopsis": "A secure and free password manager for all of your devices.", "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"], "target": ["deb", "freebsd", "rpm", "AppImage", "snap"],
"desktop": { "desktop": {
"Name": "Bitwarden", "Name": "Bitwarden",