slushjs / slush-angular

A slush generator for AngularJS using the Google Angular App Structure Recommendations
129 stars 32 forks source link

Add more generators #10

Open bebraw opened 10 years ago

bebraw commented 10 years ago

Ie.

to quote https://github.com/yeoman/generator-angular .

joakimbeng commented 10 years ago

@bebraw yes, will definitely have to do that! PR's are welcome! (sorry for the late response, been on a holiday)

bebraw commented 10 years ago

We should define some basic logic for this. I've prepared some initial spec for you below based on the last example at Angular Best Practices.

We'll need to generate module definition for controllers at least and then make sure modules get hooked up at app.js automatically to make it nice. In addition it probably should be possible to generate components within existing directories/modules.

I am sure this won't cover every possible case but perhaps a scheme like this would serve as a starting point? Any particular ideas?

joakimbeng commented 10 years ago

Like your ideas!

I wonder why you chose not to create a module in the filter or service case though?

What if we add a prompt for what module to put the file to be created in? If the module already exists it's used, if not both a folder and a module definition file are created. The module prompt defaults to the given name.

E.g:

slush angular:directive pane

[?] Which module should the directive be put in? (pane) 

And the same behavior goes for each Angular file type.

Another subgenerator that would be great to have would be one that generates a module folder, a definition, a controller with a test file, a template and a route injected into app.js.

What do you think?

bebraw commented 10 years ago

I wonder why you chose not to create a module in the filter or service case though?

I modeled it after that Google example. Now that I think of it maybe we should create the module if it doesn't exist already and hook it up with app.js.

What if we add a prompt for what module to put the file to be created in? If the module already exists it's used, if not both a folder and a module definition file are created. The module prompt defaults to the given name.

Yeah, that could be nice. Let's go with that.

Another subgenerator that would be great to have would be one that generates a module folder, a definition, a controller with a test file, a template and a route injected into app.js.

I wonder what to call this. The TODO app demo could probably depend on it (simplifies things).

reflexdemon commented 9 years ago

Hey,

I went ahead and created the slush-angular-gulp with support for all sub-generators with more inputs from angular-style-guide. Please review the same and provide some suggestions that can improve the generator.

Thanks @joakimbeng for this inspiring writeup that made me write this generator.