Socket
Socket
Sign inDemoInstall

@nestjs/cli

Package Overview
Dependencies
116
Maintainers
3
Versions
215
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @nestjs/cli

[![Nest Logo](http://kamilmysliwiec.com/public/nest-logo.png)](http://kamilmysliwiec.com/)


Version published
Maintainers
3
Install size
11.9 MB
Created

Package description

What is @nestjs/cli?

The @nestjs/cli package is a command-line interface tool for NestJS, a framework for building efficient, reliable and scalable server-side applications. This CLI tool helps developers to initialize, develop, and maintain their NestJS applications with ease by providing a set of commands to generate, run, and manage various parts of the application.

What are @nestjs/cli's main functionalities?

Project Initialization

This command creates a new NestJS project with all the necessary configuration and dependencies to get started.

nest new project-name

Generate Resources

Generates a new controller named 'users' within the project. The CLI supports generating various resources like modules, services, and guards.

nest generate controller users

Run Development Server

Starts the application in watch mode. Any changes in the source code will automatically restart the server, facilitating a smooth development process.

nest start --watch

Build Project

Compiles the application into JavaScript, preparing it for production deployment.

nest build

Other packages similar to @nestjs/cli

Readme

Source

Nest Logo

WARNING: The CLI is still a work in progress and is not ready for practical use. The repository is created to allow for insight and contributions.

Nest CLI

Join the chat at https://gitter.im/nestjs/nest-cli Build Status Known Vulnerabilities Coverage Status License: MIT

Installation

Git :

$ git clone https://github.com/nestjs/nest-cli.git <project>
$ cd <project>
$ npm install
$ npm link

###npm

npm install g @nestjs/cli

nestconfig.json

The nestconfig.json is here to manage the CLI execution like asset generation.

{
    "language": "ts | es (default: ts)"
}

Commands

new

Examples :

  • $ nest new my-app
  • $ nest new my-app myapp/
  • $ nest new my-app --repo https://github.com/ThomRick/nest-typescript-starter Creates a new Nest application by cloning https://github.com/ThomRick/nest-typescript-starter Git repository.

generate (or g)

module

Examples :

  • $ nest generate module <assetName> OR $ nest g module <assetName>
  • $ nest g module <assetName> [moduleName]
  • $ nest g module <assetName> [moduleName1/moduleName2/moduleName3]
  • Creates a templated module file :
    • src/app/modules/<assetName>/<assetName>.module.ts
    • src/app/modules/[moduleName]/modules/<assetName>/<assetName>.module.ts
    • src/app/modules/[moduleName1]>/modules/[moduleName2]>/modules/[moduleName3]>/modules/<assetName>/<assetName>.module.ts
@Module({})
export class NameModule {}
controller

Examples :

  • $ nest generate controller <assetName> OR $ nest g controller <assetName>
  • $ nest g controller <assetName> [moduleName]
  • $ nest g controller <assetName> [moduleName1/moduleName2/moduleName3] Creates a templated controller files :
  • src/app/controllers/<assetName>.controller.ts
  • src/app/modules/[moduleName]/modules/controllers/<assetName>.controller.ts
  • src/app/modules/[moduleName1]>/modules/[moduleName2]>/modules/[moduleName3]>/controllers/<assetName>.controller.ts
@Controller()
export class NameController {
    public constructor() {}
}
  • src/app/controllers/<assetName>.controller.spec.ts
  • src/app/modules/[moduleName]/modules/controllers/<assetName>.controller.spec.ts
  • src/app/modules/[moduleName1]>/modules/[moduleName2]>/modules/[moduleName3]>/controllers/<assetName>.controller.spec.ts
import {NameController} from './name.controller';
import {expect} from 'chai';

describe('NameController', () => {
    const controller: NameController;

    beforeEach(() => {
        Test.createTestingModule({
            controllers: [
                NameController
            ]
        });

        controller = Test.get(NameController);
    });

    it('should exists', () => {
        expect(controller).to.exist;
    });
}
component

Examples :

  • $ nest generate component <assetName> OR $ nest g component <assetName>
  • $ nest g component <assetName> [moduleName]
  • $ nest g component <assetName> [moduleName1/moduleName2/moduleName3] Creates a templated component files :
  • src/app/services/<assetName>.service.ts
  • src/app/modules/[moduleName]/modules/services/<assetName>.controller.ts
  • src/app/modules/[moduleName1]>/modules/[moduleName2]>/modules/[moduleName3]>/services/<assetName>.service.ts
@Component()
export class NameService {
    constructor() {}
}
  • src/app/services/<assetName>.service.spec.ts
  • src/app/modules/[moduleName]/modules/services/<assetName>.service.spec.ts
  • src/app/modules/[moduleName1]>/modules/[moduleName2]>/modules/[moduleName3]>/services/<assetName>.service.spec.ts
import {NameService} from './name.service';
import {expect} from 'chai';

describe('NameService', () => {
    const service: NameService;

    beforeEach(() => {
        Test.createTestingModule({
            components: [
                NameService
            ]
        });

        service = Test.get(NameService);
    });

    it('should exists', () => {
        expect(service).to.exist;
    });
}
middleware (not implemented)

serve (not implemented)

build (not implemented)

update (not implemented)

FAQs

Last updated on 25 Jun 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc