-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
843 additions
and
83 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use super::CommonOptions; | ||
use anyhow::Result; | ||
use clap::Args; | ||
use std::fs; | ||
use warg_protocol::registry::PackageId; | ||
use wasm_bundle::Bundler; | ||
|
||
/// Bundle With Registry Dependencies | ||
#[derive(Args)] | ||
pub struct BundleCommand { | ||
/// The common command options. | ||
#[clap(flatten)] | ||
pub common: CommonOptions, | ||
|
||
/// Only show information for the specified package. | ||
#[clap(value_name = "PACKAGE")] | ||
pub package: Option<PackageId>, | ||
} | ||
|
||
impl BundleCommand { | ||
/// Executes the command. | ||
pub async fn exec(self) -> Result<()> { | ||
let config = self.common.read_config()?; | ||
let client = self.common.create_client(&config)?; | ||
|
||
println!("registry: {url}", url = client.url()); | ||
println!("\npackages in client storage:"); | ||
let mut bundler = Bundler::new(&client); | ||
let locked = fs::read("./locked.wasm")?; | ||
let bundled = bundler.parse(&locked).await?; | ||
fs::write("./bundled.wasm", bundled.as_slice())?; | ||
Ok(()) | ||
} | ||
} |
Oops, something went wrong.