-
Notifications
You must be signed in to change notification settings - Fork 168
Forked rework of Omnisharp generator-aspnet and additon of new template w/ options #97
Comments
*** UPDATE: 1 make sure when you install this you use npm install xtianus79/generator-aspnet and the generator name is aspnet-f5 to not interfere with another generator. |
*** UPDATE: 2 - WARNING - When installing the "christian starter web template" make sure to be in the directory where you want your project installation to take place... i.e. projects/yourAppHere |
I haven't had a chance to try this yet (I'm traveling). On email one thing that I asked was to see if you could investigate default behavior of popular generators. I'd like for whatever we do to be in line with what others are doing so that we can provide a consistent experience. |
@sayedihashimi Sure I would be glad to share this with you. #1 https://github.com/yeoman/generator-angular --> run yo app in directory The reason why IMO and assumptions that this makes the most absolute sense is that you are installing and running actions from that directory - automatically. for example this line of code will install bower and npm packages automatically.
|
Thanks for the info and links. I will try the generator in the next day or so. I also found that the generators from yeoman https://github.com/yeoman have this same behavior, so that leads me to agree with you. I'd like to hear what others think. I think your brining up two issues here.
For the running grunt part, do you know if the other generators do this? In the beginning of this project we would kick off kpm restore automatically. We received feedback that was annoying. Users wanted to have a chance to modify dependencies before a restore. This feels like we might get the same feedback on grunt. Thanks for taking the time to do this I really appreciate it. We (me at least) are not yeoman experts so we are all learning together. |
@sayedihashimi I can't wait for you to try it because most of your concerns will be alleviated. In fact, we could implement the kpm restore after build the same way I implemented a grunt function. To your 2 issues/concerns... The folder name is optional in my rework based on these 2 parameters. first, if the template requires no folder generation then this property can be excluded.
second, instead of using applicationName as the app name for the default prompt you can parse the current folder you are in and hit return to simply set that name for whatever reason (if you're in the folder there might not be a purpose but it's there) or enter in your name if you are per se not in the current folder structure...
so in the end the folder name is optional and if you're in the path then you're good to go. for the next concern yeoman has this.installDependenicies built in and this allows for the functionality at the end to run bower and grunt. I also wrapped this to in an if statement from a function that prompts the user in the beginning if they want this done or not. This is conjunction with the code I show you above. The same could be done for kpm restore I presume. All in all, there are about 5 questions, in my template that help setup the build process for the user. code below of reworked end function. along with the code written in a previous comment. When you get back let me know what you think. In the end I think it will make a lot of sense to run the templates this way. A lot more choices and room for others to build templates on top of the rework.
|
*** UPDATE 3 - finished functionality of distribution folder... Added mkdir for includes and wwwroot/dist in the "christian starter web template." This will allow for the use of a _header.cshtml and _footer.cshtml to be calling into the _Layouts.cshtml for awesome functionality of bower insertions and concat and minify on project completion/publish. |
Thanks I will review today and comment back. Sorry for the delay, I'm on vacation with family. |
@sayedihashimi sounds good. hope you like it... |
In my opinion the generator-aspnet is a multipurpose generator - kind of Suisse Knife. Here - just like in VS - we can create multiple projects within a single top directory - within single solution. I like idea of using similar approach when creating a project between generator and VS tooling UX.
I've used to create projects like above within a single solution project at my work with current VS2013 tooling - so I find it really useful that I could translate that experience to generator. |
@peterblazejewicz So you agree that the projects should be deployed from within the directory. From you're example it would make sense for the subgenerators too yes? |
No, I'm not agree - have you used VisualStudio to generate different projects within a single solution? Your generator uses Foundation, have you used their |
@peterblazejewicz I am confused by this statement "have you used VisualStudio to generate different projects within a single solution?" How would that change if you would just deploy in the directory you are in? |
@xtianus79 |
In VisualStudio I create a project choosing template and providing a name - the project directory is created and filled with code. |
@peterblazejewicz maybe I am confused from this point of view. Let me explain what this rework does. It accomplishes two things.
I don't get how that coincides with what you are saying? |
@peterblazejewicz I think see what you're saying now... But I believe i have that covered. I have a question. You say
But I have a question? Is there something in the generator that C# uses to identify namespace with based on the application name you have chosen? If so that is great news because I left that parameter in there whether you are using the folder you are in i.e. application name or if you are in the project folder and then cd into the application after. What matters most here is the design UX of the template - meaning was it supposed to be in the folder or outside of the folder. To your next point of UX similarity between VS and Generator... I think about it this way. In VS if I choose a template and provide a name I am then dropped automatically into that template to do whatever it is that I need to do within that project. If this were possible then there wouldn't' be an issue but that is not possible with a Yeoman generator. In fact, that is what this methodology would accomplish right? You are in the folder at the time the files are dropped into the project. Plus, with this capability you are then able to run automatic bower and grunt commands | and potentially KPM commands that isn't even possible if you were to setup an app in VS. So if I were comparing UX I would have to say that having the generator fill the project from the directory it is in is exactly how the VS currently works. Plus with more capabilities. |
Thanks for all the comments and the sample that you created. Let's take a step back and discuss principals. I'm proposing that we follow the following principle. generator-aspnet principles
We've already achieved the first goal of being consistent with VS project templates. Regarding point 2, @xtianus79 has a good list of some of the most popular generators which do have the application name as optional. In addition to that I tried the generators created by yeoman themselves https://github.com/yeoman. They all have the application name as optional. You can specify a name and then that folder will be created. They also default to displaying the name of the current folder as the default name. So if you want your project created in that folder you hit enter, and if you want to create it in another folder you give the name at that time. Some of the generators are smart with the application name, for example generator-generator which has a naming convention of Based on that I believe that we should switch to having application name as optional. I have some comments about the specific prompting that was in the sample, but I'll hold off on those until we close on the larger question. @spboyer @peterblazejewicz thoughts? I'd also like to see if @shanselman has thoughts here. FYI I believe that @spboyer, @xtianus79 along with myself will be at the Orlando Code Camp let's get together and discuss in person if possible as well as here. |
A lot to chew on here. First, all generators are opinionated and any implementation can range from being very generic to very specific depending on the goals. As @sayedihashimi mentioned the 2 goals of generator-aspnet, I believe we have been trying to keep to these. I don't think that there is an issue with having an option of creating or not creating a directory with the appname. We just need to decide what the default behavior is and implement it. As far as the extended solution that @xtianus79 has implemented in his fork as the "christian" type, this in my opinion is a specific and extended implementation of a build or CI process using minification, foundation, jade etc. If these are additional options that should be made to the developer, there are more presentable ways to offer them. generator-ionic has a wizard like questions when asking for the cordova plug-ins with check boxes, and then adds the dependencies to the generated files for the selected items. |
@spboyer you are correct that this is a specific and extended implementation of a build. However, like the generator-ionic generator my template uses a wizard to prompt the user into what options they specifically want in the framework of my template. With that said, I believe some options that build grunt processes and add functionality would be on template level. Would you all agree with this? For example, my template isn't just the notion of adding in foundation instead of bootstrap... But rather, it is a complete workflow with many options of functionality such as building your project, putting in additional bower libraries, compiling sass files (*in a very particular setup - this isn't just a foundation cli setup), and finally - publishing your project which minifies and concats your entire workflow. With that said, that style of workflow is niche per se... The same setup could be done for boostrap or another css framework just not in this template. The reason being is that there gets to be a point where the complication of the flow or process is too great to just wizard or option out. I don't work with bootstrap so I wouldn't be the best person to create that template. For things such as including font-awesome for other templates like the original starter web template is fair for a wizard and should be easy to implement. But for a template such as the generator that I have incorporated into the aspnet generator is most viable in it's own template and not in an optional/wizard type capacity. I understand that it would be confusing to anyone that isn't immersed in foundation sass/scss process wouldn't know what this template is supposed to accomplish but a frontend person would greatly appreciate the VS integration. So my suggestion based on I would suggest providing the framework for other templates or even forks to work seamlessly would the aspnet generator. |
*** UPDATE 4 - Removed Bower:Install functionality because it wasn't playing nice with wiredep. Wiredep allows for the automatic injection of bower dependencies into your html or cshtml files directly. Replaced funtionality of Bower:Install with seperate copy and clean grunt tasks. Now the folder structure in the wwwroot/lib mimics that of bower_components minus unnecessary files and folders. As a result, there is no need to use "exportsOverride" as the file path will be the same as where it came from. |
*** UPDATE 5 - Fixed up some issues with grunt tasks so grunt bower-install runs after project is installed or kpm restore is ran. Both watch servers on port 9000 / dist 9001 work for index.html and ports 5001 work for k web command. Fixed issue for installation error on MAC OS X because of absolute file paths... I will wait to see what is decided from the .net team for implementation of pull requests and listing other generators like this one. The last update will be the publishing of the package to npm and change in readme file to reflect capabilities and changes. |
OK so @xtianus79, @spboyer and I met on Saturday to discuss and I have some thoughts to share with you. ProposalWe believe that the In addition to this we discussed the idea of the name of the project being optional or not. In the existing yeoman generators there is plenty of precedent for both having a required project name or being optional so there is no hard line one way or the other. Since the generators have been released they have behaved in the way that they do today, the name is required and that would create a new project folder. Also Visual Studio behaves this way as well. Because of that we should leave the project name as it is. If we hear feedback from the community indicating otherwise we can reconsider this decision. Since the goal of In this case @xtianus79 has created a generator which goes much farther than what Visual Studio has. This would be a good case to create a seperate generator, let's say These related generators can live anywhere. In some cases it will make sense to add them to the OmniSharp organization and in other cases in other repositories. If you've developed a related generator and you feel that it should be in the OmniSharp org please contact me and we can discuss it. I have already added a section, related generators to the wiki home page. The only generator listed there is currently If you are interested in creating a new related generator but you do not know where to start please reach out to me and I will help you get started. Thoughts? |
I love this idea. The naming thing is cool because it means I can get ones from people I respect, or from projects (generator-aspnet-nancy), or orgs. We should list them all in one place for discovery purposes! |
+1 I love the idea of not having one big ass generator project that tries to generate everything under the sun. There is no need to as well since yeoman allows for generators to be composed! 👍 http://yeoman.io/authoring/composability.html I would personally love if we claimed both the
Not sure if we should also separate out languages from project types here though. |
the big question here is what are the long term plans within MS, if |
We could list the most common base generators on the sexy new site and link to the wiki for even more community provided ones. |
@sayedihashimi |
@shanselman @spboyer @xtianus79 @peterblazejewicz @Mpdreamz @shanselman stated and I am I also love the idea
Still, I want to keep something in perspective for everyone reading or weighing in on this topic. Generators are not something that is just simple. They are robust frameworks that if done well can make life simpler and more automated in a developers work process. I have used many generators and they do take a bit of a learning curve to get the most out of them. Most would say, including myself, after using them they wouldn't ever want to do without them. With that said, I would ask the question and wonder how would it be handled in general the scope of each proposed generator. For example, I have gone to great lengths to make sure the functionality of my generator keeps with the currently UX and functionality of the original generator plus my added template. The reason why someone would choose my generator or someone else's is because they read the description and a particular generator appealed to them. Now, should that generator hold the same functionality of the original generator plus a template or certain functionality that has been added? Or is it ok if the generator does a very specific thing and omits the main generators functionality entirely or partially? Should that be in the description of the generator. Again, it was important for me and will continue to be important for me to make sure that I sync my generator upstream to the aspnet generator and allow whomever should choose to use my generator still have all of the advantages and capabilities of the original generator i.e. sub-generators for example. For my case I plan on just calling my generator aspnet-xf5 or if I plan on adding additional templates to my framework perhaps aspnet-xtianus will be more appropriate and I will have an npm package published soon based on this methodology. Most likely for the template inside I will call it foundation5... Foundation 6 will have certain aspects of angular built in and will likely need a major update. In this way, and to the heart of @sayedihashimi and @shanselman 's point I will continue to update and create additional templates for my generator while keeping in an upstream communication with the original aspnet generator. Once we come to an agreement, and I think we have... I would just like to hear a final decision... I would like to publish an npm package and setup the variations with my readme file and wikipage. In my opinion anyone submiting a generator to be listed should have it published through npm with proper readme documentation so not to confuse the installer with npm someuser/generator-aspnet. I am sure that in my case Foundation will be very happy I took the time to do this and promote this and aspnet on their site as well. They are very friendly folks! |
FYI I have created a new wiki page based on my comment above https://github.com/OmniSharp/generator-aspnet/wiki/goals-and-related-generators.
That's the beauty of the approach. You can create
It's up to that particular generator. |
@sayedihashimi all in all I feel this is a great idea... I have learned a lot about VS in my time creating my version/extension of the aspnet generator. With that said, I have buttoned up my generator and have tested it on both pc and mac and it works pretty well. I would like to submit it to the omnisharp/aspnet community https://www.npmjs.com/package/generator-aspnet-xtianus I can create a wiki for it on the aspnet wiki as well if you plan on having room for that. I have 2 readme files for the project that can be viewed for the main readme and the template specific readme here: https://github.com/xtianus79/generator-aspnet/blob/master/README.md The heart of what I have created is a not just a Foundation 5 framework for ASP.NET but a means to do frontend developement with bower and grunt while a .net developer creates his/her magic for the backend. I hope everyone can appreciate the effort and look forward to adding additional template variations inside of the aspnet-xtianus package! |
I thought I replied back to this a few days back but it looks like it was never posted. For the short term I think what we can do to ensure that related generators are discoverable are:
We also have a related generators section on the wiki https://github.com/OmniSharp/generator-aspnet/wiki, which anyone can edit. The readme and omnisharp.net sections are more important though as they will get more visibility. I've already added the initial content based on generator-aspnet and generator-csharp. In the following places.
For anyone developing a generator, after it's posted please send a PR to get a brief description of your generator added. @xtianus79 can we close this now? |
sure thing. |
Per our conversations here are the goods I promised...
https://github.com/xtianus79/generator-aspnet
*** UPDATE: 1 make sure when you install this you use npm install xtianus79/generator-aspnet and the generator name is aspnet-f5 to not interfere with another generator.
*** UPDATE: 2 - WARNING - When installing the "christian starter web template" make sure to be in the directory where you want your project installation to take place... i.e. projects/yourAppHere
*** UPDATE 3 - finished functionality of distribution folder... Added mkdir for includes and wwwroot/dist in the "christian starter web template." This will allow for the use of a _header.cshtml and _footer.cshtml to be calling into the _Layouts.cshtml for awesome functionality of bower insertions and concat and minify on project completion/publish.
*** UPDATE 4 - Removed Bower:Install functionality because it wasn't playing nice with wiredep. Wiredep allows for the automatic injection of bower dependencies into your html or cshtml files directly. Replaced funtionality of Bower:Install with seperate copy and clean grunt tasks. Now the folder structure in the wwwroot/lib mimics that of bower_components minus unnecessary files and folders. As a result, there is no need to use "exportsOverride" as the file path will be the same as where it came from.
*** UPDATE 5 - Fixed up some issues with grunt tasks so grunt bower-install runs after project is installed or kpm restore is ran. Both watch servers on port 9000 / dist 9001 work for index.html and ports 5001 work for k web command. Fixed issue for installation error on MAC OS X because of absolute file paths...
I will wait to see what is decided from the .net team for implementation of pull requests and listing other generators like this one.
The last update will be the publishing of the package to npm and change in readme file to reflect capabilities and changes.
*** Keep in mind. I believe the entry folder should be the name of your project as this gives the ability to run npm install & bower install after configuration. You will notice this when you choose "Christian's" template.
*** When running my template (from a folder inside of the projects directory) you will obtain a series of prompts. For now just hit enter (even for the project name) and it will install all of the defaults.
At the very end of the installation you will have everything installed... To test apply grunt in your CLI and you will notice that a series of events happens such as Bower:install, compile sass, copy, clean, bower-install, watch and more!!! there are many other commands as well.
*** a before distribution html playground setup on localhost port 9000 will allow for quick css / sass edits to be done and seen in realtime... no need to even refresh the browser.
*** bower install injects automagically bower packages into your project
*** The purpose of this is refined front-end work flow for Foundation or any other bower integration you can think of.
*** Lastly, I am not done with this as the very last thing I need to do... I am going to parse out the extra _Layout.cshtml into header and footer .cshtml such that it can be placed right into the real Layout.cshtml and will thus be automatically updated when working on the project above.
****** One noticeable bug from VS 2015 preview is that the gruntfile.js hangs when all of my options are selected. They are written correctly and all of them work in command line. to aleviate the issue I have commented out grunt task called dist, which is the final concat and minification of the project. <<< Very useful.
here is a link to the file.
https://github.com/xtianus79/generator-aspnet/blob/master/templates/projects/christian/_gruntfile.js
The text was updated successfully, but these errors were encountered: