Skip to content

Commit

Permalink
feat: add build script for topos-sequencer-subnet-client
Browse files Browse the repository at this point in the history
Signed-off-by: Jawad Tariq <[email protected]>
  • Loading branch information
JDawg287 committed Mar 14, 2024
1 parent b469dfe commit 3899a4a
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions crates/topos-sequencer-subnet-client/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
use std::process::{exit, Command};

const CONTRACTS_PATH: &str = "../../contracts";

fn main() {
if !CONTRACTS_PATH.is_empty() {
std::env::set_current_dir(CONTRACTS_PATH).unwrap_or_else(|err| {
eprintln!("Error changing to subdirectory: {}", err);
exit(1);
});
}

Command::new("npm")
.arg("ci")
.status()
.unwrap_or_else(|err| {
eprintln!("Error executing npm ci: {}", err);
exit(1);
});

Command::new("npm")
.arg("run")
.arg("build")
.status()
.unwrap_or_else(|err| {
eprintln!("Error executing npm run build: {}", err);
exit(1);
});

std::env::set_current_dir("..").unwrap_or_else(|err| {
eprintln!("Error changing back to the original directory: {}", err);
exit(1);
});

println!("cargo:rerun-if-changed={}", CONTRACTS_PATH);
}

0 comments on commit 3899a4a

Please sign in to comment.