Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hodfords-solutions/nestjs-command

nestjs-command simplifies creating and managing CLI commands in NestJS applications. It offers an easy way to define and execute commands, streamlining CLI integration and boosting productivity with minimal configuration.
https://github.com/hodfords-solutions/nestjs-command

cli command nestjs nodejs

Last synced: 3 days ago
JSON representation

nestjs-command simplifies creating and managing CLI commands in NestJS applications. It offers an easy way to define and execute commands, streamlining CLI integration and boosting productivity with minimal configuration.

Awesome Lists containing this project

README

        


Hodfords Logo

nestjs-command simplifies creating and managing CLI commands in NestJS applications. It offers an easy way to define and execute commands, streamlining CLI integration and boosting productivity with minimal configuration.

## Installation πŸ€–

Install the `nestjs-command` package with:

```
npm install @hodfords/nestjs-command --save
```

Set up in your codebase:

- `src/config/command.config.ts`

```javascript
import { CommandModule } from '@hodfords/nestjs-command';

export const commandConfig = CommandModule.register();

// export const = CommandModule.register(false) if typeorm is disabled
```

- `src/app.module.ts`

```javascript
import { Module } from '@nestjs/common';
import { CommandModule } from '@hodfords/nestjs-command';

@Module({
imports: [commandConfig],
controllers: [],
providers: []
})
export class AppModule {}
```

- `src/cli.ts`

```javascript
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`

```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

```bash
npm run wz-command make-command -- --module
```

```bash
wz-command make-command --module
```

### Make a controller

```bash
npm run wz-command make-controller -- --module
```

```bash
wz-command make-controller --module
```

### Make a dto

```bash
npm run wz-command make-dto -- --module
```

```bash
wz-command make-dto --module
```

### Make an e2e test

```bash
npm run wz-command make-e2e-test -- --module
```

```bash
wz-command make-e2e-test --module
```

### Make an entity

```bash
npm run wz-command make-entity -- --module
```

```bash
wz-command make-entity --module
```

### Make a migration

#### Create table

```bash
npm run wz-command make-migration -- --module --create=
```

```bash
wz-command make-migration --module --create=
```

#### Update table

```bash
npm run wz-command make-migration -- --module --update=
```

```bash
wz-command make-migration --module --update=
```

### Make a module

```bash
npm run wz-command make-module
```

```bash
wz-command make-module
```

### Make a repository

```bash
npm run wz-command make-repository -- --module
```

```bash
wz-command make-repository --module
```

### Make a service

```bash
npm run wz-command make-service -- --module
```

```bash
wz-command make-service --module
```

## License πŸ“

This project is licensed under the MIT License