sc-ts-bp
v1.0.3
Published
sc-ts-bp is a Scandio specific Typescript Blueprint (TODO: Generator)
Downloads
4
Readme
sc-ts-bp
sc-ts-bp is a Scandio specific Typescript Blueprint Generator
(Optional) Installation
To get the Generator:
npm i -g sc-ts-bpUsage
To use the Generator first create an empty folder for your new Project:
mkdir newProject
cd newProject then depending on if you have it installed:
generate-project or to directly use the Generator without installing just use npx:
npx sc-ts-bp Options:
| flag | description | | --- | --- | | -l, --layout | add the specified directory layout [technical, components] (default: "technical") | | -h, --help | display help for command |
This will unpack the Skeleton in the current Directory.
Possible Project Layouts
Technical Separation
% tree
.
├── config
│ ├── custom-environment-variables.json
│ ├── default.json
│ ├── development.json
│ └── test.json
├── docker
│ └── Dockerfile
├── docker-compose.yml
├── jest.config.js
├── jest.setup.ts
├── package.json
├── package-lock.json
├── README.md
├── src
│ ├── App.ts
│ ├── controllers
│ │ └── MonitoringController.ts
│ ├── facades
│ ├── index.ts
│ ├── middlewares
│ │ └── accessLogging.ts
│ ├── repositories
│ ├── routes
│ │ └── Routes.ts
│ ├── services
│ └── util
│ └── logger.ts
├── test
│ └── monitoringRoutes.test.ts
└── tsconfig.jsonComponent-based Separation
% tree
.
├── config
│ ├── custom-environment-variables.json
│ ├── default.json
│ ├── development.json
│ └── test.json
├── docker
│ └── Dockerfile
├── docker-compose.yml
├── jest.config.js
├── jest.setup.ts
├── package.json
├── package-lock.json
├── README.md
├── src
│ ├── App.ts
│ ├── components
│ │ ├── Health
│ │ │ └── index.ts
│ │ └── index.ts
│ ├── index.ts
│ ├── lib
│ │ └── logger.ts
│ ├── middleware
│ │ └── accessLogging.ts
│ └── routes
│ ├── HealthRouter.ts
│ └── index.ts
├── test
│ └── monitoringRoutes.test.ts
└── tsconfig.jsonDocker
The generated Projects come with a docker-compose and a Dockerfile. Both are intended for use during ongoing development on the project.
Port '9228' is exposed for use with the debugger.
IntelliJ
Attach a Debug Configuration to the open port.
Hint: Add --collectCoverage=false to jest options in the Jest Debug Template to debug tests.
VSCode
In VSCode a debugContainer can be used to directly open a VSCode Instance in Docker. VSCode will automatically prompt you to install a recommended Extension. Re-Open Workspace in Container and use VSCode as usual.
General Coding Guidelines
Where do Test files live?
| Test Type | Test File Location |
| --- | --- |
| Unit Tests | Beside the code files, Same file name with the .accessLogging.ts suffix |
| Integration Tests | in /tests |
Future Development
OPEN TOPICS
- Swagger
- Generate Swagger: express-swagger-generator
- Host Swagger UI: swagger-ui-express
- Request Validation
- Validate against OpenAPI-Spec: express-openapi-validator
