Skip to main content

Developing a Custom Component Library in a Private Environment

Prerequisites

  • Node.js environment
  • Install Cloudbase CLI
  • Private deployment environment
  • The environment supports installing npm packages or has pre-built node_modules

Creating a Custom Component Library in the Private Environment Console

Navigate to the component library management page in the private environment console and create a new component library.

Downloading the Component Library Template Code

If the current environment has public network access, you can use tcb lowcode create <identifier of the newly created component library> --skip-validate to download the template code.

If the current environment cannot access the public network, you can directly download the ZIP file from GitHub and manually upload it.

Modifying the Component Library Configuration

There is a cloudbaserc.json file in the component library code. If it was not created by the CLI, the lowcodeCustomComponents.name field in the file needs to be modified to the corresponding component library identifier. Assuming the created component library identifier is mydemo

Note

In a private environment, additional private environment-related configurations are required in the cloudbaserc.json file.

Private configurations are located in the lowcode.privateSettings field.

The credential field is the API Key generated in the private console.

In the endpoints, configure the editor and cliApi fields to represent the editor and cliApi entry points in the private environment respectively.

privateUin is the user uin in the private environment.

Except for private deployment-related configurations, the other fields are consistent with the public cloud. https://docs.cloudbase.net/lowcode/custom-components/config/config-comps

Below is a complete example of a cloudbaserc.json file

{
"envId": "{{_envId}}",
"lowcodeCustomComponents": { // This field is consistent with the public cloud
"name": "mydemo", // Component library identifier
"configRoot": "./src/configs",
"platformRoot": {
"web": {
"entry": "./src/web",
"components": "./src/web/components",
"actions": "./src/web/actions"
},
"mp": {
"entry": "./src/mp"
}
}
},
"lowcode": { // Private deployment-specific configurations
"privateSettings": {
"credential": {
"secretId": "xxxxx",
"secretKey": "xxxxx"
},
"endpoints": {
"editor": "http://lcap.o.wedagns.tcs230.fsphere.cn/v2/dev.html",
"cliApi": "http://node-api.o.wedagns.tcs230.fsphere.cn/api/v1/cliapi"
},
"privateUin": "909619400"
}
}
}

Debugging/Publishing and Using the Component Library in Applications

The usage of publishing and debugging features is consistent with the public cloud. See details