From d322b552850fca7f6281ce6629ccad13f8273b84 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Wed, 14 Jun 2023 11:41:03 +0200 Subject: [PATCH] Refactor docs --- lib/index.js | 2 +- readme.md | 55 +++++++++++++++++++++++++++------------------------- 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/lib/index.js b/lib/index.js index ffa9a0f..e25433f 100644 --- a/lib/index.js +++ b/lib/index.js @@ -46,7 +46,7 @@ * @typedef SpecAffix * Define prepending and/or appending. * @property {string | null | undefined} [prefix] - * Substring to prepend in front of the field. + * Substring to prepend before the field. * @property {string | null | undefined} [suffix] * Substring to append after the field. */ diff --git a/readme.md b/readme.md index 63c181c..23f7968 100644 --- a/readme.md +++ b/readme.md @@ -17,8 +17,8 @@ * [Install](#install) * [Use](#use) * [API](#api) - * [`rename(file, renames)`](#renamefile-renames) * [`convert(renames)`](#convertrenames) + * [`rename(file, renames)`](#renamefile-renames) * [`Move`](#move) * [`Renames`](#renames) * [`Spec`](#spec) @@ -41,7 +41,7 @@ support for renaming files to end users. ## Install This package is [ESM only][esm]. -In Node.js (version 14.14+ and 16.0+), install with [npm][]: +In Node.js (version 16+), install with [npm][]: ```sh npm install vfile-rename @@ -97,37 +97,37 @@ This package exports the identifiers [`convert`][api-convert] and [`rename`][api-rename]. There is no default export. -### `rename(file, renames)` - -Rename a file. +### `convert(renames)` -When given something, returns a vfile from that, and changes its path -properties. +Create a function (the move) from `renames`, that when given a file changes +its path properties. ###### Parameters -* `file` (`VFile`) - — file to rename * `renames` ([`Renames`][api-renames], optional) — rename instructions ###### Returns -Nothing (`undefined`). +A move ([`Move`][api-move]). -### `convert(renames)` +### `rename(file, renames)` -Create a function (the move) from `renames`, that when given a file changes -its path properties. +Rename a file. + +When given something, returns a vfile from that, and changes its path +properties. ###### Parameters +* `file` (`VFile`) + — file to rename * `renames` ([`Renames`][api-renames], optional) — rename instructions ###### Returns -A move ([`Move`][api-move]). +Nothing (`undefined`). ### `Move` @@ -171,15 +171,15 @@ the path property on the given file is prefixed and/or suffixed. ###### Fields -* `basename` (`string` or [`SpecAffix`][api-spec-affix], optional) +* `basename` ([`SpecAffix`][api-spec-affix] or `string`, optional) — change basename (`'index.min.js'`). -* `dirname` (`string` or [`SpecAffix`][api-spec-affix], optional) +* `dirname` ([`SpecAffix`][api-spec-affix] or `string`, optional) — change dirname (`'~'`). -* `extname` (`string` or [`SpecAffix`][api-spec-affix], optional) +* `extname` ([`SpecAffix`][api-spec-affix] or `string`, optional) — change extname (`'.js'`). -* `path` (`string`, `URL` or [`SpecAffix`][api-spec-affix], optional) +* `path` ([`SpecAffix`][api-spec-affix], `URL`, or `string`, optional) — change file path (`'~/index.min.js'`). -* `stem` (`string` or [`SpecAffix`][api-spec-affix], optional) +* `stem` ([`SpecAffix`][api-spec-affix] or `string`, optional) — change stem (`'index.min'`). ### `SpecAffix` @@ -189,7 +189,7 @@ Define prepending and/or appending (TypeScript type). ###### Fields * `prefix` (`string`, optional) - — substring to prepend in front of the field + — substring to prepend before the field * `suffix` (`string`, optional) — substring to append after the field. @@ -201,14 +201,17 @@ It exports the types [`Move`][api-move], [`Renames`][api-renames], ## Compatibility -Projects maintained by the unified collective are compatible with all maintained +Projects maintained by the unified collective are compatible with maintained versions of Node.js. -As of now, that is Node.js 14.14+ and 16.0+. -Our projects sometimes work with older versions, but this is not guaranteed. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, `vfile-rename@^2`, +compatible with Node.js 12. ## Security -Use of `vfile-rename` is safe by default. +Use of `vfile-rename` is safe. ## Contribute @@ -238,9 +241,9 @@ abide by its terms. [downloads]: https://www.npmjs.com/package/vfile-rename -[size-badge]: https://img.shields.io/bundlephobia/minzip/vfile-rename.svg +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=vfile-rename -[size]: https://bundlephobia.com/result?p=vfile-rename +[size]: https://bundlejs.com/?q=vfile-rename [sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg