infra(crates.io): allow publishing by including assets from a different path
This commit is contained in:
parent
e2217564c2
commit
0d20148518
3 changed files with 17 additions and 6 deletions
|
|
@ -7,7 +7,8 @@ description = "Terminal workspace (WIP)"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/zellij-org/zellij"
|
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
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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/strider.wasm -o assets/plugins/strider.wasm
|
||||||
wasm-opt -O target/wasm32-wasi/release/tab-bar.wasm -o assets/plugins/tab-bar.wasm
|
wasm-opt -O target/wasm32-wasi/release/tab-bar.wasm -o assets/plugins/tab-bar.wasm
|
||||||
echo "Publishing zellij (6/$total)..."
|
echo "Publishing zellij (6/$total)..."
|
||||||
cargo publish $@
|
cargo publish --features publish $@
|
||||||
|
|
|
||||||
18
src/main.rs
18
src/main.rs
|
|
@ -31,13 +31,23 @@ pub fn main() {
|
||||||
// First run installation of default plugins & layouts
|
// First run installation of default plugins & layouts
|
||||||
let project_dirs = ProjectDirs::from("org", "Zellij Contributors", "Zellij").unwrap();
|
let project_dirs = ProjectDirs::from("org", "Zellij Contributors", "Zellij").unwrap();
|
||||||
let data_dir = project_dirs.data_dir();
|
let data_dir = project_dirs.data_dir();
|
||||||
let assets = asset_map! {
|
let mut 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",
|
|
||||||
"assets/layouts/default.yaml" => "layouts/default.yaml",
|
"assets/layouts/default.yaml" => "layouts/default.yaml",
|
||||||
"assets/layouts/strider.yaml" => "layouts/strider.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 {
|
for (path, bytes) in assets {
|
||||||
let path = data_dir.join(path);
|
let path = data_dir.join(path);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue