Skip to content

nightwatchjs/nightwatch-docs

Repository files navigation

Nightwatch.js Documentation

Documentation sources for nightwatchjs.org website.

npm Node.js CI codecov npm package Discord Twitter Follow

Nightwatch.js Logo


Overview

The website is built with PostDoc (a static site generator built with Vite and EJS). It supports Markdown, EJS, and front matter. It comes with a dev server with Hot module replacement (HMR).

The content is written in Markdown and it is located in the docs folder. The individual API command pages are generated from the Nightwatch source code. based on the JSDoc comments.

Run the website locally

First, simply clone the repository and install the dependencies.

git clone https://github.com/nightwatchjs/nightwatch-docs.git
npm install

Configuration

Since the API documentation is generated directly from source code, you need to have the Nightwatch source code cloned locally.

Step 1: Clone the Nightwatch repository

git clone https://github.com/nightwatchjs/nightwatch.git
npm install

Step 2: Configure the path to the Nightwatch repository

Next, you have specify the path to where the api commands are in the postdoc.config.js file. You can also set the API_DOCS_FOLDER environment variable.

// postdoc.config.js
export default {
  apidocs: {
    source: '/path/to/nightwatch/lib/api/'
}

You can also disable the API docs generation by setting the apidocs property to false in the postdoc.config.js file:

// postdoc.config.js
export default {
  apidocs: false
}

Run the website dev server

npm start

The website will be available at http://127.0.0.1:5173/.

PostDoc CLI

To view the available options, run:

npx postdoc --help

Automatically open the website in the browser

npm start -- --open [chrome|firefox|edge|safari]

Build

To build the website, run:

npm run build

The generated files will be in the out folder.

Quickly serve the generated files with:

npx postdoc preview

License

MIT