@loki/integration-core
Advanced tools
Comparing version 0.22.0 to 0.23.0
{ | ||
"name": "@loki/integration-core", | ||
"version": "0.22.0", | ||
"version": "0.23.0", | ||
"description": "Loki storybook integration core lib", | ||
@@ -25,3 +25,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "0afc976871107720e6eddcf70f5a582a9dc958b0" | ||
"gitHead": "510fd0501e27efde006d906b60a0cf1e41c49015" | ||
} |
@@ -11,19 +11,19 @@ /* eslint object-shorthand: 0, prefer-arrow-callback: 0, no-var: 0, no-console: 0 */ | ||
const originalStoriesOf = storybook.storiesOf; | ||
const skippedStories = {}; | ||
function wrapWithSkipStory(add, kind, isDeprecatedCall) { | ||
return function skipStory(story, storyFn, parameters) { | ||
if (isDeprecatedCall && !warnedSkipDeprecation) { | ||
function wrapWithSkipStory(add) { | ||
return function skipStory(story, storyFn, parameters = {}) { | ||
if (!warnedSkipDeprecation) { | ||
warnedSkipDeprecation = true; | ||
console.warn( | ||
'[DEPRECATED] `.add.skip(...)` is deprecated. Please use `.lokiSkip(...)` instead.' | ||
'[DEPRECATED] `.add.skip(...)` and `.lokiSkip(...)` are deprecated. Please pass `{ loki: { skip: true } }` in the third parameter instead.' | ||
); | ||
} | ||
if (!skippedStories[kind]) { | ||
skippedStories[kind] = []; | ||
} | ||
skippedStories[kind].push(story); | ||
return add(story, storyFn, parameters); | ||
return add(story, storyFn, { | ||
...parameters, | ||
loki: { | ||
...(parameters.loki || {}), | ||
skip: true, | ||
}, | ||
}); | ||
}; | ||
@@ -68,5 +68,5 @@ } | ||
const stories = originalStoriesOf(kind, module); | ||
stories.add.skip = wrapWithSkipStory(stories.add.bind(stories), kind, true); | ||
stories.add.skip = wrapWithSkipStory(stories.add.bind(stories), kind); | ||
stories.add.async = wrapWithAsyncStory(stories.add.bind(stories), true); | ||
stories.add.async.skip = wrapWithSkipStory(stories.add.async, kind, true); | ||
stories.add.async.skip = wrapWithSkipStory(stories.add.async, kind); | ||
stories.add.skip.async = wrapWithAsyncStory(stories.add.skip, true); | ||
@@ -109,18 +109,8 @@ | ||
function getStorybook() { | ||
return storybook.getStorybook().map(function(component) { | ||
const { kind, stories } = component; | ||
const skipped = skippedStories[kind]; | ||
if (skipped) { | ||
return { | ||
kind: kind, | ||
skipped: skipped, | ||
stories: stories.filter(function(story) { | ||
return skipped.indexOf(story.name) === -1; | ||
}), | ||
}; | ||
} | ||
return component; | ||
}); | ||
return storybook | ||
.raw() | ||
.filter( | ||
({ parameters }) => | ||
!parameters || !parameters.loki || !parameters.loki.skip | ||
); | ||
} | ||
@@ -127,0 +117,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6059
132