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

[legacy-framework] feat(cli): blitz generate command #46

Closed
wants to merge 15 commits into from

Conversation

mrpacino
Copy link
Collaborator

@mrpacino mrpacino commented Mar 5, 2020

blitz generate

blitz generate context/entity produces the following folder structure plus the respective files

context/
-- entity/
---- pages/
    ContextEntityController.js
    ContextEntityModel.js

Nested 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

context/
-- nestedContext/
---- entity/
------ pages/
      NestedContextEntityController.js
      NestedContextEntityModel.js

And finally just providing an entity name will give you

entity/
-- pages/
  EntityController.js
  EntityModel.js

(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 change context to be Context... the directory structure will come out looking like context/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 of generate

@mrpacino mrpacino requested a review from flybayer as a code owner March 5, 2020 08:01
@flybayer
Copy link
Member

flybayer commented Mar 5, 2020

Are you wanting to PR this into canary or into @lorenzorapetti's custom-generator ?

If into canary, I think we should wait to merge this until #25 is merged, right?

@mrpacino mrpacino changed the base branch from canary to custom-generator March 5, 2020 08:51
@mrpacino
Copy link
Collaborator Author

mrpacino commented Mar 5, 2020

Are you wanting to PR this into canary or into @lorenzorapetti's custom-generator ?

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 :)

@flybayer
Copy link
Member

flybayer commented Mar 6, 2020

Looking good to me

flybayer
flybayer previously approved these changes Mar 8, 2020
@flybayer
Copy link
Member

@lorenzorapetti I'll let you and @marcoseoane work out when this should be merged into your branch (there's currently a couple merge conflicts)

@mrpacino
Copy link
Collaborator Author

mrpacino commented Mar 10, 2020

@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.

@quirk0o
Copy link
Collaborator

quirk0o commented Mar 10, 2020

did you consider using snapshot tests to test these generators? :)

@ryardley
Copy link
Collaborator

ryardley commented Mar 11, 2020

Looks good. I am wondering are we planning on generating into /app? or is that going to be specified this on the commandline? ie. blitz generate app/foo/bar.

@flybayer
Copy link
Member

@ryardley I was definitely thinking to generate into app

@flybayer
Copy link
Member

flybayer commented Apr 3, 2020

@all-contributors add @marcoseoane for code

@allcontributors
Copy link

@flybayer

I've put up a pull request to add @marcoseoane! 🎉

@flybayer flybayer dismissed their stale review April 6, 2020 11:28

The base branch was changed.

@flybayer flybayer changed the base branch from custom-generator to canary April 6, 2020 11:28
@flybayer
Copy link
Member

flybayer commented Apr 6, 2020

@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.

@mrpacino
Copy link
Collaborator Author

mrpacino commented Apr 6, 2020

@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

@flybayer
Copy link
Member

Closing in favor of #187

@flybayer flybayer closed this Apr 23, 2020
@flybayer flybayer deleted the context-generator branch November 13, 2020 00:21
@dillondotzip dillondotzip changed the title feat(cli): blitz generate command [legacy-framework] feat(cli): blitz generate command Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants