Uh oh!
There was an error while loading. Please reload this page.
Support shorthand scoped templates - #8298
Conversation
mrmckeb
left a comment
There was a problem hiding this comment.
This looks great @kevin940726! Are you able to add any tests for this?
@mrmckeb Sure! I was trying to do so too, but couldn’t find an appropriate place to put those tests. Should I create e2e tests? Any recommended example? |
mrmckeb
commented
Jan 9, 2020
You could create an E2E test... but those are quite flimsy right now. Perhaps for now we'll leave it, and we'll cover this as we rewrite tests towards v4. |
mrmckeb
left a comment
There was a problem hiding this comment.
This is great overall, just a few minor thoughts on the comments - let me know what you think.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| // @SCOPE/cra-template | ||
| // cra-template-NAME | ||
| // @SCOPE/cra-template-NAME |
Co-Authored-By: Brody McKee <mrmckeb@users.noreply.github.com>
58d7580 to
cb007f4Comparekevin940726
commented
Jan 9, 2020
@mrmckeb That definitely makes them clearer 👍! Just updated :) |
I've tagged this for 3.3.1, as I don't think it's worth delaying this for v3.4 - and we could argue that it is a bug that it doesn't work this way already. |
heyimalex
left a comment
There was a problem hiding this comment.
LGTM, tested each case using that code and it works.
mrmckeb
commented
Jan 12, 2020
Thanks @heyimalex! Merging now @kevin940726 - great work. |
Continue from #7991. Allow
@scopeshorthand for template package name.The motivation comes from storybookjs/storybook#9327 (comment), where when library authors want to provide cra template under their scoped name, typing
--template @storybook/cra-templateevery time seems tedious. Instead, it'd be better if the users can just type--template @storybookto use the template@storybook/cra-template. Since@is not a valid character for npm package name, it should be backward-compatible.Tests
To list all the possible combinations.
--template cra-templatecra-template--template cra-template-typescriptcra-template-typescript--template typescriptcra-template-typescript--template @scope/cra-template-typescript@scope/cra-template-typescript--template @scope/typescript@scope/cra-template-typescript--template @scope(Added)@scope/cra-templateThis PR also fixes a bug (?) when users provided
--template cra-templateswould still downloadcra-templateswhile it should becra-template-cra-templates, as templates should be prefixed bycra-template-, judging from the doc. We can instead allow the other way around though if that makes more sense.Pinging @mrmckeb as we mentioned it in the issue before :)