Skip to content

Latest commit

 

History

History
80 lines (58 loc) · 2.53 KB

CONTRIBUTING.md

File metadata and controls

80 lines (58 loc) · 2.53 KB

Contributing to InLive JavaScript SDK

Local Setup

Ensure you have already installed git, and npm in your local machine.

  1. Clone this repository to your local machine
  2. Navigate to the SDK directory and install the dependencies by using npm install command
npm install
  1. Run the development mode with this command. This will automatically bundle the SDK on every file changes.
npm run dev
  1. To run a production build, you can run with this command
npm run build

Testing

Unit Test

To categorize the SDK modules with their corresponding test file easily, we always put the test file in the same directory as the tested module. Every test file name is written on this format [modulename].test.js

To run the unit test once, you can use this command

npm run test

To run the unit test on watch mode, you can use this command

npm run test:watch

Link to other Projects Locally

Option 1

To link the SDK in the local machine and use it in another project you can use npm-link feature.

  1. Navigate to the SDK directory and run this command
npm link
  1. Navigate to the project which you want link the SDK with and run this command
npm link @inlivedev/inlive-js-sdk
  1. Note that if the project already has installed an existing SDK from the NPM, you need to change the local SDK name field in the package.json file in order to link the local SDK to the project. Then, you can run the command above with the exact value of the new name field.

Option 2

The alternative way is by installing the SDK to another local project locally without downloading it from the NPM registry. This approach is similar with the npm-link.

  1. Use npm install command that points to the SDK local path.
npm install @inlivedev/inlive-js-sdk-local@file:../path/to/the/inlive-js-sdk/directory
  1. The command above will register the @inlivedev/inlive-js-sdk-local dependency in the package.json that points to the local path of the SDK. The name of the dependency is up to you to decide.
{
  "dependencies": {
    "@inlivedev/inlive-js-sdk-local": "file:../path/to/the/inlive-js-sdk/directory",
  }
}
  1. And then, you can import the SDK just like usual
import { } from '@inlivedev/inlive-js-sdk-local'

By using this approach, you don't need to change the name field in the actual SDK package.json file.