Skip to content
DocPensieve
0.2.0

Commands

npx docpensieve <command> [arguments] [options]

init

Sets up a documentation project.

npx docpensieve init [dir]
OptionEffect
[dir]Target folder. Default: .
-n, --name <name>Project name
-t, --theme <framework>tailwind or custom
-u, --site-url <url>Public URL of the site
--version-name <version>First version, 1.0 for instance
-y, --yesAccepts the defaults without a dialogue
-f, --forceOverwrites an existing configuration
--minimalLeaves DocPensieve's documentation out

Without --force, the command refuses to overwrite an existing configuration.

Without an interactive terminal — a script, continuous integration, or a terminal that gives the programs it runs no interactive input — the command asks nothing: it says so, then sticks to the options and the defaults. --yes makes that choice explicit and silences the notice.

Unless --minimal is given, the command installs DocPensieve's documentation in the new site, in docs/<version>/99-docpensieve/: a DocPensieve section at the end of the menu, matching the installed version. Delete that folder when you no longer need it.

Under the custom theme, the command also writes theme/custom.css, where the project's own classes go, and — with the documentation — theme/99-docpensieve.css, the classes of its examples, to delete along with it. An existing theme/custom.css is never overwritten, even with --force.

build

Generates the site.

npx docpensieve build [version]
OptionEffect
[version]Version slug. When omitted, every version is built
-o, --out <dir>Output folder. Default: the one in the configuration

With a slug, only that version is written, in versions/<slug>/. That form writes neither the manifest nor the root redirect: after adding or removing a version, run a full build.

check

Reads the produced site back: internal links and markup.

npx docpensieve check
OptionEffect
-d, --dir <dir>Folder to check. Default: the one in the configuration
  • a target that ignores the deployment prefix — the file exists, but the link will lead nowhere once online. It is the symptom of a URL that escaped resolution;
  • a target that matches no produced file.

External targets, anchors and mailto: are left alone. A target that comes back several times in a page is reported only once.

Markup

  • a paragraph nested in another one;
  • a paragraph inside an element that only accepts text, a span for instance;
  • a block element inside a paragraph, a heading for instance.

They usually come from the same source, described in Writing pages: the content of a JSX tag left alone on its line becomes a paragraph. The browser then silently undoes the nesting, the wrapper disappears, and the intended layout with it.

If anything is left to fix, the command exits with code 1: it therefore fails a continuous integration run without any particular setting.

dev

Development server, which rebuilds on every save.

npx docpensieve dev
OptionEffect
-p, --port <number>Listening port. Default: 3000

serve

Serves the output folder statically, without rebuilding anything.

npx docpensieve serve
OptionEffect
-p, --port <number>Listening port. Default: 4000
-d, --dir <dir>Folder to serve

It is the command that faithfully reproduces what a host will do: to check what will be published, chain build then serve.

Exit codes

CodeMeaning
0Everything went well
1Expected error — message and hint shown, without a stack trace
2Feature not written yet

An unexpected error comes out with its full stack trace: it is a defect of the generator, not of the documentation it is given.