wdjungst / react-project

State of the art web development with React.js.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

init is copying into a blueprint/ subdir on Windows

insin opened this issue · comments

shelljs' cp() is checking for a source path ending with '/' before adding a wildcard to it, but as the blueprint directory is built with path.join(), it will be in Windows '\' format by the time shelljs gets it.

Manually adding a wildcard to the blueprint path from react-project's end of things doesn't work as a fix, as cp() will try to fs.statSync() it, which blows up with ENOENT on Windows.

I've got it working by manually tweaking the path separator cp() is checking for in react-project's node_modules/, but tweaking cp() to handle platform-normalised input paths properly would be a bigger, less fun job.

I've found copy-template-dir useful for this task cross-platform before - it also handles stripping a leading '_' from file names when copying, so blueprint dotfiles and package.json won't get picked up at unwanted times (e.g. npm will find and usefiles config in package.json at any level in your project when publishing). This could also be a potential fix for #8