From 2624522c50327e0565ba54c7b51dd5f1ddba06a5 Mon Sep 17 00:00:00 2001 From: Alfredo Gallardo Date: Mon, 9 Dec 2024 20:35:57 -0300 Subject: [PATCH] - fix: prevent build script when publishing (#83) --- libs/shinkai-tools-runner/build.rs | 15 +++++++++------ scripts/copy-deno.ts | 25 ------------------------- 2 files changed, 9 insertions(+), 31 deletions(-) delete mode 100644 scripts/copy-deno.ts diff --git a/libs/shinkai-tools-runner/build.rs b/libs/shinkai-tools-runner/build.rs index 0b7acbe..4beb625 100644 --- a/libs/shinkai-tools-runner/build.rs +++ b/libs/shinkai-tools-runner/build.rs @@ -6,10 +6,13 @@ mod copy_assets; fn main() { println!("cargo:rerun-if-changed=copy_assets.rs"); - // Get profile (debug/release) from cargo - let profile = env::var("PROFILE").unwrap(); - copy_assets::copy_assets( - Some(PathBuf::from(".")), - Some(PathBuf::from("../../target").join(&profile)), - ); + + if env::var("CARGO_PUBLISH").is_err() { + let profile = env::var("PROFILE").unwrap(); + copy_assets::copy_assets( + Some(PathBuf::from(".")), + Some(PathBuf::from("../../target").join(&profile)), + ) + .unwrap(); + } } diff --git a/scripts/copy-deno.ts b/scripts/copy-deno.ts deleted file mode 100644 index 8092338..0000000 --- a/scripts/copy-deno.ts +++ /dev/null @@ -1,25 +0,0 @@ -import * as fs from 'node:fs'; -import process from 'node:process'; -import path from 'node:path'; - -const destinationArg = Deno.args[0]; -const singleAppBinaryName = process.platform === 'win32' ? 'deno.exe' : 'deno'; -const destination = path.join(process.cwd(), destinationArg, singleAppBinaryName); -function bundle() { - try { - // Step: Copy the Deno executable to create our custom executable - console.log('step: copying Deno executable...'); - const denoPath = Deno.execPath(); - fs.mkdirSync(path.dirname(destination), { recursive: true }); - fs.copyFileSync(denoPath, destination); - console.log('deno executable copied successfully.'); - console.log('bundling completed successfully.'); - } catch (error) { - console.error('bundling failed:', error); - process.exit(1); - } -} - -// Execute the bundling process -console.log('initiating bundling process...'); -bundle();