This project (along with the sample app) both require a minimum Node version of 16.3.0 or greater. Download NodeJS here. Alternatively, you can use a tool such as nvm to install another version of node and switch to that.
This project also uses yarn package manager. You'll need to install that as well to run the commands within this project.
This library exposes the following commands you can run to get started with development
Install all dependencies for the SDK project
Starts the SDK on a local server on port 8080 available at http://localhost:8080
. Does 3 things in parallel:
- Runs
ttsc
(yes you read that rightttsc
instead oftsc
) in watch mode, which is responsible for only creating the TypeScript definitions (d.ts
) files and then transforming absolute path imports to relative ones. - Runs
babel
in watch mode, responsible for transpiling the TypeScript files into JavaScript - Runs
webpack
in watch mode, which compiles all the transpiled JavaScript files into one rootindex.js
.
Runs all the same 3 commands from yarn start
but not in watch mode.
When this command finishes, you'll have transpiled files located in the dist
directory, along with an index.js
file in the root of the project.
Runs the Jest test suite on any files ending in test.{ts|js|tsx|jsx}
or inside a __test__
directory
Recursively deletes all node_modules
directories (important if you also want to delete the node_modules
within the sample app. Otherwise rm -rf node_modules
will work just as well).
🚨 Prerequisite: Run through the configuring instructions first
While developing the SDK, you'll most likely want to run the sample app alongside it so you can test your code in a browser environment. You can get the sample app running with the SDK by using these commands:
Installs dependencies for both the SDK and the sample app. It's important to run this command before either yarn start
ing or yan build
ing.
Runs both the SDK and sample app in watch mode. Navigate to http://localhost:8080
in your browser to see the sample app running. Making changes to the SDK src
code while running both projects will also trigger the sample app to hot reload, so you can develop both projects in parallel.