Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with findProjectRoot within utils.js #43

Open
jonathan-fielding opened this issue Feb 26, 2016 · 3 comments
Open

Issue with findProjectRoot within utils.js #43

jonathan-fielding opened this issue Feb 26, 2016 · 3 comments
Labels

Comments

@jonathan-fielding
Copy link
Contributor

Hello

So I have noticed an issue with the way in which findProjectRoot attempts to find the project root. By doing a indexOf('node_modules) it sometimes gets confused by some file paths:

Example:

/Users/jonathan/Sites/_beamly_node_modules/whitelabel/node_modules/beamly-js-lint/dist

The expected project route should be

/Users/jonathan/Sites/_beamly_node_modules/whitelabel/

But instead the project route is

/Users/jonathan/Sites

This unfortunately is incorrect, because of the indexOf it is finding the directory I store my modules in _beamly_node_modules

Perhaps a valid fall back if it doesnt find a package.json like that would be to use process.cwd() to find the package.json

Thanks

Jonathan

@nlf
Copy link
Owner

nlf commented Feb 26, 2016

ah.. you're right. i'll have to change the logic so it splits the path on Path.sep and then looks for 'node_modules' in the resulting array.

@jonathan-fielding
Copy link
Contributor Author

I was going to make a pull request but I realised my fix actually breaks windows support

@nlf
Copy link
Owner

nlf commented Sep 15, 2016

how you can fix this and preserve windows support is by doing Path.sep + 'node_modules' + Path.sep instead of hard coding the /

@nlf nlf added the bug label Oct 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants