mirror of
https://github.com/bitwarden/clients.git
synced 2026-07-21 21:17:06 +08:00
We added a unix flavor of the script in #19891. This change adds a Windows flavor of the script. Additionally this change also improves the lint staged to run in node, rather than a platform specific OS. This involved creating a helper script to run the cargo tools.
27 lines
771 B
JavaScript
27 lines
771 B
JavaScript
#!/usr/bin/env node
|
|
|
|
// Helper script for git pre-commit hooks only (via lint-staged).
|
|
// Not intended to be run directly.
|
|
|
|
import { execSync } from "child_process";
|
|
import { dirname, resolve } from "path";
|
|
import { fileURLToPath } from "url";
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
const cwd = resolve(__dirname, "../apps/desktop/desktop_native");
|
|
const prepareScript =
|
|
process.platform === "win32"
|
|
? "scripts/prepare-env-windows-rust.ps1"
|
|
: "scripts/prepare-env-unix-rust.sh";
|
|
|
|
const args = process.argv.slice(2).join(" ");
|
|
|
|
try {
|
|
execSync(`cargo ${args}`, { cwd, stdio: "inherit" });
|
|
} catch {
|
|
console.error(
|
|
`\nIf you are missing the required Rust tools, you can install them with ${prepareScript}\n`,
|
|
);
|
|
process.exit(1);
|
|
}
|