@ebay/skin 16.0.0 → 16.1.0-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (268) hide show
  1. package/.github/workflows/jekyll-gh-pages.yml +1 -1
  2. package/.percy.yml +4 -3
  3. package/.prettierrc.json +1 -12
  4. package/.storybook/main.js +44 -40
  5. package/.storybook/manager.js +6 -6
  6. package/.storybook/preview-head.html +49 -11
  7. package/.storybook/theme.js +9 -9
  8. package/.stylelintrc +80 -73
  9. package/ICON-CREATION.md +22 -45
  10. package/README.md +1 -1
  11. package/_cdn/skin/v16.1.0-0/skin-default.min.css +6 -0
  12. package/_cdn/skin/v16.1.0-0/skin-full.min.css +6 -0
  13. package/_cdn/skin/v16.1.0-0/skin-headless.min.css +6 -0
  14. package/_cdn/skin/v16.1.0-0/skin-legacy.min.css +6 -0
  15. package/dist/alert-dialog/alert-dialog.css +16 -11
  16. package/dist/breadcrumbs/breadcrumbs.css +1 -1
  17. package/dist/button/button.css +3 -5
  18. package/dist/calendar/calendar.css +1 -4
  19. package/dist/carousel/carousel.css +11 -15
  20. package/dist/combobox/combobox.css +0 -2
  21. package/dist/confirm-dialog/confirm-dialog.css +16 -11
  22. package/dist/date-textbox/date-textbox.css +1 -1
  23. package/dist/drawer-dialog/drawer-dialog.css +11 -8
  24. package/dist/fullscreen-dialog/fullscreen-dialog.css +11 -8
  25. package/dist/icon/icon.css +17 -5
  26. package/dist/image-placeholder/image-placeholder.css +4 -0
  27. package/dist/infotip/infotip.css +2 -5
  28. package/dist/legacy-theme/legacy-theme.css +2 -2
  29. package/dist/legacy-tokens/ds4-light.css +2 -0
  30. package/dist/lightbox-dialog/lightbox-dialog.css +24 -17
  31. package/dist/listbox/listbox.css +0 -2
  32. package/dist/listbox-button/listbox-button.css +0 -2
  33. package/dist/menu/menu.css +0 -2
  34. package/dist/menu-button/menu-button.css +0 -2
  35. package/dist/mixins/utility-mixins.less +1 -4
  36. package/dist/page-grid/page-grid.css +15 -5
  37. package/dist/page-notice/page-notice.css +1 -1
  38. package/dist/panel-dialog/panel-dialog.css +12 -9
  39. package/dist/progress-bar/progress-bar.css +1 -1
  40. package/dist/progress-stepper/progress-stepper.css +1 -1
  41. package/dist/section-notice/section-notice.css +1 -1
  42. package/dist/section-title/section-title.css +1 -1
  43. package/dist/snackbar-dialog/snackbar-dialog.css +7 -1
  44. package/dist/square-corner-theme/square-corner-theme.css +3 -3
  45. package/dist/svg/icon/icon-bookmark-16.svg +7 -0
  46. package/dist/svg/icon/icon-bookmark-24.svg +7 -0
  47. package/dist/svg/icon/icon-play-filled-16-colored.svg +13 -0
  48. package/dist/svg/icon/icon-play-filled-24-colored.svg +11 -0
  49. package/dist/svg/icon/image-placeholder.svg +3 -0
  50. package/dist/svg/icons.svg +49 -11
  51. package/dist/toast-dialog/toast-dialog.css +7 -1
  52. package/dist/tokens/evo-dark.css +2 -0
  53. package/dist/tokens/evo-light.css +2 -0
  54. package/dist/tooltip/tooltip.css +2 -5
  55. package/dist/tourtip/tourtip.css +2 -5
  56. package/dist/typography/typography.css +1 -1
  57. package/dist/utility/utility.css +2 -8
  58. package/dist/video/video.css +1 -4
  59. package/image-placeholder.browser.json +1 -0
  60. package/image-placeholder.css +1 -0
  61. package/image-placeholder.js +1 -0
  62. package/image-placeholder.mjs +1 -0
  63. package/index.browser.json +1 -0
  64. package/index.css +1 -0
  65. package/index.js +1 -0
  66. package/index.mjs +1 -0
  67. package/package.json +12 -12
  68. package/scripts/develop-module_proper/code-generators/doc-generator.js +32 -16
  69. package/scripts/develop-module_proper/code-generators/style-generator.js +89 -34
  70. package/scripts/develop-module_proper/code-generators/test-generator.js +18 -12
  71. package/scripts/develop-module_proper/errors/illegal-input.js +1 -1
  72. package/scripts/develop-module_proper/index.js +6 -6
  73. package/scripts/develop-module_proper/input/module-name.js +9 -7
  74. package/scripts/develop-module_proper/input/parse-input.js +10 -8
  75. package/scripts/develop-module_proper/util/line-writer.js +31 -18
  76. package/scripts/develop-module_proper/util/title-case.js +4 -3
  77. package/scripts/generate-bundle.js +58 -33
  78. package/scripts/generate-images.js +72 -45
  79. package/scripts/generate-imports/config.json +21 -3
  80. package/scripts/generate-imports/index.js +35 -29
  81. package/scripts/generate-imports/module-builder.js +58 -36
  82. package/scripts/import-svgs.js +33 -25
  83. package/scripts/index.js +68 -68
  84. package/scripts/jekyll-config.js +8 -5
  85. package/scripts/log.js +5 -3
  86. package/scripts/split-icon.js +20 -15
  87. package/scripts/storybook/copy.js +29 -10
  88. package/scripts/svgo.config.js +42 -42
  89. package/scripts/util.js +15 -11
  90. package/scripts/verify-build.js +12 -12
  91. package/src/fonts/marketsans/MarketSans-Regular-WebS.css +6 -3
  92. package/src/fonts/marketsans/MarketSans-SemiBold-WebS.css +6 -3
  93. package/src/less/alert-dialog/alert-dialog.less +5 -6
  94. package/src/less/alert-dialog/stories/alert-dialog.stories.js +1 -1
  95. package/src/less/badge/stories/badge.stories.js +1 -1
  96. package/src/less/breadcrumbs/breadcrumbs.less +5 -2
  97. package/src/less/breadcrumbs/stories/button-cascade.stories.js +1 -1
  98. package/src/less/breadcrumbs/stories/button-overflow.stories.js +1 -1
  99. package/src/less/breadcrumbs/stories/buttons.stories.js +1 -1
  100. package/src/less/breadcrumbs/stories/link-cascade.stories.js +1 -1
  101. package/src/less/breadcrumbs/stories/link-overflow.stories.js +1 -1
  102. package/src/less/breadcrumbs/stories/links.stories.js +1 -1
  103. package/src/less/bundles/skin-headless.less +1 -0
  104. package/src/less/button/button.less +16 -10
  105. package/src/less/button/stories/button/base.stories.js +1 -1
  106. package/src/less/button/stories/button/borderless.stories.js +5 -3
  107. package/src/less/button/stories/button/cascade.stories.js +1 -1
  108. package/src/less/button/stories/button/dimensions.stories.js +1 -1
  109. package/src/less/button/stories/button/primary.stories.js +3 -2
  110. package/src/less/button/stories/button/secondary.stories.js +3 -2
  111. package/src/less/button/stories/button/tertiary.stories.js +1 -1
  112. package/src/less/button/stories/destructive-button/primary.stories.js +1 -1
  113. package/src/less/button/stories/destructive-button/secondary.stories.js +1 -1
  114. package/src/less/button/stories/destructive-button/tertiary.stories.js +1 -1
  115. package/src/less/button/stories/fake-button/base.stories.js +3 -2
  116. package/src/less/button/stories/fake-button/cascade.stories.js +1 -1
  117. package/src/less/button/stories/fake-button/dimensions.stories.js +1 -1
  118. package/src/less/button/stories/fake-button/primary.stories.js +1 -1
  119. package/src/less/button/stories/fake-button/secondary.stories.js +1 -1
  120. package/src/less/calendar/calendar.less +21 -10
  121. package/src/less/calendar/stories/calendar.stories.js +317 -88
  122. package/src/less/carousel/carousel.less +14 -9
  123. package/src/less/carousel/stories/carousel.stories.js +1 -1
  124. package/src/less/checkbox/checkbox.less +14 -5
  125. package/src/less/checkbox/stories/checked.stories.js +1 -1
  126. package/src/less/checkbox/stories/mixed.stories.js +1 -1
  127. package/src/less/checkbox/stories/unchecked.stories.js +1 -1
  128. package/src/less/combobox/combobox.less +4 -1
  129. package/src/less/combobox/stories/combobox.stories.js +1 -1
  130. package/src/less/confirm-dialog/confirm-dialog.less +5 -6
  131. package/src/less/confirm-dialog/stories/confirm-dialog.stories.js +1 -1
  132. package/src/less/cta-button/stories/cascade.stories.js +1 -1
  133. package/src/less/cta-button/stories/cta-button.stories.js +1 -1
  134. package/src/less/cta-button/stories/dimensions.stories.js +1 -1
  135. package/src/less/date-textbox/date-textbox.less +1 -1
  136. package/src/less/details/stories/cascade.stories.js +1 -1
  137. package/src/less/details/stories/details.stories.js +1 -1
  138. package/src/less/drawer-dialog/drawer-dialog.less +2 -2
  139. package/src/less/drawer-dialog/stories/drawer-dialog.stories.js +1 -1
  140. package/src/less/eek/eek.less +2 -2
  141. package/src/less/field/stories/stacked.stories.js +1 -1
  142. package/src/less/field/stories/unstacked.stories.js +1 -1
  143. package/src/less/filter-button/stories/button.stories.js +1 -1
  144. package/src/less/filter-button/stories/group.stories.js +1 -1
  145. package/src/less/filter-button/stories/link.stories.js +1 -1
  146. package/src/less/filter-menu/filter-menu.less +8 -4
  147. package/src/less/filter-menu/stories/filter-menu.stories.js +1 -1
  148. package/src/less/filter-menu-button/filter-menu-button.less +2 -1
  149. package/src/less/filter-menu-button/stories/filter-menu-button.stories.js +1 -1
  150. package/src/less/floating-label/stories/floating-label.stories.js +1 -1
  151. package/src/less/fullscreen-dialog/fullscreen-dialog.less +2 -2
  152. package/src/less/fullscreen-dialog/stories/fullscreen-dialog.stories.js +1 -1
  153. package/src/less/global/stories/global.stories.js +1 -1
  154. package/src/less/icon/generated/icon.less +17 -5
  155. package/src/less/icon/stories/icon.stories.js +1 -1
  156. package/src/less/icon-button/stories/alignment.stories.js +1 -1
  157. package/src/less/image-placeholder/image-placeholder.less +4 -0
  158. package/src/less/image-placeholder/stories/image-placeholder.stories.js +35 -0
  159. package/src/less/index.stories.js +1 -1
  160. package/src/less/infotip/infotip.less +1 -1
  161. package/src/less/infotip/stories/infotip.stories.js +1 -1
  162. package/src/less/inline-notice/stories/inline.stories.js +1 -1
  163. package/src/less/legacy-theme/legacy-theme.less +2 -2
  164. package/src/less/lightbox-dialog/lightbox-dialog.less +12 -9
  165. package/src/less/lightbox-dialog/stories/lightbox-dialog.stories.js +91 -1
  166. package/src/less/link/stories/link.stories.js +3 -2
  167. package/src/less/listbox/listbox.less +2 -1
  168. package/src/less/listbox/stories/cascade.stories.js +1 -1
  169. package/src/less/listbox/stories/listbox.stories.js +1 -1
  170. package/src/less/listbox-button/listbox-button.less +2 -1
  171. package/src/less/listbox-button/stories/base.stories.js +1 -1
  172. package/src/less/listbox-button/stories/cascade.stories.js +1 -1
  173. package/src/less/listbox-button/stories/dimensions.stories.js +1 -1
  174. package/src/less/listbox-button/stories/form.stories.js +1 -1
  175. package/src/less/marketsans/marketsans.less +12 -6
  176. package/src/less/menu/stories/fake-menu.stories.js +1 -1
  177. package/src/less/menu/stories/misc.stories.js +1 -1
  178. package/src/less/menu/stories/multiSelect.stories.js +1 -1
  179. package/src/less/menu-button/menu-button.less +2 -1
  180. package/src/less/menu-button/stories/base.stories.js +1 -1
  181. package/src/less/menu-button/stories/cascade.stories.js +1 -1
  182. package/src/less/menu-button/stories/dimensions.stories.js +1 -1
  183. package/src/less/menu-button/stories/fake-menu-button.stories.js +1 -1
  184. package/src/less/mixins/private/bubble-mixins.less +1 -4
  185. package/src/less/mixins/private/dialog-mixins.less +12 -10
  186. package/src/less/mixins/private/filter-menu-mixins.less +4 -1
  187. package/src/less/mixins/private/selection-list-mixins.less +0 -2
  188. package/src/less/mixins/private/token-mixins.less +2 -1
  189. package/src/less/mixins/public/utility-mixins.less +1 -4
  190. package/src/less/page-grid/page-grid.less +32 -10
  191. package/src/less/page-notice/page-notice.less +1 -1
  192. package/src/less/page-notice/stories/page-notice.stories.js +1 -1
  193. package/src/less/page-notice/stories/test.stories.js +1 -1
  194. package/src/less/pagination/stories/button-cascade.stories.js +1 -1
  195. package/src/less/pagination/stories/buttons.stories.js +1 -1
  196. package/src/less/pagination/stories/link-cascade.stories.js +1 -1
  197. package/src/less/pagination/stories/links.stories.js +1 -1
  198. package/src/less/pagination/stories/overflow.stories.js +1 -1
  199. package/src/less/panel-dialog/panel-dialog.less +5 -4
  200. package/src/less/panel-dialog/stories/panel-dialog.stories.js +1 -1
  201. package/src/less/progress-bar/progress-bar.less +1 -1
  202. package/src/less/progress-bar/stories/progress-bar.stories.js +10 -7
  203. package/src/less/progress-spinner/stories/progress-spinner.stories.js +1 -1
  204. package/src/less/progress-stepper/progress-stepper.less +29 -9
  205. package/src/less/progress-stepper/stories/progress-stepper.stories.js +1 -1
  206. package/src/less/radio/radio.less +8 -3
  207. package/src/less/radio/stories/checked.stories.js +1 -1
  208. package/src/less/radio/stories/unchecked.stories.js +1 -1
  209. package/src/less/section-notice/section-notice.less +1 -1
  210. package/src/less/section-notice/stories/rtl.stories.js +1 -1
  211. package/src/less/section-notice/stories/section-notice.stories.js +1 -1
  212. package/src/less/section-notice/stories/test.stories.js +1 -1
  213. package/src/less/section-title/section-title.less +1 -1
  214. package/src/less/section-title/stories/rtl.stories.js +1 -1
  215. package/src/less/section-title/stories/section-title.stories.js +1 -1
  216. package/src/less/select/stories/cascade.stories.js +1 -1
  217. package/src/less/select/stories/default.stories.js +1 -1
  218. package/src/less/select/stories/floating-label.stories.js +1 -1
  219. package/src/less/signal/stories/signal.stories.js +1 -1
  220. package/src/less/snackbar-dialog/snackbar-dialog.less +1 -1
  221. package/src/less/snackbar-dialog/stories/base.stories.js +1 -1
  222. package/src/less/snackbar-dialog/stories/font-size.stories.js +1 -1
  223. package/src/less/snackbar-dialog/stories/rtl.stories.js +1 -1
  224. package/src/less/split-button/stories/base.stories.js +1 -1
  225. package/src/less/split-button/stories/rtl.stories.js +1 -1
  226. package/src/less/split-button/stories/size.stories.js +1 -1
  227. package/src/less/square-corner-theme/square-corner-theme.less +3 -3
  228. package/src/less/star-rating/stories/star-rating.stories.js +1 -1
  229. package/src/less/star-rating-select/star-rating-select.less +6 -2
  230. package/src/less/star-rating-select/stories/star-rating-select.stories.js +1 -1
  231. package/src/less/switch/stories/form.stories.js +1 -1
  232. package/src/less/switch/stories/script.stories.js +1 -1
  233. package/src/less/switch/switch.less +12 -6
  234. package/src/less/tabs/stories/fake-tabs/block.stories.js +1 -1
  235. package/src/less/tabs/stories/fake-tabs/inlineBlock.stories.js +1 -1
  236. package/src/less/tabs/stories/tabs/block.stories.js +1 -1
  237. package/src/less/tabs/stories/tabs/inlineBlock.stories.js +1 -1
  238. package/src/less/textbox/stories/icon.stories.js +1 -1
  239. package/src/less/textbox/stories/rtl/icon.stories.js +1 -1
  240. package/src/less/textbox/stories/rtl/textbox.stories.js +1 -1
  241. package/src/less/textbox/stories/textbox.stories.js +1 -1
  242. package/src/less/toast-dialog/stories/toast-dialog.stories.js +1 -1
  243. package/src/less/toast-dialog/toast-dialog.less +1 -1
  244. package/src/less/tooltip/stories/pointer.stories.js +84 -78
  245. package/src/less/tooltip/stories/tooltip.stories.js +1 -1
  246. package/src/less/tooltip/tooltip.less +1 -1
  247. package/src/less/tourtip/stories/tourtip.stories.js +1 -1
  248. package/src/less/tourtip/tourtip.less +1 -1
  249. package/src/less/typography/typography.less +1 -1
  250. package/src/less/video/video.less +1 -4
  251. package/src/svg/icon/icon-bookmark-16.svg +7 -0
  252. package/src/svg/icon/icon-bookmark-24.svg +7 -0
  253. package/src/svg/icon/icon-play-filled-16-colored.svg +13 -0
  254. package/src/svg/icon/icon-play-filled-24-colored.svg +11 -0
  255. package/src/svg/icon/image-placeholder.svg +3 -0
  256. package/src/svg/icons.svg +49 -11
  257. package/src/tokens/evo-dark.css +2 -0
  258. package/src/tokens/evo-light.css +2 -0
  259. package/svg.svg +49 -11
  260. package/webpack.config.js +6 -6
  261. package/_cdn/skin/v16.0.0/skin-default.min.css +0 -6
  262. package/_cdn/skin/v16.0.0/skin-full.min.css +0 -6
  263. package/_cdn/skin/v16.0.0/skin-headless.min.css +0 -6
  264. package/_cdn/skin/v16.0.0/skin-legacy.min.css +0 -6
  265. package/dist/svg/icon/icon-image-placeholder.svg +0 -10
  266. package/src/svg/icon/icon-image-placeholder.svg +0 -10
  267. /package/dist/svg/icon/{icon-zoom-In-16.svg → icon-zoom-in-16.svg} +0 -0
  268. /package/src/svg/icon/{icon-zoom-In-16.svg → icon-zoom-in-16.svg} +0 -0
@@ -1,8 +1,8 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const log = require('../../log');
4
- const BaseGenerator = require('./base-generator');
5
- const writeLine = require('../util/line-writer');
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+ const log = require("../../log");
4
+ const BaseGenerator = require("./base-generator");
5
+ const writeLine = require("../util/line-writer");
6
6
 
7
7
  const getBaseStyleContent = (
8
8
  moduleId
@@ -11,7 +11,8 @@ const getBaseStyleContent = (
11
11
  display: block;
12
12
  }
13
13
  `;
14
- const getReferBaseStyleContent = (moduleId) => `@import '../base/${moduleId}.less';\n`;
14
+ const getReferBaseStyleContent = (moduleId) =>
15
+ `@import '../base/${moduleId}.less';\n`;
15
16
  const getModuleBrowserContent = (moduleId) => `{
16
17
  "dependencies": [
17
18
  "require: ./${moduleId}"
@@ -30,7 +31,14 @@ class StyleGenerator extends BaseGenerator {
30
31
  */
31
32
  constructor(moduleName, moduleId) {
32
33
  super(moduleName, moduleId);
33
- this.sourceStyleLocation = path.join(__dirname, '..', '..', '..', 'src', 'less');
34
+ this.sourceStyleLocation = path.join(
35
+ __dirname,
36
+ "..",
37
+ "..",
38
+ "..",
39
+ "src",
40
+ "less"
41
+ );
34
42
  }
35
43
 
36
44
  generate() {
@@ -38,11 +46,17 @@ class StyleGenerator extends BaseGenerator {
38
46
  this._addSourceBundleStyles();
39
47
  this._addPackagingStyles();
40
48
 
41
- log.info('Styles added! Make changes in %s folder.', path.join(this.sourceModuleLocation));
49
+ log.info(
50
+ "Styles added! Make changes in %s folder.",
51
+ path.join(this.sourceModuleLocation)
52
+ );
42
53
  }
43
54
 
44
55
  _addSourceStyles() {
45
- const sourceModuleLocation = path.join(this.sourceStyleLocation, this.moduleId);
56
+ const sourceModuleLocation = path.join(
57
+ this.sourceStyleLocation,
58
+ this.moduleId
59
+ );
46
60
 
47
61
  if (!fs.existsSync(sourceModuleLocation)) {
48
62
  fs.mkdirSync(sourceModuleLocation);
@@ -51,9 +65,18 @@ class StyleGenerator extends BaseGenerator {
51
65
  const baseStyleContent = getBaseStyleContent(this.moduleId);
52
66
  const dsContent = getReferBaseStyleContent(this.moduleId);
53
67
 
54
- this._addSourceStylesProper(path.join(sourceModuleLocation, 'base'), baseStyleContent);
55
- this._addSourceStylesProper(path.join(sourceModuleLocation, 'ds4'), dsContent);
56
- this._addSourceStylesProper(path.join(sourceModuleLocation, 'ds6'), dsContent);
68
+ this._addSourceStylesProper(
69
+ path.join(sourceModuleLocation, "base"),
70
+ baseStyleContent
71
+ );
72
+ this._addSourceStylesProper(
73
+ path.join(sourceModuleLocation, "ds4"),
74
+ dsContent
75
+ );
76
+ this._addSourceStylesProper(
77
+ path.join(sourceModuleLocation, "ds6"),
78
+ dsContent
79
+ );
57
80
 
58
81
  this.sourceModuleLocation = sourceModuleLocation;
59
82
  }
@@ -71,12 +94,19 @@ class StyleGenerator extends BaseGenerator {
71
94
  }
72
95
 
73
96
  _addSourceBundleStyles() {
74
- this._addSourceBundleStylesProper('ds4');
75
- this._addSourceBundleStylesProper('ds6');
97
+ this._addSourceBundleStylesProper("ds4");
98
+ this._addSourceBundleStylesProper("ds6");
76
99
  }
77
100
 
78
101
  _addSourceBundleStylesProper(version) {
79
- const filePathFromRoot = path.join('src', 'less', 'bundles', 'skin', version, 'skin.less');
102
+ const filePathFromRoot = path.join(
103
+ "src",
104
+ "less",
105
+ "bundles",
106
+ "skin",
107
+ version,
108
+ "skin.less"
109
+ );
80
110
  const newLineContent = `@import "../../../${this.moduleId}/${version}/${this.moduleId}.less";`;
81
111
  writeLine({
82
112
  filePathFromRoot,
@@ -91,25 +121,34 @@ class StyleGenerator extends BaseGenerator {
91
121
  this._addPackagingIndexDependencies();
92
122
  this._addPackagingBrowserDependencies();
93
123
  this._addPackagingModuleBrowserDependencies();
94
- this._addPackagingStylesDsReference('ds4');
95
- this._addPackagingStylesDsReference('ds6');
124
+ this._addPackagingStylesDsReference("ds4");
125
+ this._addPackagingStylesDsReference("ds6");
96
126
  this._addPackagingStylesIndexReference();
97
127
  }
98
128
 
99
129
  _addPackagingIndexDependencies() {
100
- this._addDependencies(` "require: ./${this.moduleId}"`, 'index.browser.json');
130
+ this._addDependencies(
131
+ ` "require: ./${this.moduleId}"`,
132
+ "index.browser.json"
133
+ );
101
134
  }
102
135
 
103
136
  _addPackagingBrowserDependencies() {
104
- this._addDependencies(` "./${this.moduleId}"`, 'browser.json');
137
+ this._addDependencies(` "./${this.moduleId}"`, "browser.json");
105
138
 
106
139
  const from = `./dist/${this.moduleId}/ds6/${this.moduleId}.css`;
107
140
  const newMappingItem = {
108
141
  from,
109
142
  to: `./dist/${this.moduleId}/ds4/${this.moduleId}.css`,
110
- 'if-flag': 'ds-4',
143
+ "if-flag": "ds-4",
111
144
  };
112
- const browserJsonFile = path.join(__dirname, '..', '..', '..', 'browser.json');
145
+ const browserJsonFile = path.join(
146
+ __dirname,
147
+ "..",
148
+ "..",
149
+ "..",
150
+ "browser.json"
151
+ );
113
152
  const newMappings = [];
114
153
  const browserJson = require(browserJsonFile);
115
154
  let newItemAdded = false;
@@ -132,36 +171,49 @@ class StyleGenerator extends BaseGenerator {
132
171
  }
133
172
 
134
173
  _addPackagingModuleBrowserDependencies() {
135
- const projectRootPath = path.join(__dirname, '..', '..', '..');
136
- const moduleBrowserPath = path.join(projectRootPath, `${this.moduleId}.browser.json`);
174
+ const projectRootPath = path.join(__dirname, "..", "..", "..");
175
+ const moduleBrowserPath = path.join(
176
+ projectRootPath,
177
+ `${this.moduleId}.browser.json`
178
+ );
137
179
 
138
180
  if (fs.existsSync(moduleBrowserPath)) {
139
- log.warn('[STYLES][%s] Module browser content already exists!', moduleBrowserPath);
181
+ log.warn(
182
+ "[STYLES][%s] Module browser content already exists!",
183
+ moduleBrowserPath
184
+ );
140
185
  return;
141
186
  }
142
187
 
143
- fs.writeFileSync(moduleBrowserPath, getModuleBrowserContent(this.moduleId));
188
+ fs.writeFileSync(
189
+ moduleBrowserPath,
190
+ getModuleBrowserContent(this.moduleId)
191
+ );
144
192
  }
145
193
 
146
194
  _addDependencies(newLineContent, filePathFromRoot) {
147
195
  writeLine({
148
196
  filePathFromRoot,
149
- sectionPredicate: (line) => line.match(/"dependencies"\s*\t*:\s*\t*\[/),
197
+ sectionPredicate: (line) =>
198
+ line.match(/"dependencies"\s*\t*:\s*\t*\[/),
150
199
  newLineContent,
151
200
  getLineMeta: (prevLine, currentLine, nextLine) => ({
152
201
  shouldAppend:
153
202
  (nextLine && nextLine.match(/]/)) ||
154
- (!StyleGenerator._isLegacyLine(currentLine) && currentLine > newLineContent),
155
- prevLineSuffix: prevLine && !prevLine.endsWith(',') ? ',' : '',
156
- newLineSuffix: !nextLine || nextLine.match(/]/) ? '' : ',',
203
+ (!StyleGenerator._isLegacyLine(currentLine) &&
204
+ currentLine > newLineContent),
205
+ prevLineSuffix: prevLine && !prevLine.endsWith(",") ? "," : "",
206
+ newLineSuffix: !nextLine || nextLine.match(/]/) ? "" : ",",
157
207
  }),
158
208
  });
159
209
  }
160
210
 
161
211
  _addPackagingStylesDsReference(version) {
162
- const filePathFromRoot = `${this.moduleId}${version === 'ds4' ? '[ds-4]' : ''}.js`;
212
+ const filePathFromRoot = `${this.moduleId}${
213
+ version === "ds4" ? "[ds-4]" : ""
214
+ }.js`;
163
215
  if (fs.existsSync(filePathFromRoot)) {
164
- log.warn('[STYLES][%s] Style already exists!', filePathFromRoot);
216
+ log.warn("[STYLES][%s] Style already exists!", filePathFromRoot);
165
217
  return;
166
218
  }
167
219
  fs.writeFileSync(
@@ -171,7 +223,7 @@ class StyleGenerator extends BaseGenerator {
171
223
  }
172
224
 
173
225
  _addPackagingStylesIndexReference() {
174
- const filePathFromRoot = 'index.js';
226
+ const filePathFromRoot = "index.js";
175
227
  const newLineContent = `import './${this.moduleId}';`;
176
228
  writeLine({
177
229
  filePathFromRoot,
@@ -179,14 +231,17 @@ class StyleGenerator extends BaseGenerator {
179
231
  getLineMeta: (prevLine, currentLine, nextLine) => ({
180
232
  shouldAppend:
181
233
  !nextLine ||
182
- (!StyleGenerator._isLegacyLine(currentLine) && currentLine > newLineContent),
234
+ (!StyleGenerator._isLegacyLine(currentLine) &&
235
+ currentLine > newLineContent),
183
236
  }),
184
237
  });
185
238
  }
186
239
 
187
240
  static _isLegacyLine(currentLine) {
188
241
  return (
189
- currentLine.match(/global/) || currentLine.match(/utility/) || currentLine.match(/root/)
242
+ currentLine.match(/global/) ||
243
+ currentLine.match(/utility/) ||
244
+ currentLine.match(/root/)
190
245
  );
191
246
  }
192
247
  }
@@ -1,7 +1,7 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const log = require('../../log');
4
- const BaseGenerator = require('./base-generator');
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+ const log = require("../../log");
4
+ const BaseGenerator = require("./base-generator");
5
5
 
6
6
  const getStorybookTestContent = (moduleName, moduleId) => `// Generated test
7
7
  export default { title: '${moduleName}' };
@@ -27,25 +27,31 @@ class TestGenerator extends BaseGenerator {
27
27
  generate() {
28
28
  this._addStoryBookTests();
29
29
 
30
- log.info('Tests added! Make changes in %s file.', path.join(this.storybookTestFilePath));
30
+ log.info(
31
+ "Tests added! Make changes in %s file.",
32
+ path.join(this.storybookTestFilePath)
33
+ );
31
34
  }
32
35
 
33
36
  _addStoryBookTests() {
34
37
  const testFilePath = path.join(
35
38
  __dirname,
36
- '..',
37
- '..',
38
- '..',
39
- 'src',
40
- 'less',
39
+ "..",
40
+ "..",
41
+ "..",
42
+ "src",
43
+ "less",
41
44
  this.moduleId,
42
45
  `${this.moduleId}.stories.js`
43
46
  );
44
47
  if (fs.existsSync(testFilePath)) {
45
- log.warn('[TESTS][%s] Test file already exists!', testFilePath);
48
+ log.warn("[TESTS][%s] Test file already exists!", testFilePath);
46
49
  return;
47
50
  }
48
- fs.writeFileSync(testFilePath, getStorybookTestContent(this.moduleName, this.moduleId));
51
+ fs.writeFileSync(
52
+ testFilePath,
53
+ getStorybookTestContent(this.moduleName, this.moduleId)
54
+ );
49
55
  this.storybookTestFilePath = testFilePath;
50
56
  }
51
57
  }
@@ -1,4 +1,4 @@
1
- const BaseError = require('./base-error');
1
+ const BaseError = require("./base-error");
2
2
 
3
3
  class IllegalInputError extends BaseError {
4
4
  constructor(message) {
@@ -1,13 +1,13 @@
1
- const inputParser = require('./input/parse-input');
2
- const titleCase = require('./util/title-case');
3
- const StyleGenerator = require('./code-generators/style-generator');
4
- const DocumentationGenerator = require('./code-generators/doc-generator');
5
- const TestGenerator = require('./code-generators/test-generator');
1
+ const inputParser = require("./input/parse-input");
2
+ const titleCase = require("./util/title-case");
3
+ const StyleGenerator = require("./code-generators/style-generator");
4
+ const DocumentationGenerator = require("./code-generators/doc-generator");
5
+ const TestGenerator = require("./code-generators/test-generator");
6
6
 
7
7
  class DevelopModule {
8
8
  constructor() {
9
9
  this.moduleName = titleCase(inputParser.parse().value);
10
- this.moduleId = this.moduleName.replace(/\s/g, '-').toLowerCase();
10
+ this.moduleId = this.moduleName.replace(/\s/g, "-").toLowerCase();
11
11
  }
12
12
 
13
13
  run() {
@@ -1,6 +1,6 @@
1
- const IllegalInputError = require('../errors/illegal-input');
1
+ const IllegalInputError = require("../errors/illegal-input");
2
2
 
3
- const VALUE = Symbol('value');
3
+ const VALUE = Symbol("value");
4
4
 
5
5
  /**
6
6
  * This is a value object for module name.
@@ -28,21 +28,23 @@ class ModuleName {
28
28
  * Do not invoke this as the user inputs are immutable!
29
29
  */
30
30
  set value(newMoudleName) {
31
- throw new Error('Module name provided by user is immutable!');
31
+ throw new Error("Module name provided by user is immutable!");
32
32
  }
33
33
  }
34
34
 
35
35
  function _validate(moduleName) {
36
36
  if (!moduleName) {
37
- throw new IllegalInputError('Module name has to be provided!');
37
+ throw new IllegalInputError("Module name has to be provided!");
38
38
  }
39
39
 
40
- if (typeof moduleName !== 'string') {
41
- throw new IllegalInputError('Module name has to be string!');
40
+ if (typeof moduleName !== "string") {
41
+ throw new IllegalInputError("Module name has to be string!");
42
42
  }
43
43
 
44
44
  if (moduleName.trim().length < 2) {
45
- throw new IllegalInputError('Module name has to be atleast 2 character long!');
45
+ throw new IllegalInputError(
46
+ "Module name has to be atleast 2 character long!"
47
+ );
46
48
  }
47
49
  }
48
50
 
@@ -1,12 +1,14 @@
1
- const yargs = require('yargs');
2
- const ModuleName = require('./module-name');
1
+ const yargs = require("yargs");
2
+ const ModuleName = require("./module-name");
3
3
 
4
- const argv = yargs.usage('scripts/develop-module <option> [option value]').option('m', {
5
- alias: 'moduleName',
6
- demandOption: true,
7
- description: 'The new module name that you want to develop',
8
- type: 'string',
9
- }).argv;
4
+ const argv = yargs
5
+ .usage("scripts/develop-module <option> [option value]")
6
+ .option("m", {
7
+ alias: "moduleName",
8
+ demandOption: true,
9
+ description: "The new module name that you want to develop",
10
+ type: "string",
11
+ }).argv;
10
12
 
11
13
  module.exports = {
12
14
  /**
@@ -1,6 +1,6 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const log = require('../../log');
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+ const log = require("../../log");
4
4
 
5
5
  /**
6
6
  * Write a line to an existing file.
@@ -20,47 +20,60 @@ function writeLine(options) {
20
20
  getLineMeta,
21
21
  } = options;
22
22
 
23
- const filePath = path.join(__dirname, '..', '..', '..', filePathFromRoot);
23
+ const filePath = path.join(__dirname, "..", "..", "..", filePathFromRoot);
24
24
  if (!fs.existsSync(filePath)) {
25
- log.warn('%s file does not exist to append to!', filePath);
25
+ log.warn("%s file does not exist to append to!", filePath);
26
26
  }
27
27
 
28
28
  let isSectionMatched = false;
29
29
  let lineAppended = false;
30
30
  const newFileContents = [];
31
- const currentFileContent = fs.readFileSync(filePath, 'utf8');
32
- const currentFileContents = currentFileContent.split('\n');
31
+ const currentFileContent = fs.readFileSync(filePath, "utf8");
32
+ const currentFileContents = currentFileContent.split("\n");
33
33
  for (let i = 0; i < currentFileContents.length; i++) {
34
34
  const line = currentFileContents[i];
35
35
  if (line.match(duplicateCheckText || newLineContent)) {
36
- log.warn('[%s] File already has line appended!', filePath);
36
+ log.warn("[%s] File already has line appended!", filePath);
37
37
  return;
38
38
  }
39
39
  if (
40
40
  !isSectionMatched &&
41
- (typeof sectionPredicate !== 'function' || sectionPredicate(line))
41
+ (typeof sectionPredicate !== "function" || sectionPredicate(line))
42
42
  ) {
43
43
  isSectionMatched = true;
44
44
  } else if (isSectionMatched && !lineAppended) {
45
45
  const prevLine = i > 0 ? currentFileContents[i - 1] : null;
46
- const nextLine = i < currentFileContents.length ? currentFileContents[i + 1] : null;
47
- const { prevLineSuffix, newLineSuffix = '', shouldAppend = false } = getLineMeta(
48
- prevLine,
49
- line,
50
- nextLine
51
- );
46
+ const nextLine =
47
+ i < currentFileContents.length
48
+ ? currentFileContents[i + 1]
49
+ : null;
50
+ const {
51
+ prevLineSuffix,
52
+ newLineSuffix = "",
53
+ shouldAppend = false,
54
+ } = getLineMeta(prevLine, line, nextLine);
52
55
  if (shouldAppend) {
53
- _processUpdates(newFileContents, newLineContent, prevLineSuffix, newLineSuffix);
56
+ _processUpdates(
57
+ newFileContents,
58
+ newLineContent,
59
+ prevLineSuffix,
60
+ newLineSuffix
61
+ );
54
62
  lineAppended = true;
55
63
  }
56
64
  }
57
65
  newFileContents.push(line);
58
66
  }
59
67
 
60
- fs.writeFileSync(filePath, newFileContents.join('\n'));
68
+ fs.writeFileSync(filePath, newFileContents.join("\n"));
61
69
  }
62
70
 
63
- function _processUpdates(newFileContents, newLineContent, prevLineSuffix, newLineSuffix) {
71
+ function _processUpdates(
72
+ newFileContents,
73
+ newLineContent,
74
+ prevLineSuffix,
75
+ newLineSuffix
76
+ ) {
64
77
  if (prevLineSuffix) {
65
78
  newFileContents.push(newFileContents.pop() + prevLineSuffix);
66
79
  }
@@ -1,11 +1,12 @@
1
1
  function titleCase(str) {
2
- const splitStr = str.toLowerCase().split(' ');
2
+ const splitStr = str.toLowerCase().split(" ");
3
3
 
4
4
  for (let i = 0; i < splitStr.length; i++) {
5
- splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].substring(1);
5
+ splitStr[i] =
6
+ splitStr[i].charAt(0).toUpperCase() + splitStr[i].substring(1);
6
7
  }
7
8
 
8
- return splitStr.join(' ');
9
+ return splitStr.join(" ");
9
10
  }
10
11
 
11
12
  module.exports = titleCase;