Installing a man page is not easy as there are little infos out there about it.
After a lot of trial and error, google searches and alpha publishing my app I finally have a collection of things I need to do to get it working:
- Create a roff file
- You can use https://github.com/kapouer/marked-man to convert mardown to roff
- Make sure you have a headline and several sub headlines like so:
For a full example look at https://raw.githubusercontent.com/cuttlebelle/cuttlebelle/master/man/man.mdCUTTLEBELLE =========== > Cuttlebelle - The react static site generator that separates editing and code concerns ## SYNOPSIS `cuttlebelle [init] [-i] [docs] [-d] [watch] [-w] [--no-generate] [-n] [--silent] [-s] [--version] [-V] [--verbose] [-v]` ## DESCRIPTION Cuttlebelle is a react static site generator that separates editing and code concerns. ## EXAMPLES etc
- Name the file the same as your
bin
command. So if your bin command iscuttlebelle
the name of the file should becuttlebelle.1
- A handy npm script would be:
"scripts": { "prepublish": "npm run man", "man": "cd man && marked-man --version 'v1.0.0' --manual 'Cuttlebelle Help' --section 1 man.md > cuttlebelle.1" }
- Test your roff file locally
- cd into your man folder and run
man ./cuttlebelle.1
to see what it looks like - Tweak until pretty :)
- cd into your man folder and run
- Add your roff file to your
package.json
- Derived from others you need to add below to your
package.json
:
(We assume here you placed your roff file into the"directories": { "man": "man" },
./man
folder.) - Do not add the
man
array or anything else man related
- Derived from others you need to add below to your
- Test your man page locally
- After you saved all files above rerun
npm link
. This will and should make the man page available to you locally before publishing. - If it does not work recheck everything above
- After you saved all files above rerun
- Publish
- Perhaps publish via an
alpha
tag first to make sure. Do via changing your current version tox.x.x-alpha.1
and runnpm publish --tag alpha
. Plublishing an alpha version and tagging it will prevent anyone from getting this version unless they secify that tag - Now install your app globally by specifying the version or tag:
npm i -g yourapp@alpha
- Try
man yourapp
- If successful change your version to
x.x.x
and runnpm publish
- 🔥 done!
- Perhaps publish via an