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 🙏

© 2025 – Pkg Stats / Ryan Hefner

do-functions-cli

v1.5.0

Published

CLI tool for scaffolding DigitalOcean Serverless Functions with JavaScript and TypeScript templates, automatic dependency installation, and project.yml configuration.

Readme

do-functions-cli

npm version license

A CLI tool for scaffolding DigitalOcean Serverless Functions. Quickly create new functions with JavaScript or TypeScript templates, install dependencies, and automatically update your project.yml configuration.

Note: This project is not affiliated with DigitalOcean or do-functions, but was inspired by the latter.

Features

  • Interactive function creation — Guided prompts walk you through creating new functions
  • JavaScript & TypeScript templates — Choose your preferred language
  • Automatic dependency installation — Optionally run npm install in the generated function directory
  • Auto-update project.yml — Automatically add new functions to your project configuration
  • Non-interactive mode — Use CLI flags and --yes for scripted workflows

Installation

# Global installation
npm install -g do-functions-cli

# Or use directly with npx
npx do-functions-cli create

Quick Start

Create a new function interactively:

do-functions-cli create

You'll be prompted to:

  1. Enter the packages directory (default: ./packages)
  2. Enter the package/function name (e.g., api/hello)
  3. Choose a language (JavaScript or TypeScript)
  4. Install dependencies (optional)
  5. Add the function to project.yml (optional)

Usage

Interactive Mode

do-functions-cli create

Non-Interactive Mode

Use flags to skip prompts:

do-functions-cli create --packages-dir ./packages --func api/hello --yes

CLI Options

| Option | Description | | --- | --- | | --packages-dir <dir> | Root packages directory (default: prompted, or ./packages) | | -f, --func <name> | Package/function name in package/function format | | -y, --yes | Skip optional prompts and use defaults | | --help | Show help information | | --version | Show version number |

Project Structure

After creating a function, your project will look like:

your-project/
├── packages/
│   └── api/                    # Package name
│       └── hello/              # Function name
│           ├── index.js        # Function entry point (or index.ts)
│           ├── package.json
│           └── .include        # DigitalOcean include file
└── project.yml                 # DigitalOcean project configuration

Bundling with esbuild

The generated function templates include esbuild for bundling your code. This ensures compatibility with DigitalOcean Functions by:

  • Bundling all dependencies — All node_modules are bundled into a single file (dist/bundle.js)
  • CommonJS output — Code is transpiled to CommonJS format (--format=cjs) for compatibility with the DigitalOcean Functions runtime
  • Node.js 18 targeting — The bundle is optimized for Node.js 18 (--target=node18)
  • Minification — Output is minified to reduce file size and improve cold start times

Build Script

Each function includes a build script in package.json:

# JavaScript
esbuild ./index.js --bundle --platform=node --target=node18 --format=cjs --outfile=./dist/bundle.js --minify

# TypeScript (includes type checking)
tsc --noEmit && esbuild ./index.ts --bundle --platform=node --target=node18 --format=cjs --outfile=./dist/bundle.js --minify

DigitalOcean automatically runs npm run build during deployment, so you don't need to build manually before deploying.

The .include File

Each function contains a .include file that tells DigitalOcean which files to include in the deployed function. By default, it points to the bundled output:

dist/bundle.js

This means only the bundled file is deployed, keeping your function package small and fast.

project.yml Configuration

The CLI automatically manages your project.yml file:

packages:
  - name: api
    functions:
      - name: hello
        runtime: nodejs:18
        web: true

Requirements

  • Node.js 20.12.0 or later
  • npm or compatible package manager

Roadmap

  • Additional language templates (Python, Go)
  • validate command for project configuration
  • deploy command integration with DigitalOcean CLI
  • Dry-run mode for previewing changes

License

MIT