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

@skyleague/esbuild-lambda

v5.7.0

Published

Building artifacts that are packageable for deployment to AWS Lambda.

Downloads

1,260

Readme

ESBuild Lambda (@skyleague/esbuild-lambda)

This tool provides a simple means of building artifacts that are packageable for deployment to AWS Lambda. It works together well with the @skyleague/aws-lambda module for Terraform.

Background

After years of working with a hybrid toolchain of Terraform and the Serverless Framework on the AWS cloud, we felt the need for an agnostic tool for packaging AWS Lambda, that could work with both deployment frameworks. Some projects rely heavily on Terraform, with only a single/few Lambda functions, whereas other projects might opt for a hybrid strategy of deploying "persistent" infra like S3/DynamoDB with the use of standardized Terraform modules, and subsequently deploying the runtime application with the Serverless Framework.

Being able to leverage the same build tool for both types of Lambda deployments helps in unifying the toolchain, making it easy to choose the right type of deployment that best fits the project.

Install

Install esbuild-lambda using npm:

 $ npm install --save-dev @skyleague/esbuild-lambda

Usage

Let's get started with a simple example:

// esbuild.config.ts
import { listLambdaHandlers, esbuildLambda } from '@skyleague/esbuild-lambda'

import path from 'node:path'
import { fileURLToPath } from 'node:url'

const __dirname = path.dirname(fileURLToPath(import.meta.url))

async function main() {
    const handlers = await listLambdaHandlers(path.join(__dirname, 'src', 'functions'))
    await Promise.all(handlers.map((fnDir) => esbuildLambda(fnDir, { root: __dirname })))
}
main().catch((err) => {
    console.error(err)
    process.exit(1)
})

Then add the following script to the package.json section for scripts:

// package.json
{
    "scripts": {
        // add this
        "build": "npx ts-node esbuild.config.ts"
    }
}

Finally, run the build script using npm:

$ npm run build

In this basic configuration, the listLambdaHandlers will search for all the index.ts files with an exported handler function, in the provided directory. Then esbuildLambda will run esbuild on each of those handlers, producing a .build/artifacts folder right next to the index.ts, containing the compiled Typescript handler, as well as a cherry-picked package.json with only the dependencies that are actually encountered in the require/import-chain of the index.ts. The package-lock.json will be copied over from the root of the repository, and the cherry-picked package.json will be installed in the artifact directory using npm ci.

This open source library package is part of the SkyLeague modern application delivery stack.

Support

SkyLeague provides Enterprise Support on this open-source library package at clients across industries. Please get in touch via https://skyleague.io.

If you are not under Enterprise Support, feel free to raise an issue and we'll take a look at it on a best-effort basis!

License & Copyright

This library is licensed under the MIT License (see LICENSE.md for details).

If you using this SDK without Enterprise Support, please note this (partial) MIT license clause:

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND

Copyright (c) 2022, SkyLeague Technologies B.V.. 'SkyLeague' and the astronaut logo are trademarks of SkyLeague Technologies, registered at Chamber of Commerce in The Netherlands under number 86650564.

All product names, logos, brands, trademarks and registered trademarks are property of their respective owners. All company, product and service names used in this website are for identification purposes only. Use of these names, trademarks and brands does not imply endorsement.