Run verb (https://github.com/verbose/verb) by using a docker-container.
606
Run verb on Docker.
(TOC generated by verb using markdown-toc)
verb is a great solution to document projects, create README files, enter README driven development. This project helps to make it even easier to use by "dockerizing" verb.
(By using this solution you do not need to install verb as a global node.js package anymore)
$ docker run --rm -v ${PWD}:/opt/verb stefanwalther/verb
What does actually happen here?
-v mounts the current directory to the docker containerverb will be executed (and the container being destroyed)I recommend to add a task into your package.json file, which triggers the creation of your README.md file
{
"name": "Your Repo",
"scripts": {
"docs": "docker run --rm -v ${PWD}:/opt/verb stefanwalther/verb"
}
}
Then, whenever you want to generate your docs, run:
$ npm run docs
Some recipes I have come up over time, using verb nearly on a daily basis.
If you want to auto-build your docs whenever you make changes, there is a pretty neat way to achieve that:
$ npm install -g nodemon
"scripts": {
"docs": "docker run --rm -v ${PWD}:/opt/verb stefanwalther/verb",
"docs:watch": "nodemon --config ./nodemon.json --exec 'yarn' docs"
},
{
"ext": "md",
"verbose": false,
"ignore": [
"README.md"
],
"watch": [
".verb.md",
"docs"
]
}
$ npm run docs:watch
If you are not making any changes to either .verb or any document in ./docs, then your README.md will be re-generated.
If you commit often, you don't want to miss when to run verb, but on the other hand I don't want to run it if not necessary. This is how I manged to achieve this goal:
prepush hook with a custom script which just figures out if running verb is necessary (in this case only if there are changes in the .verb file or if anything has changed in the ./docs/ directory).package.json:
"scripts": {
"docs-if-necessary": "./scripts/docs-if-necessary.sh",
"docs": "docker run --rm -v ${PWD}:/opt/verb stefanwalther/verb",
"prepublish": "npm run docs-if-necessary"
}
./scripts/docs-if-necessary.sh:
#!/usr/bin/env bash
if (git status | grep -E "docs/|.verb.md" -q);
then
npm run docs;
# Stop the push
# Note: Instead of exiting you could even go one step further and
# automatically git commit the newly created README.md. I have
# experimented with that, but didn't really like it.
exit 10;
fi
... none known so far ...
See CHANGELOG file
Stefan Walther
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue. The process for contributing is outlined below:
I cannot guarantee that I will merge all PRs but I will evaluate them all.
Copyright © 2021, Stefan Walther.
MIT
Content type
Image
Digest
Size
55.1 MB
Last updated
about 5 years ago
docker pull stefanwalther/verb