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
blueprints (formerly generators) #351
Comments
@nathanhammond you mentioned "homework" this one, if you are interesting this one may be a good fit |
@stefanpenner I meant in terms of general beta testing. :) I'm trying to avoid volunteering for too much so I can spend more cycles on ember-flows-generator. |
I’m going to put some time into this. If anyone wants to join forces, let me know. |
I'd be willing to help @jgwhite |
@tonycoco cool. I'm going to make a start on Sunday. Acceptance tests will be point of entry. Will be in #ember-cli :) |
Is everyone happy to proceed with the current format for generated modules: var FooController = Ember.Controller.extend({});
export default FooController; Does anyone prefer the terser alternative? export default Ember.Controller.extend({}); |
Couple of decisions after discussing with @rjackson:
|
I am not sure what to call it but I am wondering if there is something between a full generator, and something more like a snippet generator that emits common ember code patterns. I would love to have a command along the lines of
That writes a file to
And stubs out a common dummy example of hypothetical controller. Ideally with a bunch of common stub code. If not directly supported would be nice if ember cli had the ability to create your own snippets and stubs just by putting source files in a special directory. The ember-app-kit-rails generators have been super awesome. By way of example: The above command could in theory create the file and push something like this inside:
This may be hard to generalize but it would be nice if there was a way to store these common snippets and other custom shortcuts in an ember cli config folder somewhere. I am getting super lazy with my typing. :-) Some of this can be be achieved via text editor commands e.g. "snippets" in sublime text. I started to build something for sublime text and EAK. But would love to have a small library of these from the ember cli prompt that were more file based in scope. Or multiple files. |
@eccegordo what you describe is pretty much the goal. Great minds :) Custom generators will live in a |
Quick idea: Call generators stencils to avoid confusion with javascript generators? :) |
@MajorBreakfast interesting thought. I like the term stencil a lot. Though we do already have blueprint. One counterpoint, generators are known and well understood concept for those familiar with Rails. |
@jgwhite ya, "blueprint" and "template" are taken. That's why I propose "stencil" :) |
Generate something based on a blueprint seems fine? |
@stefanpenner We already call the initial project structure "blueprint". |
@MajorBreakfast - If you think about it these are the exact same thing. A "blueprint" is a number of files used as a template. Both the new "generators" (only used to explain what I mean) and the current The only change that I think we might need is to move |
@rjackson Agreed. Blueprints is nicely unambiguous and doesn’t conflict with any other naming conventions (generators, templates). 'ember-cli/blueprints/init' // blueprint for generating project
'ember-cli/blueprints/{controller,route,...}' // blueprints for generating application code
'my-app/blueprints/{foo,bar,baz}' // custom blueprints
'my-app/blueprints/{controller,route,...}' // custom blueprint overrides |
Hmm good point :) I like it. I also like that both can be powered by the same logic.(Even the overwrite confirmation stuff) @jgwhite What about
The blueprint defined in |
Yup and now that we have diffing it will be even nicer |
Props to @mixonic |
Just chiming in, instead of blueprint we could call it "bootstrap"... probably a bit more common. |
@tonycoco personally I’d tend to think of “bootstrap” more as a verb. The terminology we seem to be settling upon is using “blueprints” to “generate” projects and files. |
@MajorBreakfast good point |
@stefanpenner I changed the issue title and description. What verb do we use with "blueprint"? To "generate" a "blueprint" seems to imply the wrong thing. It's more like "use", "apply" (not good in js :), "employ" or "utilize". I'd keep |
I think blueprint and generate work fine together. We’re generating files from blueprints, rather than generating blueprints. |
I think that works, @jgwhite |
@jgwhite you're right. It's as simple as that. |
@jgwhite anything i can do to help you out on this? |
@stefanpenner yes. I’d love everyone’s opinion on the acceptance tests and blueprints. The task itself is a placeholder — I plan to write the real implementation following the remaining test TODOs. |
@jgwhite that looks rad. i skimmed the tests and didn't see:
Also, it appears I can't open issues on that repo. Do you mind submitting a PR, it would make (even early) review + feedback easier. |
@stefanpenner yup — turns out the existing blueprint.js handled it already without modification. The template test covers it, but can add more of these cases. |
@jgwhite perfect! Thoughts on removing more default app/* folders as they will be added on-demand as generators are needed? The reasoning is to try and present something less intimidating. |
@stefanpenner yeah, I was thinking the same. Be interested to get some newcomers’ perspectives on this. Is it more reassuring to see just the essentials, or a clear structure ready and waiting? |
@jgwhite essentials i think. |
or super-skinny?:
|
Essentials and I am for encouraging pods! Sorting by type isn't the most logical thing and we know it :) |
@MajorBreakfast would be cool to re-ignite the discussion on discourse. |
@jgwhite I think I prefer the middle ground, although the super skinny might be nice as a community blueprint or something. ember new --blueprint mini (or some URI to the mini blueprint) or something |
@stefanpenner nice idea. We should add that to the roadmap. |
@jgwhite The resolver already supports pods, we just have to use 'em. We can't really discuss it further unless we have results that show how the current iteration works in practice. |
@MajorBreakfast I’ve not tried them yet. How are you picturing the generator commands? Something like this?:
Keen to discuss in more detail. I’m in #ember-cli if you wanna take the conversation there. |
A To force it: |
So:
|
singular pod flag |
👍 |
❤️ |
tracking this now on #747 |
generatorsblueprints to be idiomaticgeneratorblueprint needs (ala rails generator templates)see: #43
The text was updated successfully, but these errors were encountered: