Releases: thecodrr/fdir
6.1.1
6.1.0
withPathSeparator(separator: "/" | "\") 🆕
withPathSeparator option allows you enforcing a specific path separator regardless of what platform the code is running on. This is especially useful if your test snapshots contain paths as those snapshots will fail on Windows because Node.js uses \\ path separator on Windows by default.
For example:
const files = await new fdir().withFullPaths().withPathSeparator("/").crawl("node_modules").withPromise();6.0.2
More reliable globbing
This release contains a lot of fixes for glob making it much more reliable. (thanks to @bglw for reporting a reproducible test case #92)
For example, doing this would return an empty array:
const crawler = new fdir().withBasePath().glob("**/*.txt");
const files = await crawler.crawl(".").withPromise();This was because picomatch and other globbing libraries don't deal too well with paths that start with . or ./. Starting from this version, fdir tries very hard to not include ./ or . at the beginning of the paths.
The end result is that fdir should now work similar to fast-glob and other globbing libraries.
Node v20 support
Starting from this version, fdir now officially supports Node v20 with all its tests running on it.
Other fixes
fdirnow automatically fallbacks to crawling the current working directory if you pass an empty string as crawl root.- Using
withRelativePathswith./as root path will now have no effect.
6.0.1
6.0.0
Note: While
fdirtries to strictly follow semver, this release doesn't actually break anything. It does deprecate a few things but overall, migrating from v5.3.0 to v6.0.0 should be seamless.
⭐ Features & new stuff
Typescript rewrite
fdir has now been fully rewritten in TypeScript. This brings better clarity into what's happening and how its happening. The code in the project has also be reorganized & broken down so it's much easier to understand now.
Another benefit of using TypeScript is types. Since everything is now autogenerated by tsc, it is always in sync with the actual API. With the help of generics, the output type is now automatically inferred based on the method used. That means no more as string[] etc.
globWithOptions
Globbing support has always been barebones in fdir. This release brings in full support for passing picomatch options when globbing. Use it like this:
new fdir()
.globWithOptions(["**/*.js"], { dot: true })
.crawl("path/to/dir")
.sync();⚔️ Deprecations
A lot of unintuitive & badly designed API choices have been deprecated. They will continue to work as intended but they will eventually be removed in the upcoming major versions. These include:
crawlWithOptions
This function was added as a convenience for people who don't like the Builder API. This has now been replaced with the fdir constructor.
Instead of this:
new fdir()
.crawlWithOptions("./", { includeDirs: true })
.sync();You should now do this:
new fdir({ includeDirs: true })
.crawl("./")
.sync();P.S. I forgot to deprecate
includeDirsand replace it withincludeDirectories. Oh well, I'll do that in the next version.
directories instead of dirs
When using the onlyCounts() API, the resulting object will now contain directories instead of dirs. A minor change but I really don't like abbreviations unless absolutely necessary.
directory instead of dir
When using the group() API, the resulting object will now contain directory instead of dir.
And that's it. No other changes to the API. I am pretty sure that the TypeScript rewrite fixed some hidden & hard-to-debug bugs so you should find v6.0.0 much more stable.
5.3.0
⭐ Features & new stuff
- It is now possible to disable path resolution of files inside symlinked directories (#84). This release adds new optional parameter to the
withSymlinks. Check the docs on how to use it:
This change is 100% backwards compatible and should not break any of your scripts that rely on symlink resolution.
5.2.1
5.2.0
Note: fdir follows semantic versoning hence this release is backward compatible with only version 5.x.
Features
withRelativePathshas been added to return paths relative to the root directory (closes #51)
Fixes
5.1.0
Note: fdir follows semantic versoning hence this release is backward compatible with only version 5.x.
Features
const files = new fdir().withSymlinks().crawl("/path/to/dir").sync();- Performance & memory usage has also been greatly improved due to the many internal refactorings.
Infrastructural improvements:
Aside from the symlinks support, this release has a lot of under-the-hood refactoring. This has improved the maintainability of the project from 83% to 97%.
Major improvements include:
- Added ARCHITECTURE.md
- Added CONTRIBUTING.md
- Consistent internal naming for functions, variables & arguments.
And other changes you can see in PR: #59
Thanks to everyone who has used, supported, tested, & worked on this project. This is also a celebratory release since fdir is now being used by projects such as snowpackjs/snowpack & mdn/yari. So YAY!
5.0.0
Note: fdir follows semantic versoning hence this release is not backward compatible with any previous release.
Breaking Changes
- Filters applied using
new fdir().filter()are now joined via AND instead of OR. (#35)
Features
- There is now a brand new
onlyDirsbuilder function that allows you to grab (and filter) only directories ignoring all files. (#43)
const crawler = new fdir().onlyDirs();- As a result, filters now work with directories as well and include
isDirectoryas second parameter to.filter()function:
const crawler = new fdir()
.filter((path, isDirectory) => path.startsWith("."))
.filter((path, isDirectory) => path.endsWith(".js"));- Full path of the directory is now sent to the
excludeFnof.exclude(excludeFn): (#46)
const crawler = new fdir().exclude((dirName, dirPath) =>
dirName.startsWith(".")
);