Ensure you have already installed git, and npm in your local machine.
- Clone this repository to your local machine
- Navigate to the SDK directory and install the dependencies by using npm install command
npm install
- Run the development mode with this command. This will automatically bundle the SDK on every file changes.
npm run dev
- To run a production build, you can run with this command
npm run build
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
To link the SDK in the local machine and use it in another project you can use npm-link feature.
- Navigate to the SDK directory and run this command
npm link
- Navigate to the project which you want link the SDK with and run this command
npm link @inlivedev/inlive-js-sdk
- Note that if the project already has installed an existing SDK from the NPM, you need to change the local SDK
name
field in thepackage.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 newname
field.
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.
- 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
- The command above will register the
@inlivedev/inlive-js-sdk-local
dependency in thepackage.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",
}
}
- 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.