This commit is contained in:
David Aaron Suddjian 2022-02-02 13:53:25 -08:00
parent 3f9ca83530
commit 5efa6eef8a
1 changed files with 18 additions and 16 deletions

View File

@ -25,8 +25,26 @@ This is because the SDK has different requirements from other parts of the Super
Namely, we need to export a lightweight frontend library that can be used in as many environments as possible.
Having separate configs allows for better separation of concerns and allows the SDK code to remain simple.
## Testing
The functions used in the sdk so far are very closely tied to browser behavior,
and therefore are not easily unit-testable. We have instead opted to test the sdk behavior using end-to-end tests.
This way, the tests can assert that the sdk actually mounts the iframe and communicates with it correctly.
At time of writing, these tests are not written yet, because we haven't yet put together the demo app that they will leverage.
## Publishing
To publish a new version, first determine whether it will be a major/minor/patch version according to [semver rules](https://semver.org/).
Run `npm version [major|minor|patch]`, and include the resulting version change in your PR.
Building the package and publishing to npm will be handled by github actions automatically on merge to master,
provided that the currently specified package version isn't already published.
## Building
Builds are handled by CI, so there is no need to run the build yourself unless you are curious about it.
The library is built in two modes: one for consumption by package managers
and subsequent build systems, and one for consumption directly by a web browser.
@ -39,19 +57,3 @@ for use directly in the browser with no build step e.g. when importing via unpkg
Typescript outputs type definition files to the `dist` directory.
Which of these outputs is used by the library consumer is determined by our package.json's `main`, `module`, and `types` fields.
## Testing
You may notice a lack of tests in this directory. The functions used in the sdk so far are very closely tied to browser behavior,
and are not easily testable. We have instead opted to test the sdk behavior using end-to-end tests.
This way, the tests can assert that the sdk actually mounts the iframe and communicates with it correctly.
At time of writing, these tests are not written yet, because we haven't yet put together the demo app that they will leverage.
## Publishing
To publish a new version, first determine whether it will be a major/minor/patch version according to [semver rules](https://semver.org/).
Run `npm version [major|minor|patch]`, and commit the resulting version change.
Building the package and publishing to npm will be handled by github actions automatically on merge to master,
provided that the currently specified package version isn't already published.