@ebay/skin 16.0.0-2 → 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.
- package/.github/workflows/jekyll-gh-pages.yml +56 -0
- package/.github/workflows/pages-html-proofer.yml +5 -0
- package/.percy.yml +4 -3
- package/.prettierrc.json +1 -12
- package/.storybook/main.js +44 -40
- package/.storybook/manager.js +6 -6
- package/.storybook/preview-head.html +49 -11
- package/.storybook/theme.js +9 -9
- package/.stylelintrc +80 -73
- package/ICON-CREATION.md +22 -45
- package/README.md +1 -1
- package/_cdn/skin/v16.1.0-0/skin-default.min.css +6 -0
- package/_cdn/skin/v16.1.0-0/skin-full.min.css +6 -0
- package/_cdn/skin/v16.1.0-0/skin-headless.min.css +6 -0
- package/_cdn/skin/v16.1.0-0/skin-legacy.min.css +6 -0
- package/dist/alert-dialog/alert-dialog.css +16 -11
- package/dist/breadcrumbs/breadcrumbs.css +1 -1
- package/dist/button/button.css +3 -5
- package/dist/calendar/calendar.css +11 -10
- package/dist/carousel/carousel.css +11 -15
- package/dist/combobox/combobox.css +0 -2
- package/dist/confirm-dialog/confirm-dialog.css +16 -11
- package/dist/date-textbox/date-textbox.css +4 -1
- package/dist/drawer-dialog/drawer-dialog.css +11 -8
- package/dist/fullscreen-dialog/fullscreen-dialog.css +11 -8
- package/dist/icon/icon.css +17 -5
- package/dist/image-placeholder/image-placeholder.css +4 -0
- package/dist/infotip/infotip.css +2 -5
- package/dist/legacy-theme/legacy-theme.css +2 -2
- package/dist/legacy-tokens/ds4-light.css +2 -0
- package/dist/lightbox-dialog/lightbox-dialog.css +24 -17
- package/dist/listbox/listbox.css +0 -2
- package/dist/listbox-button/listbox-button.css +0 -2
- package/dist/menu/menu.css +0 -2
- package/dist/menu-button/menu-button.css +0 -2
- package/dist/mixins/utility-mixins.less +1 -4
- package/dist/page-grid/page-grid.css +15 -5
- package/dist/page-notice/page-notice.css +1 -1
- package/dist/panel-dialog/panel-dialog.css +12 -9
- package/dist/progress-bar/progress-bar.css +1 -1
- package/dist/progress-stepper/progress-stepper.css +1 -1
- package/dist/section-notice/section-notice.css +1 -1
- package/dist/section-title/section-title.css +1 -1
- package/dist/snackbar-dialog/snackbar-dialog.css +7 -1
- package/dist/square-corner-theme/square-corner-theme.css +3 -3
- package/dist/svg/icon/icon-bookmark-16.svg +7 -0
- package/dist/svg/icon/icon-bookmark-24.svg +7 -0
- package/dist/svg/icon/icon-play-filled-16-colored.svg +13 -0
- package/dist/svg/icon/icon-play-filled-24-colored.svg +11 -0
- package/dist/svg/icon/image-placeholder.svg +3 -0
- package/dist/svg/icons.svg +49 -11
- package/dist/toast-dialog/toast-dialog.css +7 -1
- package/dist/tokens/evo-dark.css +2 -0
- package/dist/tokens/evo-light.css +2 -0
- package/dist/tooltip/tooltip.css +2 -5
- package/dist/tourtip/tourtip.css +2 -5
- package/dist/typography/typography.css +1 -1
- package/dist/utility/utility.css +2 -8
- package/dist/video/video.css +1 -4
- package/image-placeholder.browser.json +1 -0
- package/image-placeholder.css +1 -0
- package/image-placeholder.js +1 -0
- package/image-placeholder.mjs +1 -0
- package/index.browser.json +1 -0
- package/index.css +1 -0
- package/index.js +1 -0
- package/index.mjs +1 -0
- package/package.json +13 -12
- package/scripts/develop-module_proper/code-generators/doc-generator.js +32 -16
- package/scripts/develop-module_proper/code-generators/style-generator.js +89 -34
- package/scripts/develop-module_proper/code-generators/test-generator.js +18 -12
- package/scripts/develop-module_proper/errors/illegal-input.js +1 -1
- package/scripts/develop-module_proper/index.js +6 -6
- package/scripts/develop-module_proper/input/module-name.js +9 -7
- package/scripts/develop-module_proper/input/parse-input.js +10 -8
- package/scripts/develop-module_proper/util/line-writer.js +31 -18
- package/scripts/develop-module_proper/util/title-case.js +4 -3
- package/scripts/generate-bundle.js +58 -33
- package/scripts/generate-images.js +72 -45
- package/scripts/generate-imports/config.json +21 -3
- package/scripts/generate-imports/index.js +35 -29
- package/scripts/generate-imports/module-builder.js +58 -36
- package/scripts/import-svgs.js +33 -25
- package/scripts/index.js +68 -68
- package/scripts/jekyll-config.js +8 -5
- package/scripts/log.js +5 -3
- package/scripts/split-icon.js +20 -15
- package/scripts/storybook/copy.js +29 -10
- package/scripts/svgo.config.js +42 -42
- package/scripts/util.js +15 -11
- package/scripts/verify-build.js +12 -12
- package/src/fonts/marketsans/MarketSans-Regular-WebS.css +6 -3
- package/src/fonts/marketsans/MarketSans-SemiBold-WebS.css +6 -3
- package/src/less/alert-dialog/alert-dialog.less +5 -6
- package/src/less/alert-dialog/stories/alert-dialog.stories.js +1 -1
- package/src/less/badge/stories/badge.stories.js +1 -1
- package/src/less/breadcrumbs/breadcrumbs.less +5 -2
- package/src/less/breadcrumbs/stories/button-cascade.stories.js +1 -1
- package/src/less/breadcrumbs/stories/button-overflow.stories.js +1 -1
- package/src/less/breadcrumbs/stories/buttons.stories.js +1 -1
- package/src/less/breadcrumbs/stories/link-cascade.stories.js +1 -1
- package/src/less/breadcrumbs/stories/link-overflow.stories.js +1 -1
- package/src/less/breadcrumbs/stories/links.stories.js +1 -1
- package/src/less/bundles/skin-headless.less +1 -0
- package/src/less/button/button.less +16 -10
- package/src/less/button/stories/button/base.stories.js +1 -1
- package/src/less/button/stories/button/borderless.stories.js +5 -3
- package/src/less/button/stories/button/cascade.stories.js +1 -1
- package/src/less/button/stories/button/dimensions.stories.js +1 -1
- package/src/less/button/stories/button/primary.stories.js +3 -2
- package/src/less/button/stories/button/secondary.stories.js +3 -2
- package/src/less/button/stories/button/tertiary.stories.js +1 -1
- package/src/less/button/stories/destructive-button/primary.stories.js +1 -1
- package/src/less/button/stories/destructive-button/secondary.stories.js +1 -1
- package/src/less/button/stories/destructive-button/tertiary.stories.js +1 -1
- package/src/less/button/stories/fake-button/base.stories.js +3 -2
- package/src/less/button/stories/fake-button/cascade.stories.js +1 -1
- package/src/less/button/stories/fake-button/dimensions.stories.js +1 -1
- package/src/less/button/stories/fake-button/primary.stories.js +1 -1
- package/src/less/button/stories/fake-button/secondary.stories.js +1 -1
- package/src/less/calendar/calendar.less +31 -13
- package/src/less/calendar/stories/calendar.stories.js +601 -108
- package/src/less/carousel/carousel.less +14 -9
- package/src/less/carousel/stories/carousel.stories.js +1 -1
- package/src/less/checkbox/checkbox.less +14 -5
- package/src/less/checkbox/stories/checked.stories.js +1 -1
- package/src/less/checkbox/stories/mixed.stories.js +2 -2
- package/src/less/checkbox/stories/unchecked.stories.js +1 -1
- package/src/less/combobox/combobox.less +4 -1
- package/src/less/combobox/stories/combobox.stories.js +1 -1
- package/src/less/confirm-dialog/confirm-dialog.less +5 -6
- package/src/less/confirm-dialog/stories/confirm-dialog.stories.js +1 -1
- package/src/less/cta-button/stories/cascade.stories.js +1 -1
- package/src/less/cta-button/stories/cta-button.stories.js +1 -1
- package/src/less/cta-button/stories/dimensions.stories.js +1 -1
- package/src/less/date-textbox/date-textbox.less +5 -1
- package/src/less/details/stories/cascade.stories.js +1 -1
- package/src/less/details/stories/details.stories.js +1 -1
- package/src/less/drawer-dialog/drawer-dialog.less +2 -2
- package/src/less/drawer-dialog/stories/drawer-dialog.stories.js +1 -1
- package/src/less/eek/eek.less +2 -2
- package/src/less/field/stories/stacked.stories.js +1 -1
- package/src/less/field/stories/unstacked.stories.js +1 -1
- package/src/less/filter-button/stories/button.stories.js +1 -1
- package/src/less/filter-button/stories/group.stories.js +1 -1
- package/src/less/filter-button/stories/link.stories.js +1 -1
- package/src/less/filter-menu/filter-menu.less +8 -4
- package/src/less/filter-menu/stories/filter-menu.stories.js +1 -1
- package/src/less/filter-menu-button/filter-menu-button.less +2 -1
- package/src/less/filter-menu-button/stories/filter-menu-button.stories.js +1 -1
- package/src/less/floating-label/stories/floating-label.stories.js +1 -1
- package/src/less/fullscreen-dialog/fullscreen-dialog.less +2 -2
- package/src/less/fullscreen-dialog/stories/fullscreen-dialog.stories.js +1 -1
- package/src/less/global/stories/global.stories.js +1 -1
- package/src/less/icon/generated/icon.less +17 -5
- package/src/less/icon/stories/icon.stories.js +1 -1
- package/src/less/icon-button/stories/alignment.stories.js +1 -1
- package/src/less/image-placeholder/image-placeholder.less +4 -0
- package/src/less/image-placeholder/stories/image-placeholder.stories.js +35 -0
- package/src/less/index.stories.js +1 -1
- package/src/less/infotip/infotip.less +1 -1
- package/src/less/infotip/stories/infotip.stories.js +1 -1
- package/src/less/inline-notice/stories/inline.stories.js +1 -1
- package/src/less/legacy-theme/legacy-theme.less +2 -2
- package/src/less/lightbox-dialog/lightbox-dialog.less +12 -9
- package/src/less/lightbox-dialog/stories/lightbox-dialog.stories.js +91 -1
- package/src/less/link/stories/link.stories.js +3 -2
- package/src/less/listbox/listbox.less +2 -1
- package/src/less/listbox/stories/cascade.stories.js +1 -1
- package/src/less/listbox/stories/listbox.stories.js +1 -1
- package/src/less/listbox-button/listbox-button.less +2 -1
- package/src/less/listbox-button/stories/base.stories.js +1 -1
- package/src/less/listbox-button/stories/cascade.stories.js +1 -1
- package/src/less/listbox-button/stories/dimensions.stories.js +1 -1
- package/src/less/listbox-button/stories/form.stories.js +1 -1
- package/src/less/marketsans/marketsans.less +12 -6
- package/src/less/menu/stories/fake-menu.stories.js +1 -1
- package/src/less/menu/stories/misc.stories.js +1 -1
- package/src/less/menu/stories/multiSelect.stories.js +1 -1
- package/src/less/menu-button/menu-button.less +2 -1
- package/src/less/menu-button/stories/base.stories.js +1 -1
- package/src/less/menu-button/stories/cascade.stories.js +1 -1
- package/src/less/menu-button/stories/dimensions.stories.js +1 -1
- package/src/less/menu-button/stories/fake-menu-button.stories.js +1 -1
- package/src/less/mixins/private/bubble-mixins.less +1 -4
- package/src/less/mixins/private/dialog-mixins.less +12 -10
- package/src/less/mixins/private/filter-menu-mixins.less +4 -1
- package/src/less/mixins/private/selection-list-mixins.less +0 -2
- package/src/less/mixins/private/token-mixins.less +2 -1
- package/src/less/mixins/public/utility-mixins.less +1 -4
- package/src/less/page-grid/page-grid.less +32 -10
- package/src/less/page-notice/page-notice.less +1 -1
- package/src/less/page-notice/stories/page-notice.stories.js +1 -1
- package/src/less/page-notice/stories/test.stories.js +1 -1
- package/src/less/pagination/stories/button-cascade.stories.js +1 -1
- package/src/less/pagination/stories/buttons.stories.js +1 -1
- package/src/less/pagination/stories/link-cascade.stories.js +1 -1
- package/src/less/pagination/stories/links.stories.js +1 -1
- package/src/less/pagination/stories/overflow.stories.js +1 -1
- package/src/less/panel-dialog/panel-dialog.less +5 -4
- package/src/less/panel-dialog/stories/panel-dialog.stories.js +1 -1
- package/src/less/progress-bar/progress-bar.less +1 -1
- package/src/less/progress-bar/stories/progress-bar.stories.js +10 -7
- package/src/less/progress-spinner/stories/progress-spinner.stories.js +1 -1
- package/src/less/progress-stepper/progress-stepper.less +29 -9
- package/src/less/progress-stepper/stories/progress-stepper.stories.js +1 -1
- package/src/less/radio/radio.less +8 -3
- package/src/less/radio/stories/checked.stories.js +1 -1
- package/src/less/radio/stories/unchecked.stories.js +1 -1
- package/src/less/section-notice/section-notice.less +1 -1
- package/src/less/section-notice/stories/rtl.stories.js +1 -1
- package/src/less/section-notice/stories/section-notice.stories.js +1 -1
- package/src/less/section-notice/stories/test.stories.js +1 -1
- package/src/less/section-title/section-title.less +1 -1
- package/src/less/section-title/stories/rtl.stories.js +1 -1
- package/src/less/section-title/stories/section-title.stories.js +1 -1
- package/src/less/select/stories/cascade.stories.js +1 -1
- package/src/less/select/stories/default.stories.js +1 -1
- package/src/less/select/stories/floating-label.stories.js +1 -1
- package/src/less/signal/stories/signal.stories.js +1 -1
- package/src/less/snackbar-dialog/snackbar-dialog.less +1 -1
- package/src/less/snackbar-dialog/stories/base.stories.js +1 -1
- package/src/less/snackbar-dialog/stories/font-size.stories.js +1 -1
- package/src/less/snackbar-dialog/stories/rtl.stories.js +1 -1
- package/src/less/split-button/stories/base.stories.js +1 -1
- package/src/less/split-button/stories/rtl.stories.js +1 -1
- package/src/less/split-button/stories/size.stories.js +1 -1
- package/src/less/square-corner-theme/square-corner-theme.less +3 -3
- package/src/less/star-rating/stories/star-rating.stories.js +1 -1
- package/src/less/star-rating-select/star-rating-select.less +6 -2
- package/src/less/star-rating-select/stories/star-rating-select.stories.js +1 -1
- package/src/less/switch/stories/form.stories.js +1 -1
- package/src/less/switch/stories/script.stories.js +1 -1
- package/src/less/switch/switch.less +12 -6
- package/src/less/tabs/stories/fake-tabs/block.stories.js +1 -1
- package/src/less/tabs/stories/fake-tabs/inlineBlock.stories.js +1 -1
- package/src/less/tabs/stories/tabs/block.stories.js +1 -1
- package/src/less/tabs/stories/tabs/inlineBlock.stories.js +1 -1
- package/src/less/textbox/stories/icon.stories.js +1 -1
- package/src/less/textbox/stories/rtl/icon.stories.js +1 -1
- package/src/less/textbox/stories/rtl/textbox.stories.js +1 -1
- package/src/less/textbox/stories/textbox.stories.js +1 -1
- package/src/less/toast-dialog/stories/toast-dialog.stories.js +1 -1
- package/src/less/toast-dialog/toast-dialog.less +1 -1
- package/src/less/tooltip/stories/pointer.stories.js +84 -78
- package/src/less/tooltip/stories/tooltip.stories.js +1 -1
- package/src/less/tooltip/tooltip.less +1 -1
- package/src/less/tourtip/stories/tourtip.stories.js +1 -1
- package/src/less/tourtip/tourtip.less +1 -1
- package/src/less/typography/typography.less +1 -1
- package/src/less/video/video.less +1 -4
- package/src/svg/icon/icon-bookmark-16.svg +7 -0
- package/src/svg/icon/icon-bookmark-24.svg +7 -0
- package/src/svg/icon/icon-play-filled-16-colored.svg +13 -0
- package/src/svg/icon/icon-play-filled-24-colored.svg +11 -0
- package/src/svg/icon/image-placeholder.svg +3 -0
- package/src/svg/icons.svg +49 -11
- package/src/tokens/evo-dark.css +2 -0
- package/src/tokens/evo-light.css +2 -0
- package/svg.svg +49 -11
- package/webpack.config.js +6 -6
- package/_cdn/skin/v16.0.0-2/skin-default.min.css +0 -6
- package/_cdn/skin/v16.0.0-2/skin-full.min.css +0 -6
- package/_cdn/skin/v16.0.0-2/skin-headless.min.css +0 -6
- package/_cdn/skin/v16.0.0-2/skin-legacy.min.css +0 -6
- package/dist/svg/icon/icon-image-placeholder.svg +0 -10
- package/src/svg/icon/icon-image-placeholder.svg +0 -10
- /package/dist/svg/icon/{icon-zoom-In-16.svg → icon-zoom-in-16.svg} +0 -0
- /package/src/svg/icon/{icon-zoom-In-16.svg → icon-zoom-in-16.svg} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const fs = require(
|
|
2
|
-
const path = require(
|
|
3
|
-
const log = require(
|
|
4
|
-
const BaseGenerator = require(
|
|
5
|
-
const writeLine = require(
|
|
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) =>
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
55
|
-
|
|
56
|
-
|
|
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(
|
|
75
|
-
this._addSourceBundleStylesProper(
|
|
97
|
+
this._addSourceBundleStylesProper("ds4");
|
|
98
|
+
this._addSourceBundleStylesProper("ds6");
|
|
76
99
|
}
|
|
77
100
|
|
|
78
101
|
_addSourceBundleStylesProper(version) {
|
|
79
|
-
const filePathFromRoot = path.join(
|
|
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(
|
|
95
|
-
this._addPackagingStylesDsReference(
|
|
124
|
+
this._addPackagingStylesDsReference("ds4");
|
|
125
|
+
this._addPackagingStylesDsReference("ds6");
|
|
96
126
|
this._addPackagingStylesIndexReference();
|
|
97
127
|
}
|
|
98
128
|
|
|
99
129
|
_addPackagingIndexDependencies() {
|
|
100
|
-
this._addDependencies(
|
|
130
|
+
this._addDependencies(
|
|
131
|
+
` "require: ./${this.moduleId}"`,
|
|
132
|
+
"index.browser.json"
|
|
133
|
+
);
|
|
101
134
|
}
|
|
102
135
|
|
|
103
136
|
_addPackagingBrowserDependencies() {
|
|
104
|
-
this._addDependencies(` "./${this.moduleId}"`,
|
|
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
|
-
|
|
143
|
+
"if-flag": "ds-4",
|
|
111
144
|
};
|
|
112
|
-
const browserJsonFile = path.join(
|
|
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(
|
|
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(
|
|
181
|
+
log.warn(
|
|
182
|
+
"[STYLES][%s] Module browser content already exists!",
|
|
183
|
+
moduleBrowserPath
|
|
184
|
+
);
|
|
140
185
|
return;
|
|
141
186
|
}
|
|
142
187
|
|
|
143
|
-
fs.writeFileSync(
|
|
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) =>
|
|
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) &&
|
|
155
|
-
|
|
156
|
-
|
|
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}${
|
|
212
|
+
const filePathFromRoot = `${this.moduleId}${
|
|
213
|
+
version === "ds4" ? "[ds-4]" : ""
|
|
214
|
+
}.js`;
|
|
163
215
|
if (fs.existsSync(filePathFromRoot)) {
|
|
164
|
-
log.warn(
|
|
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 =
|
|
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) &&
|
|
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/) ||
|
|
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(
|
|
2
|
-
const path = require(
|
|
3
|
-
const log = require(
|
|
4
|
-
const BaseGenerator = require(
|
|
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(
|
|
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
|
-
|
|
40
|
-
|
|
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(
|
|
48
|
+
log.warn("[TESTS][%s] Test file already exists!", testFilePath);
|
|
46
49
|
return;
|
|
47
50
|
}
|
|
48
|
-
fs.writeFileSync(
|
|
51
|
+
fs.writeFileSync(
|
|
52
|
+
testFilePath,
|
|
53
|
+
getStorybookTestContent(this.moduleName, this.moduleId)
|
|
54
|
+
);
|
|
49
55
|
this.storybookTestFilePath = testFilePath;
|
|
50
56
|
}
|
|
51
57
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
const inputParser = require(
|
|
2
|
-
const titleCase = require(
|
|
3
|
-
const StyleGenerator = require(
|
|
4
|
-
const DocumentationGenerator = require(
|
|
5
|
-
const TestGenerator = require(
|
|
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,
|
|
10
|
+
this.moduleId = this.moduleName.replace(/\s/g, "-").toLowerCase();
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
run() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const IllegalInputError = require(
|
|
1
|
+
const IllegalInputError = require("../errors/illegal-input");
|
|
2
2
|
|
|
3
|
-
const VALUE = Symbol(
|
|
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(
|
|
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(
|
|
37
|
+
throw new IllegalInputError("Module name has to be provided!");
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
if (typeof moduleName !==
|
|
41
|
-
throw new IllegalInputError(
|
|
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(
|
|
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(
|
|
2
|
-
const ModuleName = require(
|
|
1
|
+
const yargs = require("yargs");
|
|
2
|
+
const ModuleName = require("./module-name");
|
|
3
3
|
|
|
4
|
-
const argv = yargs
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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(
|
|
2
|
-
const path = require(
|
|
3
|
-
const log = require(
|
|
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,
|
|
23
|
+
const filePath = path.join(__dirname, "..", "..", "..", filePathFromRoot);
|
|
24
24
|
if (!fs.existsSync(filePath)) {
|
|
25
|
-
log.warn(
|
|
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,
|
|
32
|
-
const currentFileContents = currentFileContent.split(
|
|
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(
|
|
36
|
+
log.warn("[%s] File already has line appended!", filePath);
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
if (
|
|
40
40
|
!isSectionMatched &&
|
|
41
|
-
(typeof sectionPredicate !==
|
|
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 =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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(
|
|
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(
|
|
68
|
+
fs.writeFileSync(filePath, newFileContents.join("\n"));
|
|
61
69
|
}
|
|
62
70
|
|
|
63
|
-
function _processUpdates(
|
|
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] =
|
|
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;
|