This package provides [Text-Runner](https://github.com/kevgo/text-runner) actions for verifying the documentation of npm packages.
npm install textrun-npmThis package provides Text-Runner
actions for verifying the documentation of npm packages.
To use these actions, add this package as a development dependency by runningnpm i -D textrun-npm.
The npm/install action verifies installation
instructions for an npm package. As an example, let's assume we are testing the
documentation of an npm package called foobar.
Its package.json file would contain amongst
other things:
``json`
{
"name": "foobar"
}
In the documentation of this npm package, we want to document how to install
this package. It would contain a section that looks something like this:
`md
Install the foobar package by running:
npm install foobar
or with Yarn:
yarn add foobar
Text-Runner verifies that the installation instructions contain the correct name
of the npm package.
Verify exported binaries
The npm/exported-executable action verifies
documentation of exported binaries of npm packages. Let's say our
foobar
package provides an executable file bin/foo,
which is listed as a binary in the package.json
file:`js
{
"name": "foobar",
"bin": {
"foo": "bin/foo"
}
}
`The documentation for the "foobar" package would document this binary like this:
`md
After you install the "foobar" package, you can run the
foo command in the terminal.
`$3
The npm/installed-executable action verifies
binaries installed by other npm packages. Let's say you develop technical
documentation for a codebase that uses the
cucumber command provided by the npm
cucumber package:
`html
To run the end-to-end tests, run
cucumber in the terminal.
`$3
The npm/script-name action verifies that you
document scripts that your
package.json file defines correctly.Let's say your npm package has this
package.json file:
`json
{
"name": "foobar",
"scripts": {
"lint": "echo linting"
}
}
`And your documentation says:
`html
To run the linters, please run the
lint script.
`$3
The npm/script-call action verifies that you
document calls of scripts defined in your
package.json file correctly.Let's say your npm package has this
package.json file:
`json
{
"name": "foobar",
"scripts": {
"lint": "echo linting"
}
}
`And your documentation says:
`html
To run the linters, please execute
npm run lint.
``