npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@skriptfabrik/elements-cli

v0.5.3

Published

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

Downloads

4,697

Readme

Elements CLI

NPM Version NPM Downloads Continuous Integration

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: "/"]
      --credentials-policy=CREDENTIALS_POLICY  Credentials policy for "Try It" feature: omit, include, same-origin [default: "omit"]
      --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: "flex: 1 0 0; overflow: hidden;"]
      --title=TITLE                            API docs title [default: "My API Docs"]
      --variable=VARIABLE                      Variable to be replaced in the OpenAPI document
  -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: "/"]
      --credentials-policy=CREDENTIALS_POLICY  Credentials policy for "Try It" feature: omit, include, same-origin [default: "omit"]
  -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: "flex: 1 0 0; overflow: hidden;"]
      --title=TITLE                            API docs title [default: "My API Docs"]
      --variable=VARIABLE                      Variable to be replaced in the OpenAPI document
  -v, --version                                Print version number
  -w  --watch                                  Watch for changes and reload (only for local files)
      --virtual-host=VIRTUAL_HOST              Reported hostname [default: localhost]
      --virtual-port=VIRTUAL_PORT              Reported port [default: 8000]
      --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