@hodfords/nestjs-command
TypeScript icon, indicating that this package has built-in type declarations

10.0.0 • Public • Published

Nest Logo

nestjs-command

Description

Nest Nest commands for common templates


Installation 🤖

npm install @hodfords/nestjs-command --save-dev
  • src/config/command.config.ts
import { CommandModule } from '@hodfords/nestjs-command';

export const commandConfig = CommandModule.register(); // CommandModule.register(false) if typeorm is disabled
  • src/app.module.ts
import { Module } from '@nestjs/common';
import { CommandModule } from '@hodfords/nestjs-command';

@Module({
    imports: [commandConfig],
    controllers: [],
    providers: []
})
export class AppModule {}
  • src/cli.ts
import { NestFactory } from '@nestjs/core';
import { CommandService } from '@hodfords/nestjs-command';
import { commandConfig } from '~config/command.config';

async function bootstrap() {
    const app = await NestFactory.create(AppModule);
    const commandService: CommandService = app.select(commandConfig).get(CommandService, { strict: true });
    await commandService.exec();
    await app.close();
}

bootstrap();
  • package.json
"wz-command": "wz-command"

Usage ⚡️

Make new command

npm run wz-command make-command <file-name> -- --module <module-name>
OR
wz-command make-command <file-name> --module <module-name>

Make controller

npm run wz-command make-controller <file-name> -- --module <module-name>
OR
wz-command make-controller <file-name> --module <module-name>

Make dto

npm run wz-command make-dto <file-name> -- --module <module-name>
OR
wz-command make-dto <file-name> --module <module-name>

Make e2e test

npm run wz-command make-e2e-test <file-name> -- --module <module-name>
OR
wz-command make-e2e-test <file-name> --module <module-name>

Make entity

npm run wz-command make-entity <file-name> -- --module <module-name>
OR
wz-command make-entity <file-name> --module <module-name>

Make migration

Create new table

npm run wz-command make-migration <file-name> -- --module <module-name> --create=<entity-name>
OR
wz-command make-migration <file-name> --module <module-name> --create=<entity-name>

Update a table

npm run wz-command make-migration <file-name> -- --module <module-name> --update=<entity-name>
OR
wz-command make-migration <file-name> --module <module-name> --update=<entity-name>

Make module

npm run wz-command make-module <module-name>
OR
wz-command make-module <file-name>

Make repository

npm run wz-command make-repository <file-name> -- --module <module-name>
OR
wz-command make-repository <file-name> --module <module-name>

Make service

npm run wz-command make-service <file-name> -- --module <module-name>
OR
wz-command make-service <file-name> --module <module-name>

Readme

Keywords

none

Package Sidebar

Install

npm i @hodfords/nestjs-command

Weekly Downloads

54

Version

10.0.0

License

ISC

Unpacked Size

242 kB

Total Files

61

Last publish

Collaborators

  • nguyentiendung-dev