2.5.2 • Published 8 months ago
epigraph-std-lib v2.5.2
INTRODUCTION
Epigraph Standard Library or epigraph-std-lib is a collection of standards that we follow across our solutions. The idea is to have a single source of truth across solutions while ensuring that the dependencies are always up to date with the industry standards.
EPIGRAPH
A global object that must only be initialized once per session and provides some common functionalities across solutions in that session.
EPIGRAPH LIBRARY EXPORTS
| Name | Description |
|---|---|
| EpigraphBaseSolution | A base class intended to enforce some common functionalities across our solutions |
| EpigraphLogger | A logger class that provides a convenient way for logging info, warning or errors in any given session |
| EpigraphQrCoreGenerator | A Utility class that allows the generation of a QR code from a give string input |
| EpigraphUnitsConverter | A Utility class that allows conversion between different standard unit, including but not limited to Distance, Color, etc. |
| EpigraphUrlProcessor | A Utility class that provides various methods to generate, process, manipulate URLs |
3rd PARTY LIBRARY EXPORTS
| Name | Version |
|---|---|
| three | |
| model-viewer | |
| @epigraph/epigraph-analytics | |
| qr-creator |
HOW TO:
Add a new EpigraphLibrary:
- Create a new directory under lib/EpigraphLibs/
<MyEpigraphLibrary> - Create the module file/s. Ensure that the names of these files are in camelCase.
- Export this module in lib/EpigraphLibs/epigraph-std-lib.ts as
export * from "./ThirdPartyLibs/main"; - Write a test for this Library under tests/<MyEpigraphLibrary.test.ts>
Write a test:
We use vitest to write tests in this repository using happy-dom to support some but not all browser functionalities. In order to write a new test:
- Create a new file for a specific test under tests/ as
<MyEpigraphLibrary>.test.ts - Write a test following the instructions and samples here
- Make sure to import the library from "../dist/epigraph-std-lib" to avoid any issues that might come up after bundling.
- Open a terminal and execute "npm run test". This will build all the libraries under dist/ and then run tests using those.
REFERENCES
A huge thanks to everyone who inspired the setup for this repository: 1. Andreas Riedmuller's Article 2. Vitest Docs
2.5.2
8 months ago