Skip to content

cd path does not work as expected #153

Closed
@mxstbr

Description

@mxstbr

When having created a new app, create-react-app outputs this information:

Success! Created weather-app at /Users/a2517/sites/commercial/plotly/academy/weather-app.

…

We suggest that you begin by typing:
  cd /Users/a2517/sites/commercial/plotly/academy/weather-app
  npm start

screen shot 2016-07-24 at 10 08 14

As you can see, there's two absolute paths there, even though it doesn't really make sense to have the cd path be absolute. Instead, the instructions should show:

cd weather-app
npm start

Looking at the source of this, it seems like there was some sort of precaution taken to only show the absolute path when one is no longer in the original folder, but it's not working as expected since it shows the absolute path even when one is in the original folder:

// init.js:58

// Make sure to display the right way to cd
    var cdpath;
    if (path.join(process.cwd(), appName) === hostPath) {
      cdpath = appName;
    } else {
      cdpath = hostPath;
    }

(hostPath is absolute, it should only show the appName when still in the original folder, as in my case)

Something about this check is off: path.join(process.cwd(), appName) === hostPath. I'm not well versed enough in that part of the codebase to find the bug in this code, but maybe @vjeux or @gaearon have some idea?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions