DEV Community

Introducing nest-commander

Jay McDoniel on April 08, 2021

Jay is a member of the NestJS core team, primarily helping out the community on Discord and Github and contributing to various parts of the framewo...
Collapse
 
simplenotezy profile image
Mattias Fjellvang • Edited

Also, by copying the example from this article, I would get:

Property 'personName' does not exist on type '{ name: string; age: number; }'.ts(2339)

I had to tweak the commend to look like this (also adding --name to option) before it would work:

paste.laravel.io/b566d7db-4791-48c...

Collapse
 
jmcdo29 profile image
Jay McDoniel

Thanks for reporting that. The post has been updated to have the proper values

Collapse
 
gktim profile image
gkTim

Nice, Great work!

Collapse
 
piotr_jura profile image
Piotr Jura

I was looking at making my own solution, now I don't have to. Great, thanks!

Collapse
 
tony133 profile image
Antonio Tripodi

Fantastic and interesting post! Great!

Collapse
 
smolinari profile image
Scott Molinari

This is cool stuff. I'm going to be using it extensively in the next couple of weeks.

Scott

Collapse
 
avantar profile image
Krzysztof Szala

I was waiting for something like this. Awesome. Thanks!

Ps. You have a few typos in your code examples.

Collapse
 
jmcdo29 profile image
Jay McDoniel

Thanks for saying something! This is what I get for writing everything in the online editor and not in my IDE

Collapse
 
sueric profile image
Eric

Very nice article! Will give it a try

Collapse
 
markpieszak profile image
Mark Pieszak

Love it Jay, great write up! 👏👏
(Btw tiny typo about in one code block you have @Opiton )

Collapse
 
jmcdo29 profile image
Jay McDoniel

Thanks Mark! Got it fixed

Collapse
 
simplenotezy profile image
Mattias Fjellvang

Would be nice to show how to actually run the command - it took a bit of tinkering to figure out

Collapse
 
jmcdo29 profile image
Jay McDoniel

I added a quick note of how you can run the command after the setup of the src/main.ts file. There's more information as well on the docs site

Collapse
 
huongnhd profile image
Jenny N

Sorry for the stupid quest of mine.
I walk through this post, but I have no idea how to invoke that.

Collapse
 
joaopedro5g profile image
João Pedro

(I'm using translator), can I create an app integrating both standard NestJS and Commander, like I want to make a custom launch command for my nestjs web app, can I do that with both?

Collapse
 
jmcdo29 profile image
Jay McDoniel

Yes, but depending on how you write your imports you might end up making a circular file chain so be careful about that. You'd essentially make the run or the command call NestFactory.create() and the subsequent methods

Collapse
 
vladib13 profile image
Vladimir Blanco Lucena

Thanks, this is so helpful <3