1.0.2 • Published 3 years ago

ts-domainer v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

domainer


core features:

  • setup project structure from scratch. Create initial files: -- AbstractUseCase -- DbContext -- DITokens

Core concepts:

  • Use case
  • Repository
  • Context
  • DB Context
  • Service/Client

диалоговое окно, спрашивающее что хотим создать если выбираем Use case | Repository, спрашивается контекст, в котором нужно создать. если выбираем Context, создаётся новая папка с дефолтной структурой:

  • application
  • infrastructure, и файлами *Module.ts . Автоматом модуль иньёктится в глобальный модуль

части, которые создаются при инициализации:

  • DITokens (UseCaseToken, ServiceToken, ClientToken, CoreToken)
  • AppModule (Nest under the hood)
  • AbstractUseCase
  • IDbContext, AbstractDbContext
  • domainer-config.json

--------- V1 ---------

*** I want to setup initial project from scratch. - DONE

  1. When I run domainer init domainer creates the next folder structure and files

src/ ----core/ --------application/ ------------AbstractUseCase.ts ------------IDbContext.ts

--------tokens/ ------------CoreToken.ts ------------UseCaseToken.ts ------------ServiceToken.ts ------------DbContextToken.ts

----AppModule.ts

domainer-config.json

  1. domainer-config.json must have all necessary information about core files (name, path)

-

-

-

-

-

-

*** I want to create new context - DONE

  1. When I run domainer add and choose Context domainer asks the name of new context

  2. If context exists domainer must notify me and do nothing

  3. If context does not exist domainer must create new Context with the next folder structure and files

src/ ----/ --------application/ ------------dataStructures/ ------------useCases/ --------infrastructure/ ------------persistence/ ------------api/ --------Module.ts

  1. Module.ts module must be imported in AppModule.ts automatically

-

-

-

-

-

-

  • *** I want to create new use case
  1. When I run domainer add and choose Use case domainer asks the next questions:
  • Use case context: string
  • Use case DB context: string <"global" is default>
  • Use case action: string
  • Use case has input data: y/n <"y" is default>
  • Use case has output data: y/n <"y" is default>
  1. If use case action already exists in same context domainer must notify me and do nothing

  2. If use case action does not exist in same context domainer must create new Use case with the next folder structure and files

src/ ----/ --------application/ ------------dataStructures/ ------------useCases/ ----------------/ --------------------UseCase.ts --------------------IUseCase.ts --------------------only if "Use case has input data: y" DSUseCaseInputData.ts --------------------only if "Use case has output data: y" DSUseCaseOutputData.ts --------infrastructure/ ------------persistence/ ------------api/ --------Module.ts

  1. UseCaseToken.ts must be upgrated with new Use case token automatically

  2. Module.ts module must be updated with new Use case automatically

-

-

-

-

-

-

*** I want to create new repository

  1. When I run domainer add and choose Repository domainer asks the next questions:
  • Repository context: string
  • Repository DB context: string <"global" is default>
  • Repository entity name: string
  1. If repository already exists in same context domainer must notify me and do nothing

  2. If repository does not exist in same context domainer must create new Repository with the next folder structure and files

src/ ----/ --------application/ ------------boundaries/ ----------------IRepository.ts ------------dataStructures/ ------------useCases/ --------infrastructure/ ------------persistence/ ----------------Repository.ts ----------------Mapper.ts ------------api/ --------Module.ts

  1. Choosen DB context must be upgrated with new Repository automatically (both interface and implementation)

*** Files validation save all paths, filenames into config.