infra(crates.io): allow publishing by including assets from a different path

This commit is contained in:
Brooks J Rady 2021-02-25 23:26:31 +00:00
parent e2217564c2
commit 0d20148518
3 changed files with 17 additions and 6 deletions

View File

@ -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

View File

@ -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 $@

View File

@ -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);