yangshun/tree-node-cli

Add sort option

slorber opened this issue · 3 comments

Unfortunately the fs.readdirSync(path); ordering is not guaranteed across OS

I'm using Tree (node API) to create Jest snapshots of FS paths on Docusaurus, it works great

But unfortunately, the tree order is non-deterministic and this leads to the CI failing but just on Windows: https://github.com/facebook/docusaurus/runs/5071012843?check_suite_focus=true

image

Let me know if you can give me access on Git/npm @yangshun, I'd be happy to refresh a bit this package as there"s not a lot of good alternatives

@slorber added you to the npm package! I'll add you to the repo as well.

Implemented in #2c2db57. See if it fixes it for you. If it does should we bump a major/minor/patch? Could be considered both a breaking change and a bug fix

Thanks 👍

I think it's safe to be considered as a windows bugfix because

-r, --reverse             Sort the output in reverse alphabetic order.

Implies not using the option is already sorted

And the test didn't change so the behavior is the same for most users


I'll add some basic typedefs and publish soon