@weego/sunubus-sdk
v0.0.82
Published
JavaScript SDK for sunubus services
Downloads
25
Maintainers
Keywords
Readme
Sunubus SDK
This repository contains the javascript SDK for communicating with Sunubus API's
How to setup
First you need node.js v8.12.0 and yarn installed. We recommend using nvm to be able to install and switch between different versions of node.js.
Clone the repository by running:
git clone [email protected]:SunuBus/sunubus-sdk.git
Then cd into it:
cd sunubus-sdk
Run yarn to install the dependencies
yarn install
Run it
Since the sdk is headless, the only thing we run in it are tests that validate that it's components are functioning correctly.
To run them, run:
yarn test
You can also live test the sdk in the projects it is used in (such as sunubus-mobile
) by using the yarn link
command. This allows you to directly test your changes in the project without deploying to NPM first. For that you will need to first run:
yarn link
and then run the webpack server in watch mode by running:
yarn webpack -w
After that, go into the project that uses the sdk and run:
yarn link @weego/sunubus-sdk
Your changes should now be reflected in real time.
Developing features
The sdk is split into multiple clients, one for each api we consume. Every client is a singleton in the sdk and contains methods that allow it to communicate with the diffrerent API's. Information is usually not shared between the clients to keep them simple. They only act as wrappers around the API's to ease their consumption. To exchange authentication data, a TokenRepository is shared between all the clients.
Deployment
The sdk is deployed to our private organization on npm. To deploy, run:
yarn publish
Make sure you have been added to the npm organization first and that you are logged in with your npm account.