MyGit

v6.0.0

thecodrr/fdir

版本发布时间: 2023-02-09 02:24:36

thecodrr/fdir最新发布版本:v6.3.0(2024-08-25 21:58:51)

Note: While fdir tries 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.

:star: 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 includeDirs and replace it with includeDirectories. 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.

相关地址:原始地址 下载(tar) 下载(zip)

查看:2023-02-09发行的版本