se-2-challenges icon indicating copy to clipboard operation
se-2-challenges copied to clipboard

Update the challenge creation guide to use extensions

Open escottalexander opened this issue 8 months ago • 10 comments

Currently the main branch repo contains instructions on how to add a challenge. It appears it is not giving advice on how to create an extension but instead, the prior challenge type.

https://github.com/scaffold-eth/se-2-challenges?tab=readme-ov-file#-contributing-guide-and-hints-to-create-new-challenges

We are going through these steps currently so we can submit a PR to change this if it seems helpful.

escottalexander avatar Mar 12 '25 15:03 escottalexander

We are going through these steps currently so we can submit a PR to change this if it seems helpful.

That would be amazing!

carletex avatar Mar 12 '25 15:03 carletex

@carletex When you are able can you add a new branch called base-challenge-extension-template. I will a submit a PR to that branch with some files that should kick-start any new challenge extension. It should replace the need for the existing base-challenge-template branch. Feel free to name it whatever you think will work best.

escottalexander avatar Mar 12 '25 20:03 escottalexander

Hey @escottalexander I added you on the repo, you should be able to create branches.

base-challenge-extension-template looks great to me!

carletex avatar Mar 13 '25 10:03 carletex

Hey @escottalexander . As an option you can move old base-challenge-template branch to base-challenge-template--v0 as we do for all other challenges, and then recreate base-challenge-template for your needs so it will have clean git history.

Note: for some reason we didn't use template branch for challenges extensions, but we can fix it in future if needed

rin-st avatar Mar 13 '25 11:03 rin-st

#278 and #279 will close this issue.

After thinking about it it seems the best way to get people set up will be for them to copy the files from the template onto the new extension they are creating after running yarn cli.

I renamed the existing template to base-challenge-template--v0 as suggested and have a PR into base-challenge-template.

escottalexander avatar Mar 15 '25 21:03 escottalexander

EDIT: I think this instruction can go in #279 🙌

Thanks @escottalexander I think #278 it is a great iteration. I was just playing around #278 and what would be the best way to create extension, Just writing some steps:

After we merge #278, We can follow this instruction:

  1. Make sure you are in create-eth repo.

Setting up things in externalExtensions:

  1. cd into externalExtensions if it's not present mkdir externalExtensions && cd externalExtensions

  2. Clone the base-challenge-template with name of your extension inside externalExtensions:

git clone -b base-challenge-template https://github.com/scaffold-eth/se-2-challenges.git <my-challenge-name>
  1. cd into <my-challenge-name> dir and create a branch of your challenge name.
cd <my-challenge-name> && git switch -c <challenge-challenge-name>
  1. Fill all the files // CHALLENGE-TODO: with comments.

  2. Commit those changes inside as initial commit : git add . && git commit -m "fill template"

Commands to be run in create-eth repo:

  1. Build the create-eth cli
yarn build:dev 
  1. Create an instance with same name as challenge name dir which was created inside externalExtensions:
yarn cli ../<my-challenge-name> -e <my-challenge-name> --dev
  1. This is create the full instance outside of create-eth repo with <my-challenge-name>

  2. Tinker in that instance add new files and commit those changes in that instance which is as ../<my-challenge-name> after commit.

  3. Run this in create-eth to copy all the changes to you extension:

yarn create-extension ../<my-challenge-name>

This will make copying things easy.


I think it would be nice to document this in README of base-challenge-tempate or maybe in having a .md in main branch saying guide to create challenge extensions?

technophile-04 avatar Mar 19 '25 16:03 technophile-04

Nice! I like this much better.

escottalexander avatar Mar 20 '25 14:03 escottalexander

Very nice, that's super helpful, thanks a lot!

I just have a small comment: the command is a bit confusing to me because we're giving the full instance the same name again. Maybe we could call it something like <full-instance-my-challenge-name> (or something better :))?

yarn cli ../<my-challenge-name> -e <my-challenge-name> --dev

Also, why not just stick to the version used in the local testing example and let the user choose the instance name in the CLI directly?

yarn cli -e <my-challenge-name> --dev

phipsae avatar Apr 26 '25 14:04 phipsae

Very nice, that's super helpful, thanks a lot!

I just have a small comment: the command is a bit confusing to me because we're giving the full instance the same name again. Maybe we could call it something like <full-instance-my-challenge-name> (or something better :))?

yarn cli ../<my-challenge-name> -e <my-challenge-name> --dev

Also, why not just stick to the version used in the local testing example and let the user choose the instance name in the CLI directly?

yarn cli -e <my-challenge-name> --dev

The reason we use > yarn cli ../<my-challenge-name> -e <my-challenge-name> --dev is so that the challenge is created in the directory above create-eth. That is why we don't use the other command but I see that it would better if it was consistent with the instructions in local testing. I guess we should decide which set of instructions should be changed.

@technophile-04 Do you have any thoughts on this? I like the way you are recommending people to make the directory outside of the create-eth directory but should the local testing instructions also make this recommendation?

escottalexander avatar Apr 28 '25 16:04 escottalexander

voting for using ../<my-challenge-name> because

  • with it, we keep create-eth folder clean without any additional projects folders
  • rollup doesn't need to check all these additional folders when using yarn dev
  • (maybe only for me) there's no mess with git in git tab of cursor/vscode

So, let's update docs and create-eth so it will be suggested to use ../folder? cc @technophile-04

rin-st avatar Aug 06 '25 10:08 rin-st