2.5.2 • Published 3 months ago

epigraph-std-lib v2.5.2

Weekly downloads
-
License
-
Repository
-
Last release
3 months ago

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

NameDescription
EpigraphBaseSolutionA base class intended to enforce some common functionalities across our solutions
EpigraphLoggerA logger class that provides a convenient way for logging info, warning or errors in any given session
EpigraphQrCoreGeneratorA Utility class that allows the generation of a QR code from a give string input
EpigraphUnitsConverterA Utility class that allows conversion between different standard unit, including but not limited to Distance, Color, etc.
EpigraphUrlProcessorA Utility class that provides various methods to generate, process, manipulate URLs

3rd PARTY LIBRARY EXPORTS

NameVersion
threethree version
model-viewer@google/model-viewer version
@epigraph/epigraph-analytics@epigraph/epigraph-analytics version
qr-creatorqr-creator version

HOW TO:

Add a new EpigraphLibrary:

  1. Create a new directory under lib/EpigraphLibs/<MyEpigraphLibrary>
  2. Create the module file/s. Ensure that the names of these files are in camelCase.
  3. Export this module in lib/EpigraphLibs/epigraph-std-lib.ts as export * from "./ThirdPartyLibs/main";
  4. 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:

  1. Create a new file for a specific test under tests/ as <MyEpigraphLibrary>.test.ts
  2. Write a test following the instructions and samples here
  3. Make sure to import the library from "../dist/epigraph-std-lib" to avoid any issues that might come up after bundling.
  4. 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