se-2-challenges
se-2-challenges copied to clipboard
Update the challenge creation guide to use extensions
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.
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 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.
Hey @escottalexander I added you on the repo, you should be able to create branches.
base-challenge-extension-template looks great to me!
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
#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.
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:
- Make sure you are in
create-ethrepo.
Setting up things in externalExtensions:
-
cd into
externalExtensionsif it's not presentmkdir externalExtensions && cd externalExtensions -
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>
- cd into
<my-challenge-name>dir and create a branch of your challenge name.
cd <my-challenge-name> && git switch -c <challenge-challenge-name>
-
Fill all the files
// CHALLENGE-TODO:with comments. -
Commit those changes inside as initial commit :
git add . && git commit -m "fill template"
Commands to be run in create-eth repo:
- Build the create-eth cli
yarn build:dev
- 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
-
This is create the full instance outside of
create-ethrepo with<my-challenge-name> -
Tinker in that instance add new files and commit those changes in that instance which is as
../<my-challenge-name>after commit. -
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?
Nice! I like this much better.
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
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> --devAlso, 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?
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