diff --git a/crates/forge/bin/cmd/init.rs b/crates/forge/bin/cmd/init.rs index 1882eca60..54d871158 100644 --- a/crates/forge/bin/cmd/init.rs +++ b/crates/forge/bin/cmd/init.rs @@ -44,7 +44,7 @@ pub struct InitArgs { impl InitArgs { pub fn run(self) -> Result<()> { let Self { root, template, branch, opts, offline, force, vscode } = self; - let DependencyInstallOpts { shallow, no_git, no_commit, quiet } = opts; + let DependencyInstallOpts { shallow, no_git, no_commit, quiet, zksync } = opts; // create the root dir if it does not exist if !root.exists() { @@ -153,6 +153,17 @@ impl InitArgs { } } + // install forge-zksync-std + if zksync && !offline { + if root.join("lib/forge-zksync-std").exists() { + p_println!(!quiet => "\"lib/forge-zksync-std\" already exists, skipping install...."); + self.opts.install(&mut config, vec![])?; + } else { + let dep = "https://github.com/Moonsong-Labs/forge-zksync-std".parse()?; + self.opts.install(&mut config, vec![dep])?; + } + } + // init vscode settings if vscode { init_vscode(&root)?; diff --git a/crates/forge/bin/cmd/install.rs b/crates/forge/bin/cmd/install.rs index 57096f859..77fad0282 100644 --- a/crates/forge/bin/cmd/install.rs +++ b/crates/forge/bin/cmd/install.rs @@ -81,6 +81,10 @@ pub struct DependencyInstallOpts { /// Do not print any messages. #[arg(short, long)] pub quiet: bool, + + /// Install ZKsync specific libraries. + #[arg(long)] + pub zksync: bool, } impl DependencyInstallOpts {