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

@dronedeploy/dronedeploy-cli

v2.2.0

Published

This plugin enables support for DroneDeploy within the Serverless Framework

Downloads

233

Readme

serverless-dronedeploy

The DroneDeploy provider implementaion for the Serverless Framework.

Prerequisites

  1. Create a DroneDeploy account

  2. Become a DroneDeploy developer (see account settings on the DroneDeploy site)

  3. Obtain a DroneDeploy developer API key

    Contact [email protected] and ask for a developer API key

  4. Take a look at our example apps

Quick start

  1. Install the Serverless Framework

     npm install -g serverless
  2. Create new service with the IFTTT application template

     serverless create --name test-service --template-url "https://github.com/dronedeploy/app-examples/tree/master/IFTTT"

    If you have the template repository already cloned locally use this command to create service

     serverless create --name test-service --template-path "<path to app-examples>/IFTTT"
  3. Install dependencies

     cd test-service
     npm install
  4. Sign in to DroneDeploy with your api key

     serverless config dronedeploy-credentials --provider=dronedeploy --key=<YOUR API KEY>
  5. Update serverless.yml with your app's id or create new app with

     serverless deploy app --name "my app name"

    This will automatically insert new app id into the configuration file.

  6. Modify serverless.yml and index.js according to your needs.

  7. Deploy all your functions

     serverless deploy

    or deploy a single selected function

     serverless deploy --function <function name>

DroneDeploy serverless.yml

Functions configuration

Functions deployment via DroneDeploy provider requires additional fields in serverless.yml file. Typical structure of functions block should look like this:

app: my-app-id
functions:
  helloWorld:
    handler: helloWorld

where the top level app field should point to your DroneDeploy app's id and key mapping for the function should be a unique string among your deployed functions for the app.

Additionally, you can pass a timeout(min: 30s, max: 540s) field. By default, timeout = 60s.

Configuration with functions sub-folders

Often, it is useful to organize multiple functions into sub-folders to keep the directory structure clean. The configuration can support this, while still keeping the serverless.yml at the top-level folder. When this is done, a path to the function(s) must be specified in serverless.yml.

Extending the snippet above, if the helloWorld function were located in a sub-folder functions/hello, the function configuration would look like this:

app: my-app-id
functions:
  helloWorld:
    handlerPath: functions/hello
    handler: helloWorld

Datastore configuration

DroneDeploy functions can make use of SQL style tables via the Datastore API. These tables can be defined in serverless.yml to make setup and configuration very easy.

This is done by adding a resources section to a function definition and then defining the tables and columns needed.

For example, and OAuth function might want to store the token data in order to determine access without making a new authorization request every time.

app: my-app-id
functions:
  oauth:
    handlerPath: function/oauth
    handler: oauth
    resources:
      tables:
        token-table:
          description: table to store token data
          columns:
            - name: accessToken
              type: Text
              encrypted: true
              length: 255
              description: Holds the OAuth access token
            - name: expiresAt
              type: DateTime
              description: The date and time that the token expires
            - name: refreshToken
              type: Text
              encrypted: true
              length: 255
              description: Holds the OAuth refresh token

Tables common to all defined functions can be defined by placing the resources property with the table definitions at the root level in serverless.yml (same level as the functions property):

app: my-app-id
functions:
  ...
resources:
  tables:
    table-1-name:
      ...
    table-2-name:
      ...

Valid Datastore column types include:

  • Integer
  • Float
  • Date
  • DateTime
  • Email
  • Text

For Text column types, two additional properties are available:

  • encrypted: Encrypts if the column data if true
  • length: Length of text allowed in the column, defaults to 255

Triggers configuration

DroneDeploy Functions can take action based on different events that occur in the DroneDeploy platform. These are called Triggers. For example, if you want a function to run once an Export operation has finished, a Trigger can be configured for Export Complete.

The following is an example of how to configure a trigger for a particular function:

app: my-app-id
functions:
  my-example:
    handlerPath: functions/example
    handler: exportComplete
    events:
      - trigger:
          object-type: Export
          type: complete

Multiple triggers may also be configured for a single function if desired. This can be done with the following syntax:

app: my-app-id
functions:
  my-example:
    handlerPath: functions/example
    handler: processComplete
    events:
      - trigger:
          object-type: Export
          type: complete
      - trigger:
          object-type: MapPlan
          type: complete

The following Event Object Types and Event Types are currently supported by the DroneDeploy platform:

Event Object Type (Event Type):

  • Export (complete)
  • MapPlan (complete)

How to use DroneDeploy Triggers

As we are currently in Beta release and things are subject to change, for now, in order to have your function execute on the defined trigger, you MUST define a handler in your function code.

The handler is for the __ddfunctiontrigger route, and when called by the DroneDeploy platform, should execute the desired code in response to the event.

An example of this can be found in the code for the IFTTT app as seen in our Getting Started Guide

DroneDeploy help commands

Get help for all available commands:

sls help

Get help for specific command:

sls <command> --help

Contributing

Contributions are welcome! Please make a pull request on this repository.

License

MIT

See LICENSE