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

@amberjs/cli

v0.0.4

Published

Amber.js command line interface

Downloads

9

Readme

@amberjs/cli

Amber.js CLI tool. Code generators for Amber.js Framework.

Table of Contents

Usage

This CLI tools is a helper for Amber.js Framework. It eases development workflow by generating codes and templates for Amber.js Framework.

You must be in the root directory of an Amber.js project generated using @brewery/cli.

Amber.js CLI v0.0.1

Commands:
  graphql:deploy            deploy resolver server using defined SDL
  scaffold                  scaffold infra, interface and domain based on swagger schema
  create:domain <name>      create domain base template
  create:appservice <name>  create app service base template
  create:datasource         create datasource wizard
  create:repository         create repository command
  create:model              create model command
  create:apiresource        create apiresource command

Development

Creating commands:

Example command configuration:

Single command in one JSON file:

{
    "command": "command <!arg1> <arg2>",
    "description": "command description",
    "usage": "command arg1 --option=value ",
    "options": {
        "option1": {
            "description": "option1 description",
            "default" : true,
            "value": "required"
        },
        "option2": {
            "description": "option2 description"
        },
        "option3": {
            "description": "option3 description"
        }
    },
    "execPath": "./actions/command/"
}

Multiple commands in one JSON file:

[
  {
    "command": "namespace:command1 <!arg1> <arg2>",
    "description": "namespace:command1 description",
    "usage": "namespace:command1 --options=value ",
    "options": {
        "option1": {
            "description": "option1 description",
            "default" : true,
            "value": "required"
        },
        "option2": {
            "description": "option2 description"
        },
        "option3": {
            "description": "option3 description"
        }
    },
    "execPath": "./actions/namespace/"
  },
  {
    "command": "namespace:command2",
    "description": "namespace:command2 description",
    "usage": "namespace:command2 --options",
    "options": {
        "option1": {
            "description": "option1 description",
            "default" : true,
            "value": "required"
        },
        "option2": {
            "description": "option2 description"
        },
        "option3": {
            "description": "option3 description"
        }
    },
    "execPath": "./actions/namespace/"
  }
]

To create commands for CLI, create new json file on src/configs/your_command.json. The config json will automatically be loaded by the CLI.

  • command: Name of the command. Expected arguments for the command should be enclosed in "< >" eg. "<arg1>", if an argument is required it should be enclosed in "<! >" eg. "<!arg2>"
  • description: description of the command
  • usage: example usage of the command
  • options: available options for the command
    • default: set to true if option should be enabled by default.
    • value: set to required if a value for the option is required.
  • execPath: should contain the path to the script that will perform the action of your command, you may place your scripts on src/actions for uniformity
  • your execPath should return a function that requires 3 parameters for (config , command, args)

Example script for command action considering the following input from the CLI

binaryname samplecommand argValue --option1=value 

const commandAction = (config, command, args) => {

  console.log(config); // contains config of your command loaded from the JSON file
  /*
    {
      "command": "samplecommand <!arg1> <arg2>",
      "description": "samplecommand description",
      "usage": "samplecommand --options=value ",
      "options": {
          "option1": {
              "description": "option1 description",
              "default" : true,
              "value": "required"
          },
          "option2": {
              "description": "option2 description"
          },
          "option3": {
              "description": "option3 description"
          }
      },
      "execPath": "./actions/samplecommand/"
    },
  */

 console.log(command); // contains organized data based on parsed input from cli
 /*
    {
      name: samplecommand
      args: {
        arg1: "argValue",
        arg2: null
      }
      options: {
          "option1": {
            value: "value"
          },
          "option2": null,
          "option3": null
      }
    }
 */

  console.log(args) // contains array of raw arguments inputted on the cli
  // ['binaryname', 'samplecommand', 'argValue', '--option1=value']


  // Perform the action for your command ...

}

module.exports = commandAction;

Prerequisites

Install pkg for creating executable files

npm install -g pkg

Build

To build executable file for all platforms (Windows, Linux, Macos) run:

npm run build

or

pkg package.json

this will create the executable files on project root directory

Contributors

License

MIT © Stratpoint Technologies Inc.