背景简介
在本地将 DX Component 开发和测试完成后,需部署至 Pega Platform 以便应用开发使用。
环境配置
- PEGA Infinity 23
详细步骤
第一步: 准备 DX Component Ruleset
参考文档: 【PEGA - 创建 Ruleset】
第二步: 获取认证 Token
参考文档: 【Generate Client Secret of OAuth 2.0 Client Registration】
第三步: 修改DX Component 项目配置文件 tasks.config.json
{
"components-directory-path": "src/components",
"server-config": {
"rulesetName": "PersDXComponent", // 更新为自己的 Ruleset 名称
"rulesetVersion": "01-01-01", // 更新目标 Ruleset 版本号
"sourceOfComponents": "Server",
"devBuild": false,
"serverType": "infinity",
"server": "https://hekmqte1.pegace.net/prweb/", // 更新为自己的 server 路径
"clientId": "99841493444694726430", // 更新为自己的 clientId
"clientSecret_comment": "Needed only when using 'passwordCreds' or 'clientCreds' grantType",
"clientSecret": "871E7C77BBEF4DE702E66C81A0900AA5", // 更新为自己的 clientSecret
"grantType": "clientCreds", // 使用 clientCreds 模式连接
"redirectUri": "https://localhost:4010/",
"authService_comment": "Infinity authentication service alias (when grantType is set to 'authCode')",
"cert_and_key_comment": "Path to SSL certificate file and SSL key file to use when starting local HTTPS server",
"cert_and_key_comment2": "Needed only when using 'authCode' grantType and redirectUri begins with 'https://localhost'",
"cert": "./keys/dxcb.crt",
"key": "./keys/dxcb.key",
"user_and_password_comment": "useful primarily when grantType is set to 'passwordCreds'",
"user": "",
"password": "",
"questions_comment": "useful for designating how frequently questions should be asked during npm run authenticate",
"questions_askAlways": "",
"questions_askNever": "",
"questions_askOnce": "server,authService",
"questions_askedOnce": "server"
},
"component": {
"library": "PersDXComponent",
"type": "",
"version": "1.0.0",
"subtype": "",
"description": "",
"icon": ""
},
"usePromotedWebPack": false
}
第四步: 生成控件
myserver@my-dev:~/pega/pega_dx_component/persdxcomponent$ npm run buildComponent
DX Component Builder v23.1.15
? Select component to build Pers_PersDXComponent_HighlightValue
? Generate development build ? No
✔ Validate config schema
✔ Lint component
✔ Bundle Component
Pers_PersDXComponent_HighlightValue schema is valid
linting /home/myserver/pega/pega_dx_component/persdxcomponent/src/components/Pers_PersDXComponent_HighlightValue
=============
WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.
You may find that it works just fine, or you may not.
SUPPORTED TYPESCRIPT VERSIONS: >=3.3.1 <4.5.0
YOUR TYPESCRIPT VERSION: 4.8.4
Please only submit bug reports when using the officially supported version.
=============
linting complete...
Creating a production build...
stats:assets by path ../../lib/components/Pers_PersDXComponent_HighlightValue/*.ts 1010 bytes
asset ../../lib/components/Pers_PersDXComponent_HighlightValue/mock.d.ts 462 bytes [emitted]
asset ../../lib/components/Pers_PersDXComponent_HighlightValue/index.d.ts 303 bytes [emitted]
asset ../../lib/components/Pers_PersDXComponent_HighlightValue/styles.d.ts 190 bytes [emitted]
asset ../../lib/components/Pers_PersDXComponent_HighlightValue/create-nonce.d.ts 53 bytes [emitted]
assets by path ../../lib/components/Pers_PersDXComponent_HighlightValue/*.map 864 bytes
asset ../../lib/components/Pers_PersDXComponent_HighlightValue/index.d.ts.map 273 bytes [emitted]
asset ../../lib/components/Pers_PersDXComponent_HighlightValue/mock.d.ts.map 231 bytes [emitted]
asset ../../lib/components/Pers_PersDXComponent_HighlightValue/create-nonce.d.ts.map 190 bytes [emitted]
asset ../../lib/components/Pers_PersDXComponent_HighlightValue/styles.d.ts.map 170 bytes [emitted]
asset Pers_PersDXComponent_HighlightValue/Pers_PersDXComponent_HighlightValue.js 112 KiB [emitted] [minimized] (name: main) 2 related assets
orphan modules 4.7 MiB [orphan] 760 modules
runtime modules 698 bytes 4 modules
built modules 270 KiB [built]
modules by path ./node_modules/ 11.9 KiB
modules by path ./node_modules/hoist-non-react-statics/ 5.36 KiB 3 modules
modules by path ./node_modules/react/ 1.15 KiB 2 modules
modules by path ./node_modules/react-is/ 2.4 KiB
./node_modules/react-is/index.js 196 bytes [built] [code generated]
./node_modules/react-is/cjs/react-is.production.min.js 2.21 KiB [built] [code generated]
./node_modules/object-assign/index.js 2.06 KiB [built] [code generated]
./node_modules/shallowequal/index.js 979 bytes [built] [code generated]
./src/components/Pers_PersDXComponent_HighlightValue/index.tsx + 36 modules 258 KiB [built] [code generated]
external "React" 42 bytes [built] [code generated]
external "ReactDOM" 42 bytes [built] [code generated]
webpack 5.89.0 compiled successfully in 10927 ms
Compiled successfully.
File sizes after gzip:
34.2 kB components/Pers_PersDXComponent_HighlightValue/Pers_PersDXComponent_HighlightValue.js
第五步: 部署控件
- 认证连接配置
myserver@my-dev:~/pega/pega_dx_component/persdxcomponent$ npm run authenticate
DX Component Builder v23.1.15
Authenticated successfully !!
- 推送部署
myserver@my-dev:~/pega/pega_dx_component/persdxcomponent$ npm run publish
DX Component Builder v23.1.15
? Select component to publish Pers_PersDXComponent_HighlightValue
? Enter ruleset name PersDXComponent
? Enter ruleset version 01-01-01
? Generate development build ? No
✔ Validate config schema
✔ Lint component
✔ Bundle Component
✔ Zip Component
✔ Publish Component
Pers_PersDXComponent_HighlightValue schema is valid
linting /home/myserver/pega/pega_dx_component/persdxcomponent/src/components/Pers_PersDXComponent_HighlightValue
=============
WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.
You may find that it works just fine, or you may not.
SUPPORTED TYPESCRIPT VERSIONS: >=3.3.1 <4.5.0
YOUR TYPESCRIPT VERSION: 4.8.4
Please only submit bug reports when using the officially supported version.
=============
linting complete...
Creating a production build...
stats:assets by path ../../lib/components/Pers_PersDXComponent_HighlightValue/*.ts 1010 bytes
asset ../../lib/components/Pers_PersDXComponent_HighlightValue/mock.d.ts 462 bytes [compared for emit]
asset ../../lib/components/Pers_PersDXComponent_HighlightValue/index.d.ts 303 bytes [compared for emit]
asset ../../lib/components/Pers_PersDXComponent_HighlightValue/styles.d.ts 190 bytes [compared for emit]
asset ../../lib/components/Pers_PersDXComponent_HighlightValue/create-nonce.d.ts 53 bytes [compared for emit]
assets by path ../../lib/components/Pers_PersDXComponent_HighlightValue/*.map 864 bytes
asset ../../lib/components/Pers_PersDXComponent_HighlightValue/index.d.ts.map 273 bytes [compared for emit]
asset ../../lib/components/Pers_PersDXComponent_HighlightValue/mock.d.ts.map 231 bytes [compared for emit]
asset ../../lib/components/Pers_PersDXComponent_HighlightValue/create-nonce.d.ts.map 190 bytes [compared for emit]
asset ../../lib/components/Pers_PersDXComponent_HighlightValue/styles.d.ts.map 170 bytes [compared for emit]
asset Pers_PersDXComponent_HighlightValue/Pers_PersDXComponent_HighlightValue.js 112 KiB [emitted] [minimized] (name: main) 2 related assets
orphan modules 4.7 MiB [orphan] 760 modules
runtime modules 698 bytes 4 modules
built modules 270 KiB [built]
modules by path ./node_modules/ 11.9 KiB
modules by path ./node_modules/hoist-non-react-statics/ 5.36 KiB 3 modules
modules by path ./node_modules/react/ 1.15 KiB 2 modules
modules by path ./node_modules/react-is/ 2.4 KiB
./node_modules/react-is/index.js 196 bytes [built] [code generated]
./node_modules/react-is/cjs/react-is.production.min.js 2.21 KiB [built] [code generated]
./node_modules/object-assign/index.js 2.06 KiB [built] [code generated]
./node_modules/shallowequal/index.js 979 bytes [built] [code generated]
./src/components/Pers_PersDXComponent_HighlightValue/index.tsx + 36 modules 258 KiB [built] [code generated]
external "React" 42 bytes [built] [code generated]
external "ReactDOM" 42 bytes [built] [code generated]
webpack 5.89.0 compiled successfully in 10081 ms
Compiled successfully.
File sizes after gzip:
34.2 kB components/Pers_PersDXComponent_HighlightValue/Pers_PersDXComponent_HighlightValue.js
Success : Component successfully created in ruleset PersDXComponent:01-01-01
第六步: 引用控件
- 在系统中查看部署是否成功
- 在 Case 中演示
以上便是本文的全部内容,感谢您的阅读。