/create-netlify-functions

An npm initializer for scaffolding functions to be deployed to Netlify

Primary LanguageJavaScript

create-netlify-functions

This is an initialiser for npm (like create-react-app) which scaffolds a small project for being able to deploy Netlify Functions.

Usage

Where you would substitute <directory-name> for the new directory you want the project to be created in.

This is required, if you don’t specify one, don’t worry it won’t use your current working directory by default.

npm init netlify-functions <directory-name>

or

npx create-netlify-functions <directory-name>

or

yarn create netlify-functions <directory-name>

What does it do?

Currently it creates a single “hello world” lambda in a directory. It sets up the Netlify config so that you could publish it immediately and it should Just Work™.

There will be a test suite already set up for you to add to. Run npm test in your new directory.

There will also be a dev environment set up for you via the netlify-lambda package

Local Development

git clone git@github.com:leggsimon/create-netlify-lambdas.git
cd create-netlify-lambdas
npm install

How to publish

(This is more for me, so I don’t forget)

This uses the np package to deploy. On the master branch locally run np and follow the instructions.

Why?

I’ve really enjoyed how Netlify have made creating lambda functions so easy to set up and deploy and I’d like to make it easier for others to do it I guess…