generator-cg-angular icon indicating copy to clipboard operation
generator-cg-angular copied to clipboard

Missing Sub-Generators

Open uwascan opened this issue 10 years ago • 21 comments

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

uwascan avatar Mar 23 '14 10:03 uwascan

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

cgross avatar Mar 23 '14 15:03 cgross

The generator is very nice indeed.

tacone avatar Mar 23 '14 18:03 tacone

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

uwascan avatar Mar 24 '14 05:03 uwascan

@tacone Thanks!

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

cgross avatar Mar 24 '14 14:03 cgross

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.

uwascan avatar Mar 25 '14 13:03 uwascan

Yup. I've already assumed that.

cgross avatar Mar 25 '14 14:03 cgross

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 avatar Mar 25 '14 16:03 uwascan

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

uwascan avatar Mar 25 '14 16:03 uwascan

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 [email protected] 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 .

bwinchester avatar Mar 25 '14 17:03 bwinchester

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.

cgross avatar Mar 25 '14 17:03 cgross

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

plmuninn avatar Mar 31 '14 16:03 plmuninn

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.

cgross avatar Mar 31 '14 17:03 cgross

+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 avatar Apr 28 '14 20:04 0x80

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

0x80 avatar Apr 28 '14 20:04 0x80

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.

cgross avatar May 01 '14 23:05 cgross

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!

masimplo avatar May 02 '14 16:05 masimplo

Thanks @mxa055!

cgross avatar May 02 '14 18:05 cgross

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.

jaroslavrehorka avatar May 03 '14 09:05 jaroslavrehorka

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.

cgross avatar May 04 '14 13:05 cgross

Thank's now it works perfectly!

jaroslavrehorka avatar May 05 '14 17:05 jaroslavrehorka

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.

oric01 avatar May 26 '14 16:05 oric01