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: more holistic frontend-template deep-dive #952

Merged
merged 3 commits into from
Sep 20, 2024

Conversation

chadoh
Copy link
Contributor

@chadoh chadoh commented Aug 29, 2024

This replaces soroban-contract-init-template. This is Step 1 in an effort to address:

The goal is to create a DevRel initiative around creating frontend templates, maybe including bounties for creating and maintaining them. But first, we need a solid guide to help people create them. That's what this does.

The old document was mostly focused on helping someone author the initialize.js script. The new one advises people to copy-paste the one from the official template, without explaining every detail of what it does. However, the old page here made me think that a lot of people probably didn't find the initialize.js script particularly readable, so I've also improved it and added many comments:

Having a more readable, well-commented script means we can avoid such detailed explanation here.

Which is good, because there's lots of other details the old guide didn't get to!

As you can see in this new guide, it now leads you through searching for templates on GitHub, then explains how they work at a high-level. It has you build your own, and explains gotchas along the way, like that you should not commit the Cargo.toml file or hard-code a reliance on specific contracts (other than hello_world).

Direct preview link

I suggest reading the preview link, not the diff here, since this was a full rewrite and git is bad at showing those: https://developers-pr952.previews.kube001.services.stellar-ops.com/docs/build/guides/dapps/soroban-contract-init-template

This replaces `soroban-contract-init-template`.

The old document was mostly focused on helping someone author the
`initialize.js` script. The new one advises people to copy-paste the one
from the official template, without explaining every detail of what it
does. However, the old page here made me think that a lot of people
probably didn't find the `initialize.js` script particularly readable,
so I've also improved it and added many comments:

- stellar/soroban-template-astro#10

Having a more readable, well-commented script means we can avoid such
detailed explanation here.

Which is good, because there's lots of other details the old guide
didn't get to!

As you can see in this new guide, it now leads you through searching for
templates on GitHub, then explains how they work at a high-level. It has
you build your own, and explains gotchas along the way, like that you
should not commit the `Cargo.toml` file or hard-code a reliance on
specific contracts (other than `hello_world`).
+ >
+ <label>
+ Who you gonna call? &nbsp;
+ <input name="toWhom" value="World" /> &nbsp;
Copy link
Contributor Author

@chadoh chadoh Aug 29, 2024

Choose a reason for hiding this comment

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

I wanted to make this say "ghost busters!" but we need to wait for a fix to the CLI to make that possible

After this is released, I can update this guide to say "ghost busters!"

@stellar-jenkins
Copy link


By printing the `helloWorldContract` object, you'll find the hello method which coincides with the hello function defined in the smart contract. Calling this method will invoke its equivalent in the smart contract.
And projects that use yours will want to commit the `Cargo.*` files and `contracts`, but your _template_ should not include them. That can cause problems with project initialization later. Nor should it gitignore them, because your `.gitignore` will be part of projects started with your template! It would cause problems and confusion, if people didn't realize that some of their most important files were gitignored!
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we should allow people to add these files to their templates, and just skip importing them into the created project:

Once we implement that, I'll circle back and update this guide.


We start off by creating `initialize.js` files in our frontend project directory.
In GitHub, in the main search bar, search for `"soroban-template-"`. With the quotes. Here's a direct link to the search results: [github.com/search?q=%22soroban-template-%22](https://github.com/search?q=%22soroban-template-%22)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ElliotFriend right now we can't search well for the templates, because I put the astro in the middle. This means you need to search for soroban-*-template, without quotes, and you get a fair bit of noise. My bad! Would you be able to change the name of https://github.com/stellar/soroban-astro-template to soroban-template-astro?

@CaptainPrinz could you also change the name of https://github.com/CaptainPrinz/soroban-react-template to soroban-template-react?

Copy link
Contributor

Choose a reason for hiding this comment

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

@ElliotFriend! Just a quick tag for this.

Copy link
Contributor

Choose a reason for hiding this comment

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

@ElliotFriend ... Would you be able to change the name of https://github.com/stellar/soroban-astro-template to soroban-template-astro?

On it!

Copy link
Contributor

@ElliotFriend ElliotFriend Sep 17, 2024

Choose a reason for hiding this comment

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

chadoh and others added 2 commits August 30, 2024 13:05
and add "Wrapping up" section to end of frontend template guide
@stellar-jenkins
Copy link

1 similar comment
@stellar-jenkins
Copy link

@briwylde08 briwylde08 self-requested a review September 16, 2024 18:09
Copy link
Contributor

@briwylde08 briwylde08 left a comment

Choose a reason for hiding this comment

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

Happy to get this merged when the open question to Elliot has been resolved.

@rice2000
Copy link
Contributor

Happy to get this merged when the open question to Elliot has been resolved.

Looks like this may have happened. All good to merge @ElliotFriend?

@ElliotFriend
Copy link
Contributor

Yes, we're looking good from my end. Let's merge it!!

@briwylde08
Copy link
Contributor

It's. Happening.

@briwylde08 briwylde08 merged commit 13a9c1b into stellar:main Sep 20, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants