@pega/custom-dx-components 8.8.17 → 8.8.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierrc.json +7 -1
- package/babel.config.cjs +13 -0
- package/jest.config.cjs +37 -0
- package/package.json +12 -4
- package/src/auth.js +9 -3
- package/src/constants.js +7 -5
- package/src/currentPath.cjs +1 -0
- package/src/tasks/authenticate/index.js +43 -40
- package/src/tasks/build/helper.js +18 -31
- package/src/tasks/build/index.js +26 -6
- package/src/tasks/build-all/index.js +15 -3
- package/src/tasks/bundle/builder/index.js +1 -1
- package/src/tasks/bundle/builder/webpack.config.js +1 -3
- package/src/tasks/create/index.js +17 -7
- package/src/tasks/create/templates/Constellation/Field/Boolean/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/Date/DateFormatter.js.mustache +7 -7
- package/src/tasks/create/templates/Constellation/Field/Date/date.js.mustache +8 -8
- package/src/tasks/create/templates/Constellation/Field/Date/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/DateTime/date-time.js.mustache +10 -10
- package/src/tasks/create/templates/Constellation/Field/DateTime/date-utils.js.mustache +6 -5
- package/src/tasks/create/templates/Constellation/Field/DateTime/date.js.mustache +6 -3
- package/src/tasks/create/templates/Constellation/Field/DateTime/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/Decimal/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/Integer/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/Picklist/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/Text/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/Text-Email/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/Text-Input/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/Text-URL/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/TimeOfDay/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/TimeOfDay/time-of-day.js.mustache +6 -5
- package/src/tasks/create/templates/Constellation/Template/DETAILS/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Template/FORM/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Template/FORM-region/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Template/PAGE/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Widget/CASE/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Widget/PAGE/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/styles.js.mustache +13 -6
- package/src/tasks/create-all/index.js +109 -150
- package/src/tasks/delete/helper.js +87 -53
- package/src/tasks/delete/index.js +8 -15
- package/src/tasks/delete-all/helper.js +132 -85
- package/src/tasks/delete-all/index.js +8 -15
- package/src/tasks/init/index.js +20 -22
- package/src/tasks/init/template/.storybook/package.json +1 -0
- package/src/tasks/init/template/babel.config.cjs +13 -0
- package/src/tasks/init/template/jest.config.cjs +21 -0
- package/src/tasks/init/template/package.json.mustache +6 -4
- package/src/tasks/init/template/test/assets/components/create/Pega_DXIL_MyTestText/config.json +55 -0
- package/src/tasks/init/template/test/assets/components/create/Pega_DXIL_MyTestText/demo.stories.jsx +51 -0
- package/src/tasks/init/template/test/assets/components/create/Pega_DXIL_MyTestText/index.jsx +60 -0
- package/src/tasks/init/template/test/assets/components/create/Pega_DXIL_MyTestText/mock.stories.js +13 -0
- package/src/tasks/init/template/test/assets/components/create/Pega_DXIL_MyTestText/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyBoolean/Boolean.js +38 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyBoolean/boolean-format.js +26 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyBoolean/config.json +145 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyBoolean/demo.stories.jsx +61 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyBoolean/event-utils.js +18 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyBoolean/index.jsx +170 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyBoolean/mock.stories.js +21 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyBoolean/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCaseWidget/OneColumnPage.svg +36 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCaseWidget/config.json +23 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCaseWidget/demo.stories.jsx +78 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCaseWidget/index.jsx +73 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCaseWidget/mock.stories.js +390 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCaseWidget/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCurrency/config.json +291 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCurrency/demo.stories.jsx +53 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCurrency/event-utils.js +18 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCurrency/index.jsx +296 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCurrency/mock.stories.js +23 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCurrency/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCurrency/suggestions-handler.js +10 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDate/DateFormatter.js +61 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDate/FormattedText.jsx +41 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDate/config.json +195 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDate/date.js +439 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDate/demo.stories.jsx +73 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDate/index.jsx +256 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDate/mock.stories.js +23 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDate/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDate/suggestions-handler.js +10 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDateTime/config.json +256 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDateTime/date-time.js +92 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDateTime/date-utils.js +288 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDateTime/date.js +331 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDateTime/demo.stories.jsx +73 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDateTime/index.jsx +254 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDateTime/mock.stories.js +23 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDateTime/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDateTime/suggestions-handler.js +10 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDecimal/config.json +278 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDecimal/demo.stories.jsx +49 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDecimal/event-utils.js +18 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDecimal/index.jsx +270 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDecimal/mock.stories.js +21 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDecimal/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDecimal/suggestions-handler.js +10 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDetails/OneColumnDetails.svg +22 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDetails/StatusWork.jsx +26 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDetails/config.json +35 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDetails/demo.stories.jsx +132 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDetails/index.jsx +83 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDetails/mock.stories.js +189 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDetails/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDetails/utils.js +152 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyEmail/config.json +111 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyEmail/demo.stories.jsx +48 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyEmail/event-utils.js +18 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyEmail/index.jsx +231 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyEmail/mock.stories.js +22 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyEmail/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyEmail/suggestions-handler.js +10 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyForm/DefaultForm.svg +29 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyForm/config.json +45 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyForm/demo.stories.jsx +166 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyForm/index.jsx +42 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyForm/mock.stories.js +137 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyForm/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyInteger/config.json +344 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyInteger/demo.stories.jsx +49 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyInteger/event-utils.js +18 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyInteger/index.jsx +333 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyInteger/mock.stories.js +21 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyInteger/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyInteger/suggestions-handler.js +10 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPage/GetNextWork.jsx +35 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPage/OneColumnPage.svg +36 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPage/config.json +32 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPage/demo.stories.jsx +102 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPage/index.jsx +70 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPage/localizations.json +4 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPage/mock.stories.js +94 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPage/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPage/utils.js +229 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageCaseWidget/Avatar.jsx +75 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageCaseWidget/OneColumnPage.svg +36 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageCaseWidget/Operator.jsx +237 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageCaseWidget/config.json +66 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageCaseWidget/demo.stories.jsx +68 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageCaseWidget/index.jsx +108 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageCaseWidget/mock.stories.js +51 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageCaseWidget/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageWidget/OneColumnPage.svg +36 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageWidget/config.json +59 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageWidget/demo.stories.jsx +30 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageWidget/index.jsx +48 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageWidget/mock.stories.js +23 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageWidget/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyParagraph/config.json +111 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyParagraph/demo.stories.jsx +48 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyParagraph/event-utils.js +18 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyParagraph/index.jsx +231 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyParagraph/mock.stories.js +20 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyParagraph/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyParagraph/suggestions-handler.js +10 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPercentage/config.json +93 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPercentage/demo.stories.jsx +49 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPercentage/event-utils.js +18 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPercentage/index.jsx +275 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPercentage/mock.stories.js +21 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPercentage/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPercentage/suggestions-handler.js +10 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPhone/config.json +123 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPhone/demo.stories.jsx +46 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPhone/event-utils.js +18 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPhone/index.jsx +266 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPhone/mock.stories.js +37 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPhone/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPhone/suggestions-handler.js +10 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPicklist/config.json +114 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPicklist/demo.stories.jsx +78 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPicklist/event-utils.js +18 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPicklist/index.jsx +351 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPicklist/mock.stories.js +67 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPicklist/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPicklist/suggestions-handler.js +10 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyText/config.json +55 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyText/demo.stories.jsx +51 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyText/index.jsx +60 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyText/mock.stories.js +13 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyText/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTextInput/StatusWork.jsx +26 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTextInput/config.json +111 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTextInput/demo.stories.jsx +48 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTextInput/event-utils.js +18 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTextInput/index.jsx +239 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTextInput/mock.stories.js +21 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTextInput/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTextInput/suggestions-handler.js +10 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTimeOfDay/config.json +185 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTimeOfDay/demo.stories.jsx +57 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTimeOfDay/index.jsx +213 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTimeOfDay/mock.stories.js +20 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTimeOfDay/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTimeOfDay/suggestions-handler.js +10 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTimeOfDay/time-of-day.js +288 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnDetails/StatusWork.jsx +26 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnDetails/TwoColumnDetails.svg +28 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnDetails/config.json +42 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnDetails/demo.stories.jsx +136 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnDetails/index.jsx +83 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnDetails/mock.stories.js +230 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnDetails/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnDetails/utils.js +155 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnForm/TwoColumn.svg +38 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnForm/config.json +27 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnForm/demo.stories.jsx +175 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnForm/index.jsx +45 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnForm/mock.stories.js +143 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnForm/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyURL/config.json +237 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyURL/demo.stories.jsx +46 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyURL/event-utils.js +18 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyURL/index.jsx +232 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyURL/mock.stories.js +22 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyURL/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyURL/suggestions-handler.js +10 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyURL/text-url.jsx +173 -0
- package/src/tasks/init/template/test/functionTest/localCreateAllListDeleteAll.test.js +157 -0
- package/src/tasks/init/template/test/functionTest/localCreateBuildAllDeleteAll.test.js +148 -0
- package/src/tasks/init/template/test/functionTest/localCreateBuildDelete.test.js +84 -0
- package/src/tasks/init/template/test/functionTest/localCreateListDelete.test.js +108 -0
- package/src/tasks/init/template/test/functionTest/localCreatePublishAllDeleteAll.test.js +148 -0
- package/src/tasks/init/template/test/functionTest/localCreatePublishDelete.test.js +84 -0
- package/src/tasks/init/template/test/functionTest/localCreateRenameDelete.test.js +84 -0
- package/src/tasks/init/template/test/functionTest/localPromoteRevertWP.test.js +59 -0
- package/src/tasks/list/helper.js +129 -61
- package/src/tasks/list/index.js +3 -4
- package/src/tasks/promote-webpack/index.js +45 -13
- package/src/tasks/publish/helper.js +69 -89
- package/src/tasks/publish/index.js +29 -12
- package/src/tasks/publish-all/helper.js +66 -92
- package/src/tasks/publish-all/index.js +30 -18
- package/src/tasks/rename/index.js +127 -97
- package/src/tasks/revert-webpack/index.js +4 -4
- package/src/util.js +205 -127
- package/test/unitTest/util.test.js +544 -0
- /package/src/tasks/init/template/.storybook/{main.js → main.cjs} +0 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// import { exec } from 'child_process';
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const util = require('node:util');
|
|
5
|
+
const exec = util.promisify(require('node:child_process').exec);
|
|
6
|
+
|
|
7
|
+
describe('promote and revert webpack', () => {
|
|
8
|
+
it('npm run promoteWebPack', async () => {
|
|
9
|
+
const script = `npm run promoteWebPack`;
|
|
10
|
+
|
|
11
|
+
const { stdout, stderr } = await exec(script);
|
|
12
|
+
// console.log(stdout);
|
|
13
|
+
expect(stdout).not.toBeNull();
|
|
14
|
+
expect(stderr).not.toBeNull();
|
|
15
|
+
|
|
16
|
+
// want message to contain component name
|
|
17
|
+
expect(stdout).toContain('Bundler now using');
|
|
18
|
+
expect(stdout).toContain('webpack.config.js');
|
|
19
|
+
|
|
20
|
+
// utilize
|
|
21
|
+
expect(stdout).toContain('Utilize this file for webpack modifications.');
|
|
22
|
+
|
|
23
|
+
// verify new file exists
|
|
24
|
+
const webPackFile = path.resolve('webpack.config.js');
|
|
25
|
+
|
|
26
|
+
expect(fs.existsSync(webPackFile)).toBeTruthy();
|
|
27
|
+
|
|
28
|
+
// if (doesExist) {
|
|
29
|
+
// // remove it
|
|
30
|
+
// fs.rmdirSync(fileDir, { recursive: true });
|
|
31
|
+
// }
|
|
32
|
+
}, 10000);
|
|
33
|
+
|
|
34
|
+
it('npm run revertWebPack', async () => {
|
|
35
|
+
const script = `npm run revertWebPack`;
|
|
36
|
+
|
|
37
|
+
const { stdout, stderr } = await exec(script);
|
|
38
|
+
// console.log(stdout);
|
|
39
|
+
expect(stdout).not.toBeNull();
|
|
40
|
+
expect(stderr).not.toBeNull();
|
|
41
|
+
|
|
42
|
+
// want message to contain component name
|
|
43
|
+
expect(stdout).toContain('marked as not used.');
|
|
44
|
+
expect(stdout).toContain('webpack.config.js');
|
|
45
|
+
|
|
46
|
+
// message with bundler
|
|
47
|
+
expect(stdout).toContain('Bundler reverted to using internal webpack.config.js.');
|
|
48
|
+
|
|
49
|
+
// verify file marked as not used
|
|
50
|
+
const webPackFile = path.resolve('webpack.config.js.notused');
|
|
51
|
+
|
|
52
|
+
expect(fs.existsSync(webPackFile)).toBeTruthy();
|
|
53
|
+
|
|
54
|
+
// if (doesExist) {
|
|
55
|
+
// // remove it
|
|
56
|
+
// fs.rmdirSync(fileDir, { recursive: true });
|
|
57
|
+
// }
|
|
58
|
+
}, 10000);
|
|
59
|
+
});
|
package/src/tasks/list/helper.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
|
-
import https from 'https';
|
|
3
2
|
|
|
4
3
|
import chalk from 'chalk';
|
|
5
4
|
import fetch from 'node-fetch';
|
|
6
5
|
|
|
7
|
-
import { LIST_COMPONENT_SERVICE_REST_ENDPOINT, LP_LIST_COMPONENT_SERVICE_REST_ENDPOINT, TOKEN_PATH } from '../../constants.js';
|
|
8
|
-
import { constructCompleteUrl, getComponents, getPegaServerConfig } from '../../util.js';
|
|
6
|
+
import { LIST_COMPONENT_SERVICE_REST_ENDPOINT, LP_LIST_COMPONENT_SERVICE_REST_ENDPOINT, TOKEN_PATH, COMPONENT_SCHEMA } from '../../constants.js';
|
|
7
|
+
import { constructCompleteUrl, getComponents, getPegaServerConfig, getHttpsAgent } from '../../util.js';
|
|
9
8
|
|
|
10
9
|
export const SOURCE_OF_COMPONENT_TYPES = {
|
|
11
10
|
SERVER: 'Server',
|
|
12
11
|
LOCAL: 'Local'
|
|
13
12
|
};
|
|
14
13
|
|
|
15
|
-
export const getListComponentsQuestions = async (options
|
|
14
|
+
export const getListComponentsQuestions = async (options) => {
|
|
16
15
|
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
17
16
|
|
|
18
17
|
return [
|
|
@@ -29,9 +28,9 @@ export const getListComponentsQuestions = async (options, sourceOfComponentsOpti
|
|
|
29
28
|
];
|
|
30
29
|
};
|
|
31
30
|
|
|
32
|
-
export const listLocalComponents = async sourceOfComponents => {
|
|
31
|
+
export const listLocalComponents = async (sourceOfComponents) => {
|
|
33
32
|
let localComponents = await getComponents();
|
|
34
|
-
localComponents = localComponents.map(name => ({ 'Rule name': name }));
|
|
33
|
+
localComponents = localComponents.map((name) => ({ 'Rule name': name }));
|
|
35
34
|
if (localComponents.length > 0) {
|
|
36
35
|
console.log(chalk.bold.blueBright(`List of custom components in ${sourceOfComponents}`));
|
|
37
36
|
console.table(localComponents, ['Rule name']);
|
|
@@ -40,91 +39,160 @@ export const listLocalComponents = async sourceOfComponents => {
|
|
|
40
39
|
}
|
|
41
40
|
};
|
|
42
41
|
|
|
43
|
-
|
|
42
|
+
async function fetchComponentsFromInfinity(apiUrl, headers) {
|
|
43
|
+
const serverConfig = await getPegaServerConfig();
|
|
44
|
+
return new Promise((resolve, reject) => {
|
|
45
|
+
let status = 500;
|
|
46
|
+
fetch(apiUrl, {
|
|
47
|
+
method: 'GET',
|
|
48
|
+
agent: getHttpsAgent(serverConfig),
|
|
49
|
+
headers
|
|
50
|
+
})
|
|
51
|
+
.then((response) => {
|
|
52
|
+
status = response.status;
|
|
53
|
+
return response.json();
|
|
54
|
+
})
|
|
55
|
+
.then((resp) => {
|
|
56
|
+
// const respData = JSON.parse(resp);
|
|
57
|
+
if (status === 401) {
|
|
58
|
+
throw new Error('Error occurred in authentication. Please regenerate using authenticate');
|
|
59
|
+
// console.log(accessTokenUri, refreshToken);
|
|
60
|
+
/* TODO - Handle refresh_token */
|
|
61
|
+
} else if (status === 200) {
|
|
62
|
+
resolve(resp);
|
|
63
|
+
} else {
|
|
64
|
+
throw new Error(`${resp.message}`);
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
|
68
|
+
.catch((e) => reject(`${chalk.bold.red(e)}`));
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async function fetchComponentsFromLaunchpad(apiUrl, headers) {
|
|
73
|
+
const serverConfig = await getPegaServerConfig();
|
|
74
|
+
// constructing urls for all type of components
|
|
75
|
+
const urls = COMPONENT_SCHEMA.type.map((type) => apiUrl.replace('{type}', type.value));
|
|
76
|
+
const statuses = [];
|
|
77
|
+
|
|
78
|
+
return new Promise((resolve, reject) => {
|
|
79
|
+
Promise.all(
|
|
80
|
+
urls.map(async (url) => {
|
|
81
|
+
return fetch(url, {
|
|
82
|
+
method: 'GET',
|
|
83
|
+
agent: getHttpsAgent(serverConfig),
|
|
84
|
+
headers
|
|
85
|
+
});
|
|
86
|
+
})
|
|
87
|
+
)
|
|
88
|
+
.then((responses) => {
|
|
89
|
+
return Promise.all(
|
|
90
|
+
responses.map((res) => {
|
|
91
|
+
statuses.push(res.status);
|
|
92
|
+
if (res.status === 401 || res.status === 503) {
|
|
93
|
+
// Finding a 503 response is sometimes being returned from Launchpad in expired authentication scenario
|
|
94
|
+
throw new Error('Authorization error. Please regenerate using authenticate');
|
|
95
|
+
} else if (res.ok) {
|
|
96
|
+
return res.json();
|
|
97
|
+
} else {
|
|
98
|
+
throw new Error(`Unexpected Error ${res.status} encountered. ${res.message}`);
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
);
|
|
102
|
+
})
|
|
103
|
+
.then((data) => {
|
|
104
|
+
const components = data.map((res) => res.components).flat();
|
|
105
|
+
resolve(components);
|
|
106
|
+
})
|
|
107
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
|
108
|
+
.catch((e) => reject(`${chalk.bold.red(e)}`));
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export const getComponentsFromServer = async () => {
|
|
44
113
|
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
45
114
|
const isLaunchpad = defaultPegaServerConfig.serverType === 'launchpad';
|
|
46
115
|
const url = constructCompleteUrl(
|
|
47
116
|
defaultPegaServerConfig.server,
|
|
48
|
-
isLaunchpad ? LP_LIST_COMPONENT_SERVICE_REST_ENDPOINT :
|
|
117
|
+
isLaunchpad ? LP_LIST_COMPONENT_SERVICE_REST_ENDPOINT : LIST_COMPONENT_SERVICE_REST_ENDPOINT
|
|
49
118
|
);
|
|
50
119
|
return new Promise((resolve, reject) => {
|
|
51
120
|
try {
|
|
52
121
|
fs.readFile(TOKEN_PATH, 'utf8', (err, data) => {
|
|
53
122
|
if (err) {
|
|
54
|
-
reject
|
|
55
|
-
|
|
56
|
-
'Error occured in authentication. Please regenerate using authenticate'
|
|
57
|
-
)}`
|
|
58
|
-
);
|
|
123
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
|
124
|
+
reject(`\n${chalk.bold.red('Error occurred in authentication. Please regenerate using authenticate')}`);
|
|
59
125
|
}
|
|
60
126
|
if (data) {
|
|
61
|
-
const {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
refresh_token: refreshToken
|
|
65
|
-
} = JSON.parse(data);
|
|
66
|
-
let status = 500;
|
|
67
|
-
|
|
68
|
-
const headers = {
|
|
69
|
-
Authorization: `${tokenType} ${accessToken}`
|
|
70
|
-
}
|
|
127
|
+
const { access_token: accessToken, token_type: tokenType } = JSON.parse(data);
|
|
128
|
+
|
|
129
|
+
const headers = {};
|
|
71
130
|
|
|
72
|
-
if(isLaunchpad) {
|
|
131
|
+
if (isLaunchpad) {
|
|
73
132
|
headers.cookie = `Pega-AAT=${accessToken}`;
|
|
74
|
-
}
|
|
75
133
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const respData = JSON.parse(resp);
|
|
87
|
-
if (status === 401) {
|
|
88
|
-
throw new Error(
|
|
89
|
-
'Error occured in authentication. Please regenerate using authenticate'
|
|
90
|
-
);
|
|
91
|
-
// console.log(accessTokenUri, refreshToken);
|
|
92
|
-
/* TODO - Handle refresh_token */
|
|
93
|
-
} else if (status == 200) {
|
|
94
|
-
resolve(resp);
|
|
95
|
-
} else {
|
|
96
|
-
throw new Error(`${respData.message}`);
|
|
97
|
-
}
|
|
98
|
-
})
|
|
99
|
-
.catch(e => reject(`${chalk.bold.red(e)}`));
|
|
134
|
+
fetchComponentsFromLaunchpad(url, headers)
|
|
135
|
+
.then((response) => resolve(response))
|
|
136
|
+
.catch((e) => reject(e));
|
|
137
|
+
} else {
|
|
138
|
+
headers.Authorization = `${tokenType} ${accessToken}`;
|
|
139
|
+
|
|
140
|
+
fetchComponentsFromInfinity(url, headers)
|
|
141
|
+
.then((response) => resolve(response))
|
|
142
|
+
.catch((e) => reject(e));
|
|
143
|
+
}
|
|
100
144
|
}
|
|
101
145
|
});
|
|
102
146
|
} catch (error) {
|
|
103
147
|
console.log(`\n${chalk.bold.red(error)}`);
|
|
148
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
|
104
149
|
reject(`${chalk.bold.red(error)}`);
|
|
105
150
|
}
|
|
106
151
|
});
|
|
107
152
|
};
|
|
108
153
|
|
|
109
|
-
export const displayServerComponents = async data => {
|
|
154
|
+
export const displayServerComponents = async (data) => {
|
|
110
155
|
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
111
156
|
const isLaunchpad = defaultPegaServerConfig.serverType === 'launchpad';
|
|
112
|
-
|
|
113
|
-
|
|
157
|
+
let list;
|
|
158
|
+
if (isLaunchpad) {
|
|
159
|
+
list = data;
|
|
160
|
+
} else {
|
|
161
|
+
try {
|
|
162
|
+
if (typeof data === 'object') {
|
|
163
|
+
list = data.pxResults;
|
|
164
|
+
} else {
|
|
165
|
+
list = JSON.parse(data).pxResults;
|
|
166
|
+
}
|
|
167
|
+
} catch (ex) {
|
|
168
|
+
/* empty */
|
|
169
|
+
}
|
|
170
|
+
}
|
|
114
171
|
/**
|
|
115
172
|
* TODO: Need to modify the components list mapping code to support Launchpad components
|
|
116
173
|
*/
|
|
117
|
-
const componentList = list?.map(({ label, pyRuleSet, pyRuleSetVersion }) =>
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
174
|
+
const componentList = list?.map(({ label, pyRuleSet, pyRuleSetVersion, type }) => {
|
|
175
|
+
if (isLaunchpad) {
|
|
176
|
+
return {
|
|
177
|
+
'Component Name': label,
|
|
178
|
+
Type: type
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return {
|
|
183
|
+
'Rule name': label,
|
|
184
|
+
'Ruleset name': pyRuleSet,
|
|
185
|
+
'Ruleset version': pyRuleSetVersion
|
|
186
|
+
};
|
|
187
|
+
});
|
|
122
188
|
|
|
123
189
|
if (componentList && componentList.length > 0) {
|
|
124
|
-
console.log(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
190
|
+
console.log(chalk.bold.blueBright(`List of custom components in ${defaultPegaServerConfig.server}`));
|
|
191
|
+
if (isLaunchpad) {
|
|
192
|
+
console.table(componentList, ['Component Name', 'Type']);
|
|
193
|
+
} else {
|
|
194
|
+
console.table(componentList, ['Rule name', 'Ruleset name', 'Ruleset version']);
|
|
195
|
+
}
|
|
128
196
|
} else {
|
|
129
197
|
console.log(chalk.bold.redBright(`No custom components in ${defaultPegaServerConfig.server}`));
|
|
130
198
|
}
|
package/src/tasks/list/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import inquirer from 'inquirer';
|
|
2
2
|
import ora from 'ora';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import { showVersion } from '../../util.js';
|
|
4
5
|
|
|
5
6
|
import {
|
|
6
7
|
listLocalComponents,
|
|
@@ -10,8 +11,6 @@ import {
|
|
|
10
11
|
getListComponentsQuestions
|
|
11
12
|
} from './helper.js';
|
|
12
13
|
|
|
13
|
-
import { showVersion } from '../../util.js';
|
|
14
|
-
|
|
15
14
|
const getList = async (sourceOfComponents, answers) => {
|
|
16
15
|
switch (sourceOfComponents) {
|
|
17
16
|
case SOURCE_OF_COMPONENT_TYPES.LOCAL: {
|
|
@@ -33,7 +32,7 @@ const getList = async (sourceOfComponents, answers) => {
|
|
|
33
32
|
}
|
|
34
33
|
};
|
|
35
34
|
|
|
36
|
-
export default async options => {
|
|
35
|
+
export default async (options) => {
|
|
37
36
|
showVersion();
|
|
38
37
|
|
|
39
38
|
let sourceOfComponentsOption = SOURCE_OF_COMPONENT_TYPES.LOCAL;
|
|
@@ -8,12 +8,16 @@ import inquirer from 'inquirer';
|
|
|
8
8
|
|
|
9
9
|
import {
|
|
10
10
|
convertIntoPascalCase,
|
|
11
|
+
checkPathAccess,
|
|
11
12
|
showVersion
|
|
12
13
|
} from '../../util.js';
|
|
13
14
|
|
|
14
15
|
import {
|
|
15
16
|
WEBPACK_CONFIG_JS_FILENAME,
|
|
16
|
-
|
|
17
|
+
WEBPACK_PATHS_JS_FILENAME,
|
|
18
|
+
PACKAGE_JSON_FILENAME,
|
|
19
|
+
BUILDER_INDEX_FILE_PATH,
|
|
20
|
+
BUILDER_DIR_FILE_PATH
|
|
17
21
|
} from '../../constants.js';
|
|
18
22
|
|
|
19
23
|
|
|
@@ -23,11 +27,12 @@ let redirectFile = "";
|
|
|
23
27
|
export const copyWebPack = async () => {
|
|
24
28
|
|
|
25
29
|
// first check to see if already have the file
|
|
26
|
-
const
|
|
30
|
+
const newWebPackConfigDir = path.resolve(WEBPACK_CONFIG_JS_FILENAME);
|
|
31
|
+
const newWebPackPathsDir = path.resolve(WEBPACK_PATHS_JS_FILENAME);
|
|
27
32
|
let override = true;
|
|
28
|
-
if (fs.existsSync(
|
|
33
|
+
if (fs.existsSync(newWebPackConfigDir)) {
|
|
29
34
|
|
|
30
|
-
console.log("Promoted file " + chalk.bold.yellow(`${
|
|
35
|
+
console.log("Promoted file " + chalk.bold.yellow(`${newWebPackConfigDir}`) + " already exists.");
|
|
31
36
|
const questions = [
|
|
32
37
|
{
|
|
33
38
|
name: 'override',
|
|
@@ -45,15 +50,42 @@ export const copyWebPack = async () => {
|
|
|
45
50
|
|
|
46
51
|
|
|
47
52
|
if (override) {
|
|
48
|
-
// call this function from top level
|
|
49
|
-
//fs.copyFileSync("./webpack.config.js", "webpack.config.js")
|
|
50
|
-
const promoteWebPackDir = fileURLToPath(new URL(WEBPACK_CONFIG_JS_FILENAME, import.meta.url));
|
|
51
53
|
|
|
52
|
-
|
|
54
|
+
const currentDirectory = process.cwd();
|
|
55
|
+
const packageJsonPath = join(currentDirectory, PACKAGE_JSON_FILENAME);
|
|
56
|
+
|
|
57
|
+
await checkPathAccess(packageJsonPath);
|
|
58
|
+
|
|
59
|
+
let data = fs.readFileSync(packageJsonPath, { encoding: 'utf8' });
|
|
60
|
+
data = JSON.parse(data);
|
|
61
|
+
|
|
62
|
+
// if top level package.json is of type=module, then promote standard webpack.config.js that is being
|
|
63
|
+
// used in builder (along with paths.js file), otherwise promote the local copy in promote-webpack directory, which is a version
|
|
64
|
+
// modified to support "require" instead of "import" (and paths code is inside the webpack.config.js file)
|
|
65
|
+
if (data["type"] && data["type"] === "module") {
|
|
66
|
+
const builderIndexDir = fileURLToPath(new URL(BUILDER_DIR_FILE_PATH, import.meta.url));
|
|
67
|
+
|
|
68
|
+
const promoteWebPackConfigDir = path.resolve(path.join(builderIndexDir, WEBPACK_CONFIG_JS_FILENAME));
|
|
69
|
+
const promoteWebPackPathsDir = path.resolve(path.join(builderIndexDir, WEBPACK_PATHS_JS_FILENAME));
|
|
70
|
+
|
|
71
|
+
fs.copyFileSync(promoteWebPackConfigDir, newWebPackConfigDir);
|
|
72
|
+
fs.copyFileSync(promoteWebPackPathsDir, newWebPackPathsDir);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
const newWebPackDir = path.resolve(WEBPACK_CONFIG_JS_FILENAME);
|
|
76
|
+
const promoteWebPackDir = fileURLToPath(new URL(WEBPACK_CONFIG_JS_FILENAME, import.meta.url));
|
|
77
|
+
|
|
78
|
+
fs.copyFileSync(promoteWebPackDir, newWebPackDir);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
53
85
|
|
|
54
86
|
}
|
|
55
87
|
|
|
56
|
-
redirectFile =
|
|
88
|
+
redirectFile = newWebPackConfigDir;
|
|
57
89
|
|
|
58
90
|
|
|
59
91
|
|
|
@@ -69,17 +101,17 @@ export const updateBuilder = async () => {
|
|
|
69
101
|
// comment out original webpack reference
|
|
70
102
|
|
|
71
103
|
// if not commented out, comment out
|
|
72
|
-
if (indexFileJS.indexOf("//import configFactory from './webpack.config.js';") < 0) {
|
|
73
|
-
indexFileJS = indexFileJS.replaceAll("import configFactory from './webpack.config.js';", "//import configFactory from './webpack.config.js';");
|
|
104
|
+
if (indexFileJS.indexOf("// import configFactory from './webpack.config.js';") < 0) {
|
|
105
|
+
indexFileJS = indexFileJS.replaceAll("import configFactory from './webpack.config.js';", "// import configFactory from './webpack.config.js';");
|
|
74
106
|
}
|
|
75
107
|
|
|
76
108
|
// uncomment out promoted webpack reference
|
|
77
|
-
indexFileJS = indexFileJS.replaceAll("//import configFactory from '../../../../../../../webpack.config.js';", "import configFactory from '../../../../../../../webpack.config.js';");
|
|
109
|
+
indexFileJS = indexFileJS.replaceAll("// import configFactory from '../../../../../../../webpack.config.js';", "import configFactory from '../../../../../../../webpack.config.js';");
|
|
78
110
|
|
|
79
111
|
fs.writeFileSync(builderIndexDir, indexFileJS, { encoding: 'utf8' });
|
|
80
112
|
|
|
81
113
|
console.log(chalk.bold.green(`Bundler now using ${redirectFile}.`));
|
|
82
|
-
console.log(chalk.bold.green(`Utilize this file for webpack
|
|
114
|
+
console.log(chalk.bold.green(`Utilize this file for webpack modifications.`));
|
|
83
115
|
}
|
|
84
116
|
|
|
85
117
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import https from 'https';
|
|
4
3
|
|
|
5
4
|
import fetch from 'node-fetch';
|
|
6
5
|
import AdmZip from 'adm-zip';
|
|
@@ -11,20 +10,17 @@ import {
|
|
|
11
10
|
getComponentDirectoryPath,
|
|
12
11
|
getComponents,
|
|
13
12
|
getPegaServerConfig,
|
|
14
|
-
validateRulesetVersion
|
|
13
|
+
validateRulesetVersion,
|
|
14
|
+
getHttpsAgent
|
|
15
15
|
} from '../../util.js';
|
|
16
|
-
import {
|
|
17
|
-
PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT,
|
|
18
|
-
LP_PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT,
|
|
19
|
-
TOKEN_PATH
|
|
20
|
-
} from '../../constants.js';
|
|
16
|
+
import { PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT, LP_PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT, TOKEN_PATH } from '../../constants.js';
|
|
21
17
|
|
|
22
18
|
export const getPublishComponentQuestions = async () => {
|
|
23
19
|
const components = await getComponents();
|
|
24
20
|
|
|
25
|
-
if (components.length
|
|
26
|
-
console.log(chalk.redBright(
|
|
27
|
-
process.exit(
|
|
21
|
+
if (components.length === 0) {
|
|
22
|
+
console.log(chalk.redBright('No components to publish'));
|
|
23
|
+
process.exit();
|
|
28
24
|
}
|
|
29
25
|
|
|
30
26
|
const defaultPegaConfig = await getPegaServerConfig();
|
|
@@ -40,7 +36,7 @@ export const getPublishComponentQuestions = async () => {
|
|
|
40
36
|
name: 'rulesetName',
|
|
41
37
|
message: 'Enter ruleset name',
|
|
42
38
|
default: defaultPegaConfig.rulesetName,
|
|
43
|
-
validate: value => {
|
|
39
|
+
validate: (value) => {
|
|
44
40
|
if (value.trim()) {
|
|
45
41
|
return true;
|
|
46
42
|
}
|
|
@@ -54,7 +50,7 @@ export const getPublishComponentQuestions = async () => {
|
|
|
54
50
|
name: 'rulesetVersion',
|
|
55
51
|
message: 'Enter ruleset version',
|
|
56
52
|
default: defaultPegaConfig.rulesetVersion,
|
|
57
|
-
validate: value => {
|
|
53
|
+
validate: (value) => {
|
|
58
54
|
if (validateRulesetVersion(value)) {
|
|
59
55
|
return true;
|
|
60
56
|
}
|
|
@@ -80,7 +76,7 @@ export const getPublishComponentQuestions = async () => {
|
|
|
80
76
|
];
|
|
81
77
|
};
|
|
82
78
|
|
|
83
|
-
export const zipComponent = async componentKey => {
|
|
79
|
+
export const zipComponent = async (componentKey) => {
|
|
84
80
|
const srcDirectory = await getComponentDirectoryPath(componentKey);
|
|
85
81
|
const buildDirectory = await path.join(path.resolve(), 'dist/components', componentKey);
|
|
86
82
|
const configJson = `${srcDirectory}/config.json`;
|
|
@@ -94,7 +90,7 @@ export const zipComponent = async componentKey => {
|
|
|
94
90
|
|
|
95
91
|
const configContent = Buffer.from(fs.readFileSync(`${srcDirectory}/config.json`)).toString();
|
|
96
92
|
|
|
97
|
-
fs.rmdir('dist', { recursive: true }, err => {
|
|
93
|
+
fs.rmdir('dist', { recursive: true }, (err) => {
|
|
98
94
|
if (err) {
|
|
99
95
|
throw err;
|
|
100
96
|
}
|
|
@@ -103,16 +99,13 @@ export const zipComponent = async componentKey => {
|
|
|
103
99
|
return { zipContent, configContent };
|
|
104
100
|
};
|
|
105
101
|
|
|
106
|
-
export const publishComponentToServer = async data => {
|
|
102
|
+
export const publishComponentToServer = async (data, doFetch) => {
|
|
107
103
|
const { configContent, zipContent, rulesetName, rulesetVersion } = data;
|
|
108
104
|
|
|
109
105
|
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
110
106
|
const { serverType, isolationId } = defaultPegaServerConfig;
|
|
111
107
|
const isLaunchpad = serverType === 'launchpad';
|
|
112
|
-
const launchpadRestEndpoint = LP_PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT.replace(
|
|
113
|
-
'{isolationId}',
|
|
114
|
-
isolationId
|
|
115
|
-
);
|
|
108
|
+
const launchpadRestEndpoint = LP_PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT.replace('{isolationId}', isolationId);
|
|
116
109
|
let apiBody;
|
|
117
110
|
|
|
118
111
|
if (isLaunchpad) {
|
|
@@ -136,79 +129,66 @@ export const publishComponentToServer = async data => {
|
|
|
136
129
|
}
|
|
137
130
|
|
|
138
131
|
const defaultPegaConfig = await getPegaServerConfig();
|
|
139
|
-
const url = constructCompleteUrl(
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
headers.Authorization = `${tokenType} ${accessToken}`;
|
|
160
|
-
}
|
|
132
|
+
const url = constructCompleteUrl(defaultPegaConfig.server, isLaunchpad ? launchpadRestEndpoint : PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT);
|
|
133
|
+
|
|
134
|
+
if (doFetch) {
|
|
135
|
+
try {
|
|
136
|
+
const OauthData = fs.readFileSync(TOKEN_PATH, 'utf8');
|
|
137
|
+
if (OauthData) {
|
|
138
|
+
const {
|
|
139
|
+
access_token: accessToken,
|
|
140
|
+
token_type: tokenType
|
|
141
|
+
// refresh_token: refreshToken
|
|
142
|
+
} = JSON.parse(OauthData);
|
|
143
|
+
let status = 500;
|
|
144
|
+
const headers = {
|
|
145
|
+
Authorization: `${tokenType} ${accessToken}`
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
if (isLaunchpad) {
|
|
149
|
+
headers.cookie = `Pega-AAT=${accessToken}`;
|
|
150
|
+
headers['Content-Type'] = 'application/json';
|
|
151
|
+
}
|
|
161
152
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
})
|
|
168
|
-
.then(response => {
|
|
169
|
-
status = response.status;
|
|
170
|
-
return response.text();
|
|
153
|
+
fetch(url, {
|
|
154
|
+
method: 'POST',
|
|
155
|
+
agent: getHttpsAgent(defaultPegaConfig),
|
|
156
|
+
headers,
|
|
157
|
+
body: JSON.stringify(apiBody)
|
|
171
158
|
})
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
);
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
// eslint-disable-next-line prefer-promise-reject-errors
|
|
205
|
-
Promise.reject(`${chalk.bold.red(e)}`);
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
} else {
|
|
159
|
+
.then((response) => {
|
|
160
|
+
status = response.status;
|
|
161
|
+
return response.text();
|
|
162
|
+
})
|
|
163
|
+
.then((resp) => {
|
|
164
|
+
const respData = isLaunchpad ? resp : JSON.parse(resp);
|
|
165
|
+
if (status === 401) {
|
|
166
|
+
throw new Error('Error occurred in authentication. Please regenerate using authenticate');
|
|
167
|
+
// console.log(accessTokenUri, refreshToken);
|
|
168
|
+
/* TODO - Handle refresh_token */
|
|
169
|
+
} else if (status === 200 || status === 201) {
|
|
170
|
+
console.log(chalk.bold.green(`Success : ${isLaunchpad ? respData : respData.message}`));
|
|
171
|
+
} else {
|
|
172
|
+
throw new Error(`${respData.message}`);
|
|
173
|
+
}
|
|
174
|
+
})
|
|
175
|
+
.catch((e) => {
|
|
176
|
+
if (e.code === 'ECONNREFUSED') {
|
|
177
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
|
178
|
+
Promise.reject(`${chalk.bold.red('Error occurred in authentication. Please regenerate using authenticate')}`);
|
|
179
|
+
} else if (status === 403) {
|
|
180
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
|
181
|
+
Promise.reject(`${chalk.bold.red('Error forbidden: User does not have privileges to Publish.')}`);
|
|
182
|
+
} else {
|
|
183
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
|
184
|
+
Promise.reject(`${chalk.bold.red(e)}`);
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
} else {
|
|
188
|
+
throw new Error(`Error occurred in authentication. Please regenerate using authenticate`);
|
|
189
|
+
}
|
|
190
|
+
} catch (err) {
|
|
209
191
|
throw new Error(`Error occurred in authentication. Please regenerate using authenticate`);
|
|
210
192
|
}
|
|
211
|
-
} catch (err) {
|
|
212
|
-
throw new Error(`Error occurred in authentication. Please regenerate using authenticate`);
|
|
213
193
|
}
|
|
214
194
|
};
|