Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
chore: run cap-setup when runing dev (#314)
McPizza9ca21c5b8eff
diff --git a/apps/desktop/package.json b/apps/desktop/package.jsonindex 80edef29b..a277dada8 100644--- a/apps/desktop/package.json+++ b/apps/desktop/package.json@@ -2,7 +2,7 @@"name": "@cap/desktop","type": "module","scripts": {- "dev": "cross-env RUST_BACKTRACE=1 dotenv -e ../../.env -- pnpm run preparescript && tauri dev",+ "dev": "pnpm -w cap-setup && cross-env RUST_BACKTRACE=1 dotenv -e ../../.env -- pnpm run preparescript && tauri dev","build:tauri": "dotenv -e ../../.env -- pnpm run preparescript && tauri build","preparescript": "node scripts/prepare.js","localdev": "dotenv -e ../../.env -- vinxi dev --port 3001",diff --git a/scripts/setup.js b/scripts/setup.jsindex 7edc3ce08..5588a282a 100644--- a/scripts/setup.js+++ b/scripts/setup.js@@ -16,30 +16,36 @@ const targetDir = path.join(__root, "target");const arch = process.arch === "arm64" ? "aarch64" : "x86_64";+// IMPORTANT: Increment this number when the setup script changes+const SETUP_VERSION_NUMBER = 1;+async function main() {+ await fs.mkdir(targetDir, { recursive: true });+if (process.platform === "darwin") {- const NATIVE_DEPS_URL =- "https://github.com/spacedriveapp/native-deps/releases/latest/download";+ const NATIVE_DEPS_VERSION = "v0.25";+ const NATIVE_DEPS_URL = `https://github.com/spacedriveapp/native-deps/releases/download/${NATIVE_DEPS_VERSION}`;const NATIVE_DEPS_ASSETS = {x86_64: "native-deps-x86_64-darwin-apple.tar.xz",aarch64: "native-deps-aarch64-darwin-apple.tar.xz",};- await fs.mkdir(targetDir, { recursive: true });-- const nativeDepsTar = path.join(targetDir, "/native-deps.tar.xz");- if (!(await fileExists(nativeDepsTar))) {+ const nativeDepsTar = `native-deps-${NATIVE_DEPS_VERSION}.tar.xz`;+ const nativeDepsTarPath = path.join(targetDir, nativeDepsTar);+ if (!(await fileExists(nativeDepsTarPath))) {+ console.log(`Downloading ${nativeDepsTar}`);const nativeDepsBytes = await fetch(`${NATIVE_DEPS_URL}/${NATIVE_DEPS_ASSETS[arch]}`).then((r) => r.blob()).then((b) => b.arrayBuffer());- await fs.writeFile(nativeDepsTar, Buffer.from(nativeDepsBytes));+ await fs.writeFile(nativeDepsTarPath, Buffer.from(nativeDepsBytes));console.log("Downloaded native deps");- } else console.log("Using cached native-deps.tar.xz");+ } else console.log(`Using cached ${nativeDepsTar}`);- const nativeDepsDir = path.join(targetDir, "/native-deps");+ const nativeDepsFolder = `native-deps-${NATIVE_DEPS_VERSION}`;+ const nativeDepsDir = path.join(targetDir, nativeDepsFolder);const frameworkDir = path.join(nativeDepsDir, "Spacedrive.framework");if (!(await fileExists(nativeDepsDir))) {await fs.mkdir(nativeDepsDir, { recursive: true });@@ -49,8 +55,8 @@ async function main() {"native-deps.tar.xz")} -C ${nativeDepsDir}`);- console.log("Extracted native-deps");- } else console.log("Using cached native-deps");+ console.log(`Extracted ${nativeDepsFolder}`);+ } else console.log(`Using cached ${nativeDepsFolder}`);await trimMacOSFramework(frameworkDir);console.log("Trimmed .framework");@@ -81,19 +87,21 @@ async function main() {}console.log("Copied ffmpeg dylibs to target/debug");} else if (process.platform === "win32") {- const FFMPEG_ZIP_NAME = "ffmpeg-7.1-full_build-shared";- const FFMPEG_ZIP_URL = `https://github.com/GyanD/codexffmpeg/releases/download/7.1/${FFMPEG_ZIP_NAME}.zip`;+ const FFMPEG_VERSION = "7.1";+ const FFMPEG_ZIP_NAME = `ffmpeg-${FFMPEG_VERSION}-full_build-shared`;+ const FFMPEG_ZIP_URL = `https://github.com/GyanD/codexffmpeg/releases/download/${FFMPEG_VERSION}/${FFMPEG_ZIP_NAME}.zip`;await fs.mkdir(targetDir, { recursive: true });- const ffmpegZip = path.join(targetDir, "ffmpeg.zip");- if (!(await fileExists(ffmpegZip))) {+ const ffmpegZip = `ffmpeg-${FFMPEG_VERSION}.zip`;+ const ffmpegZipPath = path.join(targetDir, ffmpegZip);+ if (!(await fileExists(ffmpegZipPath))) {const ffmpegZipBytes = await fetch(FFMPEG_ZIP_URL).then((r) => r.blob()).then((b) => b.arrayBuffer());- await fs.writeFile(ffmpegZip, Buffer.from(ffmpegZipBytes));- console.log("Downloaded ffmpeg.zip");- } else console.log("Using cached ffmpeg.zip");+ await fs.writeFile(ffmpegZipPath, Buffer.from(ffmpegZipBytes));+ console.log(`Downloaded ${ffmpegZip}`);+ } else console.log(`Using cached ${ffmpegZip}`);const ffmpegDir = path.join(targetDir, "ffmpeg");if (!(await fileExists(ffmpegDir))) {