GithubHelp home page GithubHelp logo

Suggestion: CLI Tools about nest HOT 22 CLOSED

nestjs avatar nestjs commented on April 17, 2024 22
Suggestion: CLI Tools

from nest.

Comments (22)

KerryRitter avatar KerryRitter commented on April 17, 2024 18

So I talked with Kamil and I'm going to start working on the nest CLI. What are you guys' thoughts on this for starters?

example screenshot:
nest-cli-ex

examples commands:

nest create my-new-app 
// generates a new Nest application in the current folder (path is an optional second parameter)

nest g module users 
// generates users folder and users.module.ts

nest g controller UsersController ./users/users.controller.ts 
// creates the users/users.service.ts file, would be usersController.ts by default

nest g component UsersService ./users/users.service.ts
// creates the users/users.service.ts file, would be usersService.ts by default

nest serve --p 8090
// serves the nest app at port 8090, probably use 8080 by default

nest build
// compiles the typescript .. somewhere

from nest.

lholznagel avatar lholznagel commented on April 17, 2024 6

Maybe like the angular cli create Controller / Services (Component)

from nest.

KerryRitter avatar KerryRitter commented on April 17, 2024 6

I created a repo here https://github.com/nestjs/nest-cli. Still very much a work in progress, but wanted to make it open.

I could use some help with the build/serve pieces of anyone is interested in that. I am working on the piece to create new projects and assets.

I think we can close this ticket and move discussion to the new repo.

from nest.

KerryRitter avatar KerryRitter commented on April 17, 2024 2

Definitely agree with this. Laravel's Artisan CMD is fantastic and would be a great tool to look at for inspiration.

from nest.

kamilmysliwiec avatar kamilmysliwiec commented on April 17, 2024 2

Hi guys!
Thanks for your involvement. About CLI, I think we should consider those commands (@KerryRitter, I used your proposals) :

nest create my-new-app 
// generates a new Nest application in the current folder (path is an optional second parameter)

nest g module users 
// generates users folder and users.module.ts

nest g controller users ./users/users.controller.ts 
// creates the users/users.controller.ts file (UsersController class), would be users.controller.ts by default

nest g component UsersService ./users/users.service.ts
// creates the users/users.service.ts file (UsersService class), would be users.service.ts by default

nest g middleware users ./users/users.middleware.ts
// creates the users/users.middleware.ts file (UsersMiddleware), would be users.middleware by default

nest g gateway users ./users/users.gateway.ts
// creates the users/users.gateway.ts file (UsersGateway), would be users.gateway by default

nest g gateway-middleware users ./users/users.middleware.ts
// or maybe just nest g middleware with additional flag? (-g?)
// creates the users/users.middleware.ts file (UsersMiddleware), would be users.middleware by default

nest g filter users ./users/users.filter.ts
// creates the users/users.filter.ts file (UsersExceptionsFilter), would be users.filter by default

nest serve --p 8090
// serves the nest app at port 8090, probably use 8080 by default

nest build
// compiles the typescript .. somewhere

Also - we have to remember that someone might want to use Nest without TypeScript (so we need 2 ways of build, serve and create app). About testing framework - I agree that it should be a standardised way to run tests. From my point of view - jasmine could be a best choice. What do you think?

from nest.

Mark-McCracken avatar Mark-McCracken commented on April 17, 2024 2

Made this. Think it could be nice looking for when we have a CLI tool.
Think this could go in when we use nest -v, similar to angular? If so, any preferences on which one? (I prefer first one)

      ____        ___                       ___        ______   ___   ________
     /    \      /  /_______     ______  __/  /_      /  ____) /  /  (___  ___}
    /  /\  \    /  //  ___  \   /  ____)(__   __}    /  /     /  /      / /
   /  /  \  \  /  //  (___)  \ /  /___    /  /      /  /     /  /      / /
  /  /    \  \/  /(  ________/ \___   \  /  /      /  /     /  /      / /
 /  /      \    /  \ \______  ____/  /  /  /_     /  /___  /  /__  __/ /__ 
/__/        \__/    \_______}{______/   \____}    \______}/______}(_______}



______     ____                     ___        ______ ___      _______
|     \    |  |                  __|  |__     / _____)| |     (__  ___}
|  |\  \   |  |  ______   ______(__    __}   | /      | |        | |
|  | \  \  |  | /  ___ \ |  ____)  |  |      | |      | |        | |
|  |  \  \ |  ||  (___) \| (____   |  |      | |      | |        | |
|  |   \  \|  ||  ______/|____  |  |  |      | |      | |        | | 
|  |    \     ||  \____   ____) |  |  \___   | |_____ | |____  __| |__
|__|     \____| \______} {______/   \_____}   \______}|______}(_______}

