@pega/custom-dx-components 8.8.16 → 8.8.18
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/cli.js +12 -0
- package/src/constants.js +9 -4
- 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 +5 -0
- 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/index.js +2 -0
- package/src/tasks/init/index.js +20 -22
- 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 +126 -0
- package/src/tasks/promote-webpack/webpack.config.js +376 -0
- package/src/tasks/publish/helper.js +69 -80
- package/src/tasks/publish/index.js +29 -12
- package/src/tasks/publish-all/helper.js +66 -83
- package/src/tasks/publish-all/index.js +30 -18
- package/src/tasks/rename/index.js +127 -97
- package/src/tasks/revert-webpack/index.js +71 -0
- package/src/util.js +205 -108
- package/test/unitTest/util.test.js +544 -0
|
@@ -1,22 +1,12 @@
|
|
|
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';
|
|
7
6
|
import chalk from 'chalk';
|
|
8
7
|
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
getComponentDirectoryPath,
|
|
12
|
-
getPegaServerConfig,
|
|
13
|
-
validateRulesetVersion
|
|
14
|
-
} from '../../util.js';
|
|
15
|
-
import {
|
|
16
|
-
PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT,
|
|
17
|
-
LP_PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT,
|
|
18
|
-
TOKEN_PATH
|
|
19
|
-
} from '../../constants.js';
|
|
8
|
+
import { constructCompleteUrl, getComponentDirectoryPath, getPegaServerConfig, validateRulesetVersion, getHttpsAgent } from '../../util.js';
|
|
9
|
+
import { PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT, LP_PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT, TOKEN_PATH } from '../../constants.js';
|
|
20
10
|
|
|
21
11
|
export const getPublishComponentQuestions = async () => {
|
|
22
12
|
const defaultPegaConfig = await getPegaServerConfig();
|
|
@@ -26,7 +16,7 @@ export const getPublishComponentQuestions = async () => {
|
|
|
26
16
|
name: 'rulesetName',
|
|
27
17
|
message: 'Enter ruleset name',
|
|
28
18
|
default: defaultPegaConfig.rulesetName,
|
|
29
|
-
validate: value => {
|
|
19
|
+
validate: (value) => {
|
|
30
20
|
if (value.trim()) {
|
|
31
21
|
return true;
|
|
32
22
|
}
|
|
@@ -40,7 +30,7 @@ export const getPublishComponentQuestions = async () => {
|
|
|
40
30
|
name: 'rulesetVersion',
|
|
41
31
|
message: 'Enter ruleset version',
|
|
42
32
|
default: defaultPegaConfig.rulesetVersion,
|
|
43
|
-
validate: value => {
|
|
33
|
+
validate: (value) => {
|
|
44
34
|
if (validateRulesetVersion(value)) {
|
|
45
35
|
return true;
|
|
46
36
|
}
|
|
@@ -66,7 +56,7 @@ export const getPublishComponentQuestions = async () => {
|
|
|
66
56
|
];
|
|
67
57
|
};
|
|
68
58
|
|
|
69
|
-
export const zipComponent = async componentKey => {
|
|
59
|
+
export const zipComponent = async (componentKey) => {
|
|
70
60
|
const srcDirectory = await getComponentDirectoryPath(componentKey);
|
|
71
61
|
const buildDirectory = await path.join(path.resolve(), 'dist/components', componentKey);
|
|
72
62
|
const configJson = `${srcDirectory}/config.json`;
|
|
@@ -89,29 +79,26 @@ export const zipComponent = async componentKey => {
|
|
|
89
79
|
};
|
|
90
80
|
|
|
91
81
|
export const cleanUp = async () => {
|
|
92
|
-
fs.rm('dist/components', { recursive: true }, err => {
|
|
82
|
+
fs.rm('dist/components', { recursive: true }, (err) => {
|
|
93
83
|
if (err) {
|
|
94
84
|
throw err;
|
|
95
85
|
}
|
|
96
86
|
});
|
|
97
87
|
|
|
98
|
-
fs.rm('lib', { recursive: true }, err => {
|
|
88
|
+
fs.rm('lib', { recursive: true }, (err) => {
|
|
99
89
|
if (err) {
|
|
100
90
|
throw err;
|
|
101
91
|
}
|
|
102
92
|
});
|
|
103
93
|
};
|
|
104
94
|
|
|
105
|
-
export const publishComponentToServer = async data => {
|
|
95
|
+
export const publishComponentToServer = async (data, doFetch) => {
|
|
106
96
|
const { configContent, zipContent, rulesetName, rulesetVersion } = data;
|
|
107
97
|
|
|
108
98
|
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
109
99
|
const { serverType, isolationId } = defaultPegaServerConfig;
|
|
110
100
|
const isLaunchpad = serverType === 'launchpad';
|
|
111
|
-
const launchpadRestEndpoint = LP_PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT.replace(
|
|
112
|
-
'{isolationId}',
|
|
113
|
-
isolationId
|
|
114
|
-
);
|
|
101
|
+
const launchpadRestEndpoint = LP_PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT.replace('{isolationId}', isolationId);
|
|
115
102
|
let apiBody;
|
|
116
103
|
|
|
117
104
|
if (isLaunchpad) {
|
|
@@ -135,70 +122,66 @@ export const publishComponentToServer = async data => {
|
|
|
135
122
|
}
|
|
136
123
|
|
|
137
124
|
const defaultPegaConfig = await getPegaServerConfig();
|
|
138
|
-
const url = constructCompleteUrl(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
headers.Authorization = `${tokenType} ${accessToken}`;
|
|
159
|
-
}
|
|
125
|
+
const url = constructCompleteUrl(defaultPegaConfig.server, isLaunchpad ? launchpadRestEndpoint : PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT);
|
|
126
|
+
|
|
127
|
+
if (doFetch) {
|
|
128
|
+
try {
|
|
129
|
+
const OauthData = fs.readFileSync(TOKEN_PATH, 'utf8');
|
|
130
|
+
if (OauthData) {
|
|
131
|
+
const {
|
|
132
|
+
access_token: accessToken,
|
|
133
|
+
token_type: tokenType
|
|
134
|
+
// refresh_token: refreshToken
|
|
135
|
+
} = JSON.parse(OauthData);
|
|
136
|
+
let status = 500;
|
|
137
|
+
const headers = {};
|
|
138
|
+
|
|
139
|
+
if (isLaunchpad) {
|
|
140
|
+
headers.cookie = `Pega-AAT=${accessToken}`;
|
|
141
|
+
headers['Content-Type'] = 'application/json';
|
|
142
|
+
} else {
|
|
143
|
+
headers.Authorization = `${tokenType} ${accessToken}`;
|
|
144
|
+
}
|
|
160
145
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
})
|
|
167
|
-
.then(response => {
|
|
168
|
-
status = response.status;
|
|
169
|
-
return response.text();
|
|
146
|
+
fetch(url, {
|
|
147
|
+
method: 'POST',
|
|
148
|
+
agent: getHttpsAgent(defaultPegaConfig),
|
|
149
|
+
headers,
|
|
150
|
+
body: JSON.stringify(apiBody)
|
|
170
151
|
})
|
|
171
|
-
|
|
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
|
-
|
|
152
|
+
.then((response) => {
|
|
153
|
+
status = response.status;
|
|
154
|
+
return response.text();
|
|
155
|
+
})
|
|
156
|
+
.then((resp) => {
|
|
157
|
+
const respData = isLaunchpad ? resp : JSON.parse(resp);
|
|
158
|
+
if (status === 401) {
|
|
159
|
+
throw new Error('Error occurred in authentication. Please regenerate using authenticate');
|
|
160
|
+
// console.log(accessTokenUri, refreshToken);
|
|
161
|
+
/* TODO - Handle refresh_token */
|
|
162
|
+
} else if (status === 200 || status === 201) {
|
|
163
|
+
console.log(chalk.bold.green(`Success : ${isLaunchpad ? respData : respData.message}`));
|
|
164
|
+
} else {
|
|
165
|
+
throw new Error(`${respData.message}`);
|
|
166
|
+
}
|
|
167
|
+
})
|
|
168
|
+
.catch((e) => {
|
|
169
|
+
if (e.code === 'ECONNREFUSED') {
|
|
170
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
|
171
|
+
Promise.reject(`${chalk.bold.red('Error occurred in authentication. Please regenerate using authenticate')}`);
|
|
172
|
+
} else if (status === 403) {
|
|
173
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
|
174
|
+
Promise.reject(`${chalk.bold.red('Error forbidden: User does not have privileges to Publish.')}`);
|
|
175
|
+
} else {
|
|
176
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
|
177
|
+
Promise.reject(`${chalk.bold.red(e)}`);
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
} else {
|
|
181
|
+
throw new Error(`Error occurred in authentication. Please regenerate using authenticate`);
|
|
182
|
+
}
|
|
183
|
+
} catch (err) {
|
|
199
184
|
throw new Error(`Error occurred in authentication. Please regenerate using authenticate`);
|
|
200
185
|
}
|
|
201
|
-
} catch (err) {
|
|
202
|
-
throw new Error(`Error occurred in authentication. Please regenerate using authenticate`);
|
|
203
186
|
}
|
|
204
187
|
};
|
|
@@ -7,15 +7,12 @@ import bundleComponent from '../bundle/index.js';
|
|
|
7
7
|
import { lintComponent } from '../linter/index.js';
|
|
8
8
|
import { getComponents, getComponentDirectoryPath, showVersion } from '../../util.js';
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
getPublishComponentQuestions,
|
|
12
|
-
publishComponentToServer,
|
|
13
|
-
zipComponent,
|
|
14
|
-
cleanUp
|
|
15
|
-
} from './helper.js';
|
|
10
|
+
import { getPublishComponentQuestions, publishComponentToServer, zipComponent, cleanUp } from './helper.js';
|
|
16
11
|
|
|
17
12
|
export function getCustomTasks(componentKey, sourceMap, devBuild, content, options) {
|
|
18
13
|
const sDevBuild = devBuild ? '(dev build)' : '';
|
|
14
|
+
// eslint-disable-next-line no-unneeded-ternary
|
|
15
|
+
const doFetch = options.params.length >= 7 ? false : true;
|
|
19
16
|
return new Listr(
|
|
20
17
|
[
|
|
21
18
|
{
|
|
@@ -49,7 +46,7 @@ export function getCustomTasks(componentKey, sourceMap, devBuild, content, optio
|
|
|
49
46
|
{
|
|
50
47
|
title: 'Publish Component',
|
|
51
48
|
task: async () => {
|
|
52
|
-
await publishComponentToServer(content);
|
|
49
|
+
await publishComponentToServer(content, doFetch);
|
|
53
50
|
}
|
|
54
51
|
}
|
|
55
52
|
],
|
|
@@ -59,31 +56,46 @@ export function getCustomTasks(componentKey, sourceMap, devBuild, content, optio
|
|
|
59
56
|
);
|
|
60
57
|
}
|
|
61
58
|
|
|
62
|
-
export default async options => {
|
|
59
|
+
export default async (options) => {
|
|
63
60
|
showVersion();
|
|
64
61
|
|
|
65
62
|
const components = await getComponents();
|
|
66
63
|
|
|
67
|
-
if (components.length
|
|
68
|
-
console.log(chalk.redBright(
|
|
69
|
-
process.exit(
|
|
64
|
+
if (components.length === 0) {
|
|
65
|
+
console.log(chalk.redBright('No components to publish'));
|
|
66
|
+
process.exit();
|
|
70
67
|
}
|
|
71
68
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
let componentKey;
|
|
70
|
+
let sourceMap;
|
|
71
|
+
let devBuild;
|
|
72
|
+
let content;
|
|
75
73
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
if (options.params.length >= 7) {
|
|
75
|
+
const rulesetName = options.params[3];
|
|
76
|
+
const rulesetVersion = options.params[4];
|
|
77
|
+
const dBuild = options.params[5];
|
|
78
|
+
devBuild = dBuild === 'Y' || dBuild === 'y' || dBuild === true || dBuild === 'true';
|
|
79
79
|
|
|
80
|
+
content = { componentKey, rulesetName, rulesetVersion, devBuild };
|
|
81
|
+
} else {
|
|
82
|
+
const questions = await getPublishComponentQuestions();
|
|
83
|
+
const answers = await inquirer.prompt(questions);
|
|
84
|
+
({ sourceMap, devBuild } = answers);
|
|
85
|
+
|
|
86
|
+
content = {
|
|
87
|
+
...answers
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// eslint-disable-next-line no-shadow
|
|
80
92
|
for (const componentKey of components) {
|
|
81
93
|
console.log(chalk.bold.green(`Publishing: ${componentKey}`));
|
|
82
94
|
|
|
83
95
|
const myCustomTasks = getCustomTasks(componentKey, sourceMap, devBuild, content, options);
|
|
84
96
|
|
|
85
97
|
// eslint-disable-next-line no-await-in-loop
|
|
86
|
-
await myCustomTasks.run().catch(err => {
|
|
98
|
+
await myCustomTasks.run().catch((err) => {
|
|
87
99
|
console.log(chalk.bold.red(err.toString()));
|
|
88
100
|
});
|
|
89
101
|
}
|
|
@@ -198,102 +198,16 @@ export default async options => {
|
|
|
198
198
|
|
|
199
199
|
const localComponents = await getComponentsObj();
|
|
200
200
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
message: 'Enter new component name (required, no spaces)',
|
|
212
|
-
validate: value => {
|
|
213
|
-
/* value should not be empty
|
|
214
|
-
It should not have spaces
|
|
215
|
-
It should not start with a number
|
|
216
|
-
Only case-insensitive alphanumeric values are allowed
|
|
217
|
-
*/
|
|
218
|
-
if (value && !/^\d/.test(value) && value === sanitize(value)) {
|
|
219
|
-
return true;
|
|
220
|
-
}
|
|
221
|
-
return 'Only alphanumeric values are allowed, starting with alphabets';
|
|
222
|
-
}
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
name: 'componentLabel',
|
|
226
|
-
message: 'Enter new component label for display (required)',
|
|
227
|
-
validate: value => {
|
|
228
|
-
if (value) {
|
|
229
|
-
return true;
|
|
230
|
-
}
|
|
231
|
-
return 'Please provide value for label';
|
|
232
|
-
}
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
name: 'organization',
|
|
236
|
-
message: 'Enter new component organization',
|
|
237
|
-
default: organization,
|
|
238
|
-
validate: value => {
|
|
239
|
-
if (value) {
|
|
240
|
-
return true;
|
|
241
|
-
}
|
|
242
|
-
return 'Please provide value for organization';
|
|
243
|
-
}
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
name: 'version',
|
|
247
|
-
message: 'Enter new component version',
|
|
248
|
-
default: componentDefaults.version,
|
|
249
|
-
validate: value => {
|
|
250
|
-
if (validateSemver(value)) {
|
|
251
|
-
return true;
|
|
252
|
-
}
|
|
253
|
-
return 'Please provide semver compatible version e.g 0.0.1';
|
|
254
|
-
}
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
name: 'library',
|
|
258
|
-
message: 'Enter new library name (required)',
|
|
259
|
-
default: componentDefaults.library,
|
|
260
|
-
validate: value => {
|
|
261
|
-
/* value should not be empty
|
|
262
|
-
It should not have spaces
|
|
263
|
-
It should not start with a number
|
|
264
|
-
Only case-insensitive alphanumeric values are allowed
|
|
265
|
-
*/
|
|
266
|
-
if (value && !/^\d/.test(value) && value === sanitize(value)) {
|
|
267
|
-
return true;
|
|
268
|
-
}
|
|
269
|
-
return 'Only alphanumeric values are allowed, starting with alphabets';
|
|
270
|
-
}
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
name: 'allowedApplications',
|
|
274
|
-
message: 'Please enter the application names to be supported (comma-separated). ',
|
|
275
|
-
suffix: 'Keep empty for all applications'
|
|
276
|
-
},
|
|
277
|
-
{
|
|
278
|
-
name: 'description',
|
|
279
|
-
message: 'Enter new description for the component (defaults to new label)',
|
|
280
|
-
default: componentDefaults.description,
|
|
281
|
-
/* if left blank and no defaults, mustache will use componentLabel, because description is used in app studio and
|
|
282
|
-
shouldn't be blank */
|
|
283
|
-
}
|
|
284
|
-
];
|
|
285
|
-
|
|
286
|
-
await inquirer.prompt(questions).then(async answers => {
|
|
287
|
-
const {
|
|
288
|
-
componentKey,
|
|
289
|
-
componentName,
|
|
290
|
-
componentLabel,
|
|
291
|
-
organization,
|
|
292
|
-
library,
|
|
293
|
-
version,
|
|
294
|
-
description,
|
|
295
|
-
allowedApplications
|
|
296
|
-
} = answers;
|
|
201
|
+
|
|
202
|
+
if (options.params.length >= 11) {
|
|
203
|
+
const componentKey = options.params[3];
|
|
204
|
+
const componentName = options.params[4];
|
|
205
|
+
const componentLabel = options.params[5];
|
|
206
|
+
const organization = options.params[6];
|
|
207
|
+
const version = options.params[7];
|
|
208
|
+
const library = options.params[8];
|
|
209
|
+
const allowedApplications = options.params[9];
|
|
210
|
+
const description = options.params[10];
|
|
297
211
|
|
|
298
212
|
await renameComponent(
|
|
299
213
|
{
|
|
@@ -309,6 +223,122 @@ export default async options => {
|
|
|
309
223
|
options
|
|
310
224
|
);
|
|
311
225
|
|
|
312
|
-
}
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
const questions = [
|
|
229
|
+
{
|
|
230
|
+
name: 'componentKey',
|
|
231
|
+
type: 'rawlist',
|
|
232
|
+
pageSize: 15,
|
|
233
|
+
message: 'Select component to rename',
|
|
234
|
+
choices: localComponents
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
name: 'componentName',
|
|
238
|
+
message: 'Enter new component name (required, no spaces)',
|
|
239
|
+
validate: value => {
|
|
240
|
+
/* value should not be empty
|
|
241
|
+
It should not have spaces
|
|
242
|
+
It should not start with a number
|
|
243
|
+
Only case-insensitive alphanumeric values are allowed
|
|
244
|
+
*/
|
|
245
|
+
if (value && !/^\d/.test(value) && value === sanitize(value)) {
|
|
246
|
+
return true;
|
|
247
|
+
}
|
|
248
|
+
return 'Only alphanumeric values are allowed, starting with alphabets';
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
name: 'componentLabel',
|
|
253
|
+
message: 'Enter new component label for display (required)',
|
|
254
|
+
validate: value => {
|
|
255
|
+
if (value) {
|
|
256
|
+
return true;
|
|
257
|
+
}
|
|
258
|
+
return 'Please provide value for label';
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
name: 'organization',
|
|
263
|
+
message: 'Enter new component organization',
|
|
264
|
+
default: organization,
|
|
265
|
+
validate: value => {
|
|
266
|
+
if (value) {
|
|
267
|
+
return true;
|
|
268
|
+
}
|
|
269
|
+
return 'Please provide value for organization';
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
name: 'version',
|
|
274
|
+
message: 'Enter new component version',
|
|
275
|
+
default: componentDefaults.version,
|
|
276
|
+
validate: value => {
|
|
277
|
+
if (validateSemver(value)) {
|
|
278
|
+
return true;
|
|
279
|
+
}
|
|
280
|
+
return 'Please provide semver compatible version e.g 0.0.1';
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
name: 'library',
|
|
285
|
+
message: 'Enter new library name (required)',
|
|
286
|
+
default: componentDefaults.library,
|
|
287
|
+
validate: value => {
|
|
288
|
+
/* value should not be empty
|
|
289
|
+
It should not have spaces
|
|
290
|
+
It should not start with a number
|
|
291
|
+
Only case-insensitive alphanumeric values are allowed
|
|
292
|
+
*/
|
|
293
|
+
if (value && !/^\d/.test(value) && value === sanitize(value)) {
|
|
294
|
+
return true;
|
|
295
|
+
}
|
|
296
|
+
return 'Only alphanumeric values are allowed, starting with alphabets';
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
name: 'allowedApplications',
|
|
301
|
+
message: 'Please enter the application names to be supported (comma-separated). ',
|
|
302
|
+
suffix: 'Keep empty for all applications'
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
name: 'description',
|
|
306
|
+
message: 'Enter new description for the component (defaults to new label)',
|
|
307
|
+
default: componentDefaults.description,
|
|
308
|
+
/* if left blank and no defaults, mustache will use componentLabel, because description is used in app studio and
|
|
309
|
+
shouldn't be blank */
|
|
310
|
+
}
|
|
311
|
+
];
|
|
312
|
+
|
|
313
|
+
await inquirer.prompt(questions).then(async answers => {
|
|
314
|
+
const {
|
|
315
|
+
componentKey,
|
|
316
|
+
componentName,
|
|
317
|
+
componentLabel,
|
|
318
|
+
organization,
|
|
319
|
+
library,
|
|
320
|
+
version,
|
|
321
|
+
description,
|
|
322
|
+
allowedApplications
|
|
323
|
+
} = answers;
|
|
324
|
+
|
|
325
|
+
await renameComponent(
|
|
326
|
+
{
|
|
327
|
+
componentKey,
|
|
328
|
+
componentName,
|
|
329
|
+
componentLabel,
|
|
330
|
+
library,
|
|
331
|
+
version,
|
|
332
|
+
description,
|
|
333
|
+
allowedApplications,
|
|
334
|
+
organization
|
|
335
|
+
},
|
|
336
|
+
options
|
|
337
|
+
);
|
|
338
|
+
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
|
|
313
343
|
|
|
314
344
|
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { join } from 'path';
|
|
5
|
+
import { URL, fileURLToPath } from 'url';
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
convertIntoPascalCase,
|
|
10
|
+
showVersion
|
|
11
|
+
} from '../../util.js';
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
WEBPACK_CONFIG_JS_FILENAME,
|
|
15
|
+
BUILDER_INDEX_FILE_PATH
|
|
16
|
+
} from '../../constants.js';
|
|
17
|
+
import build from '@pega/custom-dx-components/src/tasks/build/index.js';
|
|
18
|
+
import { up } from 'inquirer/lib/utils/readline.js';
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
export const renamePromotedWebPack = async () => {
|
|
23
|
+
|
|
24
|
+
// call this function from top level
|
|
25
|
+
//fs.copyFileSync("./webpack.config.js", "webpack.config.js")
|
|
26
|
+
|
|
27
|
+
const promoteWebPackDir = path.resolve(WEBPACK_CONFIG_JS_FILENAME);
|
|
28
|
+
const renamedPromoteWebPackDir = path.resolve(WEBPACK_CONFIG_JS_FILENAME + ".notused");
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
fs.renameSync(promoteWebPackDir, renamedPromoteWebPackDir);
|
|
32
|
+
}
|
|
33
|
+
catch (ex) {
|
|
34
|
+
console.log(chalk.bold.red(`File ${promoteWebPackDir} not found.`));
|
|
35
|
+
process.exit();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
console.log(chalk.bold.green(`File ${promoteWebPackDir} marked as not used.`));
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const revertBuilder = async () => {
|
|
43
|
+
|
|
44
|
+
const builderIndexDir = fileURLToPath(new URL(BUILDER_INDEX_FILE_PATH, import.meta.url));
|
|
45
|
+
|
|
46
|
+
let indexFileJS = fs.readFileSync(builderIndexDir, { encoding: 'utf8' });
|
|
47
|
+
|
|
48
|
+
if (indexFileJS.length > 0) {
|
|
49
|
+
// uncomment out original webpack reference
|
|
50
|
+
indexFileJS = indexFileJS.replaceAll("// import configFactory from './webpack.config.js';", "import configFactory from './webpack.config.js';");
|
|
51
|
+
|
|
52
|
+
// comment out promoted webpack reference
|
|
53
|
+
if (indexFileJS.indexOf("// import configFactory from '../../../../../../../webpack.config.js';") < 0) {
|
|
54
|
+
indexFileJS = indexFileJS.replaceAll("import configFactory from '../../../../../../../webpack.config.js';", "// import configFactory from '../../../../../../../webpack.config.js';");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
fs.writeFileSync(builderIndexDir, indexFileJS, { encoding: 'utf8' });
|
|
58
|
+
|
|
59
|
+
console.log(chalk.bold.green(`Bundler reverted to using internal webpack.config.js.`));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default async options => {
|
|
66
|
+
showVersion();
|
|
67
|
+
|
|
68
|
+
await renamePromotedWebPack();
|
|
69
|
+
await revertBuilder();
|
|
70
|
+
|
|
71
|
+
};
|