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

@api-components/api-console-builder

v3.0.0

Published

A module to build a minified and concatenated file for the API console

Downloads

2,473

Readme

api-console-builder

This version of the builder only works with API console version 6 and higher.

Build Status

api-console-builder allows to generate production ready bundle of MuleSoft API Console.

On a high level, it allows to bundle a stand-alone application of API Console. If you need to embed API Console in your application follow instructions from Rollup configuration for API Console.

Usage

The bundler creates a production ready API Console that works in modern web browsers and in IE11 withj polyfilled support for web components.

import { ApiConsoleProject } from '@api-components/api-console-builder';
const project = new ApiConsoleProject({
  destination: 'api-console-build',
  api: 'path/to/api.raml',
  apiType: 'RAML 1.0',
  apiMediaType: 'application/raml',
  tagName: '6.0.0'
});
await project.bundle();

Supported API types

API console accepts AMF json/ld model as a data source. AMF by default supports the following API formats:

  • RAML 0.8
  • RAML 1.0
  • OAS 2.0
  • OAS 3.0 - Experimental, may be missing some properties.

Configuration

The configuration is defined in BuilderOptions.js file.

tagName

Type: string

A release tag name to use. With this option the builder uses specific release of the console. If not set and src is not set it uses latest release. Note, only versions >= 6.0.0 can be used with this version of the builder.

destination

Type: string

Output directory. Default to build.

api

Type: string

required

Unlike previous versions of this library, now api property is required. The build will fail if this is not set.

Location of API specification main file.

Set apiType property to corresponding value (type of the API, see below).

Default to undefined.

apiType

Type: string

required_

Type of an API spec file recognizable by AMF.

apiMediaType

Type: string

Media type of the API.

For RAML files it is always application/yaml. OAS comes with two flavours: application/yaml and application/json.

Use it when the library can't process API spec file due to processing error.

verbose

Type: boolean

Prints a debug messages.

attributes

Type: array

An array of attributes to be set on the <api-console> element.

For boolean attributes just add name of the attribute as string.

For attributes with values add a map where the key is the attribute name and value is the attribute value.

Note: Do not use camel case notation. It will not work. See the example.

Example

const attributes = [
 'proxyencodeurl',
 {'proxy': 'https://proxy.domain.com'},
 'notryit',
 {'page': 'request'},
]

Example above is the same as:

const attributes = [
 'proxyencodeurl',
 'notryit',
 {
   'proxy': 'https://proxy.domain.com',
   'page': 'request'
 }
]

and will produce the following output:

<api-console-app
 proxyencodeurl
 notryit
 page="request"
 proxy="https://proxy.domain.com"
></api-console-app>

List of all available options can be found here: https://github.com/mulesoft/api-console/blob/master/docs/configuring-api-console.md

Note, you don't need to set this property when providing own indexFile. Simply define attributes in the file.

logger

Type: object

A console like object to print debug output. If not set then it creates it's own logger.

themeFile

Type: string

Location to a theme file with styles definition of the console. It replaces Console's own styles definition. See theming documentation of the API console for more information.

indexFile

Type: string

Location to a custom index.html file that will be used instead of the default template.

The template file must include vendor package, API Console sources, and the use of API Console. See templates/index.html for an example.

noCache

Type: boolean

By default the builder caches build results in user home folder and uses generated sources to speed up the build process.

Note, options that influence the build process (tagName, themeFile, indexFile, etc) creates new cached file.

API model is never cached.

exitOnError

Type: boolean

Decides whether to finish current process with non-zero exit code on error. Default is true.

strict

Type: boolean

When set to true it will stop build process with error when a minor issue has been detected, like missing theme file in declared location which is normally ignored.

appTitle

Type: string

Optional application title put into HTML's <title> tag. By default it uses API title or API Console if missing.