0.0.8 • Published 8 months ago

@ignis-web/cqrs-cli v0.0.8

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

CQRS CLI

CLI library for code generation commands and queries with handlers for package @ignis-web/cqrs.

npm i @ignis-web/cqrs -S

Example

Creating file with types for command and query:

# example/module/user/type.ts

import { ICommand, IQuery, ICommandHandler, IQueryHandler } from '@ignis-web/cqrs';

export interface ICreateCommand extends ICommand<'user.create', { id: number; name: string }> { };
export interface ICreateHandler extends ICommandHandler<ICreateCommand> { };

export interface IGetByIdQuery extends IQuery<'user.get-by-id', number> { };
export interface IGetByIdHandler extends IQueryHandler<IGetByIdQuery, { id: number, name: string }> { };

Generate code:

npx create-cq -m example/module/user

Output:
example/module/user/
├── cq
│   ├── Create.command.ts
│   ├── Create.handler.ts
│   ├── GetById.handler.ts
│   └── GetById.query.ts
├── index.ts
└── type.ts

Options

-m, --module <path> – path of module
-f, --folder <path> – folder of Command/Query/Handler, by default is "cq"
-i, --index <path> – name of index file with Command/Query/Handler, by default is "index.ts"
--snake-case – enable snake case naming format of Command/Query/Handler, be default is disabled (camel case)
0.0.8

8 months ago

0.0.7

8 months ago

0.0.6

9 months ago

0.0.5

9 months ago

0.0.4

9 months ago

0.0.3

9 months ago

0.0.2

9 months ago

0.0.1

9 months ago