Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: soroban init command #1156

Merged
merged 28 commits into from
Jan 22, 2024
Merged

Conversation

elizabethengelman
Copy link
Contributor

@elizabethengelman elizabethengelman commented Jan 4, 2024

What

This PR adds a soroban init command to the CLI to allow for initializing a new soroban rust project.

Addresses #656

Why

The intention of this change is to make it easier to get up and running with a soroban project, and to allow for the Getting Started guide to be more concise by being able to remove some of the boilerplate Rust setup.

Known limitations

  • Currently, this command creates a plain Rust project, there are plans to have a follow-up PR that will allow a user to pass in a specific frontend (--frontend-template) to use so that the project can be set up for frontend development as well. The first FE will be Astro, since we already have an example Astro project working.
  • I am seeing a pre-push check failing locally for this branch as well as on main.
error[E0046]: not all trait items implemented, missing: `escalate_error_to_panic`
    --> /Users/elizabethengelman/.cargo/git/checkouts/rs-soroban-sdk-0ab58a716c671239/93b09e4/soroban-sdk/src/env.rs:1449:1
     |
1449 | impl internal::EnvBase for Env {
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `escalate_error_to_panic` in implementation
     |
     = help: implement the missing item: `fn escalate_error_to_panic(&self, _: <Self as soroban_env_host::EnvBase>::Error) -> ! { todo!() }`

cmd/soroban-cli/src/commands/init.rs Outdated Show resolved Hide resolved
cmd/soroban-cli/src/commands/init.rs Outdated Show resolved Hide resolved
cmd/soroban-cli/Cargo.toml Show resolved Hide resolved
cmd/soroban-cli/src/commands/init.rs Outdated Show resolved Hide resolved
@elizabethengelman elizabethengelman changed the title Feat/soroban init feat: soroban init command Jan 4, 2024
@elizabethengelman elizabethengelman marked this pull request as ready for review January 4, 2024 19:53
@mollykarcher mollykarcher added the cli Related to Soroban CLI label Jan 4, 2024
Copy link
Contributor

@stellarsaur stellarsaur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition to the CLI!

cmd/soroban-cli/src/commands/init.rs Outdated Show resolved Hide resolved
cmd/soroban-cli/src/commands/init.rs Outdated Show resolved Hide resolved
Copy link
Member

@leighmcculloch leighmcculloch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏🏻 This is looking nice. I tried it out locally and left some comments inline.

cmd/soroban-cli/src/commands/init.rs Outdated Show resolved Hide resolved
cmd/soroban-cli/src/commands/init.rs Outdated Show resolved Hide resolved
cmd/soroban-cli/src/commands/mod.rs Outdated Show resolved Hide resolved
cmd/soroban-cli/src/commands/init.rs Outdated Show resolved Hide resolved
cmd/soroban-cli/src/commands/init.rs Outdated Show resolved Hide resolved
cmd/soroban-cli/src/commands/init.rs Outdated Show resolved Hide resolved
cmd/soroban-cli/src/commands/init.rs Outdated Show resolved Hide resolved
cmd/soroban-cli/src/commands/init.rs Outdated Show resolved Hide resolved
cmd/soroban-cli/src/commands/init.rs Outdated Show resolved Hide resolved
@elizabethengelman elizabethengelman force-pushed the feat/soroban-init branch 2 times, most recently from 1cd7efe to db5ceeb Compare January 11, 2024 15:20
@elizabethengelman
Copy link
Contributor Author

I just pushed up a change that adds the template code in this repo with the increment example contract, which I hope addresses a couple of the outstanding pieces on this PR. d71493f and 4daf40b

  • users should be able to run soroban contract init without the need for an internet connection since the template code is in this repo
  • the project will include an example contract by default, so that we're not initializing an empty project
  • I'm thinking that we can make the inclusion of other examples via --with-example from the examples repo be dependent on an internet connection, and in a follow-up PR we can generate the list instead of hardcoding it, and fall back to just including increment

Right now I just added the template code in cmd/soroban-cli/src/utils/, but in the future, maybe we can think about including it via git submodule or something. But I think that can be an add-on later. Also, happy to rethink if utils is the best place for it.

@leighmcculloch @stellarsaur curious to see what you think!

Copy link
Contributor

@chadoh chadoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed two things that I hope are quick to fix!

cmd/soroban-cli/src/commands/contract/mod.rs Show resolved Hide resolved
cmd/soroban-cli/src/commands/contract/init.rs Outdated Show resolved Hide resolved
@elizabethengelman elizabethengelman merged commit 07dcd3c into stellar:main Jan 22, 2024
25 checks passed
@elizabethengelman elizabethengelman deleted the feat/soroban-init branch January 22, 2024 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to Soroban CLI
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants