diff --git a/dapp/package.json b/dapp/package.json index 67c4b266c..7d4e89a85 100644 --- a/dapp/package.json +++ b/dapp/package.json @@ -23,7 +23,7 @@ }, "scripts": { "dev": "vite", - "build": "tsc && vite build && cp -r ./dist ../rust-executor/dapp", + "build": "tsc && vite build", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview" }, diff --git a/rust-executor/.gitignore b/rust-executor/.gitignore index 16fbedc51..e6ea29a4c 100644 --- a/rust-executor/.gitignore +++ b/rust-executor/.gitignore @@ -6,5 +6,4 @@ schema.gql !src/js_core/pubsub_extension.js !src/js_core/jwt_extension.js !src/prolog_service/prolog_service_extension.js -!src/holochain_service/holochain_service_extension.js -dapp \ No newline at end of file +!src/holochain_service/holochain_service_extension.js \ No newline at end of file diff --git a/rust-executor/Cargo.toml b/rust-executor/Cargo.toml index 8f47dd193..51893ce5a 100644 --- a/rust-executor/Cargo.toml +++ b/rust-executor/Cargo.toml @@ -11,6 +11,14 @@ repository = "https://github.com/perspect3vism/ad4m" documentation = "https://docs.ad4m.dev" readme = "README.md" +include = [ + "src/**/*", + "dapp", # Symlink to the dapp directory + "executor", # Symlink to the executor directory + "build.rs", + "Cargo.toml" +] + [lib] name = "rust_executor" path = "src/lib.rs" diff --git a/rust-executor/build.rs b/rust-executor/build.rs index 2dc9b54d4..b25e0e9e5 100644 --- a/rust-executor/build.rs +++ b/rust-executor/build.rs @@ -3,7 +3,7 @@ use std::path::Path; use std::process::Command; fn build_dapp() -> std::io::Result<()> { - let dapp_dir = Path::new("../dapp"); + let dapp_dir = Path::new("./dapp"); // Navigate to the dapp directory std::env::set_current_dir(&dapp_dir)?; @@ -30,6 +30,7 @@ fn build_dapp() -> std::io::Result<()> { Ok(()) } +#[allow(dead_code)] fn copy_dir_recursive(source: &Path, target: &Path) -> std::io::Result<()> { if source.is_dir() { fs::create_dir_all(target)?; @@ -45,7 +46,7 @@ fn copy_dir_recursive(source: &Path, target: &Path) -> std::io::Result<()> { } fn build_js_executor() -> std::io::Result<()> { - let executor_dir = Path::new("../executor"); + let executor_dir = Path::new("./executor"); // Navigate to the executor directory std::env::set_current_dir(&executor_dir)?; @@ -83,17 +84,6 @@ fn main() { std::process::exit(1); } - let source_dir = "../dapp/public"; - let target_dir = concat!(env!("CARGO_MANIFEST_DIR"), "/dapp"); - - println!("Copying from {} to {}", source_dir, target_dir); - - - if let Err(err) = copy_dir_recursive(Path::new(source_dir), Path::new(target_dir)) { - eprintln!("Error copying directory: {}", err); - std::process::exit(1); // Exit with an error code to fail the build if the copy fails - } - if let Err(err) = build_js_executor() { eprintln!("Error building JS executor: {}", err); std::process::exit(1); diff --git a/rust-executor/dapp b/rust-executor/dapp new file mode 120000 index 000000000..5010a65d9 --- /dev/null +++ b/rust-executor/dapp @@ -0,0 +1 @@ +../dapp \ No newline at end of file diff --git a/rust-executor/executor b/rust-executor/executor new file mode 120000 index 000000000..5ba960b7b --- /dev/null +++ b/rust-executor/executor @@ -0,0 +1 @@ +../executor \ No newline at end of file diff --git a/rust-executor/src/dapp_server.rs b/rust-executor/src/dapp_server.rs index 5675653e7..ec1117e6c 100644 --- a/rust-executor/src/dapp_server.rs +++ b/rust-executor/src/dapp_server.rs @@ -11,14 +11,14 @@ pub(crate) async fn serve_dapp(port: u16) -> Result<(), Box HashMap { ); map.insert( "https://ad4m.runtime/executor".to_string(), - include_str!("../../../executor/lib/bundle.js").to_string(), + include_str!("../../executor/lib/bundle.js").to_string(), ); map }