Skip to content

Commit

Permalink
Merge pull request #8 from hodfords-solutions/chore/update-readme
Browse files Browse the repository at this point in the history
chore: update readme
  • Loading branch information
dung-nguyentien authored Sep 12, 2024
2 parents 30512cd + ae0daf8 commit ac828c7
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 50 deletions.
115 changes: 68 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,31 @@
<p align="center">
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a>
<a href="http://opensource.hodfords.uk" target="blank"><img src="https://opensource.hodfords.uk/img/logo.svg" width="320" alt="Hodfords Logo" /></a>
</p>

# nestjs-command
<p align="center"> <b>nestjs-command</b> 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.</p>

## Description
## Installation 🤖

[Nest](https://github.com/nestjs/nest) Nest commands for common templates
Install the `nestjs-command` package with:

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

- [Installation](#installation)
- [Usage](#usage)
- [Make new command](#make-new-command)
- [Make controller](#make-controller)
- [Make DTO](#make-dto)
- [Make e2e test](#make-e2e-test)
- [Make entity](#make-entity)
- [Make migration](#make-migration)
- [Make module](#make-module)
- [Make repository](#make-repository)
- [Make service](#make-service)
Set up in your codebase:

## Installation 🤖
- `src/config/command.config.ts`

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

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

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

- `src/app.module.ts`
- `src/app.module.ts`

```javascript
import { Module } from '@nestjs/common';
import { CommandModule } from '@hodfords/nestjs-command';
Expand All @@ -47,7 +38,7 @@ import { CommandModule } from '@hodfords/nestjs-command';
export class AppModule {}
```

- `src/cli.ts`
- `src/cli.ts`

```javascript
import { NestFactory } from '@nestjs/core';
Expand All @@ -64,88 +55,118 @@ async function bootstrap() {
bootstrap();
```

- `package.json`
- `package.json`

```json
"wz-command": "wz-command"
```

## Usage ⚡️
## 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 new command
### Make a command

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

```bash
wz-command make-command <file-name> --module <module-name>
```

### Make controller
### Make a controller

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

```bash
wz-command make-controller <file-name> --module <module-name>
```

### Make dto
### Make a dto

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

```bash
wz-command make-dto <file-name> --module <module-name>
```

### Make e2e test
### Make an e2e test

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

```bash
wz-command make-e2e-test <file-name> --module <module-name>
```

### Make entity
### Make an entity

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

```bash
wz-command make-entity <file-name> --module <module-name>
```

### Make migration
#### Create new table
### Make a migration

#### Create table

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

```bash
wz-command make-migration <file-name> --module <module-name> --create=<entity-name>
```
#### Update a table

#### Update table

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

```bash
wz-command make-migration <file-name> --module <module-name> --update=<entity-name>
```

### Make module
### Make a module

```bash
npm run wz-command make-module <module-name>
OR
```

```bash
wz-command make-module <file-name>
```

### Make repository
### Make a repository

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

```bash
wz-command make-repository <file-name> --module <module-name>
```

### Make service
### Make a service

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

```bash
wz-command make-service <file-name> --module <module-name>
```

## License 📝

This project is licensed under the MIT License
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hodfords/nestjs-command",
"version": "10.1.0",
"version": "10.1.1",
"description": "A utility for running CLI commands in NestJS apps",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit ac828c7

Please sign in to comment.