0.0.3 • Published 9 months ago

lanadoc-cli v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

lanadoc-cli

A command-line tool that seamlessly integrates with Project-Lana.

Key Features

  • Effortless API doc generation: Automatically generate comprehensive API documentation directly from your source code.
  • Interactive local server: Instantly view and interact with your API documentation using the built-in local server.
  • Cross-Platform compatibility: Works seamlessly on Windows, macOS, and Linux, ensuring flexibility across different development environments.
  • Fully Themeable: Customize your API documentation by adjusting settings and themes to suit your specific needs.
  • Streamlined Project Setup: Initialize your API documentation project quickly with a single command.

Installation

To install lanadoc-cli globally, use npm:

npm install -g lanadoc-cli

Getting Started

Let's get your documentation project up and running.

Step 1: Initialize a Project

Use the following command to create a new lanadoc-cli project:

lanadoc init

This command initializes your project and generates a lana.config.json file in docs/ directory. This file contains essential meta info about your API doc and some customization like theme.

Configuration

lanadoc uses environment variables and is very easy to setup, you just need to pass the various values below using the lanadoc config --set <KEY>=VALUE

LANA_OPENAI_API_KEY=<your OpenAI API token>
LANA_MODEL=<either 'gpt-4', 'gpt-3.5-turbo-16k', 'gpt-3.5-turbo-0613' or 'gpt-3.5-turbo', 'lana-7b (will be default local model)'>

Example:

lanadoc config --set LANA_OPENAI_API_KEY=xxxxxx

List configs

lanadoc config --list

Reset configs

lanadoc config --reset

Available themes: 'alternate' | 'default' | 'moon' | 'purple' | 'solarized'

** More themes coming soon...

Step 2: Generate Documentation

Once your project is initialized, cd to docs/ directory and generate documentation with:

lanadoc generate

This command processes your source code etc, turning your code into comprehensive documentation.

🚨Important Note: routes files and implementation to your endpoints are required in your lana.config.json to be able to generate the doc spec.

Example:

// other configs
 "sourcePaths": {
    "routes": ["./routes/quote_route.js"],
    "implementation": ["./controllers/quote_controller.js"]
  },
// other configs

You should provide all the endpoint routes files paths in the routes array and their corresponding implementations in the implementation array as seen in the example code above.

Step 3: View Your Documentation

To view your generated documentation locally, start the lanadoc-cli server:

In the docs/ directory run...

npm run serve

This will launch a local dev server, allowing you to explore and interact with your doc site through your web browser.

Note: you need to have vue-cli installed globally

License

lanadoc-cli is licensed under the MIT License. See LICENSE for more information.