Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !8298

Support shorthand scoped templates

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/kevin940726/scope-template into master Jan 09, 2020
  • Overview 6
  • Commits 3
  • Pipelines 0
  • Changes 2

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 :)

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/kevin940726/scope-template