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

fixes #27 - upgraded required node version 0.10 as path.delimiter and pa... #60

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Conversation

KevinAdu
Copy link

@KevinAdu KevinAdu commented Aug 4, 2014

I have upgraded the required node version to 0.10 as mentioned in #27. This allows the use of path.delimiter and path.sep to make component-hint a bit more windows-friendly.

As with regards to testing, I felt that once #56 is up the possibility to test across different operating systems would be available.

If you do have any comments, please do let me know.

@@ -30,7 +30,7 @@ exports.pathMatchPatterns = function (absolutePath, pathPatterns) {
}

// Check if starts with pathPattern literal
if (absolutePath.indexOf(pathPattern.replace(/\/?$/, '/')) === 0) {
if (absolutePath.indexOf(pathPattern.replace(/[\\\/]?$/, path.sep)) === 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how will this behave on windows. Since on windows the path will not start with '/' but rather so 'C:'

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So on windows, path.sep will be '' and the regex there will search to see if the end of the pathPattern to see if it ends with either '/', '' or '' and then replace it with path.sep. Then there is a check to see if absolutePath begins with the modified pathPattern. So it will behave as normal from before. For example:

absolutePath pathPattern result
C:\foo\bar\ C:\ true
C:\foo\bar\ C:\foo\ true
C:\foo\bar\ C:\foo true
C:\foo\bar\ C:\bar false
C:\foo\bar\ C:\foo\bar true

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah my bad, seems i mis-read what you wrote. Totally thought your regex was /^[\\\/]?/. My bad. This is fine and sorry for the confusion.

@AlmirKadric
Copy link
Collaborator

Hi @KevinAdu,

Sorry for the delay, to be honest I wrote a response not too long after I got the PR and had it in my browser. But felt like nitpicking on it a bit more and ... well my browser must've crashed and before I pressed the comment button. Losing the comment, but thinking I had completed it. Apologies for that.

Apart from the question above. The PR itself looks good to go. However we will try and maintain node 0.8 compatibility for a little bit longer as we aren't in a rush to move to 0.10/0.12 just for better path management.

We are thinking of creating a component version 1 branch of this project to support some of the new features component has. This will probably belong in that branch, as component 1 needs a more up to date version of nodejs.

@KevinAdu
Copy link
Author

Hi @AlmirKadric,

That's alright, don't worry about it. Sorry about the delayed response myself, I was travelling and then just got back a couple of days ago.

Thank you for the review! I see, that makes sense. Then when that component 1 branch is created, would you like me to create a pull request for that branch?

@AlmirKadric
Copy link
Collaborator

Yes please! If you don't mind waiting a little bit longer.
We're still discussing internally about the move to component 1.0

@KevinAdu
Copy link
Author

Sure that's no problem!
Please do just let me know when you're ready :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants