Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding nodemon to Kulture addin #5

Closed
spboyer opened this issue Nov 14, 2014 · 45 comments
Closed

Adding nodemon to Kulture addin #5

spboyer opened this issue Nov 14, 2014 · 45 comments
Assignees

Comments

@spboyer
Copy link

spboyer commented Nov 14, 2014

Compiling scripts and suggestions I was able to get nodemon to watch for file changes in my projects and auto restart kestrel. Not being a Python dev, can we get another K command added?

cd [project dir] && source kvm.sh && nodemon --exec "k kestrel" -e cs,json

Name: K Mon

@johnpapa @bmsullivan

@stimms
Copy link

stimms commented Nov 14, 2014

+1 this would be a great addition

@sayedihashimi
Copy link
Member

Sounds like a great idea!

I'm not python expert either, it's all trial and error.

If someone could send a pr that would speed it up.

@shanselman
Copy link
Member

@sayedihashimi Yes we totally need to do this. Should we use nodemon? Maybe you can I can try to do this together to learn.

@sayedihashimi
Copy link
Member

@shanselman I discussed with @spboyer and he will send a PR. Is there an alternative to nodemon that should be considered here?

@johnpapa
Copy link

nodemon is the defacto in node. it could be used for this. but why the cd and sourcing?

@johnpapa
Copy link

BTW @spboyer you need the at sign to CC :)

@spboyer
Copy link
Author

spboyer commented Nov 14, 2014

@johnpapa the cd and source are a part of the command that is run as a part of the 'k kestrel' to ensure we are executing in the proper dir.

@johnpapa
Copy link

kmon is pronounced "kuh-mon" :)

@spboyer
Copy link
Author

spboyer commented Nov 15, 2014

pull request submitted for "kuh-mon" currently supports cs and json file changes, should probably files supported to settings file and add win support.

@sayedihashimi @johnpapa

@sayedihashimi
Copy link
Member

Moving comments from #6 here.

Thanks for the PR. I tried it out and it looks to work pretty good. I really appreciate that you took time out of your day to put this together.

I don't think that this is the correct way to implement this though. I say that because we add kestrelmon command in project.json then when that command is invoked in Sublime Text Kulture will detect that and replace the call to a call to nodemon. This works great for the Kulture user but it degrades the experience for the core command line user, as well as users of other editors.

I think we have the following options to get this implemented. I've ordered them in what I think is the correct prioritization (closer to the top means its preferred).

Option 1: create an ASP.NET 5 project command

FYI I just came up with the term "project command" there may be another term that I should be using that I'm not aware of

Kulture and other editors have built in support for discovering and invoking commands in project. This is how kestrel,web, etc show up in the respective editors. So if we create a new command (that ships in a NuGet package) and users add an entry in the commands section pointing to it things will just work. When this command is invoked it will make the appropriate call to nodemon. This will work for editors and command line users.
Another benefit to going this route, you'll be learning more about ASP.NET 5, so that's always a plus. I'd like to get a blog post on the ASP.NET team blog on writing a project command so you could help there (posted with your name as author of course) after the project as well.

Option 2: update Kulture with this baked in

Kulture currently has built in support for kpm restore,kpm build & kpm pack. This is added to the sublime command list here. We could add a new kestrelmon command there as well.

Pros/Cons

I'll enumerate what I think the pros/cons are to both approaches from an external perspective.

Option1
Pros
  • It's the solution which provides the broadest coverage. It works from the command line, it works from editors, it works in VS (you can even debug it in VS), etc.
  • It has the most potential. Since it's a NuGet package it can be added to yo aspnet and maybe even one day VS who knows. That could end up being a very popular NuGet package. One of the first popular community packages as well.
  • Blog post is another good opportunity if you are up for it. The idea is to create the command in OSS on github and then ship it in NuGet and then write a blog post that goes on the ASP.NET team blog like i have here and here. You can add your email/github id/twitter acct/etc so that you get recognition. How many of your friends have posts on the official ASP.NET team blog :)
Cons
  • It's more work
Option 2
Pros
  • Easy to implement and straight forward
Cons
  • Only works in Sublime
  • You're learning python/sublime instead of ASP.NET 5

Let me know what you think. If you are up for creating the command I'll try and get you some info on how to do that.

@sayedihashimi
Copy link
Member

@spboyer FYI from the PR @henriksen has stated that his is available to help out with this feature if needed

@spboyer
Copy link
Author

spboyer commented Nov 16, 2014

@sayedihashimi @henriksen what repo is the "project command" implementations in so we can start looking at this? I will repost the question of the hard dependency on nodemon per @shanselman . Certainly want the flexibility to trigger off of file changing; given that the other option is supervisor

nodemon
supervisor

@johnpapa stated nodemon is the de facto standard and has quite a bit more downloads. Juts want to make sure we are looking at all options.

@sayedihashimi
Copy link
Member

@spboyer you just create a console app and then in consuming proj add

  1. Dependency to nuget pkg (or project during dev)
  2. In the consuming proj add a command pointing to the entry point

Both kestrel and scaffolding are used in this way.

For the content that goes into project.json here are examples

  1. kestrel
  2. scaffolding

Adding @davidfowl in case i got anything wrong. Let me know if you need more details.

@henriksen
Copy link

@spboyer Regards nodemon vs others: Since kestrelmon is just a console app it won't be hard to enable multiple watchers. I suggest that supportig nodemon is the first goal and supervisior is the next. Once there's two providers in there it should be trivial for someone to figure out how to add a third, fourth and so on.

@henriksen
Copy link

I've made a proof-of-concept kestrelmon. Works on Win32 for now with nodemon starting "k web" and watching for changes in cs and js files. Will work on Linux and Kestrel version later. Feel free to fork and pull or contrib. @spboyer: I added you as a contributor, let me know if you don't want to.

@spboyer
Copy link
Author

spboyer commented Nov 18, 2014

Making some updates now.

@sayedihashimi
Copy link
Member

I looked at your repo and it looks like you got it all setup right.

FYI you can add parameters after kestrelmon, just like kestrel.

@spboyer
Copy link
Author

spboyer commented Nov 18, 2014

Those are the changes. Thanks for point to the scaffolding project big help

@sayedihashimi
Copy link
Member

@henriksen has created a prototype at https://github.com/henriksen/Kestrelmon/tree/master. Anyone have a few minutes to try it out?

cc @suhasj

@spboyer
Copy link
Author

spboyer commented Nov 20, 2014

@sayedihashimi works great in win, started adding OS X support. Could use some assistance. Use 0.2.0

@henriksen
Copy link

A spot of trouble in Debian, but should get that sorted this weekend.

@henriksen
Copy link

With "Debian", I mean the version pronounced "Ubuntu".

@sayedihashimi
Copy link
Member

Should we email 📧 insiders or tweet folks to try it out?

@sayedihashimi
Copy link
Member

@spboyer "Could use some assistance."
In what capacity?

@henriksen
Copy link

I'd like to get it working on Linux before we go wide. Let me post here when it works.

@henriksen
Copy link

@spboyer What seems to be the officer, Problem?

@spboyer
Copy link
Author

spboyer commented Nov 20, 2014

@henriksen @sayedihashimi when sublime on OSX getting the following error:
System.FormatException: Unrecognized argument format: ''.
at Microsoft.Framework.ConfigurationModel.CommandLineConfigurationSource.Load () [0x00000] in :0

good to go from Win.

@luisrudge
Copy link

so.. i wonder if this is the right approach? I was trying to do live reload just like visual studio and maybe this should not be baked in kulture or any other plugin for that matter.
I'm using gulp-aspnet-k and it's pretty easy to do that with a gulp task.

gulp.task('aspnet-run', aspnetk({
    kCommand: 'kestrel' //default is 'web'
}));

Maybe we should a gulpfile on the aspnet-generator to create basic commands and assume it's gonna be available?

@nosami
Copy link

nosami commented Nov 21, 2014

@luisrudge - if that works, then 👍

@luisrudge
Copy link

It works! Here's a gif:

k

@henriksen
Copy link

Nice @luisrudge! One advantage I see with making a k-command of it is that it would be independent of your build system. Although there is probably a similar task for grunt as well.

@luisrudge
Copy link

if this k-command is just for sublime, then it's going to be a pain to implement and support across editors.

The thing that I disliked most is that the k --watch kestrel command just kills the process when a change happens. That's a bummer. It should restart the process (or at least let me setup what I want)

@henriksen
Copy link

This is a generic asp.net project command that you can run from the command line. "k mon". Kulture will pick it up from the project.json file and make it available. This is option 1 in @sayedihashimi long comment further up here.

@henriksen
Copy link

Yes, this restarts the process.

@luisrudge
Copy link

ahh, ok then! that would be great! but we should discuss that in other issue, right?

@sayedihashimi
Copy link
Member

@luisrudge please read my design proposal above

@luisrudge
Copy link

I read it! I just didn't understand at the time. Now I do and I fully agree with the first proposal!

@davidfowl
Copy link
Member

Don't call it kestrelmon, it makes no sense. Just call it kmon or something.

@henriksen
Copy link

Anyone opposed to renaming it to kmon?

@sayedihashimi
Copy link
Member

+1

@spboyer
Copy link
Author

spboyer commented Nov 21, 2014

O kmon - we'll rename it.

On Nov 21, 2014, at 11:46 AM, David Fowler notifications@github.com wrote:

Don't call it kestrelmon, it makes no sense. Just call it kmon or something.


Reply to this email directly or view it on GitHub.

@luisrudge
Copy link

👍

@spboyer
Copy link
Author

spboyer commented Dec 9, 2014

kmon is now available. Next release 0.3.0-* supports Sublime commands integration on OSX and Windows. Please put all future issues related to kmon here: https://github.com/henriksen/kmon/issues

@sayedihashimi @shanselman @davidfowl

@spboyer spboyer closed this as completed Dec 9, 2014
@luisrudge
Copy link

Awesome!

@sayedihashimi
Copy link
Member

@spboyer 👍 thanks a lot for putting this together! This is awesome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants