michaelkrone / generator-material-app

Yet another yeoman generator for scaffolding a simple Node.js/Express/MongoDB/Angular.js app using some material design elements.
MIT License
177 stars 47 forks source link

'module name' and submodule #45

Closed Stupidism closed 8 years ago

Stupidism commented 8 years ago

Do you have time to do this? Maybe our group can join you maintaining this repo.

michaelkrone commented 8 years ago

Hi @stupidisum,

what do you mean with 'module name'? I would be glad if you would like to help maintaining this repository.

Stupidism commented 8 years ago

I found it's diffcult to get complex route like admin done without some trifle with module name. I think it will be great if apiroute can do this:

yo material-app:apiroute admin
yo material-app:apiroute admin.user
yo material-app:apiroute admin.main
yo material-app:apiroute admin.user.edit.password

I did something like this before in another generator

michaelkrone commented 8 years ago

Yes, this would be great. What would you do if the 'parent' module does not exist yet?

Stupidism commented 8 years ago

I just asked if user needs an abstract father https://github.com/stupidisum/generator-ng-zhaimi/blob/master/route/index.js#L52-L69

Stupidism commented 8 years ago

But my work with templates was bad. I just created the abstract route in the same file. https://github.com/stupidisum/generator-ng-zhaimi/blob/master/templates%2Froute%2Froute(uirouter).js#L27-L42

michaelkrone commented 8 years ago

Looks good, an optional abstract parent seems a good approach to me. Would you like to dig into this? I could investigate in this feature too, but I am preparing an Angular Material update, so it would took some time.

Stupidism commented 8 years ago

I think I will do this in this week if it's not too complex. Our project needs this feature, but it needs time, too.

Is there any way to let apiroute generate the father routes one by one? Or just add an abstract route like my old work do.

michaelkrone commented 8 years ago

There is the possibility to use generator.composeWith and call the subgenerators. All work is done by createFiles and registerRoute of the apiroute generator, so we could call ngUtil.processDirectory(options, 'apiroute', options.dir); by hand and pass in a valid options object. I think composeWith is a cleaner approach, what do you think?

Stupidism commented 8 years ago

Yes, it's much better. Just like the mkdir command.

So, if I already have routes a and a.b and I want to generate a new route a.b.c.d.e Command material-app:apiroute a.b.c.d.e is all I need and it's the same as the following commands. Module name should be exactly same as route name by default.

material-app:apiroute a.b.c
material-app:apiroute a.b.c.d
material-app:apiroute a.b.c.d.e

Here are some problems needs to be figured out.

  1. How can generator tell a.b already exists?
  2. Should the generator add new child-modules' names into father routes and how?
michaelkrone commented 8 years ago
  1. The generated .yo-rc.json contains an angularModules section, which contains modules that have been registered by the generator. Since a route is wrapped in a module, we could lookup registered modules here or add a section for registered routes.
  2. That's a harder one, we could adjust the template to insert child routes on some conditions, I do not know right now, have to think about it.
Stupidism commented 8 years ago

Hey, buddy. Do you have time to maintain this repo any more? How about giving our group permissions to maintain this repo?

michaelkrone commented 8 years ago

Hi @stupidisum,

at the moment, I do not have much time for this project. What is your group about? I would like to grant you access for developing. I sent you an collobaration invitation

Stupidism commented 8 years ago

We are IT department of ClarityMovement

https://clarity.io/

Stupidism commented 8 years ago

Sorry, I forgot to label those PRs as WIP. After you merged them, I commited something else. So I decided to reset back to 0.1.5 and merge master branch of my fork. Sorry again for push --force in master.

Please add a protection for master branch in settings. I can't change the settings of this repo. And please set develop as default branch! From now, I will develop in git-flow-mode

michaelkrone commented 8 years ago

Done. I'll close this Issue now.

Closed with #48