Created by: kevin940726
Continue from #7991. Allow @scope
shorthand for template package name.
The motivation comes from https://github.com/storybookjs/storybook/issues/9327#issuecomment-571972738, where when library authors want to provide cra template under their scoped name, typing --template @storybook/cra-template
every time seems tedious. Instead, it'd be better if the users can just type --template @storybook
to 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.
provided template | downloaded package |
---|---|
--template cra-template |
cra-template |
--template cra-template-typescript |
cra-template-typescript |
--template typescript |
cra-template-typescript |
--template @scope/cra-template-typescript |
@scope/cra-template-typescript |
--template @scope/typescript |
@scope/cra-template-typescript |
--template @scope (Added) |
@scope/cra-template |
This PR also fixes a bug (?) when users provided --template cra-templates
would still download cra-templates
while it should be cra-template-cra-templates
, as templates should be prefixed by cra-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 :)