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: clean & add comments to initialize.js #10

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

chadoh
Copy link
Contributor

@chadoh chadoh commented Aug 28, 2024

From looking at https://developers.stellar.org/docs/build/guides/dapps/soroban-contract-init-template, my guess is that people do not find the existing initialize.js script easy to understand.

I've followed the lead of @CaptainPrinz here and changed the name of exe to run, and then I added lots of comments to each function.

I also removed the SOROBAN_NETWORK variable, as I think it makes this somewhat more confusing instead of more clear. This means removing the network.${process.env.SOROBAN_NETWORK} shortcut, but maybe that's ok?

I also moved around things in the .gitignore, just so all the specific-to-this-template stuff would be at the bottom. A new frontend-template guide I am writing is going to mention and link to this stuff.

Also:

  • remove obsolete references to soroban CLI
  • remove errant Cargo.* files

@chadoh chadoh force-pushed the feat/comment-initializejs branch from ba7e8fa to 0ab3274 Compare August 28, 2024 18:02
@chadoh chadoh requested review from fnando and ElliotFriend August 28, 2024 18:03
From looking at
https://developers.stellar.org/docs/build/guides/dapps/soroban-contract-init-template,
my guess is that people do not find the existing `initialize.js` script
easy to understand.

I've followed the lead of @CaptainPrinz here and changed the name of
`exe` to `run`, and then I added lots of comments to each function.

I also removed the `SOROBAN_NETWORK` variable, as I think it makes this
somewhat more confusing instead of more clear. This means removing the
`network.${process.env.SOROBAN_NETWORK}` shortcut, but maybe that's ok?

I also moved around things in the `.gitignore`, just so all the
specific-to-this-template stuff would be at the bottom. A new
frontend-template guide I am writing is going to mention and link to
this stuff.
@chadoh chadoh force-pushed the feat/comment-initializejs branch from 0ab3274 to f99af17 Compare August 28, 2024 18:05
chadoh added 2 commits August 28, 2024 14:47
These are provided by the main `stellar contract init` script, and
should not be part of the frontend template.
chadoh added a commit to AhaLabs/stellar-docs that referenced this pull request Aug 29, 2024
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`).
briwylde08 added a commit to stellar/stellar-docs that referenced this pull request Sep 20, 2024
* feat: more holistic frontend-template deep-dive

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`).

* link frontend template guide from dapp guide

and add "Wrapping up" section to end of frontend template guide

* stylistic improvements

Co-authored-by: Bri <[email protected]>

---------

Co-authored-by: Bri <[email protected]>
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.

1 participant