@pega/dx-component-builder-sdk 0.1.0
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/.access_token +1 -0
- package/.agilestudio +3 -0
- package/.eslintrc.json +18 -0
- package/.prettierignore +2 -0
- package/.prettierrc.json +1 -0
- package/LICENSE +185 -0
- package/README.md +199 -0
- package/bin/index.js +5 -0
- package/cspell.json +26 -0
- package/package.json +67 -0
- package/src/cli.js +104 -0
- package/src/constants.js +134 -0
- package/src/tasks/authenticate/helper.js +60 -0
- package/src/tasks/authenticate/index.js +81 -0
- package/src/tasks/build/helper.js +125 -0
- package/src/tasks/build/index.js +52 -0
- package/src/tasks/bundle/builder/index.js +218 -0
- package/src/tasks/bundle/builder/modules.js +139 -0
- package/src/tasks/bundle/builder/paths.js +50 -0
- package/src/tasks/bundle/builder/webpack.config.js +336 -0
- package/src/tasks/bundle/index.js +65 -0
- package/src/tasks/create/index.js +380 -0
- package/src/tasks/create/template/config.json.mustache +62 -0
- package/src/tasks/create/template/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/template/index.jsx.mustache +55 -0
- package/src/tasks/create/template/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Boolean/Boolean.js.mustache +38 -0
- package/src/tasks/create/templates/Constellation/Field/Boolean/boolean-format.js.mustache +26 -0
- package/src/tasks/create/templates/Constellation/Field/Boolean/config.json.mustache +145 -0
- package/src/tasks/create/templates/Constellation/Field/Boolean/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Boolean/index.jsx.mustache +171 -0
- package/src/tasks/create/templates/Constellation/Field/Boolean/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Date/config.json.mustache +195 -0
- package/src/tasks/create/templates/Constellation/Field/Date/date.js.mustache +327 -0
- package/src/tasks/create/templates/Constellation/Field/Date/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/Date/index.jsx.mustache +254 -0
- package/src/tasks/create/templates/Constellation/Field/Date/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Date/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/config.json.mustache +256 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/date-time.js.mustache +93 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/date-utils.js +286 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/date.js.mustache +327 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/index.jsx.mustache +252 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal/config.json.mustache +278 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal/index.jsx.mustache +272 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/config.json.mustache +291 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/index.jsx.mustache +300 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/config.json.mustache +93 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/index.jsx.mustache +275 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Integer/config.json.mustache +347 -0
- package/src/tasks/create/templates/Constellation/Field/Integer/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/Integer/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Integer/index.jsx.mustache +335 -0
- package/src/tasks/create/templates/Constellation/Field/Integer/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Integer/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/config.json.mustache +114 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/index.jsx.mustache +308 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/picklist.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Text/config.json.mustache +62 -0
- package/src/tasks/create/templates/Constellation/Field/Text/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/Text/index.jsx.mustache +60 -0
- package/src/tasks/create/templates/Constellation/Field/Text/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Email/config.json.mustache +111 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Email/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Email/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Email/index.jsx.mustache +189 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Email/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Email/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Email/text-email.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/StatusWork.js +27 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/config.json.mustache +111 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/index.jsx.mustache +196 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/text-input.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/config.json.mustache +111 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/index.jsx.mustache +189 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/text-paragraph.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/config.json.mustache +123 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/index.jsx.mustache +223 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/text-phone.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/config.json.mustache +237 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/index.jsx.mustache +232 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/text-url.js.mustache +172 -0
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/config.json.mustache +185 -0
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/index.jsx.mustache +213 -0
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/time-of-day.js.mustache +286 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/OneColumnDetails.svg +22 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/config.json.mustache +35 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/index.jsx.mustache +88 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/utils.js.mustache +155 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/TwoColumnDetails.svg +28 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/config.json.mustache +42 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.jsx.mustache +88 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/utils.js.mustache +155 -0
- package/src/tasks/create/templates/Constellation/Template/FORM/DefaultForm.svg +29 -0
- package/src/tasks/create/templates/Constellation/Template/FORM/config.json.mustache +45 -0
- package/src/tasks/create/templates/Constellation/Template/FORM/index.jsx.mustache +49 -0
- package/src/tasks/create/templates/Constellation/Template/FORM/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Template/FORM-region/TwoColumn.svg +38 -0
- package/src/tasks/create/templates/Constellation/Template/FORM-region/config.json.mustache +27 -0
- package/src/tasks/create/templates/Constellation/Template/FORM-region/index.jsx.mustache +51 -0
- package/src/tasks/create/templates/Constellation/Template/FORM-region/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/GetNextWork.js.mustache +29 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/config.json.mustache +32 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/index.jsx.mustache +68 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/localizations.json.mustache +4 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/utils.js.mustache +226 -0
- package/src/tasks/create/templates/Constellation/Widget/CASE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/Constellation/Widget/CASE/config.json.mustache +23 -0
- package/src/tasks/create/templates/Constellation/Widget/CASE/index.jsx.mustache +75 -0
- package/src/tasks/create/templates/Constellation/Widget/CASE/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE/config.json.mustache +59 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE/index.jsx.mustache +48 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/Avatar.js.mustache +73 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/Operator.js.mustache +239 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/config.json.mustache +66 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/index.jsx.mustache +110 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-Angular/Field/__components.md +4 -0
- package/src/tasks/create/templates/SDK-Angular/Template/__components.md +4 -0
- package/src/tasks/create/templates/SDK-Angular/Widget/__components.md +4 -0
- package/src/tasks/create/templates/SDK-React/Field/Boolean/config.json.mustache +73 -0
- package/src/tasks/create/templates/SDK-React/Field/Boolean/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Boolean/index.tsx.mustache +109 -0
- package/src/tasks/create/templates/SDK-React/Field/Boolean/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Date/config.json.mustache +133 -0
- package/src/tasks/create/templates/SDK-React/Field/Date/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Date/index.tsx.mustache +122 -0
- package/src/tasks/create/templates/SDK-React/Field/Date/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/DateTime/config.json.mustache +190 -0
- package/src/tasks/create/templates/SDK-React/Field/DateTime/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/DateTime/index.tsx.mustache +112 -0
- package/src/tasks/create/templates/SDK-React/Field/DateTime/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal/config.json.mustache +80 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal/index.tsx.mustache +105 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Currency/config.json.mustache +111 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Currency/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Currency/index.tsx.mustache +131 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Currency/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Percentage/config.json.mustache +80 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Percentage/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Percentage/index.tsx.mustache +128 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Percentage/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Integer/config.json.mustache +74 -0
- package/src/tasks/create/templates/SDK-React/Field/Integer/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Integer/index.tsx.mustache +124 -0
- package/src/tasks/create/templates/SDK-React/Field/Integer/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Picklist/config.json.mustache +72 -0
- package/src/tasks/create/templates/SDK-React/Field/Picklist/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Picklist/index.tsx.mustache +141 -0
- package/src/tasks/create/templates/SDK-React/Field/Picklist/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Text/config.json.mustache +69 -0
- package/src/tasks/create/templates/SDK-React/Field/Text/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Text/index.tsx.mustache +119 -0
- package/src/tasks/create/templates/SDK-React/Field/Text/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Email/config.json.mustache +69 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Email/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Email/index.tsx.mustache +121 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Email/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Input/config.json.mustache +69 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Input/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Input/index.tsx.mustache +119 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Input/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Paragraph/config.json.mustache +69 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Paragraph/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Paragraph/index.tsx.mustache +123 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Paragraph/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Phone/config.json.mustache +81 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Phone/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Phone/index.tsx.mustache +147 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Phone/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-URL/config.json.mustache +111 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-URL/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-URL/index.tsx.mustache +98 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-URL/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/TimeofDay/config.json.mustache +121 -0
- package/src/tasks/create/templates/SDK-React/Field/TimeofDay/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/TimeofDay/index.tsx.mustache +120 -0
- package/src/tasks/create/templates/SDK-React/Field/TimeofDay/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Template/DETAILS/DefaultForm.svg +29 -0
- package/src/tasks/create/templates/SDK-React/Template/DETAILS/config.json.mustache +21 -0
- package/src/tasks/create/templates/SDK-React/Template/DETAILS/index.tsx.mustache +45 -0
- package/src/tasks/create/templates/SDK-React/Template/DETAILS/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Template/DETAILS-region/TwoColumnDetails.svg +28 -0
- package/src/tasks/create/templates/SDK-React/Template/DETAILS-region/config.json.mustache +27 -0
- package/src/tasks/create/templates/SDK-React/Template/DETAILS-region/index.tsx.mustache +53 -0
- package/src/tasks/create/templates/SDK-React/Template/DETAILS-region/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Template/FORM/DefaultForm.css +25 -0
- package/src/tasks/create/templates/SDK-React/Template/FORM/DefaultForm.svg +29 -0
- package/src/tasks/create/templates/SDK-React/Template/FORM/config.json.mustache +45 -0
- package/src/tasks/create/templates/SDK-React/Template/FORM/index.tsx.mustache +63 -0
- package/src/tasks/create/templates/SDK-React/Template/FORM/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Template/FORM-region/TwoColumn.svg +38 -0
- package/src/tasks/create/templates/SDK-React/Template/FORM-region/config.json.mustache +49 -0
- package/src/tasks/create/templates/SDK-React/Template/FORM-region/index.tsx.mustache +69 -0
- package/src/tasks/create/templates/SDK-React/Template/FORM-region/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Template/PAGE/OneColumn.tsx.mustache +32 -0
- package/src/tasks/create/templates/SDK-React/Template/PAGE/OneColumnPage.svg +28 -0
- package/src/tasks/create/templates/SDK-React/Template/PAGE/config.json.mustache +32 -0
- package/src/tasks/create/templates/SDK-React/Template/PAGE/index.tsx.mustache +31 -0
- package/src/tasks/create/templates/SDK-React/Template/PAGE/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Widget/CASE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/SDK-React/Widget/CASE/config.json.mustache +23 -0
- package/src/tasks/create/templates/SDK-React/Widget/CASE/index.tsx.mustache +183 -0
- package/src/tasks/create/templates/SDK-React/Widget/CASE/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Widget/PAGE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/SDK-React/Widget/PAGE/config.json.mustache +59 -0
- package/src/tasks/create/templates/SDK-React/Widget/PAGE/index.tsx.mustache +78 -0
- package/src/tasks/create/templates/SDK-React/Widget/PAGE/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Widget/PAGE-CASE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/SDK-React/Widget/PAGE-CASE/config.json.mustache +66 -0
- package/src/tasks/create/templates/SDK-React/Widget/PAGE-CASE/index.tsx.mustache +239 -0
- package/src/tasks/create/templates/SDK-React/Widget/PAGE-CASE/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-WebComponents/Field/__components.md +4 -0
- package/src/tasks/create/templates/SDK-WebComponents/Template/__components.md +4 -0
- package/src/tasks/create/templates/SDK-WebComponents/Widget/__components.md +4 -0
- package/src/tasks/delete/helper.js +122 -0
- package/src/tasks/delete/index.js +45 -0
- package/src/tasks/delete-all/helper.js +177 -0
- package/src/tasks/delete-all/index.js +45 -0
- package/src/tasks/index.js +11 -0
- package/src/tasks/linter/index.js +46 -0
- package/src/tasks/list/helper.js +118 -0
- package/src/tasks/list/index.js +51 -0
- package/src/tasks/map/map.js +118 -0
- package/src/tasks/publish/helper.js +147 -0
- package/src/tasks/publish/index.js +72 -0
- package/src/tasks/publish-all/helper.js +139 -0
- package/src/tasks/publish-all/index.js +84 -0
- package/src/tasks/update/index.js +5 -0
- package/src/tasks/upgrade/index.js +31 -0
- package/src/tasks/validator/index.js +216 -0
- package/src/util.js +442 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/* eslint-disable import/no-dynamic-require */
|
|
2
|
+
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import { createRequire } from 'module';
|
|
6
|
+
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
import resolve from 'resolve';
|
|
9
|
+
|
|
10
|
+
import paths from './paths.js';
|
|
11
|
+
|
|
12
|
+
const require = createRequire(import.meta.url);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Get additional module paths based on the baseUrl of a compilerOptions object.
|
|
16
|
+
*
|
|
17
|
+
* @param {Object} options
|
|
18
|
+
*/
|
|
19
|
+
function getAdditionalModulePaths(options = {}) {
|
|
20
|
+
const baseUrl = options.baseUrl;
|
|
21
|
+
|
|
22
|
+
if (!baseUrl) {
|
|
23
|
+
return '';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const baseUrlResolved = path.resolve(paths.appPath, baseUrl);
|
|
27
|
+
|
|
28
|
+
// We don't need to do anything if `baseUrl` is set to `node_modules`. This is
|
|
29
|
+
// the default behavior.
|
|
30
|
+
if (path.relative(paths.appNodeModules, baseUrlResolved) === '') {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Allow the user set the `baseUrl` to `appSrc`.
|
|
35
|
+
if (path.relative(paths.appSrc, baseUrlResolved) === '') {
|
|
36
|
+
return [paths.appSrc];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// If the path is equal to the root directory we ignore it here.
|
|
40
|
+
// We don't want to allow importing from the root directly as source files are
|
|
41
|
+
// not transpiled outside of `src`. We do allow importing them with the
|
|
42
|
+
// absolute path (e.g. `src/Components/Button.js`) but we set that up with
|
|
43
|
+
// an alias.
|
|
44
|
+
if (path.relative(paths.appPath, baseUrlResolved) === '') {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Otherwise, throw an error.
|
|
49
|
+
throw new Error(
|
|
50
|
+
chalk.red.bold(
|
|
51
|
+
"Your project's `baseUrl` can only be set to `src` or `node_modules`." +
|
|
52
|
+
' Create React App does not support other values at this time.'
|
|
53
|
+
)
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Get webpack aliases based on the baseUrl of a compilerOptions object.
|
|
59
|
+
*
|
|
60
|
+
* @param {*} options
|
|
61
|
+
*/
|
|
62
|
+
function getWebpackAliases(options = {}) {
|
|
63
|
+
const baseUrl = options.baseUrl;
|
|
64
|
+
|
|
65
|
+
if (!baseUrl) {
|
|
66
|
+
return {};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const baseUrlResolved = path.resolve(paths.appPath, baseUrl);
|
|
70
|
+
|
|
71
|
+
if (path.relative(paths.appPath, baseUrlResolved) === '') {
|
|
72
|
+
return {
|
|
73
|
+
src: paths.appSrc
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Get jest aliases based on the baseUrl of a compilerOptions object.
|
|
80
|
+
*
|
|
81
|
+
* @param {*} options
|
|
82
|
+
*/
|
|
83
|
+
function getJestAliases(options = {}) {
|
|
84
|
+
const baseUrl = options.baseUrl;
|
|
85
|
+
|
|
86
|
+
if (!baseUrl) {
|
|
87
|
+
return {};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const baseUrlResolved = path.resolve(paths.appPath, baseUrl);
|
|
91
|
+
|
|
92
|
+
if (path.relative(paths.appPath, baseUrlResolved) === '') {
|
|
93
|
+
return {
|
|
94
|
+
'^src/(.*)$': '<rootDir>/src/$1'
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function getModules() {
|
|
100
|
+
// Check if TypeScript is setup
|
|
101
|
+
const hasTsConfig = fs.existsSync(paths.appTsConfig);
|
|
102
|
+
const hasJsConfig = fs.existsSync(paths.appJsConfig);
|
|
103
|
+
|
|
104
|
+
if (hasTsConfig && hasJsConfig) {
|
|
105
|
+
throw new Error(
|
|
106
|
+
'You have both a tsconfig.json and a jsconfig.json. If you are using TypeScript please remove your jsconfig.json file.'
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
let config;
|
|
111
|
+
|
|
112
|
+
// If there's a tsconfig.json we assume it's a
|
|
113
|
+
// TypeScript project and set up the config
|
|
114
|
+
// based on tsconfig.json
|
|
115
|
+
if (hasTsConfig) {
|
|
116
|
+
const ts = require(resolve.sync('typescript', {
|
|
117
|
+
basedir: paths.appNodeModules
|
|
118
|
+
}));
|
|
119
|
+
config = ts.readConfigFile(paths.appTsConfig, ts.sys.readFile).config;
|
|
120
|
+
// Otherwise we'll check if there is jsconfig.json
|
|
121
|
+
// for non TS projects.
|
|
122
|
+
} else if (hasJsConfig) {
|
|
123
|
+
config = require(paths.appJsConfig);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
config = config || {};
|
|
127
|
+
const options = config.compilerOptions || {};
|
|
128
|
+
|
|
129
|
+
const additionalModulePaths = getAdditionalModulePaths(options);
|
|
130
|
+
|
|
131
|
+
return {
|
|
132
|
+
additionalModulePaths,
|
|
133
|
+
webpackAliases: getWebpackAliases(options),
|
|
134
|
+
jestAliases: getJestAliases(options),
|
|
135
|
+
hasTsConfig
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
module.exports = getModules();
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
|
|
4
|
+
// Make sure any symlinks in the project folder are resolved:
|
|
5
|
+
// https://github.com/facebook/create-react-app/issues/637
|
|
6
|
+
const appDirectory = fs.realpathSync(process.cwd());
|
|
7
|
+
const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
|
|
8
|
+
|
|
9
|
+
const buildPath = 'dist/components';
|
|
10
|
+
|
|
11
|
+
export const moduleFileExtensions = [
|
|
12
|
+
'web.mjs',
|
|
13
|
+
'mjs',
|
|
14
|
+
'web.js',
|
|
15
|
+
'js',
|
|
16
|
+
'web.ts',
|
|
17
|
+
'ts',
|
|
18
|
+
'web.tsx',
|
|
19
|
+
'tsx',
|
|
20
|
+
'json',
|
|
21
|
+
'web.jsx',
|
|
22
|
+
'jsx'
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
// Resolve file paths in the same order as webpack
|
|
26
|
+
const resolveModule = (resolveFn, filePath) => {
|
|
27
|
+
const extension = moduleFileExtensions.find(ext =>
|
|
28
|
+
fs.existsSync(resolveFn(`${filePath}.${ext}`))
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
if (extension) {
|
|
32
|
+
return resolveFn(`${filePath}.${extension}`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return resolveFn(`${filePath}.js`);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// config after eject: we're in ./config/
|
|
39
|
+
export default {
|
|
40
|
+
dotenv: resolveApp('.env'),
|
|
41
|
+
appPath: resolveApp('.'),
|
|
42
|
+
appBuild: resolveApp(buildPath),
|
|
43
|
+
appPublic: resolveApp('public'),
|
|
44
|
+
appIndexJs: resolveModule(resolveApp, 'src/index'),
|
|
45
|
+
appPackageJson: resolveApp('package.json'),
|
|
46
|
+
appSrc: resolveApp('src'),
|
|
47
|
+
appTsConfig: resolveApp('tsconfig.json'),
|
|
48
|
+
appJsConfig: resolveApp('jsconfig.json'),
|
|
49
|
+
appNodeModules: resolveApp('node_modules')
|
|
50
|
+
};
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import { createRequire } from 'module';
|
|
2
|
+
|
|
3
|
+
import webpack from 'webpack';
|
|
4
|
+
import TerserPlugin from 'terser-webpack-plugin';
|
|
5
|
+
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
6
|
+
import CssMinimizerPlugin from 'css-minimizer-webpack-plugin';
|
|
7
|
+
import getCSSModuleLocalIdent from 'react-dev-utils/getCSSModuleLocalIdent.js';
|
|
8
|
+
import ModuleNotFoundPlugin from 'react-dev-utils/ModuleNotFoundPlugin.js';
|
|
9
|
+
import CompressionPlugin from 'compression-webpack-plugin';
|
|
10
|
+
|
|
11
|
+
import paths from './paths.js';
|
|
12
|
+
|
|
13
|
+
const require = createRequire(import.meta.url);
|
|
14
|
+
|
|
15
|
+
// const appPackageJson = require(paths.appPackageJson);
|
|
16
|
+
|
|
17
|
+
// Source maps are resource heavy and can cause out of memory issue for large source files.
|
|
18
|
+
|
|
19
|
+
const compressionBRConfObj = {
|
|
20
|
+
filename: '[path][base].br',
|
|
21
|
+
algorithm: 'brotliCompress',
|
|
22
|
+
test: /\.(js|css|html|svg|png|jpg|woff|woff2)$/,
|
|
23
|
+
compressionOptions: { level: 11 }
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/* For gzip use below */
|
|
27
|
+
const compressionGZConfObj = {
|
|
28
|
+
filename: '[path][base].gz',
|
|
29
|
+
algorithm: 'gzip',
|
|
30
|
+
test: /\.(js|css|html|svg|png|jpg|woff|woff2)$/,
|
|
31
|
+
compressionOptions: { level: 9 }
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
let shouldUseSourceMap = process.env.SOURCE_MAP;
|
|
35
|
+
|
|
36
|
+
const imageInlineSizeLimit = Number.parseInt(process.env.IMAGE_INLINE_SIZE_LIMIT || '10000', 10);
|
|
37
|
+
|
|
38
|
+
// style files regex
|
|
39
|
+
const cssRegex = /\.css$/;
|
|
40
|
+
const cssModuleRegex = /\.module\.css$/;
|
|
41
|
+
const sassRegex = /\.(scss|sass)$/;
|
|
42
|
+
const sassModuleRegex = /\.module\.(scss|sass)$/;
|
|
43
|
+
|
|
44
|
+
// This is the production and development configuration.
|
|
45
|
+
// It is focused on developer experience, fast rebuilds, and a minimal bundle.
|
|
46
|
+
export default (
|
|
47
|
+
webpackEnv,
|
|
48
|
+
// eslint-disable-next-line no-unused-vars
|
|
49
|
+
{ inputFile, outputFile, componentKey, externals, globals, sourceMap, devBuild }
|
|
50
|
+
) => {
|
|
51
|
+
const isEnvDevelopment = webpackEnv === 'development' || devBuild;
|
|
52
|
+
const isEnvProduction = webpackEnv === 'production';
|
|
53
|
+
sourceMap = sourceMap === 'true';
|
|
54
|
+
shouldUseSourceMap = shouldUseSourceMap || sourceMap;
|
|
55
|
+
|
|
56
|
+
// common function to get style loaders
|
|
57
|
+
const getStyleLoaders = (cssOptions, preProcessor) => {
|
|
58
|
+
const loaders = [
|
|
59
|
+
isEnvProduction && {
|
|
60
|
+
loader: MiniCssExtractPlugin.loader
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
loader: require.resolve('css-loader'),
|
|
64
|
+
options: cssOptions
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
// Options for PostCSS as we reference these options twice
|
|
68
|
+
// Adds vendor prefixing based on your specified browser support in
|
|
69
|
+
// package.json
|
|
70
|
+
loader: require.resolve('postcss-loader'),
|
|
71
|
+
options: {
|
|
72
|
+
postcssOptions: {
|
|
73
|
+
plugins: [
|
|
74
|
+
[
|
|
75
|
+
'postcss-preset-env',
|
|
76
|
+
{
|
|
77
|
+
// Options
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
].filter(Boolean);
|
|
86
|
+
if (preProcessor) {
|
|
87
|
+
loaders.push(
|
|
88
|
+
{
|
|
89
|
+
loader: require.resolve('resolve-url-loader'),
|
|
90
|
+
options: {
|
|
91
|
+
sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
|
|
92
|
+
root: paths.appSrc
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
loader: require.resolve(preProcessor),
|
|
97
|
+
options: {
|
|
98
|
+
sourceMap: true
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
return loaders;
|
|
104
|
+
};
|
|
105
|
+
return {
|
|
106
|
+
mode: devBuild ? 'development' : 'production',
|
|
107
|
+
// Stop compilation early in production
|
|
108
|
+
bail: isEnvProduction,
|
|
109
|
+
// These are the "entry points" to our application.
|
|
110
|
+
// This means they will be the "root" imports that are included in JS bundle.
|
|
111
|
+
entry: inputFile,
|
|
112
|
+
devtool: devBuild ? 'eval-cheap-module-source-map' : false,
|
|
113
|
+
output: {
|
|
114
|
+
// The build folder.
|
|
115
|
+
path: paths.appBuild,
|
|
116
|
+
// There will be one main bundle, and one file per asynchronous chunk.
|
|
117
|
+
// In development, it does not produce real files.
|
|
118
|
+
filename: isEnvProduction
|
|
119
|
+
? `${componentKey}/${componentKey}.js`
|
|
120
|
+
: isEnvDevelopment && `${componentKey}/${componentKey}.js`,
|
|
121
|
+
chunkFilename: isEnvProduction
|
|
122
|
+
? `${componentKey}/js/[name].[contenthash:8].chunk.js`
|
|
123
|
+
: isEnvDevelopment && `${componentKey}/js/[name].chunk.js`,
|
|
124
|
+
library: {
|
|
125
|
+
name: componentKey,
|
|
126
|
+
type: 'umd',
|
|
127
|
+
export: 'default'
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
optimization: {
|
|
131
|
+
minimize: isEnvProduction,
|
|
132
|
+
minimizer: [new TerserPlugin(), new CssMinimizerPlugin()]
|
|
133
|
+
},
|
|
134
|
+
resolve: {
|
|
135
|
+
plugins: [],
|
|
136
|
+
extensions: ['.tsx', '.ts', '.js']
|
|
137
|
+
},
|
|
138
|
+
resolveLoader: {
|
|
139
|
+
plugins: []
|
|
140
|
+
},
|
|
141
|
+
module: {
|
|
142
|
+
strictExportPresence: true,
|
|
143
|
+
rules: [
|
|
144
|
+
{
|
|
145
|
+
// "oneOf" will traverse all following loaders until one will
|
|
146
|
+
// match the requirements. When no loader matches it will fall
|
|
147
|
+
// back to the "file" loader at the end of the loader list.
|
|
148
|
+
oneOf: [
|
|
149
|
+
// TODO: Merge this config once `image/avif` is in the mime-db
|
|
150
|
+
// https://github.com/jshttp/mime-db
|
|
151
|
+
{
|
|
152
|
+
test: [/\.avif$/],
|
|
153
|
+
loader: require.resolve('url-loader'),
|
|
154
|
+
options: {
|
|
155
|
+
limit: imageInlineSizeLimit,
|
|
156
|
+
mimetype: 'image/avif',
|
|
157
|
+
name: `${componentKey}/media/[name].[hash:8].[ext]`
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
// "url" loader works like "file" loader except that it embeds assets
|
|
161
|
+
// smaller than specified limit in bytes as data URLs to avoid requests.
|
|
162
|
+
// A missing `test` is equivalent to a match.
|
|
163
|
+
{
|
|
164
|
+
test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/, /\.svg$/],
|
|
165
|
+
loader: require.resolve('url-loader'),
|
|
166
|
+
options: {
|
|
167
|
+
limit: imageInlineSizeLimit,
|
|
168
|
+
name: `${componentKey}/media/[name].[hash:8].[ext]`
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
// Process application JS with TS-Loader.
|
|
172
|
+
// The preset includes JSX, Flow, TypeScript, and some ESnext features.
|
|
173
|
+
{
|
|
174
|
+
test: /\.(js|mjs|jsx)$/,
|
|
175
|
+
include: paths.appSrc,
|
|
176
|
+
loader: 'ts-loader',
|
|
177
|
+
options: {
|
|
178
|
+
configFile: 'tsconfig.build.json'
|
|
179
|
+
},
|
|
180
|
+
exclude: /node_modules/
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
{
|
|
184
|
+
test: /\.(ts|tsx)$/,
|
|
185
|
+
loader: 'ts-loader',
|
|
186
|
+
options: {
|
|
187
|
+
configFile: 'tsconfig.build.json'
|
|
188
|
+
},
|
|
189
|
+
exclude: /node_modules/
|
|
190
|
+
},
|
|
191
|
+
// "postcss" loader applies autoprefixer to our CSS.
|
|
192
|
+
// "css" loader resolves paths in CSS and adds assets as dependencies.
|
|
193
|
+
// "style" loader turns CSS into JS modules that inject <style> tags.
|
|
194
|
+
// In production, we use MiniCSSExtractPlugin to extract that CSS
|
|
195
|
+
// to a file, but in development "style" loader enables hot editing
|
|
196
|
+
// of CSS.
|
|
197
|
+
// By default we support CSS Modules with the extension .module.css
|
|
198
|
+
{
|
|
199
|
+
test: cssRegex,
|
|
200
|
+
exclude: cssModuleRegex,
|
|
201
|
+
use: getStyleLoaders({
|
|
202
|
+
importLoaders: 1,
|
|
203
|
+
sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment
|
|
204
|
+
}),
|
|
205
|
+
// Don't consider CSS imports dead code even if the
|
|
206
|
+
// containing package claims to have no side effects.
|
|
207
|
+
// Remove this when webpack adds a warning or an error for this.
|
|
208
|
+
// See https://github.com/webpack/webpack/issues/6571
|
|
209
|
+
sideEffects: true
|
|
210
|
+
},
|
|
211
|
+
// Adds support for CSS Modules (https://github.com/css-modules/css-modules)
|
|
212
|
+
// using the extension .module.css
|
|
213
|
+
{
|
|
214
|
+
test: cssModuleRegex,
|
|
215
|
+
use: getStyleLoaders({
|
|
216
|
+
importLoaders: 1,
|
|
217
|
+
sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
|
|
218
|
+
modules: {
|
|
219
|
+
getLocalIdent: getCSSModuleLocalIdent
|
|
220
|
+
}
|
|
221
|
+
})
|
|
222
|
+
},
|
|
223
|
+
// Opt-in support for SASS (using .scss or .sass extensions).
|
|
224
|
+
// By default we support SASS Modules with the
|
|
225
|
+
// extensions .module.scss or .module.sass
|
|
226
|
+
{
|
|
227
|
+
test: sassRegex,
|
|
228
|
+
exclude: sassModuleRegex,
|
|
229
|
+
use: getStyleLoaders(
|
|
230
|
+
{
|
|
231
|
+
importLoaders: 3,
|
|
232
|
+
sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment
|
|
233
|
+
},
|
|
234
|
+
'sass-loader'
|
|
235
|
+
),
|
|
236
|
+
// Don't consider CSS imports dead code even if the
|
|
237
|
+
// containing package claims to have no side effects.
|
|
238
|
+
// Remove this when webpack adds a warning or an error for this.
|
|
239
|
+
// See https://github.com/webpack/webpack/issues/6571
|
|
240
|
+
sideEffects: true
|
|
241
|
+
},
|
|
242
|
+
// Adds support for CSS Modules, but using SASS
|
|
243
|
+
// using the extension .module.scss or .module.sass
|
|
244
|
+
{
|
|
245
|
+
test: sassModuleRegex,
|
|
246
|
+
use: getStyleLoaders(
|
|
247
|
+
{
|
|
248
|
+
importLoaders: 3,
|
|
249
|
+
sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
|
|
250
|
+
modules: {
|
|
251
|
+
getLocalIdent: getCSSModuleLocalIdent
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
'sass-loader'
|
|
255
|
+
)
|
|
256
|
+
},
|
|
257
|
+
// "file" loader makes sure those assets get served by WebpackDevServer.
|
|
258
|
+
// When you `import` an asset, you get its (virtual) filename.
|
|
259
|
+
// In production, they would get copied to the `build` folder.
|
|
260
|
+
// This loader doesn't use a "test" so it will catch all modules
|
|
261
|
+
// that fall through the other loaders.
|
|
262
|
+
{
|
|
263
|
+
loader: require.resolve('file-loader'),
|
|
264
|
+
// Exclude `js` files to keep "css" loader working as it injects
|
|
265
|
+
// its runtime that would otherwise be processed through "file" loader.
|
|
266
|
+
// Also exclude `html` and `json` extensions so they get processed
|
|
267
|
+
// by webpack's internal loaders.
|
|
268
|
+
exclude: [/\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/],
|
|
269
|
+
options: {
|
|
270
|
+
name: `${componentKey}/media/[name].[hash:8].[ext]`
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
// ** STOP ** Are you adding a new loader?
|
|
274
|
+
// Make sure to add the new loader(s) before the "file" loader.
|
|
275
|
+
]
|
|
276
|
+
}
|
|
277
|
+
]
|
|
278
|
+
},
|
|
279
|
+
plugins: [
|
|
280
|
+
// This gives some necessary context to module not found errors, such as
|
|
281
|
+
// the requesting resource.
|
|
282
|
+
new ModuleNotFoundPlugin(paths.appPath),
|
|
283
|
+
// Makes some environment variables available to the JS code, for example:
|
|
284
|
+
// if (process.env.NODE_ENV === 'production') { ... }. See `./env.js`.
|
|
285
|
+
// It is absolutely essential that NODE_ENV is set to production
|
|
286
|
+
// during a production build.
|
|
287
|
+
// Otherwise React will be compiled in the very slow development mode.
|
|
288
|
+
isEnvProduction &&
|
|
289
|
+
new webpack.DefinePlugin({
|
|
290
|
+
PRODUCTION: JSON.stringify(true)
|
|
291
|
+
}),
|
|
292
|
+
isEnvProduction &&
|
|
293
|
+
new MiniCssExtractPlugin({
|
|
294
|
+
// Options similar to the same options in webpackOptions.output
|
|
295
|
+
// both options are optional
|
|
296
|
+
filename: `${componentKey}/css/${componentKey}.[contenthash:8].css`,
|
|
297
|
+
chunkFilename: `${componentKey}/css/${componentKey}.[contenthash:8].chunk.css`
|
|
298
|
+
}),
|
|
299
|
+
// Moment.js is an extremely popular library that bundles large locale files
|
|
300
|
+
// by default due to how webpack interprets its code. This is a practical
|
|
301
|
+
// solution that requires the user to opt into importing specific locales.
|
|
302
|
+
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
|
|
303
|
+
// You can remove this if you don't use Moment.js:
|
|
304
|
+
new webpack.IgnorePlugin({
|
|
305
|
+
resourceRegExp: /^\.\/locale$/,
|
|
306
|
+
contextRegExp: /moment$/
|
|
307
|
+
}),
|
|
308
|
+
/* Ignore cosmos icons */
|
|
309
|
+
new webpack.IgnorePlugin({
|
|
310
|
+
resourceRegExp: /^\.\/icons$/,
|
|
311
|
+
contextRegExp: /@pega\/cosmos-react-core\/lib\/components\/Icon$/
|
|
312
|
+
}),
|
|
313
|
+
|
|
314
|
+
/* Ignore cosmos icons - windows */
|
|
315
|
+
new webpack.IgnorePlugin({
|
|
316
|
+
resourceRegExp: /^\.\/icons$/,
|
|
317
|
+
contextRegExp: /@pega\\cosmos-react-core\\lib\\components\\Icon$/
|
|
318
|
+
}),
|
|
319
|
+
|
|
320
|
+
new webpack.optimize.LimitChunkCountPlugin({
|
|
321
|
+
maxChunks: 5
|
|
322
|
+
}),
|
|
323
|
+
new webpack.optimize.MinChunkSizePlugin({
|
|
324
|
+
minChunkSize: 100000 // Minimum number of characters
|
|
325
|
+
}),
|
|
326
|
+
!devBuild && new CompressionPlugin(compressionBRConfObj)
|
|
327
|
+
|
|
328
|
+
/* Dont generate gzip file */
|
|
329
|
+
/* isEnvProduction && new CompressionPlugin(compressionGZConfObj) */
|
|
330
|
+
].filter(Boolean),
|
|
331
|
+
performance: {
|
|
332
|
+
hints: 'warning'
|
|
333
|
+
},
|
|
334
|
+
externals
|
|
335
|
+
};
|
|
336
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import { stat } from 'fs/promises';
|
|
4
|
+
|
|
5
|
+
import { BUILD_CONFIG_JSON_FILENAME } from '../../constants.js';
|
|
6
|
+
import { getComponentDirectoryPath } from '../../util.js';
|
|
7
|
+
|
|
8
|
+
import buildComponent from './builder/index.js';
|
|
9
|
+
|
|
10
|
+
const extensions = ['ts', 'tsx', 'js', 'jsx'];
|
|
11
|
+
|
|
12
|
+
const bundleComponent = async (componentKey, sourceMap, devBuild) => {
|
|
13
|
+
const componentDirectory = await getComponentDirectoryPath(componentKey);
|
|
14
|
+
|
|
15
|
+
const idx = (
|
|
16
|
+
await Promise.all(
|
|
17
|
+
extensions.map(ext =>
|
|
18
|
+
stat(path.join(componentDirectory, `index.${ext}`))
|
|
19
|
+
.then(() => true)
|
|
20
|
+
.catch(() => false)
|
|
21
|
+
)
|
|
22
|
+
)
|
|
23
|
+
).findIndex(exists => exists);
|
|
24
|
+
|
|
25
|
+
if (idx === -1) throw new Error('Index file not found.');
|
|
26
|
+
|
|
27
|
+
const inputFile = path.join(componentDirectory, `index.${extensions[idx]}`);
|
|
28
|
+
const outputFile = `${componentKey}.js`;
|
|
29
|
+
|
|
30
|
+
let buildConfig = {};
|
|
31
|
+
|
|
32
|
+
if (fs.existsSync(BUILD_CONFIG_JSON_FILENAME)) {
|
|
33
|
+
buildConfig = JSON.parse(fs.readFileSync(BUILD_CONFIG_JSON_FILENAME, 'utf8'));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let externals = buildConfig.externals || [];
|
|
37
|
+
externals = {
|
|
38
|
+
react: 'React',
|
|
39
|
+
'react-dom': 'ReactDOM',
|
|
40
|
+
PCore: 'PCore',
|
|
41
|
+
...buildConfig.externals
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
let globals = buildConfig.globals || {};
|
|
45
|
+
|
|
46
|
+
const defaultGlobals = {
|
|
47
|
+
react: 'React',
|
|
48
|
+
'react-dom': 'ReactDOM',
|
|
49
|
+
PCore: 'PCore',
|
|
50
|
+
...buildConfig.globals
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
globals = { ...globals, ...defaultGlobals };
|
|
54
|
+
await buildComponent({
|
|
55
|
+
inputFile,
|
|
56
|
+
outputFile,
|
|
57
|
+
componentKey,
|
|
58
|
+
externals,
|
|
59
|
+
globals,
|
|
60
|
+
sourceMap,
|
|
61
|
+
devBuild
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export default bundleComponent;
|