1.3.2 • Published 11 months ago

funpack v1.3.2

Weekly downloads
3
License
ISC
Repository
github
Last release
11 months ago

funpack

Your function packager (for example for AWS Lambdas).

What this package does for you:

  • Bundles your code using esbuild
  • Generates proper package.json invidually for every function
  • ZIPs your functions

Why?

The problem I faced is a simple way to compile code for AWS Lambda's and then deploy them with Terraform, I wanted to make it easier and faster hence I created this package. This might be your case aswell, but I assume there are many different use cases so feel free to create issues if you're having any problems with your use case.

Setup

1.

npm install --save-dev funpack
yarn add -D funpack
  1. Add funpack to your package.json, for example like so:
// package.json
{
  ...
  "funpack": {
    "settings": {},
    "functions": {
      "myfunc1": "./src/myfunc1/index.ts",
      "otherFunction": "./src/otherFunction/index.ts"
    }
  }
}

Settings are described under the Settings section.

  1. Run the funpack cli. For example:
{
  ...
  "scripts": {
    "prepackage": "tsc --noEmit",
    "package": "funpack"
  },
  ...
}

The funpack cli accepts --packageJsonPath (defaults to directory of script execution so your main package.json) that accepts the path of the package.json that contains the funpack config.

Settings

Each option inside settings is optional. Below you can view what exactly is needed in the funpack object as well as which settings are available.

configSchema that represents the funpack config

For example you can use ESM with the following setup:

// package.json
{
  ...
  "funpack": {
    "settings": {
      "esbuildConfigOverride": {
        "format": "esm",
        "target": "node16"
      },
      "packageFieldsToCopy": [
        "type"
      ],
      "zip": true
    },
    "functions": {
      "main": "./src/main/index.ts"
    }
  }
}

Example of using custom package.json values:

{
  "settings": {
    "customPackageFields": {
      "repository": {
        "type": "git",
        "url": "${YOUR_ENV_VARIABLE}"
      }
    }
  }
}

Recommendations

When used together with TypeScript, esbuild will not perform type checking, so it's recommended to run tsc --noEmit before using funpack.

1.3.2

11 months ago

1.2.0

1 year ago

1.3.1-beta-1

1 year ago

1.1.0-beta-1

1 year ago

1.1.0-beta-2

1 year ago

1.3.0-beta-1

1 year ago

1.1.0

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.0.1

2 years ago

0.5.0-beta

2 years ago

0.3.1-beta

2 years ago

0.1.1-beta

2 years ago

0.2.0-beta

2 years ago

0.3.0-beta

2 years ago

0.4.0-beta

2 years ago

0.1.0-beta

2 years ago

0.1.2-beta

2 years ago

1.0.0

7 years ago

0.18.0

7 years ago

0.17.0

7 years ago

0.16.0

7 years ago

0.15.0

7 years ago

0.14.0

7 years ago

0.13.0

7 years ago

0.12.0

7 years ago

0.11.0

7 years ago

0.10.0

7 years ago

0.9.0

7 years ago

0.8.0

7 years ago

0.7.0

7 years ago

0.6.0

7 years ago

0.5.0

7 years ago

0.4.0

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.0.1

7 years ago

0.1.16

10 years ago

0.1.15

10 years ago

0.1.14

10 years ago

0.1.13

10 years ago

0.1.12

10 years ago

0.1.11

10 years ago

0.1.10

10 years ago

0.1.8

10 years ago

0.1.7

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago