Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: noStoriesOf loader option support for custome story #4012

Merged
merged 9 commits into from
Aug 28, 2018

Conversation

466023746
Copy link

@466023746 466023746 commented Aug 13, 2018

Issue:#3993

@466023746 466023746 requested a review from igor-dv as a code owner August 13, 2018 13:51
@466023746 466023746 changed the title add: noStoriesOf loader option support for custome story feature: noStoriesOf loader option support for custome story Aug 14, 2018
var withStorySource = require('@storybook/addon-storysource').withStorySource;
var __STORY__ = ${sourceJson};
var __ADDS_MAP__ = ${addsMap};

${result.source}
`;
} else {
return `
export var __STORY__ = ${sourceJson};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can export them anyway, and reduce this conditions complexity

const result = injectDecorator(source, ADD_DECORATOR_STATEMENT, this.resourcePath, options);

if (!result.changed) {
if (!options.noStoriesOf && !result.changed) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the whole point of the feature is that you don't want to inject the decorator, but you do wont to extract the source, so let's just call this parameter injectDecorator and it will be true by default.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, it's greet!

@466023746
Copy link
Author

if publish, hopes notify me here, thanks

@igor-dv
Copy link
Member

igor-dv commented Aug 20, 2018

if publish, hopes notify me here, thanks

You mean you don't want to continue this PR?

@466023746
Copy link
Author

ehhh..., i have thought you will change it, sorry, understand mistake.
i will continue this pr

@codecov
Copy link

codecov bot commented Aug 23, 2018

Codecov Report

Merging #4012 into master will increase coverage by 0.05%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4012      +/-   ##
==========================================
+ Coverage   40.52%   40.57%   +0.05%     
==========================================
  Files         469      469              
  Lines        5636     5641       +5     
  Branches      745      748       +3     
==========================================
+ Hits         2284     2289       +5     
  Misses       2984     2984              
  Partials      368      368
Impacted Files Coverage Δ
addons/storysource/src/loader/index.js 0% <ø> (ø) ⬆️
addons/storysource/src/loader/inject-decorator.js 100% <100%> (ø) ⬆️
addons/storysource/src/loader/generate-helpers.js 91.66% <100%> (+1.04%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9d2756c...7abf5d8. Read the comment docs.

Copy link
Member

@igor-dv igor-dv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I like it 🥇

}
);

it('don\'t injects stories decorator after the all "storiesOf" functions', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it('does not inject

}
);

it('don\'t injects stories decorator after the all "storiesOf" functions', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same =)

}
);

it('don\'t injects stories decorator after the all "storiesOf" functions', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

options.parser
);
const { injectDecorator = true } = options;
const { changed, source: newSource, comments } = injectDecorator
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's check it with injectDecorator === true

@igor-dv
Copy link
Member

igor-dv commented Aug 27, 2018

Please merge from master, it should solve CI issues.

@466023746
Copy link
Author

ok

@igor-dv igor-dv merged commit 772847a into storybookjs:master Aug 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants