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

@anthill.technology/amplify-cli

v1.1.0

Published

Command-Line Interface for Amplify

Downloads

9

Readme

Amplify CLI reference

The Amplify CLI is a command-line interface that provides a variety of tools for managing, viewing, and deploying plugins.

Commands

The command amplify --help lists the available commands and amplify <command> --help shows more details for an individual command.

Below is a brief list of the available commands and their function:

   ____                                          _       _     _              ___       _             __                   __                 _                    _ _  __
  / ___|___  _ __ ___  _ __ ___   __ _ _ __   __| |     | |   (_)_ __   ___  |_ _|_ __ | |_ ___ _ __ / _| __ _  ___ ___   / _| ___  _ __     / \   _ __ ___  _ __ | (_)/ _|_   _
 | |   / _ \| '_ ` _ \| '_ ` _ \ / _` | '_ \ / _` |_____| |   | | '_ \ / _ \  | || '_ \| __/ _ \ '__| |_ / _` |/ __/ _ \ | |_ / _ \| '__|   / _ \ | '_ ` _ \| '_ \| | | |_| | | |
 | |__| (_) | | | | | | | | | | | (_| | | | | (_| |_____| |___| | | | |  __/  | || | | | ||  __/ |  |  _| (_| | (_|  __/ |  _| (_) | |     / ___ \| | | | | | |_) | | |  _| |_| |
  \____\___/|_| |_| |_|_| |_| |_|\__,_|_| |_|\__,_|     |_____|_|_| |_|\___| |___|_| |_|\__\___|_|  |_|  \__,_|\___\___| |_|  \___/|_|    /_/   \_\_| |_| |_| .__/|_|_|_|  \__, |
                                                                                                                                                            |_|            |___/
Usage: amplify [options] [command]

Command-Line Interface for Amplify

Options:
  -V, --version            output the version number
  -h, --help               display help for command

Commands:
  login [options]          log the CLI into Amplify.
  logout                   log the CLI out of Amplify.
  use [options]            set an active organization for your working directory.
  plugin:create [options]  creates a new plugin in Amplify.
  plugin:deploy [options]  deploys a new plugin in Amplify.
  plugin:delete [options]  deletes a plugin from Amplify.
  plugin:list [options]    list the available plugins in Amplify.
  help [command]           display help for command

Installation

To download and install the Amplify CLI run the following command:

npm install -g @anthill.technology/amplify-cli

This will provide you with the globally accessible amplify command.

Usage

Log in the Amplify CLI

After installing the CLI, you must authenticate. Log into Amplify using your account by running the following command:

amplify login

Test that the CLI is properly installed and accessing your account by listing your organizations. Run the following command:

amplify use

You will be prompted to select an active organization. To change the active organization re-run the above command.

List available plugins

To view existing plugins. Run the following command:

amplify plugin:list

Create a new plugin

To create a new plugin. Run the following command:

amplify plugin:create

You will be prompted to select a plugin type, and a name for the plugin. A new directory will be created in your local path using the name of the plugin.

tree ./example-plugin

./example-plugin
├── config.js
├── index.js
└── package.json

The directory contains the following structure. For more information regarding supported schemas based on each plugin type, see schemas.

Deploy an existing plugin

To deploy a new plugin. Run the following command:

amplify plugin:deploy --directory <path-to-folder>

To redeploy an existing plugin, re-run the above command.

Schema

Config.js

Represents the configuration object of the Plugin, with an optional settings array.

module.exports = {
  id: string,
  name: string,
  type: string,
  settings: [
    {
      id: string,
      required: boolean,
      type: string,
      label: string,
      hint: string,
    },
    {
      id: string,
      required: boolean,
      type: 'selectList',
      options: [
        { label: string, value: string },
        { label: string, value: string },
      ],
    },
  ],
};
  • id: The unique identifier for the plugin (autogenerated from the plugin:create command).
  • name: The display name of the plugin.
  • type: The plugin type. Supported values are: message, buttonGroup, carousel, embedded, goTo, question and player
  • settings: Variables that can be configured when the plugin is configured in the editor.
    • id: The key used to reference the setting.
    • required: If true then the settings must have a value.
    • type: Identifies what kind of input method the settings has. Supported values are string, boolean and selectList.
    • options: If the settings type is selectList then it is necessary to define the possible input values.
    • label (optional): The display name of the setting. If this isn't defined, then the id key will be used as the display name.
    • hint (optional): A descriptive hint to render with the plugin setting to explain what can be configured with it.

Index.js

Based on the plugin type, the following schemas are required.

General setup of all types

The general setup of each plugin type is the following:

exports.handler = async (params) => {
  return {
    type: '<NODE_TYPE>',
    delay: 2,
    ...
  };
};

Where the params object consists of:

  • params: The available configration for the plugin.
    • settings: An object of the settings defined in config.js with their values defined by the editor in the builder.
    • context: All the storage values defined for the amp with their assigned value in the user's context.

And the handler method returns an object of the rendered node, which always (no matter which type of plugin it is) consists of:

  • type: The type of node to be rendered.
  • delay: How long a delay in seconds there should be for the node to be rendered (the chatbot renders a typing animating during the delay).

Message

exports.handler = async (params) => {
  // ...
  return {
    type: 'message',
    delay: 1,
    html: '<html></html>',
  };
};

Button Group

exports.handler = async (params) => {
  // ...
  return {
    type: 'buttonGroup',
    delay: 1,
    subNodes: {
      '<UUID>': {
        id: '<UUID>',
        sortIndex: 0,
        buttonTexts: ['Yes', 'No'],
      },
    },
  };
};

Carousel

exports.handler = async (params) => {
  // ...
  return {
    type: 'carousel',
    delay: 1,
    subNodes: {
      '<UUID>': {
        id: '<UUID>',
        sortIndex: 0,
        headline: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
        description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vel nunc quis orci commodo laoreet sit amet ac odio.',
        email: {
          address: '[email protected]',
          subject: 'Lorem ipsum dolor sit amet',
          title: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit',
        },
        link: {
          title: 'Lorem Picsum',
          url: 'https://picsum.photos/200/300',
        },
        media: {
          title: 'Lorem Picsum',
          type: 'image',
          url: 'https://picsum.photos/200/300',
        },
      },
    },
  };
};

Embedded

exports.handler = async (params) => {
  // ...
  return {
    type: 'embedded',
    delay: 1,
    title: 'Lorem ipsum',
    embedUrl: 'https://path.to.the.embedded.url',
    successMessageEvent: '<postMessage.success_event.name>',
    returnOnSuccess: false,
  };
};

Go To

exports.handler = async (params) => {
  // ...
  return {
    type: 'goTo',
    delay: 1,
    conversationId: '<CONVERSATION_ID>,
  };
};

Question

exports.handler = async (params) => {
  // ...
  return {
    type: 'question',
    delay: 1,
    html: '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>',
    buttonsDelay: 2,
    subNodes: {
      '<UUID>': {
        id: '<UUID>',
        sortIndex: 0,
        buttonTexts: ['Yes', 'No'],
      },
    },
  };
};

Player

exports.handler = async (params) => {
  // ...
  return {
    type: 'player',
    delay: 1,
    media: {
      url: 'https://path.to.media.asset',
      title: 'media_file_name.mp3',
      type: 'audio',
    },
    headline: 'Lorem ipsum',
    description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
    autoPlay: false,
  };
};