DeanHristov / ts-design-patterns-cheat-sheet

Design patterns implemented with Typescript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Motivation

Basically, the design patterns are typical solutions to commonly occurring problems in software engineering. They act as pre-made blueprints that we can customize to solve recurring design problems within our code.

My point is to show you how they are structured (according to me) by examples. I am going to try to cover the most common design patterns and within this repo, also I am going to use TypeScript as a programming language.

I haven't used any kind of AI tools like ChatGPT, CoPIlot, or any other "crutches" for the mind.

Requirements

Included Patterns

Creational Structural Behavioral
Factory method Decorator Command
Abstract Factory Adapter Chain of Responsibility
Builder Facade Observer Pattern
Prototype Bridge Interpreter
Singleton Composite Iterator
Flyweight Mediator
Proxy Memento
State
Strategy
Template
Visitor

Installation

After confirming that your environment meets the above requirements, it is time to clone the project ocally by doing the following:

$ git clone git@github.com:DeanHristov/ts-design-patterns-cheat-sheet.git <project-name>
$ cd <project-name>

When you're done with the steps above, run the following command:

$ npm install # or yarn install

Running the Project in development mode.

Running the app in development mode with HMR.

$ npm run start:dev

All examples can be seen in the test files(/src/[dirname]/[filename].spec.ts)

Running the Project in production mode.

Firstly, build the app with the following command:

$ npm run build

Then run following command to start the app in production mode.

$ npm start

Main tasks

All tasks automation are based on NPM scripts.

Tasks Description
npm run start:dev Running the app in dev mode
npm run build Building the code in production-ready mode
npm run start Running the app in prod mode
npm run test Running the unit tests ( using jest)
npm run test:dev Running the unit with --watchAll mode ( using jest)
npm run lint Code lining
npm run prettier-format Code formatting

Used technologies

NPM Packages

Made by

Author: D. Hristov | Documentation

About

Design patterns implemented with Typescript.


Languages

Language:TypeScript 99.3%Language:JavaScript 0.7%