Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
TestBuild: Globalize
@storybook/blocks
ifbuild.test.emptyBlocks
istrue
#24650TestBuild: Globalize
@storybook/blocks
ifbuild.test.emptyBlocks
istrue
#24650Changes from 7 commits
6538477
9a72ed0
dd598b4
bbcf2bc
fc00057
e157a2a
d241d03
533d728
af3225f
c100c46
9188288
8c2d720
8fbe192
52e38c6
33ec86a
40ea412
5230210
665ddee
901516b
dda1af7
cd3ad1f
1a90573
ebd4fa6
5c51f63
1c70ab2
c3e78ac
d64b883
7c7661a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit of a hack, reusing the
externalGlobalsPlugin
for this purpose.It would be more "correct" and easier to understand later to create a separate plugin for this that did
effectively it's the same, but I think this might be easier to debug down the line. It's also more effort though, which might not be worth it right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought, I don't understand why this PR even works in it's current state. Based on what I see in that plugin, it will now do:
But if
__STORYBOOK_BLOCKS_EMPTY_MODULE__
isundefined
that line will surely fail to destructure?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It gets assigned an empty object in the builders!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the idea here to allow referencing globals that don't actually exist in this list? That seems a little bit dangerous, as it will remove some type safety when referencing them throughout the codebase. I think it would be better to add a
//@ts-expect-error
whenglobals['@storybook/blocks']
is used, instead.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IanVS What do you think of this compromise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sure it is still autocompleted for the known keys:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But then it won't start to fail if one of those keys is removed, will it? I think that's a useful property to have, personally. Likewise, if
__STORYBOOK_BLOCKS_EMPTY_MODULE__
does get added, we would want the places expecting it to be empty to start to fail (the ts-expect-error).That said, I don't see any
ts-expec-error
in the code anymore, so it looks like maybe this is a non issue?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test
feels a little bit ambiguous to me. I can imagine a new user looking at these options and wondering what the difference is betweentest
andci
, for example. At the risk of being verbose, I would suggesttestMode
ortestingMode
or justtesting
or to be symmetric withdocs
:tests
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it to
build.test
as per @shilman's suggestion.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IanVS We had a long internal discussion about this. I'm okay with
--test-mode
or--testing
, but I guess if we have good docs--test
should be fine as well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, though I don't like relying on docs to make up for confusing names. Not everyone reads docs, and the command may be put into a package.json script where the docs are not at hand when someone is reading it and trying to understand what it does. I kind of like
--tests
, to match--docs
, personally, since they are both special modes of running Storybook, it feels like they should kind of match up.That said, I don't feel super-strongly about the naming, just wanted to bring it up as a potentially confusing name. Thanks for the consideration!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shilman What do you think about —tests?