Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit 6303f37

Browse files
committed
CLEANUP && VERSION
1 parent b1c06f8 commit 6303f37

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules/
22
dist
3+
settings.json

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "storybook-addon-smart-knobs",
3-
"version": "4.1.2",
3+
"version": "5.0.0",
44
"description": "Automatically created knobs for storybook.",
55
"repository": "https://github.com/storybooks/addon-smart-knobs",
66
"license": "MIT",
@@ -25,6 +25,7 @@
2525
"@storybook/addon-info": "^5.0.0",
2626
"@storybook/addon-knobs": "^5.0.0",
2727
"@storybook/addon-options": "^5.0.0",
28+
"@storybook/client-logger": "^5.0.0",
2829
"@storybook/react": "^5.0.0",
2930
"babel-loader": "^8.0.4",
3031
"css-loader": "^3.1.0",

src/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { cloneElement } from 'react'
22
import { action } from '@storybook/addon-actions'
3+
import { logger } from '@storybook/client-logger'
34
import { text, boolean, number, object, select } from '@storybook/addon-knobs'
45

56
const knobResolvers = {}
@@ -46,8 +47,8 @@ const createSelect = (propName, elements, defaultProps) => {
4647
try {
4748
const options = elements
4849
// Cleanup string quotes, if any.
49-
.map(value => value.value.replace(/^['"](.*)['"]$/, '$1'))
50-
.reduce(optionsReducer, {})
50+
.map(value => value.value.replace(/^['"](.*)['"]$/, '$1'))
51+
.reduce(optionsReducer, {})
5152
return select(propName, withDefaultOption(options), defaultProps[propName])
5253
}
5354
catch (e) { }
@@ -86,7 +87,7 @@ export const withSmartKnobs = (story, context) => {
8687

8788
if (!item.type) {
8889
const defaultValue = item.defaultValue ? item.defaultValue.value : 'Unknown'
89-
console.warn(`There is a prop with defaultValue ${defaultValue} but it wasnt specified on element.propTypes. Check story: "${context.kind}".`)
90+
logger.warn(`There is a prop with defaultValue ${defaultValue} but it wasn't specified on element.propTypes. Check story: "${context.kind}".`)
9091
return acc
9192
}
9293

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1459,7 +1459,7 @@
14591459
memoizerific "^1.11.3"
14601460
qs "^6.6.0"
14611461

1462-
"@storybook/[email protected]":
1462+
"@storybook/[email protected]", "@storybook/client-logger@^5.0.0":
14631463
version "5.1.9"
14641464
resolved "https://registry.yarnpkg.com/@storybook/client-logger/-/client-logger-5.1.9.tgz#87e2f7578416269adeccd407584010bc353f14d3"
14651465
integrity sha512-1+Otcn0EFgWNviDPNCR5LtUViADlboz9fmpZc7UY7bgaY5FVNIUO01E4T43tO7fduiRZoEvdltwTuQRm260Vjw==

0 commit comments

Comments
 (0)