- SRP => Single Responsibility: Responsabilidad única.
- OCP => Open/Closed: Abierto/Cerrado.
- LSP => Liskov substitution: Sustitución de Liskov.
- ISP => Interface segregation: Segregación de interfaz.
- DIP => Dependency Inversion: Inversión de dependencia.
This examples was generated with NODE JS and TypeScript
This project contains examples in TypeScript with principles SOLID code in base the book Clean JavaScript
Código limpio, SOLID y Testing
Installation
npm install
Run test with Jest
npm run test
Run example SRP
If you want run SRP mode develop, run the next line:
npm run dev:srp
Run example OCP
If you want run OCP mode develop, run the next line:
npm run dev:ocp
Run example LSP
If you want run LSP mode develop, run the next line:
npm run dev:lsp
Run example ISP
If you want run ISP mode develop, run the next line:
npm run dev:isp
Run example DIP
If you want run DIP mode develop, run the next line:
npm run dev:dip
Compile app to js
If you want run mode production, first compile app, run the next line:
tsc
This project uses a number of open source package to work properly:
-
TypeScript - extends JavaScript by adding types.
-
node.js - evented I/O for the backend
-
tslint - Find and fix problems in your TypeScript code.
-
Prettier - An opinionated code formatter.
-
Husky - Husky can prevent bad git commit, git push and more 🐶 woof!
-
ts-jest - is a delightful JavaScript Testing Framework with a focus on simplicity.
These examples are very simple, and if you do not know much about SOLID. I recommend applying them to simple use cases first.