Retool helper functions that run in a browser environment (don't use Node APIs).
Functions should be imported into, then exported from, src/index.ts
.
Don't use Node APIs, these functions are for use in a browser environment.
The Typescript is compiled into ESM and CJS compatible modules. The ESM modules are then bundled using esbundler
and exposed on the browser Window
object under the OakRetoolHelpers
object.
secrets.SONAR_TOKEN
required for running Sonar Cloud with test coverage report uploading.
- Unit tests:
npm run test
- these run in CI, but will not throw if you accidentally include Node APIs in the library. - Browser tests:
npm run browser-test
, this will open a local browser window and run Mocha tests in it. These don't run in CI because we can't extract the test result. Because they run in a browser they will throw if you accidentally include non-Browser APIs, e.g. Node'sprocess.env
.
New GitHub releases are automatically created with the Semantic Release package on merging a PR, and automatically released to npmjs.com.
Documentation can be read locally by using the command npm run open-docs
The bundled code can be included on a page as a <script>
tag. Once loaded the functions will be available on the OakRetoolHelpers
object attached to the global Window
scope, e.g. OakRetoolHelpers.slugify(myString)
. See the browser test file for an example.
We are not currently accepting external contributions, thank you.