cgross / generator-cg-angular

Yeoman generator for Enterprise Angular projects.
MIT License
592 stars 198 forks source link

Missing Sub-Generators #20

Open uwascan opened 10 years ago

uwascan commented 10 years ago

I completely love this generator, but the lack of sub-generators for route, controller and modules is a show stopper for me. Please consider adding the above sub-generators. This is the best generator for large angular projects on the Internet. Thanks

cgross commented 10 years ago

Have you tried the partial generator? That creates routes and controllers for you. For modules, there is something I'm working on.

Glad you like the generator :)

tacone commented 10 years ago

The generator is very nice indeed.

uwascan commented 10 years ago

Thanks for the info. I discovered it after making the comment above. How do I Update to new versions of the generator?

cgross commented 10 years ago

@tacone Thanks!

@uwascan The generator is just an npm module. Do an npm update -g generator-cg-angular to update it.

uwascan commented 10 years ago

Thanks. If you are considering adding support for modules, PLEASE consider a feature that will make it possible for the partial sub-generator to target a module such that one can define routes on a module by module basis instead of dumping all route definitions on the main module, in this case, the main module can define its own set of routes and also take dependencies on other modules.

Thanks for your time and effort.

cgross commented 10 years ago

Yup. I've already assumed that.

uwascan commented 10 years ago

Its me again. After more sweet usage, I realized that there is need for sub-generators for generating stand alone routes, controllers and views/partials depending on ones workflow, I am currently adding such controllers manually and updating the index.html file manually too. The partial sub-generator is good when you need a combo of route,controller and partial. I hope I am not sounding too desperate and needy. I am still new to the world of JavaScript and its related build tools, in time I will be able to contribute. Thanks again for creating this wonderful generator.

uwascan commented 10 years ago

I have committed a programming sin. But the result was amazing. I went into the installation folder of cg-angular-generator on my laptop, looked at the code and used the service sub-generator as a guide to create a stand alone controller generator. I found my self in cloud nine when it worked. I know this is bad but I am well on my way to making useful contributions. Is there a guide for contributing? and how do I setup my dev environment?

Thanks

bwinchester commented 10 years ago

You need to fork the repo, make your changes to a local clone of that fork, then commit the changes to your own fork. After that, in github, on your fork, you will see a green button to create a Pull/merge request to the original repo. Then cgross would review the merge request and approve or deny it. You can also google contributing to a github repo.

On Tuesday, March 25, 2014, uwascan notifications@github.com wrote:

I have committed a programming sin. But the result was amazing. I went into the installation folder of cg-angular-generator on my laptop, looked at the code and used the service sub-generator as a guide to create a stand alone controller generator. I found my self in cloud nine when it worked. I know this is bad but I am well on my way to making useful contributions. Is there a guide for contributing? and how do I setup my dev environment?

Thanks

Reply to this email directly or view it on GitHubhttps://github.com/cgross/generator-cg-angular/issues/20#issuecomment-38587745 .

cgross commented 10 years ago

If you'd like to contribute, you'll need to fork the repo, clone your fork on your local system, make your changes, commit and push them to your fork, then submit a pull request. It requires a bit of git knowledge but not too bad. I'm believe github has guides for it.

I'd be interested to know what use-case you the new sub-generators you propose. My logic - all routes go to partials, therefore it makes sense to ask for routes when creating a partial. All partials need controllers. Hence the controller being generated when a partial is created. There are some rare situations where you might need other controllers (though in 99% of those situations I think it makes sense to also separate out a new partial as well). But still I could possibly see reason for a controller generator. Not sure about separate html-only or route-only generators.

plmuninn commented 10 years ago

@cgross thx for this great generator. Its almost perfect for me and not only @uwascan think sub-generators for html partials and controllers should be implemented. I disagree with you about "all routes go to partials" etc. Example? Modal windows. Its logical to have controller and html partial for it. Next example, some global controllers or even directive with many included templates ; ).

And a digression. As for me, when we think about functionality of tool to creating application we should ask question "If this really will fit to this solution?". Its "Yeoman Generator for Enterprise Angular Projects" and for me "Enterprise Angular" mean to have sub-generators for everything that angular contains and have in application structure.

cgross commented 10 years ago

The directive subgenerator already includes the ability to create an external template.

Aren't modals just partials with a controller and no route? At least thats how I create them. And the existing partial subgenerator works great for that. What would a subgenerator for a html file w/o controller do? Just literally create an empty html file? What would a route only subgenerator do? Just add one line in app.js?

I'm not sure it makes sense to create subgenerators that are so simplistic. Maybe I just don't understand the use-cases very well and I'm open to being convinced.

0x80 commented 10 years ago

+1 for separate modules in partials! This is the main (and only significant) thing I'm missing from this generator. Thanks for your work!

0x80 commented 10 years ago

Just found the v3.1 branch with submodule generator. Awesome!

cgross commented 10 years ago

Just released version 3.1 of the generator. It includes new subgenerators for modals and modules.

I'm open to adding more subgenerators in the future. Please use the new v3.1 and let me know you'd still like to see more subgenerators.

masimplo commented 10 years ago

After reviewing many angular generators over the last few days, I ended up using your generator to use into a existing project that did not have any scaffolding tool so far. I was a bit indecisive until this morning, but after I got v3.1 that supports submodules I was sold! Only think I am still jealous of is the repository and model generators of angular-xl, but that's a different discussion. So I just wanted to say great work and thank you for making our lives easier!

cgross commented 10 years ago

Thanks @mxa055!

jaroslavrehorka commented 10 years ago

Thanks for your job, it is great generator! I have a one question, since 3.1.0 how to use SpyOn from jasmine? It is a bit consfusing for me (I'm new to frontend dev), when using grunt serve I've got message "'spyOn' is not defined." using grunt test runs without errors.

cgross commented 10 years ago

That's likely a jshint warning. Jshint will warn you if you use any global that it isn't told about in the .jshintrc file. You need to add an entry to the globals section of that file for spyOn.

jaroslavrehorka commented 10 years ago

Thank's now it works perfectly!

oric01 commented 10 years ago

Hi, thanks for your job ! I will just argue about the initial request from uwascan, about controller subgenerator. In a previous project I had to deal with parent controller of view controllers.

ie. an aggregatesCtrl parent of tagsCtrl and albumsCtrl (both dealing with medias)

In this case the parent controller is not bind to a particular view.

So, Id like to use a controller subgenerator exactly like service subgenerator for this kind of case.