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

create-twilio-function

v3.4.7

Published

A CLI tool to generate a new Twilio Function using that can be run locally with twilio-run.

Downloads

7,624

Readme

create-twilio-function

A command line tool to setup a new Twilio Function with local testing using twilio-run. Part of the Twilio Serverless Toolkit.

Read more about this tool in the post start a new Twilio Functions project the easy way

Usage

npm init

There are a number of ways to use this tool. The quickest and easiest is with npm init:

npm init twilio-function function-name
cd function-name
npm start

This will create a new directory named "function-name" and include all the files you need to write and run a Twilio Function locally. Starting the application will host the example function at localhost:3000/example.

Twilio CLI

Make sure you have the Twilio CLI installed with either:

npm install twilio-cli -g

or

brew tap twilio/brew && brew install twilio

Install the Twilio Serverless Toolkit plugin:

twilio plugins:install @twilio-labs/plugin-serverless

Then initialise a new Functions project with:

twilio serverless:init function-name

npx

You can also use npx to run create-twilio-function:

npx create-twilio-function function-name

Global installation

Or you can install the module globally:

npm install create-twilio-function -g
create-twilio-function function-name

Function Templates

create-twilio-function enables you to generate a new empty project or to build a project using any of the templates from the Function Templates repo. All you need to do is pass a --template option with the name of the template you want to download. Like this:

npm init twilio-function function-name --template blank

This works with any of the other ways of calling create-twilio-function. Check out the ever expanding list of function templates here.

TypeScript

If you want to build your Twilio Functions project in TypeScript you can. create-twilio-function supports generating a new project that is set up to use TypeScript too. To generate a TypeScript project, use the --typescript flag, like this:

npm init twilio-function function-name --typescript

Note: there are no Function templates written in TypeScript, so do not use the --template flag alongside the --typescript flag. The basic TypeScript project does come with some example files, but you can generate an empty project combining the --typescript and --empty flags.

Command line arguments

Creates a new Twilio Function project

Commands:
  create-twilio-function <name>          Creates a new Twilio Function project
                                                                       [default]
  create-twilio-function list-templates  Lists the available Twilio Function
                                         templates

Positionals:
  name  Name of your project.                                           [string]

Options:
  --account-sid, -a     The Account SID for your Twilio account         [string]
  --auth-token, -t      Your Twilio account Auth Token                  [string]
  --skip-credentials    Don't ask for Twilio account credentials or import them
                        from the environment          [boolean] [default: false]
  --import-credentials  Import credentials from the environment variables
                        TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN
                                                      [boolean] [default: false]
  --template            Initialize your new project with a template from
                        github.com/twilio-labs/function-templates       [string]
  --empty               Initialize your new project with empty functions and
                        assets directories            [boolean] [default: false]
  --typescript          Initialize your Serverless project with TypeScript
                                                      [boolean] [default: false]
  -h, --help            Show help                                      [boolean]
  -v, --version         Show version number                            [boolean]
  --path                                                        [default: (cwd)]

Contributing

This project welcomes contributions from the community. Please see the CONTRIBUTING.md file for more details.

LICENSE

MIT