diff --git a/Cargo.toml b/Cargo.toml index 7059c3b65..fa32f5821 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,8 @@ description = "Terminal workspace (WIP)" license = "MIT" repository = "https://github.com/zellij-org/zellij" -include = ["target/*.wasm"] +[features] +publish = [] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/publish.sh b/publish.sh index e84c0c0e7..d6e22da8b 100755 --- a/publish.sh +++ b/publish.sh @@ -20,4 +20,4 @@ wasm-opt -O target/wasm32-wasi/release/status-bar.wasm -o assets/plugins/status- wasm-opt -O target/wasm32-wasi/release/strider.wasm -o assets/plugins/strider.wasm wasm-opt -O target/wasm32-wasi/release/tab-bar.wasm -o assets/plugins/tab-bar.wasm echo "Publishing zellij (6/$total)..." -cargo publish $@ +cargo publish --features publish $@ diff --git a/src/main.rs b/src/main.rs index c4123e556..716acb91c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,13 +31,23 @@ pub fn main() { // First run installation of default plugins & layouts let project_dirs = ProjectDirs::from("org", "Zellij Contributors", "Zellij").unwrap(); let data_dir = project_dirs.data_dir(); - let assets = asset_map! { - "target/status-bar.wasm" => "plugins/status-bar.wasm", - "target/tab-bar.wasm" => "plugins/tab-bar.wasm", - "target/strider.wasm" => "plugins/strider.wasm", + let mut assets = asset_map! { "assets/layouts/default.yaml" => "layouts/default.yaml", "assets/layouts/strider.yaml" => "layouts/strider.yaml", }; + // FIXME: This is a hideous hack and I hate it (a lot) + #[cfg(not(feature = "publish"))] + assets.extend(asset_map! { + "target/status-bar.wasm" => "plugins/status-bar.wasm", + "target/tab-bar.wasm" => "plugins/tab-bar.wasm", + "target/strider.wasm" => "plugins/strider.wasm", + }); + #[cfg(feature = "publish")] + assets.extend(asset_map! { + "assets/plugins/status-bar.wasm" => "plugins/status-bar.wasm", + "assets/plugins/tab-bar.wasm" => "plugins/tab-bar.wasm", + "assets/plugins/strider.wasm" => "plugins/strider.wasm", + }); for (path, bytes) in assets { let path = data_dir.join(path);