@appdirect/sfb-toolkit 4.0.22 → 4.0.24

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.
Files changed (70) hide show
  1. package/bin/index.js +92 -14
  2. package/coverage/clover.xml +32 -32
  3. package/coverage/coverage-final.json +4 -4
  4. package/coverage/lcov-report/constants/customUserAttributesMock.js.html +1 -1
  5. package/coverage/lcov-report/constants/index.html +1 -1
  6. package/coverage/lcov-report/constants/pageUrls.js.html +1 -1
  7. package/coverage/lcov-report/constants/userMock.js.html +1 -1
  8. package/coverage/lcov-report/controllers/controllers-utils/assetsUtils.js.html +1 -1
  9. package/coverage/lcov-report/controllers/controllers-utils/index.html +1 -1
  10. package/coverage/lcov-report/controllers/data-filters/bootstrap-data-filter.js.html +1 -1
  11. package/coverage/lcov-report/controllers/data-filters/call-to-actions-filter.js.html +1 -1
  12. package/coverage/lcov-report/controllers/data-filters/index.html +1 -1
  13. package/coverage/lcov-report/controllers/index.html +1 -1
  14. package/coverage/lcov-report/controllers/index.js.html +1 -1
  15. package/coverage/lcov-report/front-end-utils/src/components/base/ResultItem.js.html +7 -7
  16. package/coverage/lcov-report/front-end-utils/src/components/base/SearchBar.js.html +3 -3
  17. package/coverage/lcov-report/front-end-utils/src/components/base/index.html +1 -1
  18. package/coverage/lcov-report/front-end-utils/src/components/base/item.js.html +11 -11
  19. package/coverage/lcov-report/front-end-utils/src/components/container.js.html +1 -1
  20. package/coverage/lcov-report/front-end-utils/src/components/data-view.js.html +1 -1
  21. package/coverage/lcov-report/front-end-utils/src/components/header-view.js.html +1 -1
  22. package/coverage/lcov-report/front-end-utils/src/components/index.html +1 -1
  23. package/coverage/lcov-report/front-end-utils/src/components/search.js.html +13 -13
  24. package/coverage/lcov-report/front-end-utils/src/constants/index.html +1 -1
  25. package/coverage/lcov-report/front-end-utils/src/constants/pageUrl.js.html +1 -1
  26. package/coverage/lcov-report/front-end-utils/src/constants/roleType.js.html +1 -1
  27. package/coverage/lcov-report/front-end-utils/src/constants/searchType.js.html +1 -1
  28. package/coverage/lcov-report/front-end-utils/src/utils/debounce.js.html +1 -1
  29. package/coverage/lcov-report/front-end-utils/src/utils/index.html +1 -1
  30. package/coverage/lcov-report/index.html +1 -1
  31. package/coverage/lcov-report/middlewares/config.js.html +1 -1
  32. package/coverage/lcov-report/middlewares/index.html +1 -1
  33. package/coverage/lcov-report/tools/index.html +1 -1
  34. package/coverage/lcov-report/tools/proxy-fetch.js.html +1 -1
  35. package/coverage/lcov.info +81 -81
  36. package/customComponents/index.js +10 -2
  37. package/npm-shrinkwrap.json +144 -20
  38. package/package.json +4 -4
  39. package/readme.md +9 -0
  40. package/src/boilerplates/AddComponent/AddComponent.jsx +234 -0
  41. package/src/boilerplates/AddComponent/styles/AddComponent.scss +47 -0
  42. package/src/tools/prompt-questions.js +109 -14
  43. package/src/tools/toolkit-common-fun.js +30 -15
  44. package/src/tools/toolkit-common-vars-namespace.js +106 -0
  45. package/src/tools/toolkit-common-vars.js +1 -1
  46. package/src/tools/toolkit-components-add.js +334 -0
  47. package/src/tools/toolkit-components-copy.js +78 -46
  48. package/src/tools/toolkit-components-delete.js +370 -0
  49. package/src/tools/toolkit-components-fun.js +126 -7
  50. package/src/tools/toolkit-components-info.js +6 -4
  51. package/src/tools/toolkit-components-vars.js +50 -0
  52. package/src/tools/toolkit-components.js +1 -1
  53. package/src/tools/toolkit-create.js +2 -3
  54. package/src/tools/toolkit-import.js +182 -0
  55. package/src/tools/toolkit-install.js +6 -5
  56. package/src/tools/toolkit-package.js +3 -0
  57. package/src/tools/toolkit-setup.js +1 -1
  58. package/src/tools/toolkit-start.js +4 -1
  59. package/src/tools/toolkit-storybook.js +136 -48
  60. package/src/tools/toolkit-zip-utils.js +35 -0
  61. package/src/tools/zip-theme.js +62 -50
  62. package/themes-config.json +0 -7
  63. package/customComponents/atoms/label/Label.jsx +0 -20
  64. package/customComponents/atoms/label/stories/Label.story.mdx +0 -20
  65. package/customComponents/atoms/label/styles/Label.scss +0 -4
  66. package/customComponents/components/atoms-showcase-custom/AtomsShowcaseCustom.jsx +0 -8
  67. package/customComponents/components/atoms-showcase-custom/stories/AtomsShowcaseCustom.story.mdx +0 -17
  68. package/customComponents/components/atoms-showcase-modules/AtomsShowcaseModules.jsx +0 -223
  69. package/customComponents/components/atoms-showcase-modules/stories/AtomsShowcaseModules.story.mdx +0 -49
  70. package/customComponents/components/index.js +0 -2
package/bin/index.js CHANGED
@@ -1,11 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const { Command } = require("commander")
3
+ const { Command, Option } = require("commander")
4
4
  const { spawn } = require("child_process")
5
+ const chalk = require("chalk")
5
6
  const {
6
7
  shouldNotBeInExtensionsFolder,
7
8
  } = require("../src/tools/toolkit-common-utils")
8
9
 
10
+ const { PAGE_NAME_TO_NAMESPACE } = require("../src/tools/toolkit-common-vars-namespace")
11
+ const { COMPONENTS_DELETE_FLAG_SHORT, COMPONENTS_DELETE_FLAG_FULL, INDEX_EXPORT_COMMENT_OUT,
12
+ INDEX_EXPORT_REPLACE, INDEX_EXPORT_NO_CHANGE } = require('../src/tools/toolkit-components-vars')
13
+
9
14
  const PROJECT_SETUP_PATH = "src/tools/toolkit-setup.js"
10
15
  const PROJECT_SETUP_E2E_PATH = "src/tools/toolkit-setup-e2e.js"
11
16
  const PROJECT_CONFIG_SETUP_PATH = "src/tools/toolkit-config-setup.js"
@@ -23,10 +28,15 @@ const INSTALL = "src/tools/toolkit-install.js"
23
28
  const COMPONENTS = "src/tools/toolkit-components.js"
24
29
  const COMPONENTS_INFO = "src/tools/toolkit-components-info.js"
25
30
  const DEV_E2E = "src/tools/toolkit-dev-e2e.js"
26
- // const COMPONENTS_COPY = "src/tools/toolkit-components-copy.js"
31
+ const COMPONENTS_ADD = "src/tools/toolkit-components-add.js"
32
+ const IMPORT_PATH = "src/tools/toolkit-import.js"
33
+ const COMPONENTS_COPY = "src/tools/toolkit-components-copy.js"
34
+ const COMPONENTS_DELETE = "src/tools/toolkit-components-delete.js"
27
35
 
28
36
  const program = new Command()
29
37
 
38
+ const DEPRECATED_COMMAND_PREFIX = chalk.bold.bgRed(" DEPRECATED ");
39
+
30
40
  program
31
41
  .command("setup [name]")
32
42
  .description("Creates a new project")
@@ -38,7 +48,7 @@ program
38
48
  })
39
49
 
40
50
  program
41
- .command("setup-e2e-theme")
51
+ .command("setup-e2e-theme", { hidden: true })
42
52
  .description("Creates a new project for e2e tests")
43
53
  .action((name) => {
44
54
  spawn(`node "${__dirname}/../${PROJECT_SETUP_E2E_PATH}" ${name}`, {
@@ -149,7 +159,11 @@ program
149
159
 
150
160
  program
151
161
  .command("storybook")
152
- .description("Start storybook for the currently selected theme.")
162
+ .description(
163
+ `${DEPRECATED_COMMAND_PREFIX} Start storybook for the currently selected theme. ${chalk.bold.red(
164
+ "\nCan only be used with themes previously configured with Storybook."
165
+ )}`
166
+ )
153
167
  .action(() => {
154
168
  let majorVersion = 0
155
169
 
@@ -207,18 +221,69 @@ program
207
221
  })
208
222
  })
209
223
 
210
- // program
211
- // .command("components-copy [components...]")
212
- // .description("Clone custom components")
213
- // .action((components) => {
214
- // spawn(`node "${__dirname}/../${COMPONENTS_COPY}" ${components}`, {
215
- // stdio: "inherit",
216
- // shell: true,
217
- // })
218
- // })
224
+ program
225
+ .command("components-copy [components...]")
226
+ .addOption( new Option(`-r, --${INDEX_EXPORT_REPLACE}`,
227
+ 'Replace existing exported components with those provided.').conflicts(['comment', 'skip']))
228
+ .addOption( new Option(`-c, --${INDEX_EXPORT_COMMENT_OUT}`,
229
+ 'Comment out existing exported components and add those provided.').conflicts(['replace', 'skip']))
230
+ .addOption( new Option(`-s, --${INDEX_EXPORT_NO_CHANGE}`,
231
+ 'Do nothing. (Manual index Update will be required)').conflicts(['replace', 'comment']))
232
+ .description(`${chalk.bold.bgRed(' BETA ')} Copy custom components`)
233
+ .action((components, options) => {
234
+ const hasFlagArgument = Object.keys(options).length !== 0;
235
+ const hasComponentArguments = components.length !== 0;
236
+
237
+ if(hasFlagArgument === hasComponentArguments) {
238
+ spawn(`node "${__dirname}/../${COMPONENTS_COPY}" "${hasFlagArgument && JSON.stringify({
239
+ [`"${INDEX_EXPORT_REPLACE}"`]: options[INDEX_EXPORT_REPLACE] && JSON.stringify(components),
240
+ [`"${INDEX_EXPORT_COMMENT_OUT}"`]: options[INDEX_EXPORT_COMMENT_OUT] && JSON.stringify(components),
241
+ [`"${INDEX_EXPORT_NO_CHANGE}"`]: options[INDEX_EXPORT_NO_CHANGE] && JSON.stringify(components)
242
+ })}"`, {
243
+ stdio: "inherit",
244
+ shell: true,
245
+ })
246
+ } else if(hasFlagArgument) {
247
+ console.log('error: missing [components] argument');
248
+ } else {
249
+ console.log('error: missing [-flag] argument');
250
+ }
251
+ })
252
+
253
+ program
254
+ .command("components-delete")
255
+ .description(`${chalk.bold.bgRed(' BETA ')} Delete custom components`)
256
+ .option(`${COMPONENTS_DELETE_FLAG_SHORT}, ${COMPONENTS_DELETE_FLAG_FULL} <sfbVersion> <components...>`,
257
+ 'Delete all specified [components] found in sfb_theme_components[sfbVersion]')
258
+ .action(() => {
259
+ spawn(`node "${__dirname}/../${COMPONENTS_DELETE}" ${process.argv.slice(3)}`, {
260
+ stdio: "inherit",
261
+ shell: true,
262
+ })
263
+ })
264
+
265
+ program
266
+ .command("components-add")
267
+ .argument("[name]", "Component name (letters and numbers only)")
268
+ .addOption(
269
+ new Option("-p, --page <page>", "Page name").choices(
270
+ Object.keys(PAGE_NAME_TO_NAMESPACE)
271
+ )
272
+ )
273
+ .option("-o, --orderable", "Whether the component is orderable", false)
274
+ .description(`${chalk.bold.bgRed(' BETA ')} Add a new component`)
275
+ .action((name, options) => {
276
+ spawn(
277
+ `node "${__dirname}/../${COMPONENTS_ADD}" ${name} ${options.page} ${options.orderable}`,
278
+ {
279
+ stdio: "inherit",
280
+ shell: true,
281
+ }
282
+ )
283
+ })
219
284
 
220
285
  program
221
- .command("use-local-sfb-components")
286
+ .command("use-local-sfb-components", { hidden: true })
222
287
  .description("Setup theme to use local sfb-components bundles for e2e")
223
288
  .action(() => {
224
289
  spawn(`node "${__dirname}/../${DEV_E2E}"`, {
@@ -251,6 +316,19 @@ program
251
316
  })
252
317
  })
253
318
 
319
+ program
320
+ .command("import [themePath] [marketplacePath] [themeName]")
321
+ .description(`${chalk.bold.bgRed(' BETA ')} Imports a theme`)
322
+ .action((themePath, marketplacePath, themeName) => {
323
+ spawn(
324
+ `node "${__dirname}/../${IMPORT_PATH}" ${themePath} ${marketplacePath} ${themeName}`,
325
+ {
326
+ stdio: "inherit",
327
+ shell: true,
328
+ }
329
+ )
330
+ })
331
+
254
332
  shouldNotBeInExtensionsFolder()
255
333
  program.parse(process.argv)
256
334
 
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <coverage generated="1707832764423" clover="3.2.0">
3
- <project timestamp="1707832764423" name="All files">
2
+ <coverage generated="1710962461627" clover="3.2.0">
3
+ <project timestamp="1710962461627" 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"/>
@@ -367,9 +367,9 @@
367
367
  <file name="search.js" path="/var/jenkins/workspace/sf-devtools-pipeline-release-to-npm/src/front-end-utils/src/components/search.js">
368
368
  <metrics statements="76" coveredstatements="73" conditionals="57" coveredconditionals="47" methods="31" coveredmethods="29"/>
369
369
  <line num="13" count="2" type="stmt"/>
370
- <line num="15" count="58" type="cond" truecount="2" falsecount="0"/>
371
- <line num="17" count="58" type="cond" truecount="2" falsecount="0"/>
372
- <line num="25" count="58" type="cond" truecount="2" falsecount="0"/>
370
+ <line num="15" count="57" type="cond" truecount="2" falsecount="0"/>
371
+ <line num="17" count="57" type="cond" truecount="2" falsecount="0"/>
372
+ <line num="25" count="57" type="cond" truecount="2" falsecount="0"/>
373
373
  <line num="29" count="2" type="stmt"/>
374
374
  <line num="40" count="2" type="stmt"/>
375
375
  <line num="48" count="2" type="stmt"/>
@@ -386,13 +386,13 @@
386
386
  <line num="90" count="5" type="cond" truecount="1" falsecount="1"/>
387
387
  <line num="91" count="5" type="stmt"/>
388
388
  <line num="98" count="11" type="cond" truecount="2" falsecount="0"/>
389
- <line num="103" count="17" type="stmt"/>
390
- <line num="104" count="17" type="cond" truecount="2" falsecount="0"/>
389
+ <line num="103" count="16" type="stmt"/>
390
+ <line num="104" count="16" type="cond" truecount="2" falsecount="0"/>
391
391
  <line num="105" count="4" type="stmt"/>
392
- <line num="114" count="13" type="cond" truecount="1" falsecount="1"/>
393
- <line num="115" count="13" type="stmt"/>
392
+ <line num="114" count="12" type="cond" truecount="1" falsecount="1"/>
393
+ <line num="115" count="12" type="stmt"/>
394
394
  <line num="131" count="0" type="stmt"/>
395
- <line num="136" count="17" type="stmt"/>
395
+ <line num="136" count="16" type="stmt"/>
396
396
  <line num="140" count="7" type="stmt"/>
397
397
  <line num="141" count="7" type="stmt"/>
398
398
  <line num="143" count="7" type="cond" truecount="2" falsecount="0"/>
@@ -413,7 +413,7 @@
413
413
  <line num="185" count="8" type="stmt"/>
414
414
  <line num="186" count="8" type="stmt"/>
415
415
  <line num="189" count="8" type="stmt"/>
416
- <line num="190" count="5" type="stmt"/>
416
+ <line num="190" count="4" type="stmt"/>
417
417
  <line num="196" count="13" type="stmt"/>
418
418
  <line num="197" count="10" type="stmt"/>
419
419
  <line num="198" count="10" type="cond" truecount="4" falsecount="0"/>
@@ -439,9 +439,9 @@
439
439
  <line num="244" count="5" type="stmt"/>
440
440
  <line num="250" count="5" type="cond" truecount="1" falsecount="1"/>
441
441
  <line num="251" count="5" type="stmt"/>
442
- <line num="266" count="58" type="stmt"/>
443
- <line num="267" count="58" type="stmt"/>
444
- <line num="290" count="17" type="cond" truecount="2" falsecount="0"/>
442
+ <line num="266" count="57" type="stmt"/>
443
+ <line num="267" count="57" type="stmt"/>
444
+ <line num="290" count="16" type="cond" truecount="2" falsecount="0"/>
445
445
  </file>
446
446
  </package>
447
447
  <package name="front-end-utils.src.components.base">
@@ -449,12 +449,12 @@
449
449
  <file name="ResultItem.js" path="/var/jenkins/workspace/sf-devtools-pipeline-release-to-npm/src/front-end-utils/src/components/base/ResultItem.js">
450
450
  <metrics statements="33" coveredstatements="24" conditionals="29" coveredconditionals="15" methods="12" coveredmethods="7"/>
451
451
  <line num="10" count="2" type="stmt"/>
452
- <line num="12" count="18" type="cond" truecount="2" falsecount="0"/>
452
+ <line num="12" count="17" type="cond" truecount="2" falsecount="0"/>
453
453
  <line num="14" count="2" type="stmt"/>
454
454
  <line num="19" count="2" type="stmt"/>
455
- <line num="21" count="18" type="cond" truecount="1" falsecount="1"/>
455
+ <line num="21" count="17" type="cond" truecount="1" falsecount="1"/>
456
456
  <line num="24" count="2" type="stmt"/>
457
- <line num="26" count="18" type="cond" truecount="2" falsecount="0"/>
457
+ <line num="26" count="17" type="cond" truecount="2" falsecount="0"/>
458
458
  <line num="30" count="2" type="stmt"/>
459
459
  <line num="34" count="2" type="stmt"/>
460
460
  <line num="41" count="2" type="stmt"/>
@@ -478,9 +478,9 @@
478
478
  <line num="95" count="0" type="stmt"/>
479
479
  <line num="97" count="0" type="stmt"/>
480
480
  <line num="102" count="0" type="stmt"/>
481
- <line num="110" count="18" type="stmt"/>
482
- <line num="111" count="18" type="stmt"/>
483
- <line num="112" count="18" type="stmt"/>
481
+ <line num="110" count="17" type="stmt"/>
482
+ <line num="111" count="17" type="stmt"/>
483
+ <line num="112" count="17" type="stmt"/>
484
484
  </file>
485
485
  <file name="SearchBar.js" path="/var/jenkins/workspace/sf-devtools-pipeline-release-to-npm/src/front-end-utils/src/components/base/SearchBar.js">
486
486
  <metrics statements="11" coveredstatements="11" conditionals="0" coveredconditionals="0" methods="3" coveredmethods="1"/>
@@ -493,29 +493,29 @@
493
493
  <line num="53" count="2" type="stmt"/>
494
494
  <line num="71" count="2" type="stmt"/>
495
495
  <line num="79" count="2" type="stmt"/>
496
- <line num="94" count="58" type="stmt"/>
497
- <line num="95" count="58" type="stmt"/>
496
+ <line num="94" count="57" type="stmt"/>
497
+ <line num="95" count="57" type="stmt"/>
498
498
  </file>
499
499
  <file name="item.js" path="/var/jenkins/workspace/sf-devtools-pipeline-release-to-npm/src/front-end-utils/src/components/base/item.js">
500
500
  <metrics statements="18" coveredstatements="18" conditionals="12" coveredconditionals="12" methods="11" coveredmethods="9"/>
501
501
  <line num="5" count="2" type="stmt"/>
502
- <line num="9" count="257" type="cond" truecount="2" falsecount="0"/>
503
- <line num="23" count="257" type="stmt"/>
504
- <line num="26" count="257" type="cond" truecount="2" falsecount="0"/>
505
- <line num="27" count="257" type="cond" truecount="2" falsecount="0"/>
506
- <line num="29" count="257" type="cond" truecount="2" falsecount="0"/>
502
+ <line num="9" count="256" type="cond" truecount="2" falsecount="0"/>
503
+ <line num="23" count="256" type="stmt"/>
504
+ <line num="26" count="256" type="cond" truecount="2" falsecount="0"/>
505
+ <line num="27" count="256" type="cond" truecount="2" falsecount="0"/>
506
+ <line num="29" count="256" type="cond" truecount="2" falsecount="0"/>
507
507
  <line num="33" count="2" type="stmt"/>
508
- <line num="36" count="257" type="stmt"/>
509
- <line num="40" count="257" type="cond" truecount="2" falsecount="0"/>
508
+ <line num="36" count="256" type="stmt"/>
509
+ <line num="40" count="256" type="cond" truecount="2" falsecount="0"/>
510
510
  <line num="42" count="2" type="stmt"/>
511
511
  <line num="46" count="2" type="stmt"/>
512
512
  <line num="50" count="2" type="stmt"/>
513
- <line num="54" count="257" type="cond" truecount="2" falsecount="0"/>
513
+ <line num="54" count="256" type="cond" truecount="2" falsecount="0"/>
514
514
  <line num="57" count="2" type="stmt"/>
515
515
  <line num="67" count="2" type="stmt"/>
516
516
  <line num="80" count="2" type="stmt"/>
517
- <line num="105" count="257" type="stmt"/>
518
- <line num="106" count="257" type="stmt"/>
517
+ <line num="105" count="256" type="stmt"/>
518
+ <line num="106" count="256" type="stmt"/>
519
519
  </file>
520
520
  </package>
521
521
  <package name="front-end-utils.src.constants">