diff --git a/docs/modules/README.md b/docs/modules/README.md index e891cb8..297bed9 100644 --- a/docs/modules/README.md +++ b/docs/modules/README.md @@ -26,6 +26,7 @@ ESLint plugin. - [`ezspawn`](./process-exec.md) - [`faker`](./faker.md) - [`fast-glob`](./glob.md) +- [`fs-extra`](./fs-extra.md) - [`glob`](./glob.md) - [`globby`](./glob.md) - [`ìnvariant`](./invariant.md) diff --git a/docs/modules/fs-extra.md b/docs/modules/fs-extra.md new file mode 100644 index 0000000..dfd8978 --- /dev/null +++ b/docs/modules/fs-extra.md @@ -0,0 +1,60 @@ +# fs-extra + +`fs-extra` adds some file system methods that previously were not included in the native `fs` module and added `Promise` support to the `fs` methods. +Many of the fs-extra modules have since been implemented natively by Node. + +[fs-extra](https://github.com/jprichardson/node-fs-extra) + +## Alternatives + +### `node:fs` + +[Node.js File System Module](https://nodejs.org/docs/latest/api/fs.html) + +To use the promise-based APIs: + +```js +import * as fs from 'node:fs/promises'; +``` + +To use the callback and sync APIs: + +```js +import * as fs from 'node:fs/promises'; +``` + +### Equivalent Methods + +- `ensureFile` -> `fs.exists` - deprecated since v1 +- `ensureFileSync` -> `fs.existsSync` +- `copySync` -> `fs.copyFileSync` +- `mkdirp` -> fs.mkdir` +- `mkdirpSync` -> `fs.mkdirSync` +- `removeSync` -> `fs.rmSync` +- `remove` -> `fs.rm` +- `move` -> `fs.rename` +- `moveSync` -> `fs.renameSync` +- `ensureDirSync` -> `fs.existsSync` +- `pathExistsSync` -> `fs.existsSync` +- `outputFileSync` -> `fs.writeFileSync` + +### Methods that need migrating + +- `copy` +- `emptyDir` +- `emptyDirSync` +- `ensureDir` +- `ensureLink` +- `ensureLinkSync` +- `ensureSymlink` +- `ensureSymlinkSync` +- `mkdirs` +- `mkdirsSync` +- `outputFile` +- `outputJson` +- `outputJsonSync` +- `pathExists` +- `readJson` +- `readJsonSync` +- `writeJson` +- `writeJsonSync` diff --git a/docs/templates/module.md b/docs/templates/module.md index 4621d5d..ccea83a 100644 --- a/docs/templates/module.md +++ b/docs/templates/module.md @@ -2,9 +2,9 @@ {Optional description} -# Alternatives +## Alternatives -## {Alternative package name} +### {Alternative package name} {Description of alternative package} diff --git a/manifests/preferred.json b/manifests/preferred.json index 808d22d..33203d2 100644 --- a/manifests/preferred.json +++ b/manifests/preferred.json @@ -90,6 +90,12 @@ "docPath": "glob", "category": "preferred" }, + { + "type": "documented", + "moduleName": "fs-extra", + "docPath": "fs-extra", + "category": "preferred" + }, { "type": "documented", "moduleName": "glob",