This repo is the Command-Line Interface for fnhub.io. It can be used to easily publish, share, and consume open-source serverless functions for deployment on platforms like AWS Lambda, Microsoft Azure Functions, or Google Cloud Functions. Below is a reference list for all of the commands in the CLI. They are divided into three areas - General commands, Publisher commands, and Consumer commands.
General commands are used to get more details on a fnhub.io package.
The info
command provides information on a specific module.
fnhub info
name (bold fields are required) | description | type | validation | default value |
---|---|---|---|---|
module | The name of the module for which you are requesting info | string | none | none |
version | The module version to obtain information for | string | none | "latest" |
Provides details on the currently authenticated user.
fnhub who
This command has no options or parameters.
These commands are intended to be used by module publishers. They consist of all of the commands necessary to upload a function module to fnhub.io, as well as maintain its information.
This authenticates the user with fnhub.io, using a persistent cookie to track authorization. Required prior to running any other publishing commands
fnhub signin --username [email protected] --password 123456
name (bold fields are required) | description | type | validation | default value |
---|---|---|---|---|
username | The user's registered username | string | supports email and plaintext | none |
password | The registered user's password | string | none | none |
The init
command initializes a fnhub.io module. It creates a module.yaml
file in the working directory. This file will hold all necessary information about the module being created.
fnhub init --name hi --authorEmail [email protected] --authorName "Relly Rivlin" --version 1.0.110 --description "module description" --repo" "https://github.com/relly/fnhub" --keywords "hello world" --license mit
name (bold fields are required) | description | type | validation | default value |
---|---|---|---|---|
name | The module's name, to be published. Must be globally unique | string | supports alphanumeric characters and dashes | Current working directory |
authorEmail | The module's author's email | string | current authenticated user's email | |
authorName | The module's author's name | string | alphanumeric | current authenticated user's name |
version | The module's version | string | validated per rules at http://semver.org | 1.0.0 |
description | A description of the module | string | none | none |
repo | The module's github repository | string | url | If a github file ID exists, this value is used |
keywords | A list of keywords that users will use when searching for the module | string | Checks for a space-delimited string | The module's name |
license | The module's license | string | none | ISC |
Adds a serverless function to the current module. Each module can support multiple functions.
Note: Many serverless function providers, as a part of their best practices, recommend having a single set of source code with multiple entry points when working with related functionality.
fnhub add --name "hi1" --description "function description" --handler index.handler1 --runtime nodejs4.3 --env "{}"
name (bold fields are required) | description | type | validation | default value |
---|---|---|---|---|
name | The function name to add to the module (this can include more than one function name) | string | supports alphanumeric characters and dashes | current module name |
description | A description of the function | string | none | none |
runtime | The run time environment for the function | string | must be one of 'nodejs4.3', 'nodejs6.10', 'Edge Node.js 4.3', 'Python 2.7', 'Python 3.6', 'Java 8', or 'C#' | none |
handler | The serverless function's entry point | string | none | index.handler |
env | Environment variables for the function, defined in JSON | JSON | must be valid JSON | {} |
Publishes the module. If this is the first module you have published, FnHub.io first creates a unique namespace. This can return an error if the name requested is already taken. Once this is finished, the CLI updates your module's version then deploys the code to global storage (in AWS S3).
fnhub publish
None
Retrieves the module version from module.yml
fnhub version
None
Increases the module's major version segment in module.yml
fnhub version major
None
Increases the module's minor version segment in module.yml
fnhub version minor
None
Increases the module's patch version segment in module.yml
fnhub version patch
None
Deletes the module (all versions) and clears local storage
fnhub delete
name (bold fields are required) | description | type | validation | default value |
---|---|---|---|---|
description | The module name to delete | string | none | If none is provided, the name is pulled from module.yml |
These commands are used by consumers seeking to leverage code published on fnhub.io in their own projects.
The functions below operate using our AWS CloudFormation plugin, cf
Creates a fnhub-stack.yaml
file in the working directory. This file holds all necessary stack information
fnhub cf create --name stack001 --description "stack description"
name (bold fields are required) | description | type | validation | default value |
---|---|---|---|---|
name | The name of the stack | string | supports alphanumeric characters and dashes | none |
description | A description of the stack | string | none | none |
Adds a module to the fnhub-stack.yml
file in the current working directory. A stack can include several modules.
fnhub cf include --module hi --version 1.0.0
name (bold fields are required) | description | type | validation | default value |
---|---|---|---|---|
module | The name of the module to include | string | supports alphanumeric characters and dashes | none |
version | The version of the module to include | string | validated per rules at http://semver.org | latest |
Uses the AWS CLI to deploy a cloud formation yaml file to your AWS account
fnhub cf deploy
None
The SAM plugin operates in exactly the same way as our AWS CloudFormation plugin, but simply uses SAM instead of CloudFormation. Simply replace cf
with sam
in any of the CloudFormation commands, and your commands will be ready to go.