SAP / generator-easy-ui5

Meta-generator various project types within the UI5 Universe
https://blogs.sap.com/2021/04/09/easy-ui5-3.0-from-community-contributions-to-community-plugins/
Apache License 2.0
242 stars 72 forks source link

Remove the extra dir uimodule when generate app #38

Closed ttay265 closed 3 years ago

ttay265 commented 4 years ago

Easy-Ui5 version: 6.9.0 OS/version: Windows 10 Browser/version (+device/version): Chrome Steps to reproduce the problem:

  1. type: yo easy-ui5
  2. follow all steps to generate

What is the expected result? The folder webapp should be right below the root folder (same level as node_modules)

What happens instead? The folder webapp is contained in uimodule folder

brandoncaulfield commented 4 years ago

Hi ttay265,

I've just tried and get the same thing. @IObert does this have something to do with Cloud Foundry?

Thanks!

ttay265 commented 4 years ago

Hi ttay265,

I've just tried and get the same thing. @IObert does this have something to do with Cloud Foundry?

Thanks!

Hello brandoncaulfield, I tried SAP Netweaver as the host, not Cloud Foundry, and still issues.

Thanks,

IObert commented 4 years ago

Hi,

I designed it that way to allow multiple web apps in one project. If the webapp folder would be in the project root, there could be only one of them. So this is not specific to CF.

I'm open to suggestions if you have an idea to organize this differently.

ttay265 commented 4 years ago

Hi IObert, Thank you for your answer. It's clear enough for me. I suggest we could have an option to choose the project root instead of forcing to put webapp in uimodule. Thanks

brandoncaulfield commented 4 years ago

Hi @IObert ,

May I ask why you would want multiple webapps in one project? I always assumed it was one project, one webapp.

I personally would also find it very useful to have the option to allow the webapp to be placed in the root folder. Is that something I could help add/ contribute to the code base myself?

Thanks @IObert

IObert commented 4 years ago

Hi @ttay265, Hi @brandoncaulfield,

yes, I can see that this is a valid use-case and it makes sense to add a prompt like "Is this a single web app project?" to the generator. I'm currently on vacation and don't think it'll get to this any time soon. So I'd be very happy if you could help out and create a PR for this.

Regards, Marius

brandoncaulfield commented 4 years ago

Hi @ttay265, Hi @brandoncaulfield,

yes, I can see that this is a valid use-case and it makes sense to add a prompt like "Is this a single web app project?" to the generator. I'm currently on vacation and don't think it'll get to this any time soon. So I'd be very happy if you could help out and create a PR for this.

Regards, Marius

Hi @IObert,

Sure, I'll take a stab at it and let you know. I might have some queries here and there but lets see how I get on. :)

brandoncaulfield commented 4 years ago

Hi @IObert,

I've added the prompt but not sure exactly how you'd like me to add the new template. Should I just reference a new folder structure or is there a better way? :)

IObert commented 4 years ago

My gut feeling would be to reuse the "newwebapp" sub-generator and to add a condition that will rewrite the target path (and remove the "uimodule") there. I did something similar here when the subgenerator is called a second time.

Please also add a check that will prevent this sub-generator can be called a second time as this would override the original webapp folder.

brandoncaulfield commented 4 years ago

Hi @IObert,

Thanks for the advice. I found that point as well and have been trying it out. I've made the following changes in the newwebapp sub-gen: here Trying to add the if logic as well.

Bu I wanted to see if I could get it to work before writing in the IF condition and I come out with a strange error both in debugging and in a normal test at this point it seems - here

Debugger error: subgen target change debugger error messages

Normal test using yo easy-ui5: subgen target change yo easy-ui5 test error messages

I'm not sure what's happened because the file paths seem to be updated without the "uimodule" correctly.

I feel like I'm missing the bigger context somewhere here...

Thanks @IObert ! Hope you're having a good vacation!

IObert commented 4 years ago

I just had a very short look but it might be that your replacement turns a relative path in an absolute path (uimodule/webapp -> /webapp).
That could explain why the ui5.yaml file is directly on C:\ in your case

IObert commented 4 years ago

One more thing just came to my mind. Please make sure the sub-generator for "newview" and "newcontrols" will continue to work when the folder hierarchy changes

brandoncaulfield commented 3 years ago

Hi @IObert ,

Apologies for the delay but it's been very hectic. I've still got this on my todo list and will get back on it asap!

IObert commented 3 years ago

FYI : We moved the code that is addressed by this issue to another repo. Please do the PR here once you find the time: https://github.com/ui5-community/generator-ui5-project