Skip to content

🎥 Make videos programmatically with React

skip in vercel ano other environments without rust

Jonny Burger9c104ce8df5c
diff --git a/packages/compositor/build.mjs b/packages/compositor/build.mjs
new file mode 100644
index 0000000000..06675cedf2
--- /dev/null
+++ b/packages/compositor/build.mjs
@@ -0,0 +1,22 @@
+import { execSync } from "child_process";
+import os from "os";
+
+const isWin = os.platform() === "win32";
+const where = isWin ? "where" : "which";
+
+const hasCargo = () => {
+ try {
+ execSync(`${where} cargo`);
+ return true;
+ } catch (err) {
+ return false;
+ }
+};
+
+if (hasCargo()) {
+ execSync("cargo build --release", {
+ stdio: "inherit",
+ });
+} else {
+ console.log("Environment has no cargo. Skipping Rust builds.");
+}
diff --git a/packages/compositor/package.json b/packages/compositor/package.json
index 79016b5dc3..116bac59ab 100644
--- a/packages/compositor/package.json
+++ b/packages/compositor/package.json
@@ -7,7 +7,7 @@
"dist"
],
"scripts": {
- "build": "cargo build --release",
+ "build": "node build.mjs",
"build-all": "sh cross_compile.sh"
},
"author": "",