Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/hodfords-solutions/nestjs-command
- Owner: hodfords-solutions
- Created: 2021-08-13T06:37:41.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-11-29T07:31:45.000Z (about 2 months ago)
- Last Synced: 2025-01-14T14:09:27.428Z (10 days ago)
- Topics: cli, command, nestjs, nodejs
- Language: TypeScript
- Homepage: https://opensource.hodfords.uk/nestjs-command
- Size: 162 KB
- Stars: 47
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
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