@ignis-web/cqrs-cli

0.0.8 • Public • Published

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)

Package Sidebar

Install

npm i @ignis-web/cqrs-cli

Weekly Downloads

2

Version

0.0.8

License

ISC

Unpacked Size

34.8 kB

Total Files

7

Last publish

Collaborators

  • dm-kamaev