-
-
Notifications
You must be signed in to change notification settings - Fork 798
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
[legacy-framework] feat(cli): blitz generate command #46
Conversation
Are you wanting to PR this into If into canary, I think we should wait to merge this until #25 is merged, right? |
i was intending to PR it into custom-generator! lol made the PR right before jetting out the door to head to work so was in a bit of a rush. Have changed the base branch to reflect this now, and later on when I'm back from work I'll be adding a description detailing some of the code decisions and current functionality etc so its not just a blank slate :) |
Looking good to me |
…s including the entity name twice
…s including the entity name twice
@lorenzorapetti I'll let you and @marcoseoane work out when this should be merged into your branch (there's currently a couple merge conflicts) |
i've resolved the conflicts, one was a small difference in a line where @lorenzorapetti was using optional chaining + the other was using ensureDir vs mkdirSync of which ensureDir is the superior option. |
did you consider using snapshot tests to test these generators? :) |
Looks good. I am wondering are we planning on generating into |
@ryardley I was definitely thinking to generate into app |
@all-contributors add @marcoseoane for code |
I've put up a pull request to add @marcoseoane! 🎉 |
@marcoseoane most of this PR is now obsolete with the new architecture. Do you want to close this and then you or someone else can create a new one? Either way, we should create a new issue to define what exactly the generate command will do and how it works. |
@flybayer thought as much! Have been laying low in these crazy times but have noticed massive progress taking place in Slack hence I haven't touched this branch with any further updates lol. Let's tie down some new requirements and I'll be happy to start rewriting something that fits our new architechture |
Closing in favor of #187 |
blitz generate
blitz generate context/entity
produces the following folder structure plus the respective filesNested file structures are also supported, with the prefix on the entity file names always being the preceding directory as seen in the next example:
blitz generate context/nestedContext/entity
Will generate the structure below
And finally just providing an entity name will give you
(although I have spotted an error with the current code that puts the entity name in filenames twice, so will have to push a fix for this)
One design decision I have put into the code which I want everyone to give their thoughts on is the formatting of the top level context directory name.
Currently the code is setting it to be lowercase, so if we take the
context/nestedContext
example and changecontext
to beContext
... the directory structure will come out looking likecontext/nestedContext
.I took this direction with the idea that it would be nice to keep the display/formatting of all the root level directories in the blitz app cohesive, anything nested deeper will be up to the developer.
Next step will be setting up the template for the
Model
files, and any other default files we would like to include as the result ofgenerate