@appdirect/sfb-toolkit 4.0.12 → 4.0.14
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/bin/index.js +11 -0
- package/coverage/clover.xml +2 -2
- package/coverage/lcov-report/constants/customUserAttributesMock.js.html +1 -1
- package/coverage/lcov-report/constants/index.html +1 -1
- package/coverage/lcov-report/constants/pageUrls.js.html +1 -1
- package/coverage/lcov-report/constants/userMock.js.html +1 -1
- package/coverage/lcov-report/controllers/controllers-utils/assetsUtils.js.html +1 -1
- package/coverage/lcov-report/controllers/controllers-utils/index.html +1 -1
- package/coverage/lcov-report/controllers/data-filters/bootstrap-data-filter.js.html +1 -1
- package/coverage/lcov-report/controllers/data-filters/call-to-actions-filter.js.html +1 -1
- package/coverage/lcov-report/controllers/data-filters/index.html +1 -1
- package/coverage/lcov-report/controllers/index.html +1 -1
- package/coverage/lcov-report/controllers/index.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/components/base/ResultItem.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/components/base/SearchBar.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/components/base/index.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/components/base/item.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/components/container.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/components/data-view.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/components/header-view.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/components/index.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/components/search.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/constants/index.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/constants/pageUrl.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/constants/roleType.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/constants/searchType.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/utils/debounce.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/utils/index.html +1 -1
- package/coverage/lcov-report/index.html +1 -1
- package/coverage/lcov-report/middlewares/config.js.html +1 -1
- package/coverage/lcov-report/middlewares/index.html +1 -1
- package/coverage/lcov-report/tools/index.html +1 -1
- package/coverage/lcov-report/tools/proxy-fetch.js.html +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/readme.md +18 -0
- package/src/tools/prompt-questions.js +15 -2
- package/src/tools/toolkit-common-fun.js +4 -233
- package/src/tools/toolkit-components-fun.js +264 -0
- package/src/tools/toolkit-components-info.js +24 -0
- package/src/tools/toolkit-components.js +4 -4
package/bin/index.js
CHANGED
|
@@ -19,6 +19,7 @@ const VERSION_PATH = "src/tools/toolkit-version.js"
|
|
|
19
19
|
const STORYBOOK = "src/tools/toolkit-storybook.js"
|
|
20
20
|
const INSTALL = "src/tools/toolkit-install.js"
|
|
21
21
|
const COMPONENTS = "src/tools/toolkit-components.js"
|
|
22
|
+
const COMPONETNS_INFO = "src/tools/toolkit-components-info.js"
|
|
22
23
|
const DEV_E2E = "src/tools/toolkit-dev-e2e.js"
|
|
23
24
|
|
|
24
25
|
program
|
|
@@ -195,6 +196,16 @@ program
|
|
|
195
196
|
})
|
|
196
197
|
})
|
|
197
198
|
|
|
199
|
+
program
|
|
200
|
+
.command("components-info")
|
|
201
|
+
.description("Custom components information")
|
|
202
|
+
.action(() => {
|
|
203
|
+
spawn(`node "${__dirname}/../${COMPONETNS_INFO}"`, {
|
|
204
|
+
stdio: "inherit",
|
|
205
|
+
shell: true,
|
|
206
|
+
})
|
|
207
|
+
})
|
|
208
|
+
|
|
198
209
|
program
|
|
199
210
|
.command("use-local-sfb-components")
|
|
200
211
|
.description("Setup theme to use local sfb-components bundles for e2e")
|
package/coverage/clover.xml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<coverage generated="
|
|
3
|
-
<project timestamp="
|
|
2
|
+
<coverage generated="1696621012920" clover="3.2.0">
|
|
3
|
+
<project timestamp="1696621012920" name="All files">
|
|
4
4
|
<metrics statements="498" coveredstatements="424" conditionals="246" coveredconditionals="175" methods="133" coveredmethods="109" elements="877" coveredelements="708" complexity="0" loc="498" ncloc="498" packages="10" files="20" classes="20"/>
|
|
5
5
|
<package name="constants">
|
|
6
6
|
<metrics statements="9" coveredstatements="9" conditionals="0" coveredconditionals="0" methods="1" coveredmethods="1"/>
|
|
@@ -481,7 +481,7 @@ module.exports = customUserAttributesMock
|
|
|
481
481
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
482
482
|
Code coverage generated by
|
|
483
483
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
484
|
-
at 2023-10-
|
|
484
|
+
at 2023-10-06T19:36:52.893Z
|
|
485
485
|
</div>
|
|
486
486
|
<script src="../prettify.js"></script>
|
|
487
487
|
<script>
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
132
132
|
Code coverage generated by
|
|
133
133
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
134
|
-
at 2023-10-
|
|
134
|
+
at 2023-10-06T19:36:52.893Z
|
|
135
135
|
</div>
|
|
136
136
|
<script src="../prettify.js"></script>
|
|
137
137
|
<script>
|
|
@@ -88,7 +88,7 @@ module.exports = { toolkitAssetsPath, themeAssetsPath }
|
|
|
88
88
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
89
89
|
Code coverage generated by
|
|
90
90
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
91
|
-
at 2023-10-
|
|
91
|
+
at 2023-10-06T19:36:52.893Z
|
|
92
92
|
</div>
|
|
93
93
|
<script src="../prettify.js"></script>
|
|
94
94
|
<script>
|
|
@@ -148,7 +148,7 @@ module.exports = userMock
|
|
|
148
148
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
149
149
|
Code coverage generated by
|
|
150
150
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
151
|
-
at 2023-10-
|
|
151
|
+
at 2023-10-06T19:36:52.893Z
|
|
152
152
|
</div>
|
|
153
153
|
<script src="../prettify.js"></script>
|
|
154
154
|
<script>
|
|
@@ -163,7 +163,7 @@ module.exports = buildHeaderAssets
|
|
|
163
163
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
164
164
|
Code coverage generated by
|
|
165
165
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
166
|
-
at 2023-10-
|
|
166
|
+
at 2023-10-06T19:36:52.893Z
|
|
167
167
|
</div>
|
|
168
168
|
<script src="../../prettify.js"></script>
|
|
169
169
|
<script>
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
102
102
|
Code coverage generated by
|
|
103
103
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
104
|
-
at 2023-10-
|
|
104
|
+
at 2023-10-06T19:36:52.893Z
|
|
105
105
|
</div>
|
|
106
106
|
<script src="../../prettify.js"></script>
|
|
107
107
|
<script>
|
|
@@ -136,7 +136,7 @@ module.exports = {
|
|
|
136
136
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
137
137
|
Code coverage generated by
|
|
138
138
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
139
|
-
at 2023-10-
|
|
139
|
+
at 2023-10-06T19:36:52.893Z
|
|
140
140
|
</div>
|
|
141
141
|
<script src="../../prettify.js"></script>
|
|
142
142
|
<script>
|
|
@@ -337,7 +337,7 @@ module.exports = {
|
|
|
337
337
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
338
338
|
Code coverage generated by
|
|
339
339
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
340
|
-
at 2023-10-
|
|
340
|
+
at 2023-10-06T19:36:52.893Z
|
|
341
341
|
</div>
|
|
342
342
|
<script src="../../prettify.js"></script>
|
|
343
343
|
<script>
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
117
117
|
Code coverage generated by
|
|
118
118
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
119
|
-
at 2023-10-
|
|
119
|
+
at 2023-10-06T19:36:52.893Z
|
|
120
120
|
</div>
|
|
121
121
|
<script src="../../prettify.js"></script>
|
|
122
122
|
<script>
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
102
102
|
Code coverage generated by
|
|
103
103
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
104
|
-
at 2023-10-
|
|
104
|
+
at 2023-10-06T19:36:52.893Z
|
|
105
105
|
</div>
|
|
106
106
|
<script src="../prettify.js"></script>
|
|
107
107
|
<script>
|
|
@@ -1426,7 +1426,7 @@ module.exports = Pages
|
|
|
1426
1426
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
1427
1427
|
Code coverage generated by
|
|
1428
1428
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
1429
|
-
at 2023-10-
|
|
1429
|
+
at 2023-10-06T19:36:52.893Z
|
|
1430
1430
|
</div>
|
|
1431
1431
|
<script src="../prettify.js"></script>
|
|
1432
1432
|
<script>
|
|
@@ -508,7 +508,7 @@ export default class ResultItem extends React.Component {
|
|
|
508
508
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
509
509
|
Code coverage generated by
|
|
510
510
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
511
|
-
at 2023-10-
|
|
511
|
+
at 2023-10-06T19:36:52.893Z
|
|
512
512
|
</div>
|
|
513
513
|
<script src="../../../../prettify.js"></script>
|
|
514
514
|
<script>
|
|
@@ -442,7 +442,7 @@ export default class Search extends React.Component {
|
|
|
442
442
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
443
443
|
Code coverage generated by
|
|
444
444
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
445
|
-
at 2023-10-
|
|
445
|
+
at 2023-10-06T19:36:52.893Z
|
|
446
446
|
</div>
|
|
447
447
|
<script src="../../../../prettify.js"></script>
|
|
448
448
|
<script>
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
132
132
|
Code coverage generated by
|
|
133
133
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
134
|
-
at 2023-10-
|
|
134
|
+
at 2023-10-06T19:36:52.893Z
|
|
135
135
|
</div>
|
|
136
136
|
<script src="../../../../prettify.js"></script>
|
|
137
137
|
<script>
|
|
@@ -448,7 +448,7 @@ export default class Item extends React.Component {
|
|
|
448
448
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
449
449
|
Code coverage generated by
|
|
450
450
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
451
|
-
at 2023-10-
|
|
451
|
+
at 2023-10-06T19:36:52.893Z
|
|
452
452
|
</div>
|
|
453
453
|
<script src="../../../../prettify.js"></script>
|
|
454
454
|
<script>
|
|
@@ -538,7 +538,7 @@ export default class Container extends React.Component {
|
|
|
538
538
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
539
539
|
Code coverage generated by
|
|
540
540
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
541
|
-
at 2023-10-
|
|
541
|
+
at 2023-10-06T19:36:52.893Z
|
|
542
542
|
</div>
|
|
543
543
|
<script src="../../../prettify.js"></script>
|
|
544
544
|
<script>
|
|
@@ -373,7 +373,7 @@ export default class DataView extends React.Component {
|
|
|
373
373
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
374
374
|
Code coverage generated by
|
|
375
375
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
376
|
-
at 2023-10-
|
|
376
|
+
at 2023-10-06T19:36:52.893Z
|
|
377
377
|
</div>
|
|
378
378
|
<script src="../../../prettify.js"></script>
|
|
379
379
|
<script>
|
|
@@ -793,7 +793,7 @@ export default class HeaderView extends React.Component {
|
|
|
793
793
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
794
794
|
Code coverage generated by
|
|
795
795
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
796
|
-
at 2023-10-
|
|
796
|
+
at 2023-10-06T19:36:52.893Z
|
|
797
797
|
</div>
|
|
798
798
|
<script src="../../../prettify.js"></script>
|
|
799
799
|
<script>
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
147
147
|
Code coverage generated by
|
|
148
148
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
149
|
-
at 2023-10-
|
|
149
|
+
at 2023-10-06T19:36:52.893Z
|
|
150
150
|
</div>
|
|
151
151
|
<script src="../../../prettify.js"></script>
|
|
152
152
|
<script>
|
|
@@ -967,7 +967,7 @@ export default class SearchTool extends React.Component {
|
|
|
967
967
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
968
968
|
Code coverage generated by
|
|
969
969
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
970
|
-
at 2023-10-
|
|
970
|
+
at 2023-10-06T19:36:52.893Z
|
|
971
971
|
</div>
|
|
972
972
|
<script src="../../../prettify.js"></script>
|
|
973
973
|
<script>
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
132
132
|
Code coverage generated by
|
|
133
133
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
134
|
-
at 2023-10-
|
|
134
|
+
at 2023-10-06T19:36:52.893Z
|
|
135
135
|
</div>
|
|
136
136
|
<script src="../../../prettify.js"></script>
|
|
137
137
|
<script>
|
|
@@ -76,7 +76,7 @@ export const MOCK_ADMIN_PAGE_URL = `${BASE_URL}/admin`;</pre></td></tr></table><
|
|
|
76
76
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
77
77
|
Code coverage generated by
|
|
78
78
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
79
|
-
at 2023-10-
|
|
79
|
+
at 2023-10-06T19:36:52.893Z
|
|
80
80
|
</div>
|
|
81
81
|
<script src="../../../prettify.js"></script>
|
|
82
82
|
<script>
|
|
@@ -82,7 +82,7 @@ export const NO_ROLE = "NO_ROLE";
|
|
|
82
82
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
83
83
|
Code coverage generated by
|
|
84
84
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
85
|
-
at 2023-10-
|
|
85
|
+
at 2023-10-06T19:36:52.893Z
|
|
86
86
|
</div>
|
|
87
87
|
<script src="../../../prettify.js"></script>
|
|
88
88
|
<script>
|
|
@@ -154,7 +154,7 @@ export const SEARCH_TYPES = [
|
|
|
154
154
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
155
155
|
Code coverage generated by
|
|
156
156
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
157
|
-
at 2023-10-
|
|
157
|
+
at 2023-10-06T19:36:52.893Z
|
|
158
158
|
</div>
|
|
159
159
|
<script src="../../../prettify.js"></script>
|
|
160
160
|
<script>
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
107
107
|
Code coverage generated by
|
|
108
108
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
109
|
-
at 2023-10-
|
|
109
|
+
at 2023-10-06T19:36:52.893Z
|
|
110
110
|
</div>
|
|
111
111
|
<script src="../../../prettify.js"></script>
|
|
112
112
|
<script>
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
102
102
|
Code coverage generated by
|
|
103
103
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
104
|
-
at 2023-10-
|
|
104
|
+
at 2023-10-06T19:36:52.893Z
|
|
105
105
|
</div>
|
|
106
106
|
<script src="../../../prettify.js"></script>
|
|
107
107
|
<script>
|
|
@@ -236,7 +236,7 @@
|
|
|
236
236
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
237
237
|
Code coverage generated by
|
|
238
238
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
239
|
-
at 2023-10-
|
|
239
|
+
at 2023-10-06T19:36:52.893Z
|
|
240
240
|
</div>
|
|
241
241
|
<script src="prettify.js"></script>
|
|
242
242
|
<script>
|
|
@@ -178,7 +178,7 @@ module.exports = (req, res, next) => {
|
|
|
178
178
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
179
179
|
Code coverage generated by
|
|
180
180
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
181
|
-
at 2023-10-
|
|
181
|
+
at 2023-10-06T19:36:52.893Z
|
|
182
182
|
</div>
|
|
183
183
|
<script src="../prettify.js"></script>
|
|
184
184
|
<script>
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
102
102
|
Code coverage generated by
|
|
103
103
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
104
|
-
at 2023-10-
|
|
104
|
+
at 2023-10-06T19:36:52.893Z
|
|
105
105
|
</div>
|
|
106
106
|
<script src="../prettify.js"></script>
|
|
107
107
|
<script>
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
102
102
|
Code coverage generated by
|
|
103
103
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
104
|
-
at 2023-10-
|
|
104
|
+
at 2023-10-06T19:36:52.893Z
|
|
105
105
|
</div>
|
|
106
106
|
<script src="../prettify.js"></script>
|
|
107
107
|
<script>
|
|
@@ -118,7 +118,7 @@ module.exports = fetchProxied;
|
|
|
118
118
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
119
119
|
Code coverage generated by
|
|
120
120
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
121
|
-
at 2023-10-
|
|
121
|
+
at 2023-10-06T19:36:52.893Z
|
|
122
122
|
</div>
|
|
123
123
|
<script src="../prettify.js"></script>
|
|
124
124
|
<script>
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appdirect/sfb-toolkit",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.14",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@appdirect/sfb-toolkit",
|
|
9
|
-
"version": "4.0.
|
|
9
|
+
"version": "4.0.14",
|
|
10
10
|
"license": "SEE LICENSE IN https://help.appdirect.com/sfb-eula.pdf",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@appdirect/public-custom-app-ui": "^0.0.17",
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -10,6 +10,24 @@ It can be easily mixed with eg. HTML, CSS, JavaScript, jQuery, SASS.
|
|
|
10
10
|
|
|
11
11
|
### Release Notes:
|
|
12
12
|
|
|
13
|
+
**4.0.14**
|
|
14
|
+
- Bug fix: fixed error message showing when executing `sfb-toolkit setup`
|
|
15
|
+
|
|
16
|
+
**4.0.13**
|
|
17
|
+
- Added new command `sfb-toolkit components-info`
|
|
18
|
+
- shows which custom components could override our internal UI library (`sfb-theme-components`)
|
|
19
|
+
- Updated warning prompt for `sfb-toolkit install @appdirect/sfb-theme-components`
|
|
20
|
+
- includes the current version of `sfb-theme-components` used
|
|
21
|
+
- indicates which custom components should potentially be tested when updating the `sfb-theme-components` version
|
|
22
|
+
|
|
23
|
+
**4.0.12**
|
|
24
|
+
- Bug fix: fixed proxy issue
|
|
25
|
+
|
|
26
|
+
**4.0.11**
|
|
27
|
+
- Added warning prompt to `sfb-toolkit components` command
|
|
28
|
+
- Added warning prompt to `sfb-toolkit install @appdirect/sfb-theme-components` command
|
|
29
|
+
- Bug fix: fixed node_modules issue
|
|
30
|
+
|
|
13
31
|
**4.0.10**
|
|
14
32
|
- Add Node 18 support
|
|
15
33
|
- Add prompts when enabling custom components and updating sfb-theme-component version
|
|
@@ -9,6 +9,8 @@ const {
|
|
|
9
9
|
EXTENSION_PROMPT,
|
|
10
10
|
} = require("./toolkit-common-vars");
|
|
11
11
|
|
|
12
|
+
const { getCustomComponentsInfo, getSfbThemeComponentsVersion } = require('./toolkit-components-fun');
|
|
13
|
+
|
|
12
14
|
// small function to check if item has been defined
|
|
13
15
|
const isDefined = (answer) => !!answer;
|
|
14
16
|
|
|
@@ -77,6 +79,16 @@ const isValidMarketplaceURL = async (toTest) => {
|
|
|
77
79
|
|
|
78
80
|
const licenseText = ` In order to use this software, please type 'agree' to accept the license agreement that can be found at https://help.appdirect.com/sfb-eula.pdf`;
|
|
79
81
|
|
|
82
|
+
const customComponentsHints = () => {
|
|
83
|
+
const { overridesJavaScript, overridesSass } = getCustomComponentsInfo();
|
|
84
|
+
return (overridesJavaScript.length || overridesSass.length)
|
|
85
|
+
? '\nSee below a list (none exhaustive) of custom components that should be ' +
|
|
86
|
+
`tested after changing the ${chalk.cyan("@appdirect/sfb-theme-components")} version:` +
|
|
87
|
+
(overridesJavaScript.length ? `\n\nOverrides Components JS:\n ` + chalk.green(overridesJavaScript.join(',\n ')) : '') +
|
|
88
|
+
(overridesSass.length ? `\n\nOverrides Components SCSS:\n ` + chalk.green(overridesSass.join(',\n ')) : '')
|
|
89
|
+
: '';
|
|
90
|
+
}
|
|
91
|
+
|
|
80
92
|
// list of default questions that could be prompt to user
|
|
81
93
|
const QUESTIONS = [
|
|
82
94
|
{
|
|
@@ -110,14 +122,15 @@ const QUESTIONS = [
|
|
|
110
122
|
)} library.` +
|
|
111
123
|
` Please note your current ${chalk.cyan(
|
|
112
124
|
"@appdirect/sfb-theme-components"
|
|
113
|
-
)} version before going forward in the event you need to revert.
|
|
125
|
+
)} version (${chalk.bgRed.yellowBright(getSfbThemeComponentsVersion())}) before going forward in the event you need to revert.
|
|
114
126
|
\u2022 ${chalk.bgRed.yellowBright(
|
|
115
127
|
"Ensure you thoroughly test your theme before deploying this new version."
|
|
116
128
|
)}
|
|
117
129
|
\u2022 Please see our documentation for more information.
|
|
118
130
|
${chalk.cyan(
|
|
119
131
|
"https://developer.appdirect.com/storefront/how-tos/components/storefront-custom-components#update-custom-components-ui-library-sfb-theme-components."
|
|
120
|
-
)}
|
|
132
|
+
)}
|
|
133
|
+
${customComponentsHints()}
|
|
121
134
|
\nDo you wish to proceed? (y/n)`
|
|
122
135
|
),
|
|
123
136
|
},
|
|
@@ -8,6 +8,9 @@ const chalk = require("chalk")
|
|
|
8
8
|
const { CURRENT_PATH, TOOLKIT_PATH, BOOTSTRAP_FOLDERS, BOOTSTRAP_FILES, CONFIG_PATH, THEME_COMPONENT_MODULE,
|
|
9
9
|
THEME_COMPONENT_VERSION, ACTIVE_THEME_PATH, THEME_LOGS_PATH, THEME_LOGS_FILE_PATH, SASS_MODULE,
|
|
10
10
|
SASS_VERSION, SASS_LOADER_MODULE, SASS_LOADER_VERSION } = require("./toolkit-common-vars");
|
|
11
|
+
|
|
12
|
+
const { getCustomComponentsInfo } = require("./toolkit-components-fun");
|
|
13
|
+
|
|
11
14
|
const { has } = require("lodash");
|
|
12
15
|
|
|
13
16
|
// function to remove project's folders (used to revert changes on error)
|
|
@@ -188,237 +191,6 @@ const updateCustomComponentsMetadata = (data) => {
|
|
|
188
191
|
return data;
|
|
189
192
|
}
|
|
190
193
|
|
|
191
|
-
const removeCurrentFolderPathPrefix = (path) => {
|
|
192
|
-
return path.replace(/^\.\//, '').trim();
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
const getExportList = (fileData, prefixPath = '') => {
|
|
196
|
-
const exportList = [];
|
|
197
|
-
const defaultExports = [];
|
|
198
|
-
const pathPattern = /['|"|`](.+)['|"|`]/;
|
|
199
|
-
const exportedComponentPattern = /default\s*as\s*(\w+).*['|"|`](.+)['|"|`]/;
|
|
200
|
-
const filterOutComments = fileData.replace(/\/\/+.*\s*/g, '');
|
|
201
|
-
const filterOutNewlines = filterOutComments.replace(/\r?\n$/g, '');
|
|
202
|
-
const dataList = filterOutNewlines.split(/\r?\n/);
|
|
203
|
-
dataList.forEach(item => {
|
|
204
|
-
const directExportItem = exportedComponentPattern.exec(item);
|
|
205
|
-
if(directExportItem) {
|
|
206
|
-
defaultExports.push({
|
|
207
|
-
alias: directExportItem[1].trim(),
|
|
208
|
-
path: prefixPath + removeCurrentFolderPathPrefix(directExportItem[2])
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
} else {
|
|
212
|
-
const exportItem = pathPattern.exec(item);
|
|
213
|
-
if(exportItem) {
|
|
214
|
-
exportList.push(prefixPath + removeCurrentFolderPathPrefix(exportItem[1]));
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
})
|
|
218
|
-
|
|
219
|
-
return {
|
|
220
|
-
exportList,
|
|
221
|
-
defaultExports
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
const getPathToUse = (usePath) => {
|
|
226
|
-
let fullPath;
|
|
227
|
-
let isPathToFolder = false;
|
|
228
|
-
const basePath = `${ACTIVE_THEME_PATH}/customComponents/${usePath}`;
|
|
229
|
-
const jsFilePath = `${basePath}.js`;
|
|
230
|
-
const jsxFilePath = `${basePath}.jsx`;
|
|
231
|
-
const indexFilePath = `${basePath}/index.js`;
|
|
232
|
-
|
|
233
|
-
if(!(/\.jsx?$/.test(basePath))) {
|
|
234
|
-
if(fs.existsSync(jsxFilePath)) {
|
|
235
|
-
fullPath = jsxFilePath;
|
|
236
|
-
} else if (fs.existsSync(jsFilePath)) {
|
|
237
|
-
fullPath = jsFilePath;
|
|
238
|
-
} else if (fs.existsSync(indexFilePath)) {
|
|
239
|
-
fullPath = indexFilePath;
|
|
240
|
-
isPathToFolder = true;
|
|
241
|
-
}
|
|
242
|
-
} else {
|
|
243
|
-
if(fs.existsSync(basePath)) {
|
|
244
|
-
fullPath = basePath;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
return {
|
|
249
|
-
fullPath,
|
|
250
|
-
isPathToFolder
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
const customComponentsExportsTraversal = (pathsToTraverse) => {
|
|
255
|
-
let paths = [...pathsToTraverse];
|
|
256
|
-
let allDefaultExports = [];
|
|
257
|
-
const overridenScss = new Set();
|
|
258
|
-
while(paths.length > 0) {
|
|
259
|
-
let pathItem = paths.pop();
|
|
260
|
-
let usePath = pathItem.path || pathItem;
|
|
261
|
-
let prefixPath = usePath;
|
|
262
|
-
const { fullPath, isPathToFolder } = getPathToUse(usePath);
|
|
263
|
-
|
|
264
|
-
if (fullPath) {
|
|
265
|
-
const fileData = fs.readFileSync(fullPath, 'utf8');
|
|
266
|
-
const filterOutComments = fileData.replace(/\/\/+.*\s*/g, '');
|
|
267
|
-
|
|
268
|
-
// check if file content is a component
|
|
269
|
-
const component = filterOutComments.match(/export\s+default\s+(?:\w*\((\w+)\)|(\w+));?/);
|
|
270
|
-
|
|
271
|
-
if(component) {
|
|
272
|
-
foundComponent = component[1] || component[2];
|
|
273
|
-
const allScssImports = filterOutComments.matchAll(/['|"|`](.*\/(\w+)\.s?css)['|"|`]/g);
|
|
274
|
-
for(const match of allScssImports) {
|
|
275
|
-
const sfbLibraryScssImport = match[1].includes(THEME_COMPONENT_MODULE);
|
|
276
|
-
if(!sfbLibraryScssImport) {
|
|
277
|
-
if(pathItem.alias) {
|
|
278
|
-
overridenScss.add(pathItem.alias);
|
|
279
|
-
} else {
|
|
280
|
-
// catches the case: export * from 'somePath'
|
|
281
|
-
overridenScss.add(match[2]);
|
|
282
|
-
allDefaultExports.push(match[2]);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
} else {
|
|
287
|
-
if(!isPathToFolder || usePath.match(/jsx?/)) {
|
|
288
|
-
prefixPath = usePath.match(/(.+)\/.*$/)[1];
|
|
289
|
-
};
|
|
290
|
-
const {
|
|
291
|
-
exportList,
|
|
292
|
-
defaultExports
|
|
293
|
-
} = getExportList(fileData, prefixPath + "/");
|
|
294
|
-
paths.push(...exportList);
|
|
295
|
-
paths.push(...defaultExports);
|
|
296
|
-
|
|
297
|
-
allDefaultExports.push(...defaultExports);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
return {
|
|
303
|
-
// converts to Set to filter duplicates then back to a list
|
|
304
|
-
allDefaultExports: [...new Set(allDefaultExports)],
|
|
305
|
-
overridenScss: [...overridenScss]
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
const getSfbThemeComponentsList = () => {
|
|
310
|
-
const sfbThemeComponentsPath = `${ACTIVE_THEME_PATH}/node_modules/${THEME_COMPONENT_MODULE}/src/components/index.js`;
|
|
311
|
-
const sfbThemeComponents = fs.existsSync(sfbThemeComponentsPath);
|
|
312
|
-
const defaultExportAliasList = []
|
|
313
|
-
if (sfbThemeComponents) {
|
|
314
|
-
const fileData = fs.readFileSync(sfbThemeComponentsPath, 'utf8');
|
|
315
|
-
const { defaultExports } = getExportList(fileData);
|
|
316
|
-
for(const exportItem of defaultExports) {
|
|
317
|
-
defaultExportAliasList.push(exportItem.alias);
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
return defaultExportAliasList;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
const getCustomComponentsInfo = () => {
|
|
324
|
-
try {
|
|
325
|
-
const overridesJavaScript = new Set();
|
|
326
|
-
const overridesSass = new Set();
|
|
327
|
-
const userDefinedCustomComponents = new Set();
|
|
328
|
-
const sfbConfigPath = CURRENT_PATH;
|
|
329
|
-
const currentTheme = JSON.parse(fs.readFileSync(`${sfbConfigPath}/.sfbconfig`)).current;
|
|
330
|
-
const customComponentsFilesPath = `${sfbConfigPath}/themes/${currentTheme}/customComponents/index.js`;
|
|
331
|
-
const customComponents = fs.existsSync(customComponentsFilesPath);
|
|
332
|
-
|
|
333
|
-
if(customComponents) {
|
|
334
|
-
let componentsPathsLoadedBeforeUiLibrary = [];
|
|
335
|
-
let componentsPathsLoadedAfterUiLibrary = [];
|
|
336
|
-
let uiLibraryPassed = false;
|
|
337
|
-
const indexFileData = fs.readFileSync(customComponentsFilesPath, 'utf8');
|
|
338
|
-
const { exportList, defaultExports }= getExportList(indexFileData);
|
|
339
|
-
const sfbDirectExportsList = getSfbThemeComponentsList();
|
|
340
|
-
const {
|
|
341
|
-
overridenScss: rootIndexOverridenScss
|
|
342
|
-
} = customComponentsExportsTraversal(defaultExports);
|
|
343
|
-
|
|
344
|
-
defaultExports.forEach(exportedItem => {
|
|
345
|
-
if(sfbDirectExportsList.includes(exportedItem.alias)) {
|
|
346
|
-
overridesJavaScript.add(exportedItem.alias);
|
|
347
|
-
if(rootIndexOverridenScss.includes(exportedItem.alias)) {
|
|
348
|
-
overridesSass.add(exportedItem.alias);
|
|
349
|
-
}
|
|
350
|
-
} else {
|
|
351
|
-
userDefinedCustomComponents.add(exportedItem.alias);
|
|
352
|
-
}
|
|
353
|
-
});
|
|
354
|
-
|
|
355
|
-
exportList.forEach(exportPath => {
|
|
356
|
-
if(uiLibraryPassed) {
|
|
357
|
-
componentsPathsLoadedAfterUiLibrary.push(exportPath);
|
|
358
|
-
} else {
|
|
359
|
-
if(exportPath.includes(THEME_COMPONENT_MODULE)) {
|
|
360
|
-
uiLibraryPassed = true;
|
|
361
|
-
} else {
|
|
362
|
-
componentsPathsLoadedBeforeUiLibrary.push(exportPath);
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
});
|
|
366
|
-
|
|
367
|
-
const {
|
|
368
|
-
allDefaultExports: directExportsBeforeUiLibrary,
|
|
369
|
-
overridenScss: overridenScssBefore
|
|
370
|
-
} = customComponentsExportsTraversal(componentsPathsLoadedBeforeUiLibrary);
|
|
371
|
-
|
|
372
|
-
const {
|
|
373
|
-
allDefaultExports: directExportsAfterUiLibrary,
|
|
374
|
-
overridenScss: overridenScssAfter
|
|
375
|
-
} = customComponentsExportsTraversal(componentsPathsLoadedAfterUiLibrary);
|
|
376
|
-
|
|
377
|
-
directExportsBeforeUiLibrary.forEach(exportedItem => {
|
|
378
|
-
if(sfbDirectExportsList.includes(exportedItem.alias)) {
|
|
379
|
-
overridesJavaScript.add(exportedItem.alias);
|
|
380
|
-
if(overridenScssBefore.includes(exportedItem.alias)) {
|
|
381
|
-
overridesSass.add(exportedItem.alias);
|
|
382
|
-
}
|
|
383
|
-
} else if (sfbDirectExportsList.includes(exportedItem)) {
|
|
384
|
-
if(overridenScssBefore.includes(exportedItem)) {
|
|
385
|
-
overridesSass.add(exportedItem);
|
|
386
|
-
}
|
|
387
|
-
} else {
|
|
388
|
-
userDefinedCustomComponents.add(exportedItem.alias);
|
|
389
|
-
}
|
|
390
|
-
});
|
|
391
|
-
|
|
392
|
-
directExportsAfterUiLibrary.forEach(exportedItem => {
|
|
393
|
-
if(sfbDirectExportsList.includes(exportedItem.alias)) {
|
|
394
|
-
if(overridenScssAfter.includes(exportedItem.alias)) {
|
|
395
|
-
overridesSass.add(exportedItem.alias);
|
|
396
|
-
}
|
|
397
|
-
} else if(sfbDirectExportsList.includes(exportedItem)) {
|
|
398
|
-
if(overridenScssAfter.includes(exportedItem)) {
|
|
399
|
-
overridesSass.add(exportedItem);
|
|
400
|
-
}
|
|
401
|
-
} else {
|
|
402
|
-
userDefinedCustomComponents.add(exportedItem.alias);
|
|
403
|
-
}
|
|
404
|
-
})
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
return {
|
|
408
|
-
overridesJavaScript: [...overridesJavaScript].sort(),
|
|
409
|
-
overridesSass: [...overridesSass].sort(),
|
|
410
|
-
userDefinedCustomComponents: [...userDefinedCustomComponents].sort()
|
|
411
|
-
}
|
|
412
|
-
} catch (error) {
|
|
413
|
-
console.error(chalk.red(`\n ERROR: Unable to obtain Custom Components information due to: ${error}.\n`));
|
|
414
|
-
return {
|
|
415
|
-
overridesJavaScript: [],
|
|
416
|
-
overridesSass: [],
|
|
417
|
-
userDefinedCustomComponents: []
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
|
|
422
194
|
const addMetadata = (metadata = {}, themePath) => {
|
|
423
195
|
const sfbConfigPath = themePath || CURRENT_PATH;
|
|
424
196
|
const currentTheme = JSON.parse(fs.readFileSync(`${sfbConfigPath}/.sfbconfig`)).current;
|
|
@@ -516,6 +288,5 @@ module.exports = {
|
|
|
516
288
|
createCustomThemePacakgeJson,
|
|
517
289
|
updateCustomComponentsMetadata,
|
|
518
290
|
addMetadata,
|
|
519
|
-
installSass
|
|
520
|
-
getCustomComponentsInfo
|
|
291
|
+
installSass
|
|
521
292
|
}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
const fs = require("fs-extra");
|
|
2
|
+
const chalk = require("chalk");
|
|
3
|
+
const { CURRENT_PATH, THEME_COMPONENT_MODULE, ACTIVE_THEME_PATH} = require("./toolkit-common-vars");
|
|
4
|
+
|
|
5
|
+
const removeCurrentFolderPathPrefix = (path) => {
|
|
6
|
+
return path.replace(/^\.\//, '').trim();
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const getExportList = (fileData, prefixPath = '') => {
|
|
10
|
+
const exportList = [];
|
|
11
|
+
const defaultExports = [];
|
|
12
|
+
const pathPattern = /['|"|`](.+)['|"|`]/;
|
|
13
|
+
const exportedComponentPattern = /default\s*as\s*(\w+).*['|"|`](.+)['|"|`]/;
|
|
14
|
+
const filterOutComments = fileData.replace(/\/\/+.*\s*/g, '');
|
|
15
|
+
const filterOutNewlines = filterOutComments.replace(/\r?\n$/g, '');
|
|
16
|
+
const dataList = filterOutNewlines.split(/\r?\n/);
|
|
17
|
+
dataList.forEach(item => {
|
|
18
|
+
const directExportItem = exportedComponentPattern.exec(item);
|
|
19
|
+
if(directExportItem) {
|
|
20
|
+
defaultExports.push({
|
|
21
|
+
alias: directExportItem[1].trim(),
|
|
22
|
+
path: prefixPath + removeCurrentFolderPathPrefix(directExportItem[2])
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
} else {
|
|
26
|
+
const exportItem = pathPattern.exec(item);
|
|
27
|
+
if(exportItem) {
|
|
28
|
+
exportList.push(prefixPath + removeCurrentFolderPathPrefix(exportItem[1]));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
exportList,
|
|
35
|
+
defaultExports
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const getPathToUse = (usePath) => {
|
|
40
|
+
let fullPath;
|
|
41
|
+
let isPathToFolder = false;
|
|
42
|
+
const basePath = `${ACTIVE_THEME_PATH}/customComponents/${usePath}`;
|
|
43
|
+
const jsFilePath = `${basePath}.js`;
|
|
44
|
+
const jsxFilePath = `${basePath}.jsx`;
|
|
45
|
+
const indexFilePath = `${basePath}/index.js`;
|
|
46
|
+
|
|
47
|
+
if(!(/\.jsx?$/.test(basePath))) {
|
|
48
|
+
if(fs.existsSync(jsxFilePath)) {
|
|
49
|
+
fullPath = jsxFilePath;
|
|
50
|
+
} else if (fs.existsSync(jsFilePath)) {
|
|
51
|
+
fullPath = jsFilePath;
|
|
52
|
+
} else if (fs.existsSync(indexFilePath)) {
|
|
53
|
+
fullPath = indexFilePath;
|
|
54
|
+
isPathToFolder = true;
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
if(fs.existsSync(basePath)) {
|
|
58
|
+
fullPath = basePath;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
fullPath,
|
|
64
|
+
isPathToFolder
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const customComponentsEnabled = () => {
|
|
69
|
+
const customComponentsPath = `${ACTIVE_THEME_PATH}/customComponents`
|
|
70
|
+
return fs.existsSync(customComponentsPath);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const customComponentsExportsTraversal = (pathsToTraverse) => {
|
|
74
|
+
let paths = [...pathsToTraverse];
|
|
75
|
+
let allDefaultExports = [];
|
|
76
|
+
const overridenScss = new Set();
|
|
77
|
+
while(paths.length > 0) {
|
|
78
|
+
let pathItem = paths.pop();
|
|
79
|
+
let usePath = pathItem.path || pathItem;
|
|
80
|
+
let prefixPath = usePath;
|
|
81
|
+
const { fullPath, isPathToFolder } = getPathToUse(usePath);
|
|
82
|
+
|
|
83
|
+
if (fullPath) {
|
|
84
|
+
const fileData = fs.readFileSync(fullPath, 'utf8');
|
|
85
|
+
const filterOutComments = fileData.replace(/\/\/+.*\s*/g, '');
|
|
86
|
+
|
|
87
|
+
// check if file content is a component
|
|
88
|
+
const component = filterOutComments.match(/export\s+default\s+(?:\w*\((\w+)\)|(\w+));?/);
|
|
89
|
+
|
|
90
|
+
if(component) {
|
|
91
|
+
foundComponent = component[1] || component[2];
|
|
92
|
+
const allScssImports = filterOutComments.matchAll(/['|"|`](.*\/(\w+)\.s?css)['|"|`]/g);
|
|
93
|
+
for(const match of allScssImports) {
|
|
94
|
+
const sfbLibraryScssImport = match[1].includes(THEME_COMPONENT_MODULE);
|
|
95
|
+
if(!sfbLibraryScssImport) {
|
|
96
|
+
if(pathItem.alias) {
|
|
97
|
+
overridenScss.add(pathItem.alias);
|
|
98
|
+
} else {
|
|
99
|
+
// catches the case: export * from 'somePath'
|
|
100
|
+
overridenScss.add(match[2]);
|
|
101
|
+
allDefaultExports.push(match[2]);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
} else {
|
|
106
|
+
if(!isPathToFolder || usePath.match(/jsx?/)) {
|
|
107
|
+
prefixPath = usePath.match(/(.+)\/.*$/)[1];
|
|
108
|
+
};
|
|
109
|
+
const {
|
|
110
|
+
exportList,
|
|
111
|
+
defaultExports
|
|
112
|
+
} = getExportList(fileData, prefixPath + "/");
|
|
113
|
+
paths.push(...exportList);
|
|
114
|
+
paths.push(...defaultExports);
|
|
115
|
+
|
|
116
|
+
allDefaultExports.push(...defaultExports);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return {
|
|
122
|
+
// converts to Set to filter duplicates then back to a list
|
|
123
|
+
allDefaultExports: [...new Set(allDefaultExports)],
|
|
124
|
+
overridenScss: [...overridenScss]
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const getSfbThemeComponentsList = () => {
|
|
129
|
+
const sfbThemeComponentsPath = `${ACTIVE_THEME_PATH}/node_modules/${THEME_COMPONENT_MODULE}/src/components/index.js`;
|
|
130
|
+
const sfbThemeComponents = fs.existsSync(sfbThemeComponentsPath);
|
|
131
|
+
const defaultExportAliasList = []
|
|
132
|
+
if (sfbThemeComponents) {
|
|
133
|
+
const fileData = fs.readFileSync(sfbThemeComponentsPath, 'utf8');
|
|
134
|
+
const { defaultExports } = getExportList(fileData);
|
|
135
|
+
for(const exportItem of defaultExports) {
|
|
136
|
+
defaultExportAliasList.push(exportItem.alias);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return defaultExportAliasList;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const getCustomComponentsInfo = () => {
|
|
143
|
+
try {
|
|
144
|
+
const overridesJavaScript = new Set();
|
|
145
|
+
const overridesSass = new Set();
|
|
146
|
+
const userDefinedCustomComponents = new Set();
|
|
147
|
+
const sfbConfigPath = CURRENT_PATH;
|
|
148
|
+
const sfbconfigExists = fs.existsSync(`${sfbConfigPath}/.sfbconfig`);
|
|
149
|
+
let customComponentsFilesPath;
|
|
150
|
+
let customComponents;
|
|
151
|
+
if(sfbconfigExists) {
|
|
152
|
+
const currentTheme = JSON.parse(fs.readFileSync(`${sfbConfigPath}/.sfbconfig`)).current;
|
|
153
|
+
customComponentsFilesPath = `${sfbConfigPath}/themes/${currentTheme}/customComponents/index.js`;
|
|
154
|
+
customComponents = fs.existsSync(customComponentsFilesPath);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if(customComponents) {
|
|
158
|
+
let componentsPathsLoadedBeforeUiLibrary = [];
|
|
159
|
+
let componentsPathsLoadedAfterUiLibrary = [];
|
|
160
|
+
let uiLibraryPassed = false;
|
|
161
|
+
const indexFileData = fs.readFileSync(customComponentsFilesPath, 'utf8');
|
|
162
|
+
const { exportList, defaultExports }= getExportList(indexFileData);
|
|
163
|
+
const sfbDirectExportsList = getSfbThemeComponentsList();
|
|
164
|
+
const {
|
|
165
|
+
overridenScss: rootIndexOverridenScss
|
|
166
|
+
} = customComponentsExportsTraversal(defaultExports);
|
|
167
|
+
|
|
168
|
+
defaultExports.forEach(exportedItem => {
|
|
169
|
+
if(sfbDirectExportsList.includes(exportedItem.alias)) {
|
|
170
|
+
overridesJavaScript.add(exportedItem.alias);
|
|
171
|
+
if(rootIndexOverridenScss.includes(exportedItem.alias)) {
|
|
172
|
+
overridesSass.add(exportedItem.alias);
|
|
173
|
+
}
|
|
174
|
+
} else {
|
|
175
|
+
userDefinedCustomComponents.add(exportedItem.alias);
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
exportList.forEach(exportPath => {
|
|
180
|
+
if(uiLibraryPassed) {
|
|
181
|
+
componentsPathsLoadedAfterUiLibrary.push(exportPath);
|
|
182
|
+
} else {
|
|
183
|
+
if(exportPath.includes(THEME_COMPONENT_MODULE)) {
|
|
184
|
+
uiLibraryPassed = true;
|
|
185
|
+
} else {
|
|
186
|
+
componentsPathsLoadedBeforeUiLibrary.push(exportPath);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
const {
|
|
192
|
+
allDefaultExports: directExportsBeforeUiLibrary,
|
|
193
|
+
overridenScss: overridenScssBefore
|
|
194
|
+
} = customComponentsExportsTraversal(componentsPathsLoadedBeforeUiLibrary);
|
|
195
|
+
|
|
196
|
+
const {
|
|
197
|
+
allDefaultExports: directExportsAfterUiLibrary,
|
|
198
|
+
overridenScss: overridenScssAfter
|
|
199
|
+
} = customComponentsExportsTraversal(componentsPathsLoadedAfterUiLibrary);
|
|
200
|
+
|
|
201
|
+
directExportsBeforeUiLibrary.forEach(exportedItem => {
|
|
202
|
+
if(sfbDirectExportsList.includes(exportedItem.alias)) {
|
|
203
|
+
overridesJavaScript.add(exportedItem.alias);
|
|
204
|
+
if(overridenScssBefore.includes(exportedItem.alias)) {
|
|
205
|
+
overridesSass.add(exportedItem.alias);
|
|
206
|
+
}
|
|
207
|
+
} else if (sfbDirectExportsList.includes(exportedItem)) {
|
|
208
|
+
if(overridenScssBefore.includes(exportedItem)) {
|
|
209
|
+
overridesSass.add(exportedItem);
|
|
210
|
+
}
|
|
211
|
+
} else {
|
|
212
|
+
userDefinedCustomComponents.add(exportedItem.alias);
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
directExportsAfterUiLibrary.forEach(exportedItem => {
|
|
217
|
+
if(sfbDirectExportsList.includes(exportedItem.alias)) {
|
|
218
|
+
if(overridenScssAfter.includes(exportedItem.alias)) {
|
|
219
|
+
overridesSass.add(exportedItem.alias);
|
|
220
|
+
}
|
|
221
|
+
} else if(sfbDirectExportsList.includes(exportedItem)) {
|
|
222
|
+
if(overridenScssAfter.includes(exportedItem)) {
|
|
223
|
+
overridesSass.add(exportedItem);
|
|
224
|
+
}
|
|
225
|
+
} else {
|
|
226
|
+
userDefinedCustomComponents.add(exportedItem.alias);
|
|
227
|
+
}
|
|
228
|
+
})
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return {
|
|
232
|
+
overridesJavaScript: [...overridesJavaScript].sort(),
|
|
233
|
+
overridesSass: [...overridesSass].sort(),
|
|
234
|
+
userDefinedCustomComponents: [...userDefinedCustomComponents].sort()
|
|
235
|
+
}
|
|
236
|
+
} catch (error) {
|
|
237
|
+
console.error(chalk.red(`\n ERROR: Unable to obtain Custom Components information due to: ${error}.\n`));
|
|
238
|
+
return {
|
|
239
|
+
overridesJavaScript: [],
|
|
240
|
+
overridesSass: [],
|
|
241
|
+
userDefinedCustomComponents: []
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const getSfbThemeComponentsVersion = () => {
|
|
247
|
+
let sfbThemeComponentsVersion = "N/A";
|
|
248
|
+
const hasPackageJson = fs.existsSync(`${ACTIVE_THEME_PATH}/package.json`);
|
|
249
|
+
if (hasPackageJson) {
|
|
250
|
+
const themePackageJson = JSON.parse(fs.readFileSync(`${ACTIVE_THEME_PATH}/package.json`));
|
|
251
|
+
const sfbVersion = themePackageJson.dependencies['@appdirect/sfb-theme-components'];
|
|
252
|
+
const foundSfbVersion = sfbVersion && sfbVersion.match(/\d+\.\d+\.\d+/)[0];
|
|
253
|
+
if(foundSfbVersion) {
|
|
254
|
+
sfbThemeComponentsVersion = foundSfbVersion;
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
return sfbThemeComponentsVersion;
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
module.exports = {
|
|
261
|
+
getCustomComponentsInfo,
|
|
262
|
+
customComponentsEnabled,
|
|
263
|
+
getSfbThemeComponentsVersion
|
|
264
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const chalk = require("chalk");
|
|
2
|
+
|
|
3
|
+
const { shouldBeProjectFolder } = require("./toolkit-common-fun");
|
|
4
|
+
|
|
5
|
+
const { getCustomComponentsInfo, customComponentsEnabled } = require("./toolkit-components-fun");
|
|
6
|
+
|
|
7
|
+
// check if user is in correct location
|
|
8
|
+
shouldBeProjectFolder(true);
|
|
9
|
+
|
|
10
|
+
(() => {
|
|
11
|
+
try {
|
|
12
|
+
if(customComponentsEnabled) {
|
|
13
|
+
const { overridesJavaScript, overridesSass, userDefinedCustomComponents } = getCustomComponentsInfo();
|
|
14
|
+
console.log('Overrides Components JS:', overridesJavaScript);
|
|
15
|
+
console.log('Overrides Components SCSS:', overridesSass);
|
|
16
|
+
console.log('User Defined Components/Atoms:', userDefinedCustomComponents);
|
|
17
|
+
} else {
|
|
18
|
+
console.log('Custom components are not enabled for this theme.');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
} catch ( err ) {
|
|
22
|
+
console.error(chalk.red(`\n ERROR: Unable to find configuration for current project due to: ${err}.\n`));
|
|
23
|
+
}
|
|
24
|
+
})();
|
|
@@ -4,7 +4,7 @@ const prompt = require("./prompt-questions");
|
|
|
4
4
|
const { shouldBeProjectFolder, installSfbThemeComponents,
|
|
5
5
|
createPackageJson, updateCustomComponentsMetadata, installSass } = require("./toolkit-common-fun");
|
|
6
6
|
const { ACTIVE_THEME_PATH, TOOLKIT_PATH } = require("./toolkit-common-vars");
|
|
7
|
-
|
|
7
|
+
const { customComponentsEnabled } = require("./toolkit-components-fun");
|
|
8
8
|
shouldBeProjectFolder(true);
|
|
9
9
|
|
|
10
10
|
const addCustomCompToBase = (baseFilePath, data) => {
|
|
@@ -21,9 +21,9 @@ const settingsSchemaData = `{ "useComponents": true }`;
|
|
|
21
21
|
(async () => {
|
|
22
22
|
const baseFilePath = `${ACTIVE_THEME_PATH}/content/layout/base.html`;
|
|
23
23
|
const customComponentsPath = `${ACTIVE_THEME_PATH}/customComponents`
|
|
24
|
-
const
|
|
24
|
+
const areCustomComponentsEnabled = customComponentsEnabled();
|
|
25
25
|
|
|
26
|
-
if(!
|
|
26
|
+
if(!areCustomComponentsEnabled) {
|
|
27
27
|
const customComponents = await prompt.ask(["InstallCustomComponents"]);
|
|
28
28
|
if(customComponents.InstallCustomComponents.toLowerCase() !== "y") {
|
|
29
29
|
return;
|
|
@@ -42,7 +42,7 @@ const settingsSchemaData = `{ "useComponents": true }`;
|
|
|
42
42
|
})
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
if (!
|
|
45
|
+
if (!areCustomComponentsEnabled) {
|
|
46
46
|
try {
|
|
47
47
|
fs.copySync(`${TOOLKIT_PATH}/customComponents`, customComponentsPath)
|
|
48
48
|
} catch (error) {
|