@pega/dx-component-builder-sdk 0.1.46 → 0.1.48
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/package.json +3 -2
- package/src/auth.js +3 -3
- package/src/cli.js +1 -1
- package/src/constants.js +728 -2
- package/src/tasks/authenticate/index.js +1 -1
- package/src/tasks/build/helper.js +10 -6
- package/src/tasks/build/index.js +76 -22
- package/src/tasks/build-all/helper.js +16 -11
- package/src/tasks/build-all/index.js +108 -44
- package/src/tasks/bundle/{builder → builderAngular}/paths.js +2 -2
- package/src/tasks/bundle/builderAngular/webpack.config.js +342 -0
- package/src/tasks/bundle/builderReact/index.js +218 -0
- package/src/tasks/bundle/builderReact/modules.js +139 -0
- package/src/tasks/bundle/builderReact/paths.js +50 -0
- package/src/tasks/bundle/{builder → builderReact}/webpack.config.js +5 -4
- package/src/tasks/bundle/index.js +64 -5
- package/src/tasks/create/index.js +54 -12
- 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/index.jsx.mustache +2 -2
- package/src/tasks/create/templates/Constellation/field/Decimal/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/field/Decimal-Currency/index.jsx.mustache +2 -2
- package/src/tasks/create/templates/Constellation/field/Decimal-Currency/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/field/Decimal-Percentage/index.jsx.mustache +4 -4
- package/src/tasks/create/templates/Constellation/field/Decimal-Percentage/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/field/Integer/index.jsx.mustache +2 -2
- 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/index.jsx.mustache +0 -1
- 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 +14 -0
- package/src/tasks/create/templates/Constellation/field/{TimeofDay → TimeOfDay}/time-of-day.js.mustache +6 -5
- package/src/tasks/create/templates/Constellation/template/DETAILS/demo.stories.jsx.mustache +20 -6
- package/src/tasks/create/templates/Constellation/template/DETAILS/index.jsx.mustache +2 -2
- package/src/tasks/create/templates/Constellation/template/DETAILS/mock.stories.js.mustache +20 -10
- package/src/tasks/create/templates/Constellation/template/DETAILS/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/template/DETAILS-region/demo.stories.jsx.mustache +20 -7
- package/src/tasks/create/templates/Constellation/template/DETAILS-region/index.jsx.mustache +2 -2
- package/src/tasks/create/templates/Constellation/template/DETAILS-region/mock.stories.js.mustache +28 -13
- package/src/tasks/create/templates/Constellation/template/DETAILS-region/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/template/FORM/demo.stories.jsx.mustache +92 -16
- package/src/tasks/create/templates/Constellation/template/FORM/index.jsx.mustache +2 -2
- package/src/tasks/create/templates/Constellation/template/FORM/mock.stories.js.mustache +24 -12
- package/src/tasks/create/templates/Constellation/template/FORM/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/template/FORM-region/demo.stories.jsx.mustache +91 -13
- package/src/tasks/create/templates/Constellation/template/FORM-region/index.jsx.mustache +2 -2
- package/src/tasks/create/templates/Constellation/template/FORM-region/mock.stories.js.mustache +24 -12
- package/src/tasks/create/templates/Constellation/template/FORM-region/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/template/PAGE/demo.stories.jsx.mustache +1 -0
- package/src/tasks/create/templates/Constellation/template/PAGE/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/widget/CASE/index.jsx.mustache +2 -2
- 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/Operator.jsx.mustache +2 -2
- package/src/tasks/create/templates/Constellation/widget/PAGE-CASE/index.jsx.mustache +2 -2
- package/src/tasks/create/templates/Constellation/widget/PAGE-CASE/styles.js.mustache +13 -6
- package/src/tasks/create/templates/SDK-Angular/field/Boolean/boolean.component.html.mustache +42 -0
- package/src/tasks/create/templates/SDK-Angular/field/Boolean/boolean.component.scss.mustache +24 -0
- package/src/tasks/create/templates/SDK-Angular/field/Boolean/boolean.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/Boolean/boolean.component.ts.mustache +165 -0
- package/src/tasks/create/templates/SDK-Angular/field/Boolean/config.json.mustache +87 -0
- package/src/tasks/create/templates/SDK-Angular/field/Boolean/demo.stories.jsx.mustache +56 -0
- package/src/tasks/create/templates/SDK-Angular/field/Boolean/mock.stories.js.mustache +15 -0
- package/src/tasks/create/templates/SDK-Angular/field/Date/config.json.mustache +147 -0
- package/src/tasks/create/templates/SDK-Angular/field/Date/date.component.html.mustache +35 -0
- package/src/tasks/create/templates/SDK-Angular/field/Date/date.component.scss.mustache +20 -0
- package/src/tasks/create/templates/SDK-Angular/field/Date/date.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/Date/date.component.ts.mustache +209 -0
- package/src/tasks/create/templates/SDK-Angular/field/DateTime/config.json.mustache +204 -0
- package/src/tasks/create/templates/SDK-Angular/field/DateTime/date-time.component.html.mustache +31 -0
- package/src/tasks/create/templates/SDK-Angular/field/DateTime/date-time.component.scss.mustache +20 -0
- package/src/tasks/create/templates/SDK-Angular/field/DateTime/date-time.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/DateTime/date-time.component.ts.mustache +177 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal/config.json.mustache +94 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal/decimal.component.html.mustache +32 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal/decimal.component.scss.mustache +20 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal/decimal.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal/decimal.component.ts.mustache +170 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Currency/config.json.mustache +125 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Currency/decimal-currency.component.html.mustache +33 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Currency/decimal-currency.component.scss.mustache +20 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Currency/decimal-currency.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Currency/decimal-currency.component.ts.mustache +175 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Percentage/config.json.mustache +94 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Percentage/decimal-percentage.component.html.mustache +33 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Percentage/decimal-percentage.component.scss.mustache +20 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Percentage/decimal-percentage.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Percentage/decimal-percentage.component.ts.mustache +176 -0
- package/src/tasks/create/templates/SDK-Angular/field/Integer/config.json.mustache +88 -0
- package/src/tasks/create/templates/SDK-Angular/field/Integer/integer.component.html.mustache +33 -0
- package/src/tasks/create/templates/SDK-Angular/field/Integer/integer.component.scss.mustache +20 -0
- package/src/tasks/create/templates/SDK-Angular/field/Integer/integer.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/Integer/integer.component.ts.mustache +180 -0
- package/src/tasks/create/templates/SDK-Angular/field/Picklist/config.json.mustache +86 -0
- package/src/tasks/create/templates/SDK-Angular/field/Picklist/picklist.component.html.mustache +30 -0
- package/src/tasks/create/templates/SDK-Angular/field/Picklist/picklist.component.scss.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/Picklist/picklist.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/Picklist/picklist.component.ts.mustache +195 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text/config.json.mustache +83 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text/text.component.html.mustache +17 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text/text.component.scss.mustache +30 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text/text.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text/text.component.ts.mustache +145 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Email/config.json.mustache +83 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Email/text-email.component.html.mustache +31 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Email/text-email.component.scss.mustache +20 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Email/text-email.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Email/text-email.component.ts.mustache +175 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Input/config.json.mustache +83 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Input/text.component.html.mustache +31 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Input/text.component.scss.mustache +20 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Input/text.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Input/text.component.ts.mustache +177 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Paragraph/config.json.mustache +83 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Paragraph/text-paragraph.component.html.mustache +31 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Paragraph/text-paragraph.component.scss.mustache +20 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Paragraph/text-paragraph.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Paragraph/text-paragraph.component.ts.mustache +179 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Phone/config.json.mustache +95 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Phone/text-phone.component.html.mustache +30 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Phone/text-phone.component.scss.mustache +81 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Phone/text-phone.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Phone/text-phone.component.ts.mustache +194 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-URL/config.json.mustache +111 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-URL/text-url.component.html.mustache +30 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-URL/text-url.component.scss.mustache +20 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-URL/text-url.component.spec.ts.mustache +26 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-URL/text-url.component.ts.mustache +174 -0
- package/src/tasks/create/templates/SDK-Angular/field/TimeOfDay/time-of-day.component.html.mustache +30 -0
- package/src/tasks/create/templates/SDK-Angular/field/TimeOfDay/time-of-day.component.scss.mustache +20 -0
- package/src/tasks/create/templates/SDK-Angular/field/TimeOfDay/time-of-day.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/TimeOfDay/time-of-day.component.ts.mustache +172 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS/DefaultForm.svg +29 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS/config.json.mustache +21 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS/demo.stories.jsx.mustache +71 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS/details.component.html.mustache +7 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS/details.component.scss.mustache +7 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS/details.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS/details.component.ts.mustache +121 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS/mock.stories.js.mustache +294 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS-region/TwoColumnDetails.svg +28 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS-region/config.json.mustache +27 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS-region/demo.stories.jsx.mustache +73 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS-region/details.component.html.mustache +6 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS-region/details.component.scss.mustache +7 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS-region/details.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS-region/details.component.ts.mustache +92 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS-region/mock.stories.js.mustache +290 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM/DefaultForm.svg +29 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM/config.json.mustache +45 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM/demo.stories.jsx.mustache +215 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM/form.component.html.mustache +23 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM/form.component.scss.mustache +33 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM/form.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM/form.component.ts.mustache +71 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM-region/TwoColumn.svg +38 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM-region/config.json.mustache +49 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM-region/demo.stories.jsx.mustache +183 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM-region/form.component.html.mustache +16 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM-region/form.component.scss.mustache +28 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM-region/form.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM-region/form.component.ts.mustache +26 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM-region/mock.stories.js.mustache +132 -0
- package/src/tasks/create/templates/SDK-Angular/template/PAGE/OneColumnPage.svg +28 -0
- package/src/tasks/create/templates/SDK-Angular/template/PAGE/config.json.mustache +32 -0
- package/src/tasks/create/templates/SDK-Angular/template/PAGE/demo.stories.jsx.mustache +80 -0
- package/src/tasks/create/templates/SDK-Angular/template/PAGE/mock.stories.js.mustache +115 -0
- package/src/tasks/create/templates/SDK-Angular/template/PAGE/page.component.html.mustache +15 -0
- package/src/tasks/create/templates/SDK-Angular/template/PAGE/page.component.scss.mustache +3 -0
- package/src/tasks/create/templates/SDK-Angular/template/PAGE/page.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/template/PAGE/page.component.ts.mustache +63 -0
- package/src/tasks/create/templates/SDK-Angular/widget/CASE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/SDK-Angular/widget/CASE/case.component.html.mustache +15 -0
- package/src/tasks/create/templates/SDK-Angular/widget/CASE/case.component.scss.mustache +22 -0
- package/src/tasks/create/templates/SDK-Angular/widget/CASE/case.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/widget/CASE/case.component.ts.mustache +111 -0
- package/src/tasks/create/templates/SDK-Angular/widget/CASE/config.json.mustache +23 -0
- package/src/tasks/create/templates/SDK-Angular/widget/CASE/demo.stories.jsx.mustache +70 -0
- package/src/tasks/create/templates/SDK-Angular/widget/CASE/mock.stories.js.mustache +390 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE/config.json.mustache +59 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE/demo.stories.jsx.mustache +29 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE/mock.stories.js.mustache +23 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE/page.component.html.mustache +17 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE/page.component.scss.mustache +19 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE/page.component.ts.mustache +32 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE/pagecomponent.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE-CASE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE-CASE/config.json.mustache +66 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE-CASE/demo.stories.jsx.mustache +52 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE-CASE/mock.stories.js.mustache +52 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE-CASE/page-case.component.html.mustache +28 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE-CASE/page-case.component.scss.mustache +137 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE-CASE/page-case.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE-CASE/page-case.component.ts.mustache +115 -0
- package/src/tasks/create/templates/SDK-React/field/Boolean/index.tsx.mustache +3 -3
- package/src/tasks/create/templates/SDK-React/field/Date/index.tsx.mustache +2 -2
- package/src/tasks/create/templates/SDK-React/field/DateTime/index.tsx.mustache +6 -7
- package/src/tasks/create/templates/SDK-React/field/Decimal/demo.stories.jsx.mustache +5 -1
- package/src/tasks/create/templates/SDK-React/field/Decimal/index.tsx.mustache +78 -28
- package/src/tasks/create/templates/SDK-React/field/Decimal-Currency/index.tsx.mustache +3 -3
- package/src/tasks/create/templates/SDK-React/field/Decimal-Percentage/index.tsx.mustache +2 -2
- package/src/tasks/create/templates/SDK-React/field/Integer/index.tsx.mustache +2 -2
- package/src/tasks/create/templates/SDK-React/field/Picklist/demo.stories.jsx.mustache +13 -0
- package/src/tasks/create/templates/SDK-React/field/Picklist/index.tsx.mustache +30 -10
- package/src/tasks/create/templates/SDK-React/field/Text/index.tsx.mustache +2 -2
- package/src/tasks/create/templates/SDK-React/field/Text-Email/index.tsx.mustache +2 -2
- package/src/tasks/create/templates/SDK-React/field/Text-Input/index.tsx.mustache +2 -2
- package/src/tasks/create/templates/SDK-React/field/Text-Paragraph/index.tsx.mustache +2 -2
- package/src/tasks/create/templates/SDK-React/field/Text-Phone/index.tsx.mustache +6 -5
- package/src/tasks/create/templates/SDK-React/field/Text-URL/index.tsx.mustache +11 -0
- package/src/tasks/create/templates/SDK-React/field/TimeOfDay/config.json.mustache +135 -0
- package/src/tasks/create/templates/SDK-React/field/{TimeofDay → TimeOfDay}/index.tsx.mustache +12 -1
- package/src/tasks/create/templates/SDK-React/template/DETAILS/index.tsx.mustache +7 -3
- package/src/tasks/create/templates/SDK-React/template/DETAILS-region/index.tsx.mustache +8 -4
- package/src/tasks/create/templates/SDK-React/template/FORM/index.tsx.mustache +30 -20
- package/src/tasks/create/templates/SDK-React/template/FORM-region/demo.stories.jsx.mustache +2 -2
- package/src/tasks/create/templates/SDK-React/template/PAGE/demo.stories.jsx.mustache +1 -0
- package/src/tasks/create/templates/SDK-React/widget/CASE/index.tsx.mustache +4 -3
- package/src/tasks/create/templates/SDK-React/widget/PAGE/index.tsx.mustache +7 -7
- package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/demo.stories.jsx.mustache +2 -10
- package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/index.tsx.mustache +138 -36
- package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/mock.stories.js.mustache +1 -1
- package/src/tasks/create-all/index.js +114 -58
- package/src/tasks/delete/helper.js +88 -24
- package/src/tasks/delete/index.js +17 -8
- package/src/tasks/delete-all/helper.js +88 -25
- package/src/tasks/delete-all/index.js +15 -6
- package/src/tasks/list/index.js +14 -7
- package/src/tasks/map/map.js +212 -20
- package/src/tasks/map-all/index.js +19 -2
- package/src/tasks/override/index.js +137 -76
- package/src/tasks/override-all/index.js +54 -6
- package/src/tasks/publish/helper.js +93 -50
- package/src/tasks/publish/index.js +87 -34
- package/src/tasks/publish-all/helper.js +96 -57
- package/src/tasks/publish-all/index.js +123 -47
- package/src/tasks/rename/index.js +184 -111
- package/src/tasks/validator/index.js +31 -7
- package/src/util.js +173 -20
- package/src/tasks/create/templates/Constellation/field/TimeofDay/styles.js.mustache +0 -7
- /package/src/tasks/bundle/{builder → builderAngular}/index.js +0 -0
- /package/src/tasks/bundle/{builder → builderAngular}/modules.js +0 -0
- /package/src/tasks/create/templates/Constellation/field/{TimeofDay → TimeOfDay}/config.json.mustache +0 -0
- /package/src/tasks/create/templates/Constellation/field/{TimeofDay → TimeOfDay}/demo.stories.jsx.mustache +0 -0
- /package/src/tasks/create/templates/Constellation/field/{TimeofDay → TimeOfDay}/index.jsx.mustache +0 -0
- /package/src/tasks/create/templates/Constellation/field/{TimeofDay → TimeOfDay}/mock.stories.js.mustache +0 -0
- /package/src/tasks/create/templates/Constellation/field/{TimeofDay → TimeOfDay}/suggestions-handler.js +0 -0
- /package/src/tasks/create/templates/{SDK-React/field/TimeofDay → SDK-Angular/field/TimeOfDay}/config.json.mustache +0 -0
- /package/src/tasks/create/templates/SDK-React/field/{TimeofDay → TimeOfDay}/demo.stories.jsx.mustache +0 -0
- /package/src/tasks/create/templates/SDK-React/field/{TimeofDay → TimeOfDay}/mock.stories.js.mustache +0 -0
- /package/src/tasks/create/templates/SDK-React/field/{TimeofDay → TimeOfDay}/styles.js.mustache +0 -0
|
@@ -0,0 +1,342 @@
|
|
|
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
|
+
publicPath: ''
|
|
130
|
+
},
|
|
131
|
+
optimization: {
|
|
132
|
+
minimize: isEnvProduction,
|
|
133
|
+
minimizer: [new TerserPlugin(), new CssMinimizerPlugin()]
|
|
134
|
+
},
|
|
135
|
+
resolve: {
|
|
136
|
+
plugins: [],
|
|
137
|
+
extensions: ['.tsx', '.ts', '.js']
|
|
138
|
+
},
|
|
139
|
+
resolveLoader: {
|
|
140
|
+
plugins: []
|
|
141
|
+
},
|
|
142
|
+
module: {
|
|
143
|
+
strictExportPresence: true,
|
|
144
|
+
rules: [
|
|
145
|
+
{
|
|
146
|
+
// "oneOf" will traverse all following loaders until one will
|
|
147
|
+
// match the requirements. When no loader matches it will fall
|
|
148
|
+
// back to the "file" loader at the end of the loader list.
|
|
149
|
+
oneOf: [
|
|
150
|
+
// TODO: Merge this config once `image/avif` is in the mime-db
|
|
151
|
+
// https://github.com/jshttp/mime-db
|
|
152
|
+
{
|
|
153
|
+
test: [/\.avif$/],
|
|
154
|
+
loader: require.resolve('url-loader'),
|
|
155
|
+
options: {
|
|
156
|
+
limit: imageInlineSizeLimit,
|
|
157
|
+
mimetype: 'image/avif',
|
|
158
|
+
name: `${componentKey}/media/[name].[hash:8].[ext]`
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
// "url" loader works like "file" loader except that it embeds assets
|
|
162
|
+
// smaller than specified limit in bytes as data URLs to avoid requests.
|
|
163
|
+
// A missing `test` is equivalent to a match.
|
|
164
|
+
{
|
|
165
|
+
test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/, /\.svg$/],
|
|
166
|
+
loader: require.resolve('url-loader'),
|
|
167
|
+
options: {
|
|
168
|
+
limit: imageInlineSizeLimit,
|
|
169
|
+
name: `${componentKey}/media/[name].[hash:8].[ext]`
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
// Process application JS with TS-Loader.
|
|
173
|
+
// The preset includes JSX, Flow, TypeScript, and some ESnext features.
|
|
174
|
+
{
|
|
175
|
+
test: /\.(js|mjs|jsx)$/,
|
|
176
|
+
include: paths.appSrc,
|
|
177
|
+
loader: 'ts-loader',
|
|
178
|
+
options: {
|
|
179
|
+
configFile: paths.appTsConfig
|
|
180
|
+
},
|
|
181
|
+
exclude: /node_modules/
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
test: /\.m?js/,
|
|
185
|
+
resolve: {
|
|
186
|
+
fullySpecified: false
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
test: /\.(ts|tsx)$/,
|
|
191
|
+
loader: 'ts-loader',
|
|
192
|
+
options: {
|
|
193
|
+
configFile: paths.appTsConfig
|
|
194
|
+
},
|
|
195
|
+
exclude: /node_modules/
|
|
196
|
+
},
|
|
197
|
+
// "postcss" loader applies autoprefixer to our CSS.
|
|
198
|
+
// "css" loader resolves paths in CSS and adds assets as dependencies.
|
|
199
|
+
// "style" loader turns CSS into JS modules that inject <style> tags.
|
|
200
|
+
// In production, we use MiniCSSExtractPlugin to extract that CSS
|
|
201
|
+
// to a file, but in development "style" loader enables hot editing
|
|
202
|
+
// of CSS.
|
|
203
|
+
// By default we support CSS Modules with the extension .module.css
|
|
204
|
+
{
|
|
205
|
+
test: cssRegex,
|
|
206
|
+
exclude: cssModuleRegex,
|
|
207
|
+
use: getStyleLoaders({
|
|
208
|
+
importLoaders: 1,
|
|
209
|
+
sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment
|
|
210
|
+
}),
|
|
211
|
+
// Don't consider CSS imports dead code even if the
|
|
212
|
+
// containing package claims to have no side effects.
|
|
213
|
+
// Remove this when webpack adds a warning or an error for this.
|
|
214
|
+
// See https://github.com/webpack/webpack/issues/6571
|
|
215
|
+
sideEffects: true
|
|
216
|
+
},
|
|
217
|
+
// Adds support for CSS Modules (https://github.com/css-modules/css-modules)
|
|
218
|
+
// using the extension .module.css
|
|
219
|
+
{
|
|
220
|
+
test: cssModuleRegex,
|
|
221
|
+
use: getStyleLoaders({
|
|
222
|
+
importLoaders: 1,
|
|
223
|
+
sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
|
|
224
|
+
modules: {
|
|
225
|
+
getLocalIdent: getCSSModuleLocalIdent
|
|
226
|
+
}
|
|
227
|
+
})
|
|
228
|
+
},
|
|
229
|
+
// Opt-in support for SASS (using .scss or .sass extensions).
|
|
230
|
+
// By default we support SASS Modules with the
|
|
231
|
+
// extensions .module.scss or .module.sass
|
|
232
|
+
{
|
|
233
|
+
test: sassRegex,
|
|
234
|
+
exclude: sassModuleRegex,
|
|
235
|
+
use: getStyleLoaders(
|
|
236
|
+
{
|
|
237
|
+
importLoaders: 3,
|
|
238
|
+
sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment
|
|
239
|
+
},
|
|
240
|
+
'sass-loader'
|
|
241
|
+
),
|
|
242
|
+
// Don't consider CSS imports dead code even if the
|
|
243
|
+
// containing package claims to have no side effects.
|
|
244
|
+
// Remove this when webpack adds a warning or an error for this.
|
|
245
|
+
// See https://github.com/webpack/webpack/issues/6571
|
|
246
|
+
sideEffects: true
|
|
247
|
+
},
|
|
248
|
+
// Adds support for CSS Modules, but using SASS
|
|
249
|
+
// using the extension .module.scss or .module.sass
|
|
250
|
+
{
|
|
251
|
+
test: sassModuleRegex,
|
|
252
|
+
use: getStyleLoaders(
|
|
253
|
+
{
|
|
254
|
+
importLoaders: 3,
|
|
255
|
+
sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
|
|
256
|
+
modules: {
|
|
257
|
+
getLocalIdent: getCSSModuleLocalIdent
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
'sass-loader'
|
|
261
|
+
)
|
|
262
|
+
},
|
|
263
|
+
// "file" loader makes sure those assets get served by WebpackDevServer.
|
|
264
|
+
// When you `import` an asset, you get its (virtual) filename.
|
|
265
|
+
// In production, they would get copied to the `build` folder.
|
|
266
|
+
// This loader doesn't use a "test" so it will catch all modules
|
|
267
|
+
// that fall through the other loaders.
|
|
268
|
+
{
|
|
269
|
+
loader: require.resolve('file-loader'),
|
|
270
|
+
// Exclude `js` files to keep "css" loader working as it injects
|
|
271
|
+
// its runtime that would otherwise be processed through "file" loader.
|
|
272
|
+
// Also exclude `html` and `json` extensions so they get processed
|
|
273
|
+
// by webpack's internal loaders.
|
|
274
|
+
exclude: [/\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/],
|
|
275
|
+
options: {
|
|
276
|
+
name: `${componentKey}/media/[name].[hash:8].[ext]`
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
// ** STOP ** Are you adding a new loader?
|
|
280
|
+
// Make sure to add the new loader(s) before the "file" loader.
|
|
281
|
+
]
|
|
282
|
+
}
|
|
283
|
+
]
|
|
284
|
+
},
|
|
285
|
+
plugins: [
|
|
286
|
+
// This gives some necessary context to module not found errors, such as
|
|
287
|
+
// the requesting resource.
|
|
288
|
+
new ModuleNotFoundPlugin(paths.appPath),
|
|
289
|
+
// Makes some environment variables available to the JS code, for example:
|
|
290
|
+
// if (process.env.NODE_ENV === 'production') { ... }. See `./env.js`.
|
|
291
|
+
// It is absolutely essential that NODE_ENV is set to production
|
|
292
|
+
// during a production build.
|
|
293
|
+
// Otherwise React will be compiled in the very slow development mode.
|
|
294
|
+
isEnvProduction &&
|
|
295
|
+
new webpack.DefinePlugin({
|
|
296
|
+
PRODUCTION: JSON.stringify(true)
|
|
297
|
+
}),
|
|
298
|
+
isEnvProduction &&
|
|
299
|
+
new MiniCssExtractPlugin({
|
|
300
|
+
// Options similar to the same options in webpackOptions.output
|
|
301
|
+
// both options are optional
|
|
302
|
+
filename: `${componentKey}/css/${componentKey}.[contenthash:8].css`,
|
|
303
|
+
chunkFilename: `${componentKey}/css/${componentKey}.[contenthash:8].chunk.css`
|
|
304
|
+
}),
|
|
305
|
+
// Moment.js is an extremely popular library that bundles large locale files
|
|
306
|
+
// by default due to how webpack interprets its code. This is a practical
|
|
307
|
+
// solution that requires the user to opt into importing specific locales.
|
|
308
|
+
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
|
|
309
|
+
// You can remove this if you don't use Moment.js:
|
|
310
|
+
new webpack.IgnorePlugin({
|
|
311
|
+
resourceRegExp: /^\.\/locale$/,
|
|
312
|
+
contextRegExp: /moment$/
|
|
313
|
+
}),
|
|
314
|
+
/* Ignore cosmos icons */
|
|
315
|
+
new webpack.IgnorePlugin({
|
|
316
|
+
resourceRegExp: /^\.\/icons$/,
|
|
317
|
+
contextRegExp: /@pega\/cosmos-react-core\/lib\/components\/Icon$/
|
|
318
|
+
}),
|
|
319
|
+
|
|
320
|
+
/* Ignore cosmos icons - windows */
|
|
321
|
+
new webpack.IgnorePlugin({
|
|
322
|
+
resourceRegExp: /^\.\/icons$/,
|
|
323
|
+
contextRegExp: /@pega\\cosmos-react-core\\lib\\components\\Icon$/
|
|
324
|
+
}),
|
|
325
|
+
|
|
326
|
+
new webpack.optimize.LimitChunkCountPlugin({
|
|
327
|
+
maxChunks: 1
|
|
328
|
+
}),
|
|
329
|
+
new webpack.optimize.MinChunkSizePlugin({
|
|
330
|
+
minChunkSize: 100000 // Minimum number of characters
|
|
331
|
+
}),
|
|
332
|
+
!devBuild && new CompressionPlugin(compressionBRConfObj)
|
|
333
|
+
|
|
334
|
+
/* Dont generate gzip file */
|
|
335
|
+
/* isEnvProduction && new CompressionPlugin(compressionGZConfObj) */
|
|
336
|
+
].filter(Boolean),
|
|
337
|
+
performance: {
|
|
338
|
+
hints: 'warning'
|
|
339
|
+
},
|
|
340
|
+
externals
|
|
341
|
+
};
|
|
342
|
+
};
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
import webpack from 'webpack';
|
|
4
|
+
import FileSizeReporter from 'react-dev-utils/FileSizeReporter.js';
|
|
5
|
+
import printBuildError from 'react-dev-utils/printBuildError.js';
|
|
6
|
+
|
|
7
|
+
import configFactory from './webpack.config.js';
|
|
8
|
+
import paths from './paths.js';
|
|
9
|
+
|
|
10
|
+
// Do this as the first thing so that any code reading it knows the right env.
|
|
11
|
+
let Env = 'production';
|
|
12
|
+
if (process.argv.includes('development')) {
|
|
13
|
+
Env = 'development';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (process.argv.includes('source-map')) {
|
|
17
|
+
process.env.SOURCE_MAP = true;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Do this as the first thing so that any code reading it knows the right env.
|
|
21
|
+
process.env.BABEL_ENV = Env;
|
|
22
|
+
process.env.NODE_ENV = Env;
|
|
23
|
+
|
|
24
|
+
// Makes the script crash on unhandled rejections instead of silently
|
|
25
|
+
// ignoring them. In the future, promise rejections that are not handled will
|
|
26
|
+
// terminate the Node.js process with a non-zero exit code.
|
|
27
|
+
process.on('unhandledRejection', err => {
|
|
28
|
+
console.log(err);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const measureFileSizesBeforeBuild = FileSizeReporter.measureFileSizesBeforeBuild;
|
|
33
|
+
const printFileSizesAfterBuild = FileSizeReporter.printFileSizesAfterBuild;
|
|
34
|
+
|
|
35
|
+
// These sizes are pretty large. We'll warn for bundles exceeding them.
|
|
36
|
+
const WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024;
|
|
37
|
+
const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024;
|
|
38
|
+
|
|
39
|
+
let compilationErrors = null;
|
|
40
|
+
|
|
41
|
+
// Create the build and print the deployment instructions.
|
|
42
|
+
function build(config, previousFileSizes) {
|
|
43
|
+
console.log(`Creating a ${Env} build...`);
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
const compiler = webpack(config);
|
|
48
|
+
return new Promise((resolve, reject) => {
|
|
49
|
+
compiler.run((err, stats) => {
|
|
50
|
+
|
|
51
|
+
if (err != null && typeof (err) == "object") {
|
|
52
|
+
if (err.error != undefined) {
|
|
53
|
+
//store and print elsewhere
|
|
54
|
+
compilationErrors = err.error;
|
|
55
|
+
//console.log("err:" + err);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (stats != null & typeof(stats) == "object") {
|
|
59
|
+
if (stats.errors != undefined) {
|
|
60
|
+
console.log("stats:" + stats);
|
|
61
|
+
}
|
|
62
|
+
else if (stats.compilation != undefined && stats.compilation.errors != undefined) {
|
|
63
|
+
|
|
64
|
+
//store and print elsewhere
|
|
65
|
+
compilationErrors = stats.compilation.errors;
|
|
66
|
+
|
|
67
|
+
console.log("stats:" + stats);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
let messages;
|
|
74
|
+
if (err) {
|
|
75
|
+
if (!err.message) {
|
|
76
|
+
return reject(err);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
let errMessage = err.message;
|
|
80
|
+
|
|
81
|
+
// Add additional information for postcss errors
|
|
82
|
+
if (Object.prototype.hasOwnProperty.call(err, 'postcssNode')) {
|
|
83
|
+
errMessage += `\nCompileError: Begins at CSS selector ${err.postcssNode.selector}`;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
messages = {
|
|
87
|
+
errors: [errMessage],
|
|
88
|
+
warnings: []
|
|
89
|
+
};
|
|
90
|
+
} else {
|
|
91
|
+
messages = stats.toJson({ all: false, warnings: true, errors: true });
|
|
92
|
+
}
|
|
93
|
+
if (messages.errors.length) {
|
|
94
|
+
// Only keep the first error. Others are often indicative
|
|
95
|
+
// of the same problem, but confuse the reader with noise.
|
|
96
|
+
if (messages.errors.length > 1) {
|
|
97
|
+
messages.errors.length = 1;
|
|
98
|
+
}
|
|
99
|
+
return reject(new Error(messages.errors));
|
|
100
|
+
}
|
|
101
|
+
if (
|
|
102
|
+
process.env.CI &&
|
|
103
|
+
(typeof process.env.CI !== 'string' || process.env.CI.toLowerCase() !== 'false') &&
|
|
104
|
+
messages.warnings.length
|
|
105
|
+
) {
|
|
106
|
+
console.log(
|
|
107
|
+
chalk.yellow(
|
|
108
|
+
'\nTreating warnings as errors because process.env.CI = true.\n' +
|
|
109
|
+
'Most CI servers set it automatically.\n'
|
|
110
|
+
)
|
|
111
|
+
);
|
|
112
|
+
return reject(new Error(messages.warnings.join('\n\n')));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const resolveArgs = {
|
|
116
|
+
stats,
|
|
117
|
+
previousFileSizes,
|
|
118
|
+
warnings: messages.warnings
|
|
119
|
+
};
|
|
120
|
+
return resolve(resolveArgs);
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export default ({
|
|
126
|
+
inputFile,
|
|
127
|
+
outputFile,
|
|
128
|
+
componentKey,
|
|
129
|
+
externals,
|
|
130
|
+
globals,
|
|
131
|
+
sourceMap,
|
|
132
|
+
devBuild
|
|
133
|
+
}) => {
|
|
134
|
+
// Generate configuration
|
|
135
|
+
const config = configFactory(Env, {
|
|
136
|
+
inputFile,
|
|
137
|
+
outputFile,
|
|
138
|
+
componentKey,
|
|
139
|
+
externals,
|
|
140
|
+
globals,
|
|
141
|
+
sourceMap,
|
|
142
|
+
devBuild
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
if (devBuild) {
|
|
146
|
+
Env = 'development';
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return new Promise((resolve, reject) => {
|
|
150
|
+
measureFileSizesBeforeBuild(paths.appBuild)
|
|
151
|
+
.then(previousFileSizes => {
|
|
152
|
+
// Remove all content but keep the directory so that
|
|
153
|
+
// if you're in it, you don't end up in Trash
|
|
154
|
+
fs.emptyDirSync(paths.appBuild);
|
|
155
|
+
// Start the webpack build
|
|
156
|
+
return build(config, previousFileSizes);
|
|
157
|
+
})
|
|
158
|
+
.then(
|
|
159
|
+
({ stats, previousFileSizes, warnings }) => {
|
|
160
|
+
if (warnings.length) {
|
|
161
|
+
//console.log(chalk.yellow('Compiled with warnings.\n'), warnings[0].message);
|
|
162
|
+
console.log(chalk.yellow('Compiled with warnings.\n'));
|
|
163
|
+
for (let warning in warnings) {
|
|
164
|
+
console.log(chalk.yellow("Warning.."), warnings[warning].message);
|
|
165
|
+
}
|
|
166
|
+
} else {
|
|
167
|
+
console.log(chalk.green('Compiled successfully.\n'));
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
console.log('File sizes after gzip:\n');
|
|
171
|
+
printFileSizesAfterBuild(
|
|
172
|
+
stats,
|
|
173
|
+
previousFileSizes,
|
|
174
|
+
paths.appBuild,
|
|
175
|
+
WARN_AFTER_BUNDLE_GZIP_SIZE,
|
|
176
|
+
WARN_AFTER_CHUNK_GZIP_SIZE
|
|
177
|
+
);
|
|
178
|
+
resolve('done emitting');
|
|
179
|
+
},
|
|
180
|
+
err => {
|
|
181
|
+
reject();
|
|
182
|
+
const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === 'true';
|
|
183
|
+
if (tscCompileOnError) {
|
|
184
|
+
console.log(
|
|
185
|
+
chalk.yellow(
|
|
186
|
+
'Compiled with the following type errors (you may want to check these before deploying your app):\n'
|
|
187
|
+
)
|
|
188
|
+
);
|
|
189
|
+
printBuildError(err);
|
|
190
|
+
}
|
|
191
|
+
else if (compilationErrors != null) {
|
|
192
|
+
if (compilationErrors.length == undefined) {
|
|
193
|
+
console.log(chalk.red("Error..."), compilationErrors.message);
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
for (let error in compilationErrors) {
|
|
197
|
+
console.log(chalk.red("Error..."), compilationErrors[error].message);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
process.exit(1);
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
console.log(chalk.red('Failed to compile.\n'));
|
|
205
|
+
printBuildError(JSON.stringify(err));
|
|
206
|
+
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
)
|
|
210
|
+
.catch(err => {
|
|
211
|
+
reject();
|
|
212
|
+
if (err && err.message) {
|
|
213
|
+
console.log(err.message);
|
|
214
|
+
}
|
|
215
|
+
process.exit(1);
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
};
|
|
@@ -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();
|