Skip to content

Commit

Permalink
init forge project with zksync
Browse files Browse the repository at this point in the history
  • Loading branch information
nbaztec committed Sep 20, 2024
1 parent d9af657 commit 3deda3c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
13 changes: 12 additions & 1 deletion crates/forge/bin/cmd/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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)?;
Expand Down
4 changes: 4 additions & 0 deletions crates/forge/bin/cmd/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 3deda3c

Please sign in to comment.