@basaldev/nodeblocks-cloud-sdk
v0.7.0
Published
Nodeblocks cloud SDK
Keywords
Readme
Nodeblocks Cloud SDK
Nodeblocks Cloud SDK for creating the custom adapter.
🧑💻 For the user who use this SDK
Installation
You need npm token to install the package. Contact to the Nodeblocks team to get the token.
npm i @basaldev/nodeblocks-cloud-sdkConfiguration
We recommend to create the configuration files below by running
nbc adapter devinteractively.
Create nbc.sdk.json file in the root directory and add the following configuration to specify the service and the version of the adapter.
cp nbc.sdk.json.default nbc.sdk.json{
"adapter":{
"service":"auth|user|organization|catalog|order|review|chat|notification",
"version":"x.x.x"
}
}Create a .env.${service} file in the root directory and add the following configuration to pass the configs to the service and the adapter.
cp .env.default .env.${service}ADAPTER_PACKAGE_NAME=`Absolute path to the adapter package`
PORT=8080
NODE_ENV=production
SERVICE_XXXX=`Service configuration (depends on the service)`
...
ADAPTER_XXXX=`Adapter configuration (depends on the service and the adapter)`
...Commands
Start the development server to develop the custom adapter
nbc adapter devStart the server with the custom adapter
nbc adapter start👮♀️ For the developers who develop this SDK
Installation
npm ciCommands
Fetch the latest service templates
In the root directory, create a file called nbc.sdk.json and add the following configuration:
{
"backendRepo": "[email protected]:basaldev/nodeblocks-cloud-backend.git"
}To fetch the latest templates from backend repository, run the following command:
npm run templates:fetchBy default, it fetches from the default branch. You can specify the branch as follows:
{
"backendRepo":{
"url": "[email protected]:basaldev/nodeblocks-cloud-backend.git",
"branch": "develop"
}Testing
To test the SDK command locally, use /test folder.
First create pack file for the SDK:
npm packThis will create a file called basaldev-nodeblocks-cloud-sdk-x.x.x.tgz in the root directory.
In package.json of the test folder, update the dependencies to use the local package and npm i --no-save to install the package.
// Change x.x.x to the version of the package
"dependencies": {
"@basaldev/nodeblocks-cloud-sdk": "file:../basaldev-nodeblocks-cloud-sdk-x.x.x.tgz"
}Then, run the scripts you want like npm run adapter:dev to test there.
You should delete ADAPTER_PACKAGE_NAME from .env.${service} file not to use the custom adapter.
Publish the package
Upgrade the version in package.json file.
Run the following command to publish the package:
npm publish