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

Add CLI Foundry Template (cont.) #905

Merged
merged 101 commits into from
Dec 17, 2024

Conversation

jimmychu0807
Copy link
Contributor

@jimmychu0807 jimmychu0807 commented Nov 28, 2024

Description

Completing #854

  1. Preferring using node_modules instead of git submodules in this repo.
  2. As I am making this a js package with package.json, I removed the Makefile.

This is a draft PR, but please review the updated approach and see if it is okay.

A few tasks left:

  • Enhance the test so it test for event with exact parameters and verify the contract state.
  • Allow running anvil node locally and deploy Feedback.sol to it.
  • Update readme.

Related Issue(s)

closes #185

Other information

cc @cedoor @vplasencia @sripwoud
cc @timou0911 @csiejimmyliu

I thought I could continue building on top of #854, but end up opening a new PR. Let me know if there is a way / how to do it if this is important enough.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have run yarn format and yarn lint without getting any errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@jimmychu0807
Copy link
Contributor Author

jimmychu0807 commented Dec 8, 2024

Would like to followup and resolve on this PR.

@cedoor @sripwoud will you have a chance to take a look at this PR in this week or next? Thanks.

@vplasencia
Copy link
Member

Hey @jimmychu0807! I will review the PR this week.

@vplasencia
Copy link
Member

Thank you very much for creating this PR and following up @jimmychu0807 🙏

Copy link
Member

@vplasencia vplasencia left a comment

Choose a reason for hiding this comment

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

Thank you so much for this PR @jimmychu0807 🙏

Since the Semaphore templates are configured to use yarn, could you add a .yarnrc.yml file and add the lines related to npm and yarn to the .gitignore file: https://github.com/semaphore-protocol/semaphore/blob/main/packages/cli-template-contracts-hardhat/.gitignore

It would also be nice to have a yarn release in the template like in the others: https://github.com/semaphore-protocol/semaphore/tree/main/packages/cli-template-contracts-hardhat/.yarn/releases

Not all the tests are passing successfully for me, are all the tests passing successfully for you?

@jimmychu0807
Copy link
Contributor Author

jimmychu0807 commented Dec 16, 2024

@vplasencia, thanks for the review.

Not all the tests are passing successfully for me, are all the tests passing successfully for you?

hmm... I see. I wonder how do you run the test? The following is my screenshot:

Screenshot 2024-12-16 at 11 17 31


p.s. I have updated the gitignore and yarnrc file.

p.p.s. I believe in this monorepo setting, the node_modules dir is going to be stored in the root level, not in the package level. That's why the paths in the remappings.txt all start with ../... I wonder do you take the template-foundry package out to become an independent node project during your test?

@vplasencia
Copy link
Member

Hey @jimmychu0807!

hmm... I see. I wonder how do you run the test? The following is my screenshot:

One of my tests was failing because I had to run foundryup to update the Foundry version. Now they work fine after modifying the remappings.

p.p.s. I believe in this monorepo setting, the node_modules dir is going to be stored in the root level, not in the package level. That's why the paths in the remappings.txt all start with ../... I wonder do you take the template-foundry package out to become an independent node project during your test?

Yes, the templates should be tested outside because they will be independent projects. This will be executed to create a new project using a template: https://github.com/semaphore-protocol/semaphore/blob/main/packages/cli/src/index.ts#L54

Copy link
Member

@vplasencia vplasencia left a comment

Choose a reason for hiding this comment

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

It would be nice to add the Foundry template to the CLI so that developers can use the template right after it's ready. You can do this by adding:

    {
        value: "contracts-foundry",
        name: "Foundry"
    }

to the supportedTemplates here: https://github.com/semaphore-protocol/semaphore/blob/main/packages/cli/src/index.ts#L23-L36

@jimmychu0807
Copy link
Contributor Author

Yes, the templates should be tested outside because they will be independent projects. This will be executed to create a new project using a template: https://github.com/semaphore-protocol/semaphore/blob/main/packages/cli/src/index.ts#L54

ah, I see the context now. Let me update it accordingly.

@jimmychu0807
Copy link
Contributor Author

jimmychu0807 commented Dec 17, 2024

@vplasencia Updated the packages/cli and remapping path.


I wonder how do you test the packages/cli locally? I run the command yarn workspace @semaphore-protocol/cli start create and create a project using contracts-foundry (Foundry) template. At some point, it will try to download the package from https://registry.npmjs.org and complain it is not found (as it is not published yet). How do you make it using the local foundry template instead of from npm?

@vplasencia
Copy link
Member

Hey @jimmychu0807 thank you very much for all the updates.

I wonder how do you test the packages/cli locally? I run the command yarn workspace @semaphore-protocol/cli start create and create a project using contracts-foundry (Foundry) template. At some point, it will try to download the package from https://registry.npmjs.org/ and complain it is not found (as it is not published yet). How do you make it using the local foundry template instead of from npm?

To test the new template you can just copy/paste the cli-template-contracts-foundry folder somewhere else and add the yarn.lock file.

Copy link
Member

@vplasencia vplasencia left a comment

Choose a reason for hiding this comment

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

Thank you very much for the great work @jimmychu0807 🚀

@vplasencia vplasencia merged commit 4cc6980 into semaphore-protocol:main Dec 17, 2024
5 checks passed
@jimmychu0807 jimmychu0807 deleted the jc/854 branch December 17, 2024 14:08
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.

Create CLI Foundry template
5 participants