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
  • Issues
  • #4266
Closed
Open
Issue created Apr 06, 2018 by Administrator@rootContributor

Should it be allowed paths on the --scripts-version argument?

Created by: mAiNiNfEcTiOn

At work I was creating our own react-scripts package, but to test it I needed to define a path rather than a package name.

So for that I ran create-react-app my-example-app --scripts-version file:/my/absolute/path

Obviously, this is a misuse of the attribute and I know this is not a bug, it's just how things are 😉

On the other hand, I noticed that the only reason why this didn't work was because in this line on createReactApp.js it is expected that packageName is a part of the path and not the path itself...

So in the beginning of this function I did a mutation of the argument (I know I know, bad boy...):

packageName = packageName.startsWith('file:') ? path.basename(packageName.substr(5)) : packageName;

I'd like to highlight that this serves only my purpose...

So my question is... Imagining that I'd refactor it to a proper fix, that would imply I detect (on the failing places) that a the packageName.startsWith('file:'), then I use as the start of the path.resolve() the packageName directly. Why? To cover cases where the packageName is something like /my/absolute/path/@org/react-scripts, where a basename would kill it 😛

Would you be interested in it?

Assignee
Assign to
Time tracking