The missing CLI for beautiful, interactive API docs powered by with Stoplight Elements

Overview

NPM Version NPM Downloads Continuous Integration

Elements CLI

The missing CLI for beautiful, interactive API docs powered by with Stoplight Elements

Installation

Install using npm as global package:

npm install -g @skriptfabrik/elements-cli

Usage

elements --help
Elements CLI

Usage:
  elements command [options] [arguments]

Options:
  -h, --help     Display this help message
  -v, --version  Print version number

Commands:
  export   Export rendered API docs
  preview  Preview rendered API docs

Export

elements export --help
Elements CLI

Usage:
  elements export [options] <openapi_json>

Arguments:
  openapi_json  The path or URL of the OpenAPI JSON file

Options:
      --base-path=BASE_PATH    Use the given base path [default: "/"]
      --cors-proxy=CORS_PROXY  Provide CORS proxy
  -f, --filter-internal        Filter out any content which has been marked as internal with x-internal
  -h, --help                   Display this help message
      --layout=LAYOUT          Layout for Elements: sidebar, stacked [default: "sidebar"]
      --logo=LOGO              URL of an image that will show as a small square logo next to the title
  -n  --no-try-it              Hide the "Try It" panel (the interactive API console)
      --router=ROUTER          Determines how navigation should work: history, hash, memory, static [default: "history"]
      --style=STYLE            Additional style for Elements [default: "display: block; height: 100vh"]
      --title=TITLE            API docs title [default: "My API Docs"]
  -v, --version                Print version number

Examples:
  Export rendered API docs based on local openapi.json path as index.html:

    elements export openapi.json > index.html

  Export rendered Swagger Petstore docs based on remote https://petstore.swagger.io/v2/swagger.json URL as index.html:

    elements export --title="Swagger Petstore" https://petstore.swagger.io/v2/swagger.json > index.html

Preview

elements preview --help
Elements CLI

Usage:
  elements preview [options] <openapi_json>

Arguments:
  openapi_json  The path or URL of the OpenAPI JSON file

Options:
      --base-path=BASE_PATH  Use the given base path [default: "/"]
  -c  --with-cors-proxy      Enable CORS proxy capabilities
  -f, --filter-internal      Filter out any content which has been marked as internal with x-internal
  -h, --help                 Display this help message
      --hostname=HOSTNAME    Server hostname [default: "localhost"]
      --layout=LAYOUT        Layout for Elements: sidebar, stacked [default: "sidebar"]
      --logo=LOGO            URL of an image that will show as a small square logo next to the title
  -n  --no-try-it            Hide the "Try It" panel (the interactive API console)
  -p, --poll                 Use polling instead of file system events
      --port=PORT            Server port [default: 8000]
      --router=ROUTER        Determines how navigation should work: history, hash, memory, static [default: "history"]
      --style=STYLE          Additional style for Elements [default: "display: block; height: 100vh"]
      --title=TITLE          API docs title [default: "My API Docs"]
  -v, --version              Print version number
  -w  --watch                Watch for changes and reload (only for local files)
      --working-dir=PWD      Use the given directory as working directory

Examples:
  Preview rendered API docs based on local openapi.json path:

    elements preview openapi.json

  Preview rendered Swagger Petstore docs based on remote https://petstore.swagger.io/v2/swagger.json URL:

    elements preview --title="Swagger Petstore" https://petstore.swagger.io/v2/swagger.json

  Preview local API docs, enable CORS proxy and watch/reload on data changes:

    elements preview -cw openapi.json

Docker

Export

Export rendered Swagger Petstore docs as index.html:

docker run --rm skriptfabrik/elements-cli export --title="Swagger Petstore" https://petstore.swagger.io/v2/swagger.json > index.html

Preview

Use the following command to preview rendered API docs at http://localhost:8080/ based on mounted openapi.json path:

docker run --rm -p 8000:8000 -v `pwd`:/data:ro skriptfabrik/elements-cli preview openapi.json

Preview rendered Swagger Petstore docs at http://localhost:8080/ based on remote URL:

docker run --rm -p 8000:8000 skriptfabrik/elements-cli preview --title="Swagger Petstore" https://petstore.swagger.io/v2/swagger.json

Preview mounted API docs at http://localhost:8080/, enable CORS proxy capabilities and watch/reload on data changes:

docker run --rm -p 8000:8000 -v `pwd`:/data:ro skriptfabrik/elements-cli preview -cw openapi.json
You might also like...

curtains.js is a lightweight vanilla WebGL javascript library that turns HTML DOM elements into interactive textured planes.

curtains.js is a lightweight vanilla WebGL javascript library that turns HTML DOM elements into interactive textured planes.

What is it ? Shaders are the new front-end web developpment big thing, with the ability to create very powerful 3D interactions and animations. A lot

Jan 1, 2023

Create beautiful interactive stories using Sutori formtted XML.

Create beautiful interactive stories using Sutori formtted XML.

Sutori Studio An IDE for creating beautiful interactive stories powered by sutori-js. This project is still in an early state, and has a number of kno

Jul 4, 2022

Create beautiful interactive web application with Recative System.

Recative is a comprehensive system to help creators to build interactive media for the modern web platform. The Recative System aims to allow creators

Jan 2, 2023

🚀 Blazing Fast S3 Powered CDN ✨ Powered By Fastify, S3 Buckets & Docker!

🚀 WasiCDN Blazing Fast S3 Powered CDN, Powered By Fastify, S3 Compatible Buckets & Docker! Core DockerHub: https://hub.docker.com/r/maximking19/wasic

Aug 31, 2022

A CLI tool to embed interactive PUML diagrams to your github markdown files.

puml-for-markdown Simple CLI Usage Just run puml-for-markdown in any directory where you have markdown files and it will render links to PlantUML file

Jan 3, 2023

A JavaScript-powered CLI for converting HTML into PDFs

Print Ready by Nicholas C. Zakas If you find this useful, please consider supporting my work with a donation. Description A JavaScript-powered CLI for

Dec 18, 2022

A simple CLI experiment that writes recommendation of GitHub repository/project in form of tweet. Powered by OpenAI GPT-3.

A simple CLI experiment that writes recommendation of GitHub repository/project in form of tweet. Powered by OpenAI GPT-3.

GitHub Repo Recommendation Writer A simple CLI experiment that writes recommendation of GitHub repository/project in form of tweet. Powered by OpenAI

Jul 18, 2022

A simple cli-app that allows you to divide a YouTube video into multiple separate videos base on a video's time stamps. Powered by pkg and yt-scissors library.

A simple cli-app that allows you to divide a YouTube video into multiple separate videos base on a video's time stamps. Powered by pkg and  yt-scissors library.

YouTube-Scissors CLI A simple CLI app that allows you to divide a YouTube video into multiple separate videos base on a video's time stamps. This proj

Nov 8, 2022

GPT-3 powered cli tool to help with bash commands you can't remember

qwery GPT-3 powered cli tool to help with bash commands you can't remember eg $ qw ffmpeg command to transcode mp4 to mov QWERY RESULT: ffmpeg -i inpu

Oct 31, 2022
Comments
  • Fix default arguments for Docker container

    Fix default arguments for Docker container

    The Docker container should arguably always listen on 0.0.0.0 regardless of the desired advertised hostname. This makes the container work with no extra arguments and the url advertised on stdout is correct so you can click it in your console.

    opened by colinmollenhour 5
  • Add '--listen-address' option and fix default environment for running…

    Add '--listen-address' option and fix default environment for running…

    … as Docker container. Separates listen address from advertised hostname.

    When running in docker and exposing the port if you use the defaults it will listen on the containers localhost which cannot be reached from the host, it needs to listen on 0.0.0.0. However if you set the hostname to 0.0.0.0 you get a url reported in the console that is invalid. This lets you separate the listen address from the reported url hostname.

    If anything since this is a dev tool I'd just remove the hostname option entirely and always report the hostname as "localhost", but without a patch it is kinda annoying that the url reported in the console cannot be visited and then you have to determine/remember/figure out the correct url to visit.

    This patch causes the most commonly needed defaults to be used whether it is run from the host directly using node/npm or if it is run from a docker container. Needing to change the defaults would be pretty rare.

    opened by colinmollenhour 2
  • Fix loading of static assets when used as a module (not global).

    Fix loading of static assets when used as a module (not global).

    This allows you to use this package like so:

      ...
      "devDependencies": {
        "@skriptfabrik/elements-cli": "..."
      },
      "scripts": {
        "preview": "elements preview --watch --port=8000",
      }
    }
    

    And then:

    $ npm run preview -- openapi.yaml
    
    opened by colinmollenhour 0
  • Hot reload loses Endpoints

    Hot reload loses Endpoints

    Thanks for sharing your work on this awesome tool!

    I don't know if it is my particular file or what but when I edit a file the hot reload re-renders the page without the ENDPOINTS section, it's completely missing.. If I refresh the page the content is all there it is only when I trigger a hot-reload.

    image

    Have you experienced this?

    No errors are logged to stdout/stderr or to the browser console.

    help wanted 
    opened by colinmollenhour 3
Releases(0.4.1)
Owner
skriptfabrik GmbH
skriptfabrik GmbH
Create a deep copy of a set of matched elements with the dynamic state of all form elements copied to the cloned elements.

jq-deepest-copy FUNCTION: Create a deep copy of a set of matched elements while preserving the dynamic state of any matched form elements. Example Use

Michael Coughlin 5 Oct 28, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Missing Person Finder re-design

Missing Person Finder With ReactJs #Technology Used React Routing with React-routing-dom Redux with Redux Persist API calling with axios Ant design UI

Itp Manish 0 Jul 12, 2022
🐢🦕 The missing child of Node.js and Deno.

Venode The missing child of Node.js and Deno. Venode is a node runner that supports deno features like vendoring and http imports! Features Javascript

M. Bagher Abiat 178 Aug 18, 2022
Domvas implements the missing piece that connects the DOM and Canvas.

Domvas Overview Domvas implements the missing piece that connects the DOM and Canvas. It gives to the ability to take arbitrary DOM content and paint

Paul Bakaus 389 Dec 29, 2022
Contracts with missing implementation details and unit tests to help guide junior solidity developers.

template-challenge-staking Contracts with missing implementation details and unit tests to help guide junior solidity developers. Getting started Open

BuiltByFrancis 4 Oct 7, 2022
Chappe - 🧑‍💻 Developer Docs builder. Write guides in Markdown and references in API Blueprint. Comes with a built-in search engine.

Chappe Developer Docs builder. Write guides in Markdown and references in API Blueprint. Comes with a built-in search engine. Chappe is a Developer Do

Valerian Saliou 146 Jan 1, 2023
🧑‍💻 Developer Docs builder. Write guides in Markdown and references in API Blueprint. Comes with a built-in search engine.

Developer Docs builder. Write guides in Markdown and references in API Blueprint. Comes with a built-in search engine. Chappe is a Developer Docs buil

Crisp (OSS) 146 Jan 1, 2023