11.0.6 β€’ Published 10 months ago

@hodfords/nestjs-command v11.0.6

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

Installation πŸ€–

Install the nestjs-command package with:

npm install @hodfords/nestjs-command --save

Set up in your codebase:

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

export const commandConfig = CommandModule.register();

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

@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.createApplicationContext(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 πŸš€

Here’s how you can use them. For each type of component, you can use one of the two available command formats: with npm run or directly with wz-command

Make a command

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

Make a controller

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

Make a dto

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

Make an e2e test

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

Make an entity

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

Make a migration

Create table

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

Update table

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

Make a module

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

Make a repository

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

Make a service

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

List all scheduled cron jobs

npm run wz-command list-cron-jobs
wz-command list-cron-jobs

Run specific cron jobs

npm run wz-command run-cron-jobs -- --jobs <jobName>
wz-command run-cron-jobs --jobs <jobName>

License πŸ“

This project is licensed under the MIT License

10.2.0

1 year ago

10.2.1

1 year ago

11.0.6

10 months ago

11.0.4

11 months ago

11.0.5

10 months ago

11.0.2

12 months ago

11.0.3

12 months ago

11.0.0

12 months ago

11.0.1

12 months ago

10.1.2

1 year ago

10.1.3

1 year ago

10.1.0

1 year ago

10.0.1

2 years ago

10.1.1

1 year ago

10.0.2

2 years ago

10.0.3

2 years ago

10.0.4

2 years ago

10.0.0

2 years ago

8.0.0

2 years ago

1.0.8

2 years ago

1.0.7

3 years ago

1.0.6

3 years ago