-
Notifications
You must be signed in to change notification settings - Fork 917
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
CLI dev mode #436
CLI dev mode #436
Conversation
force pushed after rebasing on current cli, to get the templates from #430 |
@carletex @technophile-04 I've given this a test locally and things seem to be working as expected. There are improvements around the .dev file, but we can make them as we need them, which might be never haha. |
This is looking promising!! Thanks for the detailed explanation @dgrcode Still testing, but noticed a couple of things:
It seems that the This happens with the |
Yeah I faced same issue Also, I am getting this warning But this is looking great @dgrcode !! And great description !! thanks 🙌.... Will try to play around / debug more tomorrow 🙌 |
hmm interesting. I'll have a look at this after the issue with windows |
alright so there was a bug where the package.json were not created. I'm not sure what I tested. Probably tested before introducing the bug, and then only tested the symlinks and not the project. Anyways, the interesting part is that after the package.json are created again, the package "@se-2/hardhat" exists, but npm says it's missing. It also looks like the package.json from the root folder is symlinked (where it shouldn't), which might be causing npm to look at the packages under the source's "template/base/", instead of the instance's "packages/". It sounds weird that it behaves that way, but I guess there are a few things that can work funny using symlinks. I'll see if not using symlinks for package.json files fixes it. |
I just pushed a couple of commits that made some packages "invisible", but I'm still having funky behavior when trying to run next |
Just tested it out and works like a charm ✨ !!! Tysm @dgrcode !! I think we missed something duringa6610a5 so it breaks... added a notion doc link in TG chat but if you checkout to d5860a9 everything works there! Some basic testing which I performed :
Just one question on generated --- TEMPLATE FILE
templates/base/packages/nextjs/pages/index.tsx.template.mjs
--- ARGS FILES
- undefined
--- RESULTING ARGS
- pkgName: [Hardhat] Regarding Nevertheless, everything works great !!! Let's fix the latest merge issue and maybe update CONTRIBUTING.MD a bit, Tysm Dani this is really nice !!! |
Thanks for the tests Shiv! 🙌
I'll check what's going on an try to push a fix.
Nope, you're right. There we should have a path to the file instead of I'll see if I can get both those points done today. Thanks again! |
@technophile-04 I can't reproduce the issues shown in the notion doc. I was looking at the changes from the cli branch since this branch was created until the last merge, but I didn't see anything suspicious. The diff for reference: https://github.com/scaffold-eth/scaffold-eth-2/compare/686db1a..b5e3c86 Can you re-test and see if you still have the issue? Just in case I'll mention how I run the command:
I'm not sure if we're doing something differently. |
The way I usually run CLI is I have two panes split :
Additionally, if you try to do
Maybe I think you have the prvious build version which you are using here, could you do |
oh yes, my bad! I forgot to build after pulling the latest changes! 😅🤦 I'll build and see what I find |
yep, reproducing now 😓 |
Alright, found the issue with the I think this has also fixed the "ARGS FILES" section being After fixing it I've tested:
I can't reproduce the .DS_Store issue. Maybe because I'm on a Mac? I'll commit the fix for the rename. Could you check again if the .DS_Store went away in the next commit? Thanks! |
Tysm @dgrcode, I just tested and works great even with Umm I still got "ARGS FILES" section Also, from #436 (comment) this is still there : I see this dosen't cause any harm and everything works correctly but I found doing this solves this issue : import { promises } from "fs";
const { mkdir, link } = promises; checkout this stackoverflow link I think we are pretty close to merging this beast !! cc @Pabl0cks whenever you have time could you just try this on |
Regarding "ARGS FILES" section, I just created the dev mode projects with hardhat, foundry, and no framework. I'm not getting Hardhat
Foundry
No framework
Regarding the unresolved dependency, I completely missed that one. I'll implement the fix you propose, thanks! 👍 |
I tested it and everything is working fine!! Anyway, I think that since this dev feature will be used mostly by us at least at the beginning, we can use it carefully, trying to find new bugs and new improvements to make. I think we should update the CONTRIBUTING.MD file with clear instructions on how to use the cli in dev mode, test the cli on Windows, and if everything goes well, we can merge it! Great work guys!!! |
I tried CLI dev mode with Windows and it worked nice. Tried selecting both Hardhat and Foundry, changing stuff on a few pages and into the contract and all got reflected on templates/ from the source when I did Good job! 🙌 |
Awesome, tysm 🙌 !! I think we are just remaining on :
We can update CONTRIBUTING.MD in different PR but since we already published a version after #483, we are not in a rush 🙌 |
We moved CONTRIBUTING to "templates/base/", but that's going to be the CONTRIBUTING of the project created by people. Should we have a different CONTRIBUTING at the root? or maybe a copy so it's both in our project and the project created by users? I'm thinking the same about the root's README.md. Should we rewrite both the README and CONTRIBUTING taking RFC-extensions into account? |
We are probably gonna remove "template/base/CONTRIBUTING.md" since people can create their own according to their needs, So I think we should create our CONTRIBUTING.md at the root
I was thinking something like this : Root
|
Yep that sounds great Shiv 🙌 I'll put something together and push a commit |
I added an initial version. To see the changes made to the copied version of CONTRIBUTING.md, I recommend looking at the changes from the two last commits together: https://github.com/scaffold-eth/scaffold-eth-2/compare/bbff792..cli-dev-mode I'll update the links to the resulting urls after having pushed them to the remote |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EDIT: I guess we'll have to update those links as we merge branches
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like github supports relative links!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tysm @dgrcode for updating .md
files, Love it as always !!!!!
I have just removed hardcoded test-cli
from package.json
leaving it upon on developer add path while testing, because I like to prefer creating "instance project" out of this repo 😅 just to be safe and avoid committing test-cli
directory :
We could have added test-cli
in .gitignore
but I think its fine if we let the developer decide 🙌, also update Developer_Guide reflecting these changes at 8945977. But we can always iterate on it as well as other .md
files later
Mergin this, I have gone through the test again and everything works nicely. Thanks again !!! Also thanks to everyone for testing 🙌
Yeah makes sense. I didn't think about that use case. Sounds good then! 🙌 |
Description
Add dev mode for the CLI.
The goal is to improve the DX when contributing changes to anything in the "templates/" folder.
How to use
The way this should be used is by running
yarn cli project_name --dev
. By using the dev flag, the CLI turns into dev mode.What it does
When in dev mode, we create symlinks instead of copying files from "templates/". That way, the user would see as if the instance project (the project resulting from running the CLI) had been created. The user can also modify the files within the instance project, and see changes in realtime with the normal tooling (
yarn dev
, etc). However, since the files are actually symlinked to the source files within "templates/", they are actually modifying the source files.Once the user is happy with the changes, they can run
git diff
, and git actually understand that the files changed were the source ones, so there's no extra copy/paste required to update source files.Caveat: special files
In the normal CLI mode, there are a few files that are not copied, but generated from the source files instead. Those files are
package.json
and**.templates.mjs
.Even though there are ways to automate those changes as well, it's quite complex to update the right files in the source. Because this is a proof of concept, we won't do any automation, and these special files have to be updated manually.
However, we'll generate sibling files to them with information that aims to make those manual changes easier. Think of those files as a human readable sourcemap for generated files. These files will have the name
resulting_file.ext.dev
, so they should live next to the resulting files, only with the suffix.dev
.Tasks
package.json.dev
files**.dev
files generated out of templates.