@pega/custom-dx-components 2.0.15 → 2.0.16
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 +2 -2
- package/src/cli.js +0 -18
- package/src/tasks/authenticate/index.js +1 -3
- package/src/tasks/create/index.js +3 -6
- package/src/tasks/create/templates/Constellation/Field/Boolean/boolean-format.js.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Boolean/demo.stories.jsx.mustache +18 -29
- package/src/tasks/create/templates/Constellation/Field/Boolean/index.jsx.mustache +2 -1
- package/src/tasks/create/templates/Constellation/Field/Date/date.js.mustache +67 -179
- package/src/tasks/create/templates/Constellation/Field/Date/demo.stories.jsx.mustache +16 -40
- package/src/tasks/create/templates/Constellation/Field/Date/index.jsx.mustache +1 -3
- package/src/tasks/create/templates/Constellation/Field/DateTime/date-time.js.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/{date-utils.js.mustache → date-utils.js} +0 -1
- package/src/tasks/create/templates/Constellation/Field/DateTime/date.js.mustache +0 -1
- package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.jsx.mustache +15 -40
- package/src/tasks/create/templates/Constellation/Field/DateTime/index.jsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Decimal/demo.stories.jsx.mustache +17 -22
- package/src/tasks/create/templates/Constellation/Field/Decimal/index.jsx.mustache +1 -2
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.jsx.mustache +17 -25
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/index.jsx.mustache +4 -3
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.jsx.mustache +17 -22
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/index.jsx.mustache +2 -8
- package/src/tasks/create/templates/Constellation/Field/Integer/demo.stories.jsx.mustache +17 -22
- package/src/tasks/create/templates/Constellation/Field/Integer/index.jsx.mustache +1 -2
- package/src/tasks/create/templates/Constellation/Field/Picklist/demo.stories.jsx.mustache +14 -42
- package/src/tasks/create/templates/Constellation/Field/Picklist/index.jsx.mustache +1 -44
- package/src/tasks/create/templates/Constellation/Field/Picklist/picklist.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Field/Text/demo.stories.jsx.mustache +16 -21
- package/src/tasks/create/templates/Constellation/Field/Text-Email/demo.stories.jsx.mustache +16 -20
- package/src/tasks/create/templates/Constellation/Field/Text-Email/index.jsx.mustache +2 -44
- package/src/tasks/create/templates/Constellation/Field/Text-Email/text-email.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/{Template/DETAILS/StatusWork.jsx.mustache → Field/Text-Input/StatusWork.js} +1 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/demo.stories.jsx.mustache +17 -21
- package/src/tasks/create/templates/Constellation/Field/Text-Input/index.jsx.mustache +3 -46
- package/src/tasks/create/templates/Constellation/Field/Text-Input/text-input.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/demo.stories.jsx.mustache +17 -21
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/index.jsx.mustache +2 -44
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/text-paragraph.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/demo.stories.jsx.mustache +17 -19
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/index.jsx.mustache +2 -46
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/text-phone.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/demo.stories.jsx.mustache +17 -19
- package/src/tasks/create/templates/Constellation/Field/Text-URL/index.jsx.mustache +3 -174
- package/src/tasks/create/templates/Constellation/Field/Text-URL/text-url.js.mustache +172 -0
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/demo.stories.jsx.mustache +16 -24
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/time-of-day.js.mustache +0 -1
- package/src/tasks/create/templates/Constellation/Template/DETAILS/index.jsx.mustache +29 -14
- package/src/tasks/create/templates/Constellation/Template/DETAILS/utils.js.mustache +77 -3
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.jsx.mustache +29 -14
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/utils.js.mustache +74 -3
- package/src/tasks/create/templates/Constellation/Template/FORM/index.jsx.mustache +10 -6
- package/src/tasks/create/templates/Constellation/Template/FORM-region/index.jsx.mustache +8 -10
- package/src/tasks/create/templates/Constellation/Template/PAGE/{GetNextWork.jsx.mustache → GetNextWork.js.mustache} +0 -6
- package/src/tasks/create/templates/Constellation/Template/PAGE/index.jsx.mustache +7 -9
- package/src/tasks/create/templates/Constellation/Template/PAGE/utils.js.mustache +1 -4
- package/src/tasks/create/templates/Constellation/Widget/CASE/index.jsx.mustache +0 -1
- package/src/tasks/create/templates/Constellation/Widget/PAGE/index.jsx.mustache +8 -8
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/{Avatar.jsx.mustache → Avatar.js.mustache} +0 -2
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/{Operator.jsx.mustache → Operator.js.mustache} +1 -2
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/index.jsx.mustache +9 -9
- package/src/tasks/delete/helper.js +0 -4
- package/src/tasks/delete/index.js +0 -4
- package/src/tasks/index.js +0 -3
- package/src/tasks/init/index.js +1 -1
- package/src/tasks/init/template/.eslintrc.json +5 -186
- package/src/tasks/init/template/package.json.mustache +4 -19
- package/src/tasks/init/template/tasks.config.json +0 -1
- package/src/tasks/list/index.js +0 -4
- package/src/tasks/{bundle → publish/bundle}/builder/index.js +0 -0
- package/src/tasks/{bundle → publish/bundle}/builder/modules.js +0 -0
- package/src/tasks/{bundle → publish/bundle}/builder/paths.js +0 -0
- package/src/tasks/{bundle → publish/bundle}/builder/webpack.config.js +2 -0
- package/src/tasks/{bundle → publish/bundle}/index.js +2 -2
- package/src/tasks/publish/index.js +1 -14
- package/src/util.js +0 -10
- package/src/tasks/build/helper.js +0 -123
- package/src/tasks/build/index.js +0 -54
- package/src/tasks/create/templates/Constellation/Field/Boolean/mock.stories.js.mustache +0 -21
- package/src/tasks/create/templates/Constellation/Field/Date/DateFormatter.js.mustache +0 -61
- package/src/tasks/create/templates/Constellation/Field/Date/FormattedText.jsx.mustache +0 -41
- package/src/tasks/create/templates/Constellation/Field/Date/mock.stories.js.mustache +0 -23
- package/src/tasks/create/templates/Constellation/Field/DateTime/mock.stories.js.mustache +0 -23
- package/src/tasks/create/templates/Constellation/Field/Decimal/mock.stories.js.mustache +0 -21
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/mock.stories.js.mustache +0 -23
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/mock.stories.js.mustache +0 -21
- package/src/tasks/create/templates/Constellation/Field/Integer/mock.stories.js.mustache +0 -21
- package/src/tasks/create/templates/Constellation/Field/Picklist/mock.stories.js.mustache +0 -67
- package/src/tasks/create/templates/Constellation/Field/Text/mock.stories.js.mustache +0 -13
- package/src/tasks/create/templates/Constellation/Field/Text-Email/mock.stories.js.mustache +0 -22
- package/src/tasks/create/templates/Constellation/Field/Text-Input/StatusWork.jsx +0 -26
- package/src/tasks/create/templates/Constellation/Field/Text-Input/mock.stories.js.mustache +0 -21
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/mock.stories.js.mustache +0 -20
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/mock.stories.js.mustache +0 -37
- package/src/tasks/create/templates/Constellation/Field/Text-URL/mock.stories.js.mustache +0 -22
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/mock.stories.js.mustache +0 -20
- package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.jsx.mustache +0 -110
- package/src/tasks/create/templates/Constellation/Template/DETAILS/mock.stories.js.mustache +0 -179
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/StatusWork.jsx.mustache +0 -26
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.jsx.mustache +0 -118
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/mock.stories.js.mustache +0 -215
- package/src/tasks/create/templates/Constellation/Template/FORM/demo.stories.jsx.mustache +0 -89
- package/src/tasks/create/templates/Constellation/Template/FORM/mock.stories.js.mustache +0 -125
- package/src/tasks/create/templates/Constellation/Template/FORM-region/demo.stories.jsx.mustache +0 -100
- package/src/tasks/create/templates/Constellation/Template/FORM-region/mock.stories.js.mustache +0 -131
- package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.jsx.mustache +0 -102
- package/src/tasks/create/templates/Constellation/Template/PAGE/mock.stories.js.mustache +0 -94
- package/src/tasks/create/templates/Constellation/Widget/CASE/demo.stories.jsx.mustache +0 -78
- package/src/tasks/create/templates/Constellation/Widget/CASE/mock.stories.js.mustache +0 -389
- package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.jsx.mustache +0 -30
- package/src/tasks/create/templates/Constellation/Widget/PAGE/mock.stories.js.mustache +0 -22
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/demo.stories.jsx.mustache +0 -68
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/mock.stories.js.mustache +0 -51
- package/src/tasks/delete-all/helper.js +0 -175
- package/src/tasks/delete-all/index.js +0 -49
- package/src/tasks/init/template/.eslintignore +0 -8
- package/src/tasks/linter/index.js +0 -46
- package/src/tasks/publish-all/helper.js +0 -139
- package/src/tasks/publish-all/index.js +0 -84
|
@@ -1,191 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"root": true,
|
|
3
2
|
"extends": ["@pega"],
|
|
4
|
-
"parserOptions": {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
},
|
|
8
|
-
"settings": {
|
|
9
|
-
"import/resolver": {
|
|
10
|
-
"typescript": {},
|
|
11
|
-
"node": {
|
|
12
|
-
"extensions": [".js", ".jsx"]
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"react": {
|
|
16
|
-
"version": "detect"
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
"ignorePatterns": ["node_modules", "packages/*/lib", "!.storybook", ".storybook/public"],
|
|
3
|
+
"parserOptions": { "project": "tsconfig.json" },
|
|
4
|
+
"root": true,
|
|
5
|
+
"ignorePatterns": ["node_modules", "lib", "!.storybook", ".storybook/public"],
|
|
20
6
|
"rules": {
|
|
21
|
-
// Prettier recommends running separately from a linter.
|
|
22
|
-
// https://prettier.io/docs/en/integrating-with-linters.html#notes
|
|
23
7
|
"prettier/prettier": "off",
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"sonarjs/cognitive-complexity": "off",
|
|
27
|
-
"sonarjs/no-identical-functions": "off",
|
|
28
|
-
"sonarjs/no-duplicate-string": "off",
|
|
29
|
-
"sonarjs/no-nested-template-literals": "off",
|
|
30
|
-
|
|
31
|
-
//
|
|
32
|
-
// JA - Override some default lint handling here
|
|
33
|
-
"@typescript-eslint/array-type": ["error", { "default": "generic" }],
|
|
34
|
-
// "import/extensions": ["warn", "never"], // Turning off for now (see below)
|
|
35
|
-
|
|
36
|
-
//
|
|
37
|
-
// Initial release: turning these off; phase in to "warn" or "error" over time
|
|
38
|
-
// For "quotes" and "@typescript-eslint/quotes", see override below for .ts/.tsx files
|
|
39
|
-
"import/extensions": ["off", "never"],
|
|
40
|
-
"import/named": "off",
|
|
41
|
-
"import/no-cycle": "off",
|
|
42
|
-
"import/no-duplicates": "off",
|
|
43
|
-
"import/no-extraneous-dependencies": "off",
|
|
44
|
-
"import/no-named-as-default": "off",
|
|
45
|
-
"import/no-named-as-default-member": "off",
|
|
46
|
-
"import/no-self-import": "off",
|
|
47
|
-
"import/no-unresolved": "off",
|
|
48
|
-
"import/no-useless-path-segments": "off",
|
|
49
|
-
"import/order": "off",
|
|
50
|
-
|
|
51
|
-
"no-else-return": "off",
|
|
52
|
-
"no-restricted-syntax": "off",
|
|
53
|
-
"no-underscore-dangle": "off",
|
|
54
|
-
|
|
55
|
-
"jsx-a11y/alt-text": "off",
|
|
56
|
-
"jsx-a11y/anchor-is-valid": "off",
|
|
57
|
-
"jsx-a11y/click-events-have-key-events": "off",
|
|
58
|
-
"jsx-a11y/label-has-associated-control": "off",
|
|
59
|
-
"jsx-a11y/no-static-element-interactions": "off",
|
|
60
|
-
|
|
61
|
-
"react/jsx-fragments": "off",
|
|
62
|
-
"react/jsx-no-bind": "off",
|
|
63
|
-
"react/self-closing-comp": "off",
|
|
64
|
-
|
|
65
|
-
"sonarjs/prefer-immediate-return": "off",
|
|
66
|
-
|
|
67
|
-
"@typescript-eslint/dot-notation": "off", // prefer warn but needs different parserOptions
|
|
68
|
-
"@typescript-eslint/naming-convention": "off", // prefer warn but needs different parserOptions
|
|
69
|
-
"@typescript-eslint/ban-types": "off", // also, see override below
|
|
70
|
-
|
|
71
|
-
//
|
|
72
|
-
// Initial release: set to error
|
|
73
|
-
"@typescript-eslint/no-inferrable-types": "error",
|
|
74
|
-
"eqeqeq": "error",
|
|
75
|
-
"no-alert": "error",
|
|
76
|
-
"no-console": "error",
|
|
77
|
-
"no-fallthrough": "error",
|
|
78
|
-
"no-undef": "error",
|
|
79
|
-
"no-unused-vars": "error",
|
|
80
|
-
"no-var": "error",
|
|
81
|
-
"prefer-const": "error",
|
|
82
|
-
"yoda": "error",
|
|
83
|
-
|
|
84
|
-
"import/no-mutable-exports": "error",
|
|
85
|
-
"sonarjs/max-switch-cases": "error",
|
|
86
|
-
"sonarjs/no-collapsible-if": "error",
|
|
87
|
-
"sonarjs/no-all-duplicated-branches": "error",
|
|
88
|
-
"sonarjs/no-duplicated-branches": "error",
|
|
89
|
-
"sonarjs/no-gratuitous-expressions": "error",
|
|
90
|
-
"sonarjs/no-ignored-return": "error",
|
|
91
|
-
"sonarjs/no-small-switch": "error",
|
|
92
|
-
"sonarjs/prefer-object-literal": "error",
|
|
93
|
-
"sonarjs/prefer-single-boolean-return": "error",
|
|
94
|
-
"@typescript-eslint/no-shadow": "error",
|
|
95
|
-
"react/default-props-match-prop-types": "error",
|
|
96
|
-
"react/no-unescaped-entities": "error",
|
|
97
|
-
"react/no-unused-prop-types": "error",
|
|
98
|
-
"react/static-property-placement": "error",
|
|
99
|
-
"array-callback-return": "error",
|
|
100
|
-
"camelcase": "error",
|
|
101
|
-
"default-case": "error",
|
|
102
|
-
"func-names": "error",
|
|
103
|
-
"no-case-declarations": "error",
|
|
104
|
-
"no-lonely-if": "error",
|
|
105
|
-
"no-nested-ternary": "error",
|
|
106
|
-
"no-plusplus": "error",
|
|
107
|
-
"no-restricted-globals": "error",
|
|
108
|
-
"no-restricted-properties": "error",
|
|
109
|
-
"no-shadow": "error",
|
|
110
|
-
"radix": "error",
|
|
111
|
-
"spaced-comment": "error",
|
|
112
|
-
|
|
113
|
-
"import/newline-after-import": "error",
|
|
114
|
-
"sonarjs/no-nested-switch": "error",
|
|
115
|
-
"@typescript-eslint/no-array-constructor": "error",
|
|
116
|
-
"@typescript-eslint/no-empty-function": "error",
|
|
117
|
-
"@typescript-eslint/no-unused-vars": "error",
|
|
118
|
-
"@typescript-eslint/no-useless-constructor": "error",
|
|
119
|
-
"react/button-has-type": "error",
|
|
120
|
-
"react/jsx-curly-brace-presence": "error",
|
|
121
|
-
"react/jsx-boolean-value": "error",
|
|
122
|
-
"react/no-array-index-key": "error",
|
|
123
|
-
"class-methods-use-this": "error",
|
|
124
|
-
"guard-for-in": "error",
|
|
125
|
-
"no-unneeded-ternary": "error",
|
|
126
|
-
"no-unused-expressions": "error",
|
|
127
|
-
"operator-assignment": "error",
|
|
128
|
-
"prefer-template": "error",
|
|
129
|
-
"vars-on-top": "error",
|
|
130
|
-
|
|
131
|
-
"no-use-before-define": "off", // doc for @typescript-eslint/no-use-before-define says to turn off the base implementation
|
|
132
|
-
"@typescript-eslint/no-use-before-define": "error"
|
|
133
|
-
},
|
|
134
|
-
"overrides": [
|
|
135
|
-
{
|
|
136
|
-
"files": "*.@(ts|tsx)",
|
|
137
|
-
"rules": {
|
|
138
|
-
"@typescript-eslint/method-signature-style": ["error", "property"],
|
|
139
|
-
// "@typescript-eslint/ban-types": [
|
|
140
|
-
// "warn",
|
|
141
|
-
// {
|
|
142
|
-
// "types": {
|
|
143
|
-
// "Omit": "Please use the 'OmitStrict' type from 'src/types/' instead.",
|
|
144
|
-
// "object": false,
|
|
145
|
-
// "Function": false
|
|
146
|
-
// },
|
|
147
|
-
// "extendDefaults": true
|
|
148
|
-
// }
|
|
149
|
-
// ],
|
|
150
|
-
|
|
151
|
-
"quotes": "off",
|
|
152
|
-
"@typescript-eslint/quotes": "off"
|
|
153
|
-
// [
|
|
154
|
-
// "error",
|
|
155
|
-
// "single",
|
|
156
|
-
// {
|
|
157
|
-
// "avoidEscape": true,
|
|
158
|
-
// "allowTemplateLiterals": false
|
|
159
|
-
// }
|
|
160
|
-
// ]
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
"files": "*.@(jsx|tsx|mdx)",
|
|
165
|
-
"rules": {
|
|
166
|
-
"react/react-in-jsx-scope": "off",
|
|
167
|
-
// Set up configuration for future sweep
|
|
168
|
-
"react-hooks/exhaustive-deps": [
|
|
169
|
-
"off",
|
|
170
|
-
{
|
|
171
|
-
"additionalHooks": "useAfterInitialEffect"
|
|
172
|
-
}
|
|
173
|
-
]
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
"files": "*.@(js|jsx|ts|tsx|mdx)",
|
|
178
|
-
"rules": {}
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
"files": ".storybook/*.js",
|
|
182
|
-
"extends": ["@pega/eslint-config/script"]
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
"files": "*/**/mocks/**.@(mocks|styles).@(tsx|ts)",
|
|
186
|
-
"rules": {
|
|
187
|
-
"import/prefer-default-export": ["off"]
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
]
|
|
8
|
+
"react/react-in-jsx-scope": "off"
|
|
9
|
+
}
|
|
191
10
|
}
|
|
@@ -10,15 +10,12 @@
|
|
|
10
10
|
"lint": "run-p -cl lint:*",
|
|
11
11
|
"fix": "run-p -cl fix:*",
|
|
12
12
|
"authenticate": "custom-dx-components authenticate",
|
|
13
|
-
"buildComponent": "custom-dx-components buildComponent",
|
|
14
13
|
"create": "custom-dx-components create",
|
|
15
14
|
"publish": "custom-dx-components publish",
|
|
16
|
-
"publishAll": "custom-dx-components publishAll",
|
|
17
15
|
"list": "custom-dx-components list",
|
|
18
16
|
"validate-schema": "custom-dx-components validateSchema",
|
|
19
17
|
"update": "custom-dx-components update",
|
|
20
18
|
"delete": "custom-dx-components delete",
|
|
21
|
-
"deleteAll": "custom-dx-components deleteAll",
|
|
22
19
|
"lint:types": "tsc --noEmit",
|
|
23
20
|
"lint:es": "eslint .",
|
|
24
21
|
"lint:styles": "stylelint \"./**/*.@(js|jsx|ts|tsx)\"",
|
|
@@ -38,8 +35,8 @@
|
|
|
38
35
|
"license": "Enter License",
|
|
39
36
|
"sideEffects": false,
|
|
40
37
|
"dependencies": {
|
|
41
|
-
"@pega/cosmos-react-core": "^3.0.
|
|
42
|
-
"@pega/cosmos-react-work": "3.0.
|
|
38
|
+
"@pega/cosmos-react-core": "^3.0.0-rc.4",
|
|
39
|
+
"@pega/cosmos-react-work": "3.0.0-rc.4",
|
|
43
40
|
"@storybook/addon-knobs": "^6.3.1",
|
|
44
41
|
"dayjs": "^1.11.5",
|
|
45
42
|
"jest": "^29.3.1",
|
|
@@ -55,8 +52,7 @@
|
|
|
55
52
|
},
|
|
56
53
|
"devDependencies": {
|
|
57
54
|
"@pega/configs": "^0.3.4",
|
|
58
|
-
"@pega/custom-dx-components": "^2.0.
|
|
59
|
-
"@pega/eslint-config": "^0.3.2",
|
|
55
|
+
"@pega/custom-dx-components": "^2.0.16",
|
|
60
56
|
"@storybook/addon-actions": "^6.5.12",
|
|
61
57
|
"@storybook/addon-essentials": "^6.5.12",
|
|
62
58
|
"@storybook/addon-links": "^6.5.12",
|
|
@@ -69,18 +65,7 @@
|
|
|
69
65
|
"@types/react-color": "^3.0.6",
|
|
70
66
|
"@types/react-dom": "^17.0.11",
|
|
71
67
|
"@types/styled-components": "^5.1.26",
|
|
72
|
-
"
|
|
73
|
-
"eslint": "^8.4.1",
|
|
74
|
-
"eslint-plugin-import": "^2.25.3",
|
|
75
|
-
"eslint-plugin-jest": "^25.3.0",
|
|
76
|
-
"eslint-plugin-jsx-a11y": "^6.5.1",
|
|
77
|
-
"eslint-plugin-mdx": "^2.0.5",
|
|
78
|
-
"eslint-plugin-prettier": "^4.0.0",
|
|
79
|
-
"eslint-plugin-react": "^7.27.1",
|
|
80
|
-
"eslint-plugin-react-hooks": "^4.3.0",
|
|
81
|
-
"eslint-plugin-sonarjs": "^0.11.0",
|
|
82
|
-
"jest": "^29.3.1",
|
|
83
|
-
"jest-environment-jsdom": "^29.3.1",
|
|
68
|
+
"eslint": "^8.23.1",
|
|
84
69
|
"npm-run-all": "^4.1.5",
|
|
85
70
|
"prettier": "2.7.1",
|
|
86
71
|
"stylelint": "^14.11.0",
|
package/src/tasks/list/index.js
CHANGED
|
@@ -10,8 +10,6 @@ import {
|
|
|
10
10
|
getListComponentsQuestions
|
|
11
11
|
} from './helper.js';
|
|
12
12
|
|
|
13
|
-
import { showVersion } from '../../util.js';
|
|
14
|
-
|
|
15
13
|
const getList = async (sourceOfComponents, answers) => {
|
|
16
14
|
switch (sourceOfComponents) {
|
|
17
15
|
case SOURCE_OF_COMPONENT_TYPES.LOCAL: {
|
|
@@ -34,8 +32,6 @@ const getList = async (sourceOfComponents, answers) => {
|
|
|
34
32
|
};
|
|
35
33
|
|
|
36
34
|
export default async options => {
|
|
37
|
-
showVersion();
|
|
38
|
-
|
|
39
35
|
let sourceOfComponentsOption = SOURCE_OF_COMPONENT_TYPES.LOCAL;
|
|
40
36
|
|
|
41
37
|
if (options.params[3] === SOURCE_OF_COMPONENT_TYPES.LOCAL) {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -306,12 +306,14 @@ export default (
|
|
|
306
306
|
contextRegExp: /moment$/
|
|
307
307
|
}),
|
|
308
308
|
/* Ignore cosmos icons */
|
|
309
|
+
|
|
309
310
|
new webpack.IgnorePlugin({
|
|
310
311
|
resourceRegExp: /^\.\/icons$/,
|
|
311
312
|
contextRegExp: /@pega\/cosmos-react-core\/lib\/components\/Icon$/
|
|
312
313
|
}),
|
|
313
314
|
|
|
314
315
|
/* Ignore cosmos icons - windows */
|
|
316
|
+
|
|
315
317
|
new webpack.IgnorePlugin({
|
|
316
318
|
resourceRegExp: /^\.\/icons$/,
|
|
317
319
|
contextRegExp: /@pega\\cosmos-react-core\\lib\\components\\Icon$/
|
|
@@ -2,8 +2,8 @@ import path from 'path';
|
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import { stat } from 'fs/promises';
|
|
4
4
|
|
|
5
|
-
import { BUILD_CONFIG_JSON_FILENAME } from '
|
|
6
|
-
import { getComponentDirectoryPath } from '
|
|
5
|
+
import { BUILD_CONFIG_JSON_FILENAME } from '../../../constants.js';
|
|
6
|
+
import { getComponentDirectoryPath } from '../../../util.js';
|
|
7
7
|
|
|
8
8
|
import buildComponent from './builder/index.js';
|
|
9
9
|
|
|
@@ -4,15 +4,10 @@ import chalk from 'chalk';
|
|
|
4
4
|
|
|
5
5
|
import validate from '../validator/index.js';
|
|
6
6
|
|
|
7
|
-
import bundleComponent from '
|
|
8
|
-
import { lintComponent } from '../linter/index.js';
|
|
9
|
-
|
|
10
|
-
import { getComponentDirectoryPath, showVersion } from '../../util.js';
|
|
7
|
+
import bundleComponent from './bundle/index.js';
|
|
11
8
|
import { getPublishComponentQuestions, publishComponentToServer, zipComponent } from './helper.js';
|
|
12
9
|
|
|
13
10
|
export default async options => {
|
|
14
|
-
showVersion();
|
|
15
|
-
|
|
16
11
|
const questions = await getPublishComponentQuestions();
|
|
17
12
|
const answers = await inquirer.prompt(questions);
|
|
18
13
|
const { componentKey, sourceMap, devBuild } = answers;
|
|
@@ -29,14 +24,6 @@ export default async options => {
|
|
|
29
24
|
await validate(componentKey);
|
|
30
25
|
}
|
|
31
26
|
},
|
|
32
|
-
{
|
|
33
|
-
title: 'Lint component',
|
|
34
|
-
task: async () => {
|
|
35
|
-
const targetDirectory = await getComponentDirectoryPath(componentKey);
|
|
36
|
-
// console.log(`in buildComponent Lint component task: componentKey: ${componentKey} targetDirectory: ${targetDirectory}`);
|
|
37
|
-
await lintComponent(targetDirectory);
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
27
|
{
|
|
41
28
|
title: 'Bundle Component',
|
|
42
29
|
task: async () => await bundleComponent(componentKey, sourceMap, devBuild),
|
package/src/util.js
CHANGED
|
@@ -7,8 +7,6 @@ import chalk from 'chalk';
|
|
|
7
7
|
import mustache from 'mustache';
|
|
8
8
|
import pascalCase from 'pascalcase';
|
|
9
9
|
import fetch from 'node-fetch';
|
|
10
|
-
import { createRequire } from 'module';
|
|
11
|
-
|
|
12
10
|
|
|
13
11
|
import {
|
|
14
12
|
COMPONENTS_DIRECTORY_PATH,
|
|
@@ -220,14 +218,6 @@ export const validateRulesetVersion = str => {
|
|
|
220
218
|
return regex.test(str);
|
|
221
219
|
};
|
|
222
220
|
|
|
223
|
-
export const showVersion = () => {
|
|
224
|
-
// get package version, so can display at start
|
|
225
|
-
const require = createRequire(import.meta.url);
|
|
226
|
-
const pData = require("@pega/custom-dx-components/package.json");
|
|
227
|
-
|
|
228
|
-
console.log(chalk.green("DX Component Builder v" + pData.version));
|
|
229
|
-
}
|
|
230
|
-
|
|
231
221
|
export const getOOTBComponents = async () => {
|
|
232
222
|
return new Promise((resolve, reject) => {
|
|
233
223
|
fs.readFile(OOTB_COMPONENTS, 'utf-8', async (err, data) => {
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import https from 'https';
|
|
4
|
-
|
|
5
|
-
import fetch from 'node-fetch';
|
|
6
|
-
import AdmZip from 'adm-zip';
|
|
7
|
-
import chalk from 'chalk';
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
constructCompleteUrl,
|
|
11
|
-
getComponentDirectoryPath,
|
|
12
|
-
getComponents,
|
|
13
|
-
getPegaServerConfig,
|
|
14
|
-
validateRulesetVersion
|
|
15
|
-
} from '../../util.js';
|
|
16
|
-
import { PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT, TOKEN_PATH } from '../../constants.js';
|
|
17
|
-
|
|
18
|
-
export const getPublishComponentQuestions = async () => {
|
|
19
|
-
const components = await getComponents();
|
|
20
|
-
const defaultPegaConfig = await getPegaServerConfig();
|
|
21
|
-
|
|
22
|
-
return [
|
|
23
|
-
{
|
|
24
|
-
name: 'componentKey',
|
|
25
|
-
type: 'rawlist',
|
|
26
|
-
message: 'Select component to build',
|
|
27
|
-
choices: components
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: 'sourceMap',
|
|
31
|
-
message: 'Generate source map ?',
|
|
32
|
-
default: defaultPegaConfig.sourceMap,
|
|
33
|
-
when: () => false && !process.env.SOURCE_MAP
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
name: 'devBuild',
|
|
37
|
-
message: 'Generate development build ?',
|
|
38
|
-
default: defaultPegaConfig.devBuild
|
|
39
|
-
}
|
|
40
|
-
];
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const zipComponent = async componentKey => {
|
|
44
|
-
const srcDirectory = await getComponentDirectoryPath(componentKey);
|
|
45
|
-
const buildDirectory = await path.join(path.resolve(), 'dist/components', componentKey);
|
|
46
|
-
const configJson = `${srcDirectory}/config.json`;
|
|
47
|
-
|
|
48
|
-
const zip = new AdmZip();
|
|
49
|
-
|
|
50
|
-
zip.addLocalFolder(srcDirectory, 'src/');
|
|
51
|
-
zip.addLocalFile(configJson);
|
|
52
|
-
zip.addLocalFolder(buildDirectory);
|
|
53
|
-
const zipContent = zip.toBuffer().toString('base64');
|
|
54
|
-
|
|
55
|
-
const configContent = Buffer.from(fs.readFileSync(`${srcDirectory}/config.json`)).toString();
|
|
56
|
-
fs.rmdir('dist', { recursive: true }, err => {
|
|
57
|
-
if (err) {
|
|
58
|
-
throw err;
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
return { zipContent, configContent };
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export const publishComponentToServer = async data => {
|
|
65
|
-
const { configContent, zipContent, componentKey, rulesetName, rulesetVersion } = data;
|
|
66
|
-
|
|
67
|
-
const apiBody = {
|
|
68
|
-
configContent,
|
|
69
|
-
zipContent,
|
|
70
|
-
componentKey: JSON.parse(configContent).componentKey,
|
|
71
|
-
publishFor: 'constellation',
|
|
72
|
-
rulesetName,
|
|
73
|
-
rulesetVersion,
|
|
74
|
-
category: ''
|
|
75
|
-
};
|
|
76
|
-
const defaultPegaConfig = await getPegaServerConfig();
|
|
77
|
-
const url = constructCompleteUrl(
|
|
78
|
-
defaultPegaConfig.server,
|
|
79
|
-
PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT
|
|
80
|
-
);
|
|
81
|
-
try {
|
|
82
|
-
const OauthData = fs.readFileSync(TOKEN_PATH, 'utf8');
|
|
83
|
-
if (OauthData) {
|
|
84
|
-
const {
|
|
85
|
-
access_token: accessToken,
|
|
86
|
-
token_type: tokenType,
|
|
87
|
-
refresh_token: refreshToken
|
|
88
|
-
} = JSON.parse(OauthData);
|
|
89
|
-
let status = 500;
|
|
90
|
-
fetch(url, {
|
|
91
|
-
method: 'POST',
|
|
92
|
-
agent: new https.Agent({ rejectUnauthorized: false }),
|
|
93
|
-
headers: {
|
|
94
|
-
Authorization: `${tokenType} ${accessToken}`
|
|
95
|
-
},
|
|
96
|
-
body: JSON.stringify(apiBody)
|
|
97
|
-
})
|
|
98
|
-
.then(response => {
|
|
99
|
-
status = response.status;
|
|
100
|
-
return response.text();
|
|
101
|
-
})
|
|
102
|
-
.then(resp => {
|
|
103
|
-
const respData = JSON.parse(resp);
|
|
104
|
-
if (status === 401) {
|
|
105
|
-
throw new Error(
|
|
106
|
-
'Error occured in authentication. Please regenerate using authenticate'
|
|
107
|
-
);
|
|
108
|
-
// console.log(accessTokenUri, refreshToken);
|
|
109
|
-
/* TODO - Handle refresh_token */
|
|
110
|
-
} else if (status == 200) {
|
|
111
|
-
console.log(chalk.bold.green(`Success : ${respData.message}`));
|
|
112
|
-
} else {
|
|
113
|
-
throw new Error(`${respData.message}`);
|
|
114
|
-
}
|
|
115
|
-
})
|
|
116
|
-
.catch(e => Promise.reject(`${chalk.bold.red(e)}`));
|
|
117
|
-
} else {
|
|
118
|
-
throw new Error(`Error occured in authentication. Please regenerate using authenticate`);
|
|
119
|
-
}
|
|
120
|
-
} catch (err) {
|
|
121
|
-
throw new Error(`Error occured in authentication. Please regenerate using authenticate`);
|
|
122
|
-
}
|
|
123
|
-
};
|
package/src/tasks/build/index.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import inquirer from 'inquirer';
|
|
2
|
-
import Listr from 'listr';
|
|
3
|
-
import chalk from 'chalk';
|
|
4
|
-
|
|
5
|
-
import validate from '../validator/index.js';
|
|
6
|
-
|
|
7
|
-
import bundleComponent from '../bundle/index.js';
|
|
8
|
-
import lintComponent from '../linter/index.js';
|
|
9
|
-
import { getPublishComponentQuestions, publishComponentToServer, zipComponent } from './helper.js';
|
|
10
|
-
import { getComponentDirectoryPath, showVersion } from '../../util.js';
|
|
11
|
-
|
|
12
|
-
export default async options => {
|
|
13
|
-
showVersion();
|
|
14
|
-
|
|
15
|
-
const questions = await getPublishComponentQuestions();
|
|
16
|
-
const answers = await inquirer.prompt(questions);
|
|
17
|
-
const { componentKey, sourceMap, devBuild } = answers;
|
|
18
|
-
|
|
19
|
-
let content = {
|
|
20
|
-
...answers
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const tasks = new Listr(
|
|
24
|
-
[
|
|
25
|
-
{
|
|
26
|
-
title: 'Validate config schema',
|
|
27
|
-
task: async () => {
|
|
28
|
-
await validate(componentKey);
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
title: 'Lint component',
|
|
33
|
-
task: async () => {
|
|
34
|
-
const targetDirectory = await getComponentDirectoryPath(componentKey);
|
|
35
|
-
// console.log(`in buildComponent Lint component task: componentKey: ${componentKey} targetDirectory: ${targetDirectory}`);
|
|
36
|
-
await lintComponent(targetDirectory);
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
title: 'Bundle Component',
|
|
41
|
-
task: async () => await bundleComponent(componentKey, sourceMap, devBuild),
|
|
42
|
-
skip: () => (options.skipBundle ? 'Skipped bundling component' : undefined)
|
|
43
|
-
}
|
|
44
|
-
],
|
|
45
|
-
{
|
|
46
|
-
exitOnError: true
|
|
47
|
-
}
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
await tasks.run().catch(err => {
|
|
51
|
-
console.log(chalk.bold.red(err.toString()));
|
|
52
|
-
});
|
|
53
|
-
return true;
|
|
54
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export const configProps = {
|
|
2
|
-
value: true,
|
|
3
|
-
label: 'Boolean label',
|
|
4
|
-
helperText: 'Test helper text',
|
|
5
|
-
caption: 'Boolean caption',
|
|
6
|
-
validatemessage: '',
|
|
7
|
-
hideLabel: false,
|
|
8
|
-
testId: '12345678',
|
|
9
|
-
additionalProps: {},
|
|
10
|
-
displayMode: '',
|
|
11
|
-
variant: '',
|
|
12
|
-
trueLabel: 'True',
|
|
13
|
-
falseLabel: 'False',
|
|
14
|
-
disabled: false,
|
|
15
|
-
readOnly: false,
|
|
16
|
-
required: true
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const stateProps = {
|
|
20
|
-
value: '.Test'
|
|
21
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import dayjs from 'dayjs';
|
|
2
|
-
import relativeTime from 'dayjs/plugin/relativeTime';
|
|
3
|
-
import localizedFormat from 'dayjs/plugin/localizedFormat';
|
|
4
|
-
import utc from 'dayjs/plugin/utc';
|
|
5
|
-
import tzone from 'dayjs/plugin/timezone';
|
|
6
|
-
|
|
7
|
-
dayjs.extend(relativeTime);
|
|
8
|
-
dayjs.extend(localizedFormat);
|
|
9
|
-
dayjs.extend(utc);
|
|
10
|
-
dayjs.extend(tzone);
|
|
11
|
-
|
|
12
|
-
const types = ['fromNow', 'customFormat'];
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
// value should be in ISO 8601 format.
|
|
17
|
-
function DateFormatter(
|
|
18
|
-
value,
|
|
19
|
-
{ type = types[1], format = "DD/MM/YYYY", timezone } = {}
|
|
20
|
-
) {
|
|
21
|
-
if (!value) return value;
|
|
22
|
-
switch (type) {
|
|
23
|
-
case types[1]:
|
|
24
|
-
if (timezone) return dayjs(value).tz(timezone).format(format);
|
|
25
|
-
return dayjs(value).format(format);
|
|
26
|
-
case types[0]:
|
|
27
|
-
return dayjs(value).from(dayjs());
|
|
28
|
-
default:
|
|
29
|
-
return value;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// value should be in hh:mm:ss format (00:00:00 - 23:59:59).
|
|
34
|
-
function TimeFormatter(value, options) {
|
|
35
|
-
if (!value) return value;
|
|
36
|
-
const { locale = "en-US" } = options;
|
|
37
|
-
const timeOnlyRegex = /^(?:[01]\d|2[0123]):(?:[012345]\d):(?:[012345]\d)$/;
|
|
38
|
-
if (value.length === 8 && timeOnlyRegex.test(value)) {
|
|
39
|
-
const tempDate = new Date();
|
|
40
|
-
const hours = parseInt(value.substr(0, 2), 10);
|
|
41
|
-
const minutes = parseInt(value.substr(3, 2), 10);
|
|
42
|
-
const seconds = parseInt(value.substr(6, 2), 10);
|
|
43
|
-
tempDate.setHours(hours);
|
|
44
|
-
tempDate.setMinutes(minutes);
|
|
45
|
-
tempDate.setSeconds(seconds);
|
|
46
|
-
return tempDate.toLocaleTimeString(locale);
|
|
47
|
-
}
|
|
48
|
-
return DateFormatter(value, options);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export default {
|
|
52
|
-
Date: (value, options) => DateFormatter(value, { type: 'customFormat', ...options }),
|
|
53
|
-
'Date-Time-Default': (value, options) =>
|
|
54
|
-
DateFormatter(value, { ...options, type: 'customFormat', format: 'lll' }),
|
|
55
|
-
'Time-Default': (value, options) =>
|
|
56
|
-
TimeFormatter(value, {
|
|
57
|
-
...options,
|
|
58
|
-
type: 'customFormat',
|
|
59
|
-
format: 'hh:mm A'
|
|
60
|
-
})
|
|
61
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { FieldValueList } from '@pega/cosmos-react-core';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
import { format } from './date.js';
|
|
5
|
-
|
|
6
|
-
export default function FormattedText(props) {
|
|
7
|
-
const { formatType, label, value, testId, hideLabel, variant, additionalProps } = props;
|
|
8
|
-
|
|
9
|
-
let text = value;
|
|
10
|
-
|
|
11
|
-
text = format(text, formatType, additionalProps);
|
|
12
|
-
|
|
13
|
-
const fields = [
|
|
14
|
-
{
|
|
15
|
-
id: label.toLowerCase(),
|
|
16
|
-
name: hideLabel ? '' : label,
|
|
17
|
-
value: text
|
|
18
|
-
}
|
|
19
|
-
];
|
|
20
|
-
return <FieldValueList variant={variant} fields={fields} data-testid={testId} />;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
FormattedText.defaultProps = {
|
|
24
|
-
formatType: 'none',
|
|
25
|
-
variant: 'stacked',
|
|
26
|
-
value: undefined,
|
|
27
|
-
label: '',
|
|
28
|
-
testId: null,
|
|
29
|
-
hideLabel: false,
|
|
30
|
-
additionalProps: {}
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
FormattedText.propTypes = {
|
|
34
|
-
formatType: PropTypes.string,
|
|
35
|
-
variant: PropTypes.oneOf(['inline', 'stacked']),
|
|
36
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]),
|
|
37
|
-
label: PropTypes.string,
|
|
38
|
-
testId: PropTypes.string,
|
|
39
|
-
additionalProps: PropTypes.objectOf(PropTypes.any),
|
|
40
|
-
hideLabel: PropTypes.bool
|
|
41
|
-
};
|