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

Update sortFiles function #25

Merged
merged 2 commits into from
May 21, 2021

Conversation

friederbluemle
Copy link
Contributor

A couple of improvements to the way the files array is sorted.

It now places exclusions (starting with !) last - Otherwise they have no effect. It will also put directories (ending in /) first, so it better reflects the default ls output with --group-directories-first.

Fixes #24

I also added four new test cases for the sortFiles function.

src/sort-files.js Outdated Show resolved Hide resolved
@friederbluemle
Copy link
Contributor Author

Oh wow, seems like CI is failing for Node 10 due to the way the array sort parameter order was changed in Node.js 11: nodejs/node#24294

Looking into it...

@cameronhunter
Copy link
Owner

@friederbluemle apologies for only seeing this PR now... I somehow completely missed or forgot about it. Looking now.

src/sort-files.js Outdated Show resolved Hide resolved
src/sort-files.js Outdated Show resolved Hide resolved
tests/__fixtures__/package-1.json Show resolved Hide resolved
@friederbluemle
Copy link
Contributor Author

Hey @cameronhunter - thanks for taking a look! It's been a while since I last checked this repo 😅 will have a look as soon as I'm in front of a computer 👍

@cameronhunter
Copy link
Owner

Yeah, I've been slow on this repo. I've just rewritten it in TypeScript and released a new version. It looks like there are some conflicts with this PR as a result – apologies.

Copy link
Contributor Author

@friederbluemle friederbluemle left a comment

Choose a reason for hiding this comment

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

@cameronhunter - I've just rebased the branch and left two comments. Please check when you have time. Thanks!

src/sort-files.js Outdated Show resolved Hide resolved
src/sort-files.js Outdated Show resolved Hide resolved
@friederbluemle
Copy link
Contributor Author

Ooh, I guess I still need to update some of the tests that are broken now...

@friederbluemle friederbluemle force-pushed the update-files-sort branch 2 times, most recently from 5b08cd3 to 8e8adf8 Compare May 8, 2021 02:21
src/sort-files.ts Outdated Show resolved Hide resolved
src/sort-files.ts Outdated Show resolved Hide resolved
@cameronhunter cameronhunter merged commit e2a30ec into cameronhunter:main May 21, 2021
@cameronhunter
Copy link
Owner

Thanks for the contribution @friederbluemle! 🎉

@cameronhunter
Copy link
Owner

Published as v2.6.0

@friederbluemle friederbluemle deleted the update-files-sort branch October 26, 2021 21:16
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.

Sort of files property has undesired side-effect
2 participants