ts-domainer v1.0.2
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
- 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
- domainer-config.json must have all necessary information about core files (name, path)
-
-
-
-
-
-
*** I want to create new context - DONE
When I run
domainer add
and chooseContext
domainer asks the name of new contextIf context exists domainer must notify me and do nothing
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
- Module.ts module must be imported in AppModule.ts automatically
-
-
-
-
-
-
- *** I want to create new use case
- When I run
domainer add
and chooseUse 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>
If use case action already exists in same context domainer must notify me and do nothing
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
UseCaseToken.ts must be upgrated with new Use case token automatically
Module.ts module must be updated with new Use case automatically
-
-
-
-
-
-
*** I want to create new repository
- When I run
domainer add
and chooseRepository
domainer asks the next questions:
- Repository context: string
- Repository DB context: string <"global" is default>
- Repository entity name: string
If repository already exists in same context domainer must notify me and do nothing
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
- Choosen DB context must be upgrated with new Repository automatically (both interface and implementation)
*** Files validation save all paths, filenames into config.