from nest.

thomrick avatar thomrick commented on April 17, 2024 1

For the ones who want to develop the CLI tool look at Caporal.js !

https://github.com/mattallty/Caporal.js

I think this could be a great framework to expose the CLI actions

from nest.

Mark-McCracken avatar Mark-McCracken commented on April 17, 2024 1

totally agree, a CLI tool similar to ng-cli would be great. Do we need to get some core requirements down for what this should be able to do? Happy to help in any way, even if its just organising stuff

from nest.

KerryRitter avatar KerryRitter commented on April 17, 2024 1

I'm using Caporal per @thomrick's suggestion - it's fantastic to get rolling.

If you'd like to help, I could use a hand with a good build process on compiling the app and serving the app. I following Ionic's method of using git repos to initialize apps and will look at how Angular CLI does the asset generation.

I am planning on working with Kamil + other contributors to get a proper repo setup but i can make one on my account in the meantime.

from nest.

joshwiens avatar joshwiens commented on April 17, 2024 1

@KerryRitter - I can give you a hand with the CI/CD related work, first decade in software was in devops.

from nest.

KerryRitter avatar KerryRitter commented on April 17, 2024 1

Ahh. Right. Es6. How should we do that? Suffix everything with "es" or "ts"? Perhaps a nest.config.json?

I agree with the proposal - all looks good to me.

from nest.

kamilmysliwiec avatar kamilmysliwiec commented on April 17, 2024 1

@Mark-McCracken, organization profile is already created @nestjs. I am a little bit busy right now, there is a lot of things to do so I'll update each informations when I am free. At the same time, I am working on simple page with urls to github profile & documentation.

from nest.

FieryCod avatar FieryCod commented on April 17, 2024

Could you specify what such a CLI should do? You mean it should have component, controller, basic project generating script?

from nest.

HeroBart avatar HeroBart commented on April 17, 2024

This project seems really promising. I'd love to see something like @angular/cli to start a new project and generate files to lower the bar to get started with this :D

from nest.

Pinedo11 avatar Pinedo11 commented on April 17, 2024

I agree with @Mark-McCracken and @lholznagel. For scaffolding stuff, generate new components, controllers etc... we can do something similar as @angular/cli bearing in mind that the syntax is quite similar.

from nest.

Mark-McCracken avatar Mark-McCracken commented on April 17, 2024

Absolutely 100% agree!
Was going to post exactly this tomorrow afternoon.
Totally agree with format and commands, should be able to have simple one liners to
Generate new components/controllers/entire app
Run the server.
I think there should also be a nest test command, to run all of the tests, I think testability should have a reasonably strong focus in that there's a straightforward, standardised way to run tests, perhaps with Jasmine.
Would love to contribute to this, shall I put together some requirements maybe? Think we need a new repo for this.
Also think we can lean heavily on the work done by the angular cli team, as a lot of this will be fairly similar

from nest.

thomrick avatar thomrick commented on April 17, 2024

Hey @KerryRitter !

Fantastic command documentation !
The Nest-CLI repo has been created yet ?
Where is it ?
Can I bring my contribution on it ?

from nest.

KerryRitter avatar KerryRitter commented on April 17, 2024

There isn't one yet, but I can open up a repo tomorrow and push up what I have. Contributions are certainly welcome!

from nest.

Mark-McCracken avatar Mark-McCracken commented on April 17, 2024

Sounds great!
Think everyone would be pretty happy with Jasmine, angular uses it as theirs, can't see anyone complaining.
Personally, I don't think many people will want to use it without JavaScript, the Type system and experimental decorators are some of the biggest draws for me,
but by all means if I'm wrong here, keep going with JS aspects.

I've been using
tsc -w
in one terminal window, and using
nodemon index.js
in another, and literally can't explain how awesome it is to quickly switch to postman and see your changes already implemented and run!

If anyone has made a start on this project, I think perhaps it might be a good idea to move it to an organisation repo like angulars. Just seen Kamil's post on the evangelism issue, so this seems like the go ahead method :)

from nest.

Mark-McCracken avatar Mark-McCracken commented on April 17, 2024

Does someone wanna set this up?
screen shot 2017-05-07 at 14 12 12

from nest.

kamilmysliwiec avatar kamilmysliwiec commented on April 17, 2024

Thanks @KerryRitter, can't wait to see more

from nest.

lock avatar lock commented on April 17, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

from nest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.