readmelinks v0.2.1
readmelinks
TL;DR
Install
npm i -D readmelinks
or
yarn add readmelinks -D
First run
yarn readmelinks
or
node_modules/.bin/readmelinks
Check generated configuration in the package.json
Overview
A simple tool which does two things
- finds all
*.md
files across the project (<root>/src
is default folder for search) - inserts links of found files into the
README.md
in the root of the project
No extra dependencies
readmelinks
uses only Nodejs
API.
Although it is written in typescript
and tested with Jest, in the end you are using a pure Javascript
tool without any 3-rd party dependencies and thus unexpected surprises.
Configuration
First run of node_modules/.bin/readmelinks
inserts default configuration and script into package.json
.
// package.json
{
...
"scripts": {
...
"readmelinks": "readmelinks"
},
...
"readmelinks": {
"srcRoot": "src",
"commentMark": "readmelinks-generator",
"regexp": "\\.md$"
}
}
Then you can run the tool with a short command
npm run readmelinks
Multiple configurations
You can define an array of configurations this way
// package.json
{
...
"scripts": {
...
"readmelinks": "readmelinks"
},
...
"readmelinks": [
{
"srcRoot": "src",
"commentMark": "readmelinks-generator",
"regexp": "\\.md$"
},
{
"srcRoot": "assets",
"commentMark": "readmelinks-svg-generator",
"regexp": "\\.svg$"
}
]
}
Configuration params
srcRoot
Relative path to the search folder
Example:
Name of the project folder = foo
Name of the search folder = app
Absolute path to search folder = ~/project/foo/src/app
Config value to use = "srcRoot": "src/app"
commentMark
Name of the comment placeholder, which readmelinks
uses to find the location for generated content.
Example:
"commentMark": "readmelinks-generator"
First time readmelinks
is executed it inserts two comment lines in the end of README.md
unless those comment lines are already present.
The generated list of links will be put between them.
<!-- readmelinks-generator-begin -->
... generated content is updated here every time readmelinks is executed
<!-- readmelinks-generator-end -->
You can move those two lines wherever you want in README.md
regexp
This attribute is required and expects a valid Regexp string,
so new Regexp(regexp)
should not throw an error.
Examples:
regexp: "\\.png$"
showFileName
Optional parameter with boolean type.
If set to true
then the link name will contain the name of the file
Examples
showFileName: false
* [components/Pagination/docs](docs/Pagination.md)
showFileName: true
* [components/Pagination/docs/Pagination.md](docs/Pagination.md)