Skip to content
GitLab
    • Explore Projects Groups Snippets
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
  • Issues
  • #8844
Closed
Open
Issue created 5 years ago by Administrator@rootContributor
  • New related issue

  • Report abuse to administrator

  • New related issue

  • Report abuse to administrator

Support template sources outside of npmjs.com

Closed

Support template sources outside of npmjs.com

Created by: andredigenova

Is your proposal related to a problem?

Using create-react-app templates outside of the npmjs.com ecosystem is painful. It seems the only viable way to do it is pull the code down yourself and use the file: syntax, or host a tarball somewhere.

This is fairly important for template code bases that are private since there doesn't appear to be a no-cost way of hosting private packages on npmjs.com.

Describe the solution you'd like

There are a couple solutions to this and I think both of them would be universally useful.

  • Support git repo URI syntax in the --template argument.
  • Support an argument to specify a 3rd party npm registry for the template

I'm sure there are probably others I didn't think of.

Describe alternatives you've considered

Setting a 3rd-party npm package registry on npm globally before running npx create-react-app seems to be broken. I tested it with Github's npm registry and it failed with an odd error part way through project setup.

All variations of git URI syntax I've tried don't seem to work and produce errors mostly related to cra-template getting injected when it shouldn't be.

Additional context

(Write your answer here.)

  1. Oh no!

    You are trying to upload something other than an image. Please upload a .png, .jpg, .jpeg, .gif, .bmp, .tiff or .ico.

    Incoming!

    Drop your designs to start your upload.
Tasks
0

No tasks are currently assigned. Use tasks to break down this issue into smaller parts.

Linked items
0

Link issues together to show that they're related. Learn more.

Activity


  • Administrator
    Administrator @root · 5 years ago
    Author Contributor

    Created by: ricardoamedeiros

    Is your proposal related to a problem?

    Using create-react-app templates outside of the npmjs.com ecosystem is painful. It seems the only viable way to do it is pull the code down yourself and use the file: syntax, or host a tarball somewhere.

    This is fairly important for template code bases that are private since there doesn't appear to be a no-cost way of hosting private packages on npmjs.com.

    Describe the solution you'd like

    There are a couple solutions to this and I think both of them would be universally useful.

    • Support git repo URI syntax in the --template argument.
    • Support an argument to specify a 3rd party npm registry for the template

    I'm sure there are probably others I didn't think of.

    Describe alternatives you've considered

    Setting a 3rd-party npm package registry on npm globally before running npx create-react-app seems to be broken. I tested it with Github's npm registry and it failed with an odd error part way through project setup.

    All variations of git URI syntax I've tried don't seem to work and produce errors mostly related to cra-template getting injected when it shouldn't be.

    Additional context

    (Write your answer here.)

    Hi @andredigenova,

    I have the same problem. Your issue is similar the issue #8425 (closed).

    I did all set up for private npm, but not working.

  • Administrator
    Administrator @root · 5 years ago
    Author Contributor

    Created by: ricardoamedeiros

    I discovered the problem. The template path within node_modules was not being found. I made the pull request with the following adjustment:

    javascript:

    create-react-app/packages/react-scripts/scripts/init.js

    befor:

    const templatePath = path.dirname( require.resolve(${templateName}/package.json, { paths: [appPath] }) );

    after:

    const templatePath = path.dirname( require.resolve(${templateName}/package.json, { paths: [${appPath}/node_modules] }) );

  • Administrator
    Administrator @root · 5 years ago
    Author Contributor

    Created by: mrmckeb

    Hi @andredigenova,

    This should work fine with third-party registries. I use it with Verdaccio on a work-related project. Can you please share your template?

    Also, note that templates are required to have a main field in them to work until our next release, see: https://github.com/facebook/create-react-app/commit/e0b179c8ffd0386609ad7c2ad5599652ca8cbcd1#diff-1453d9590326c639309801105bc967c2

  • Administrator
    Administrator @root · 5 years ago
    Author Contributor

    Created by: ricardoamedeiros

    With field "main" in package.json worked.

  • Administrator
    Administrator @root · 5 years ago
    Author Contributor

    Created by: mrmckeb

    Thanks for the update! I'll close this off. Sorry again, we'll get the fix out ASAP.

Please register or sign in to reply
0 Assignees
None
Assign to
Labels
1
issue: needs investigation
1
issue: needs investigation
    Assign labels
  • Manage project labels

Milestone
No milestone
None
Due date
None
None
None
Time tracking
No estimate or time spent
Confidentiality
Not confidential
Not confidential

You are going to turn on confidentiality. Only project members with at least the Reporter role, the author, and assignees can view or be notified about this issue.

Lock issue
Unlocked
1
1 participant
Administrator
Reference: facebook/create-react-app#8844

Menu

Explore Projects Groups Snippets