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

developing extension(part 1) #73

Merged
merged 34 commits into from
Jul 23, 2024
Merged

developing extension(part 1) #73

merged 34 commits into from
Jul 23, 2024

Conversation

technophile-04
Copy link
Collaborator

@technophile-04 technophile-04 commented Jul 2, 2024

Developer extension flow:

  1. Developer clones the create-eth repo
    1.5) run yarn build:dev => (this scripts create cli.js and create-extension.js ins dist dir)
  2. Run yarn cli => (runs dist/cli.js)
    • The project path base name which developer mentions will be the extension name
    • example: ../my-instance => extension name will be "my-instance"
  3. Developer starts adding stuff to "my-instance" for example:
    • create a new page my-instance/packages/nextjs/app/my-page/page.tsx
    • commits that changes in "my-instance" repo
  4. Now to create extension, developer need to run yarn create-extension ${instancePath} => runs dist/create-extension
    • Example: yarn create-extension ../my-instance
    • The above commands gets all the file changed/added in my-instance repo and create extension
      in create-eth/externalExtensions/${extensionName} following same hierarchy compliant with external extensions
  5. If the developer does some changes to files which are templates(for example Header.tsx), we log him warning that he needs to create corresponding Header.tsx.args.mjs manually in extenalExtensions
    • Regarding package.json we will be copying them completely if changed, since package.json are merged so common fields will be managed and new added package will also be added(the extension package.json will replace the version if it clashes with base)
  6. Developer repeats 4th step in cycle, commits in extension instance and then yarn create-extension ${instancePath}
  7. To do actual test with his extension, he will do phase 2 of Developing external extensions (v0.1) #57 (comment)
  8. Once user is satisfied he cd's into his created extension dir for example externalExtensions/${extensionName} and push that repo to github, which then can be used by others

image

@technophile-04 technophile-04 marked this pull request as ready for review July 5, 2024 05:51
rollup.dev.config.js Outdated Show resolved Hide resolved
rollup.dev.config.js Outdated Show resolved Hide resolved
src/dev/create-extension.ts Outdated Show resolved Hide resolved
src/dev/create-extension.ts Outdated Show resolved Hide resolved
src/dev/create-extension.ts Outdated Show resolved Hide resolved
@rin-st
Copy link
Member

rin-st commented Jul 5, 2024

Thanks Shiv! Great changes! 👍 It makes developing of extension much easier! I left some comments, and also

  • Regarding package.json we will be copying them completely if changed, since package.json are merged so common fields will be managed and new added package will also be added(the extension package.json will replace the version if it clashes with base)

I think it's not good since in create-eth we will update packages, but not sure about all the extensions. So if extension is old, it will overwrite newest packages of create-eth. So I think it's better to skip package.json too and write to console that package.json should be also written manually with only additional libs

  1. Once user is satisfied he cd's into his created extension dir for example externalExtensions/${extensionName} and push that repo to github, which then can be used by others

You mean push that folder to github? Since there is no repo there

@damianmarti
Copy link
Member

Great work @technophile-04 !! And good comments from @rin-st!

I'm working on the Ponder extension, so I will test this with that, and get back to you with comments and feedback!

@technophile-04
Copy link
Collaborator Author

technophile-04 commented Jul 7, 2024

So if extension is old, it will overwrite newest packages of create-eth. So I think it's better to skip package.json too and write to console that package.json should be also written manually with only additional libs

Yeah agree, pushed some changes to handle this. So currently if the package.json overlaps Solidity-frameworks package.json OR root package.json OR nextjs package.json we don't copy them and print info warning, But if the users want to add new package to monorepo(for example subgraph) then I we should copy it completely

Screenshot 2024-07-07 at 2 31 12 PM

You mean push that folder to github? Since there is no repo there

yes

src/dev/create-extension.ts Outdated Show resolved Hide resolved
Copy link
Member

@rin-st rin-st 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 for updates! Great job!

@technophile-04 technophile-04 requested a review from carletex July 9, 2024 04:26
@carletex
Copy link
Member

carletex commented Jul 9, 2024

This is looking great!!! Thanks Shiv + Rinat for the review!

As Damu, I'll also be testing this during the week

@technophile-04
Copy link
Collaborator Author

coreFiles: Files which belong to solidity frameworks OR base dir. Something we should be clear about in docs.

Was discussing with Carlos about it and found a bug where we were copying coreFiles as well. Just pushed a commit at f2cf80c which avoids it and log an warning regarding it.

image

@damianmarti
Copy link
Member

@technophile-04 I was able to create the Ponder extension following the directions from this PR and #57 and everything worked great!!!

https://github.com/damianmarti/ponder-se2-extension This is the extension created, I have to add the READMEs, I will do it on Monday.

I have only two comments:

Maybe it will be useful to be able to add items to scaffoldConfig. I wanted to add a ponderURL there and ended up using a process.env var directly, but I think it's better if we can have all this kind of config on the scaffoldConfig file.

At first, I got some errors when I ran yarn cli (issues with my extension code), and the application was created anyway. And then I have to delete the folder to be able to run it again. Maybe, the cli can delete the created app folder if there is any error.

Awesome job!!!

Copy link
Member

@carletex carletex left a comment

Choose a reason for hiding this comment

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

This is looking great @technophile-04

Thank you for tackling all open "issues" that we discussed.

@carletex
Copy link
Member

Should we merge this?

@technophile-04
Copy link
Collaborator Author

Ohh actually we thought merging the doc too in this PR #84 (comment)

But maybe we can merge and iterate more on doc in that PR?

@carletex
Copy link
Member

Ok sure! In my head we could merge this since it doesn't affect users... but both things work for me!

@technophile-04
Copy link
Collaborator Author

In my head we could merge this since it doesn't affect users... but both things work for me!

Yup merging this, we could also play around with this more and update #84

@technophile-04 technophile-04 merged commit f1033a6 into main Jul 23, 2024
1 check passed
@technophile-04 technophile-04 deleted the developer-extension-v0.2 branch July 23, 2024 08:19
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.

4 participants