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

@haftahave/serverless-ses-template

v6.1.0

Published

Serverless template sync plugin for Amazon Simple Email Service

Downloads

14,010

Readme

Serverless NPM npm Build Status slack Made in Ukraine

Stand With Ukraine

Template sync plugin for Amazon Simple Email Service

A serverless plugin that allows automatically creating, updating and removing AWS SES Templates using a configuration file and keeps your AWS SES Templates synced with your configuration file.

🚨 Important Notice: Starting from 6.x version, plugin has transitioned to pure ESM and requires serverless v3.2.0 or newer.

If you need for CJS package use 5.x plugin series

If you need compatibility with serverless<=3.0.0, please use tag v4.0.7.

Read motivation here


REQUIRES nodejs 18+


:zap: Features

  • Allows declaring email templates that will be synced in pre-deploy phase
  • Allows you to optionally add stage to template names while syncing
  • Allows you to list and delete SES template by specified name

Examples

Installation

npm install @haftahave/serverless-ses-template

Configuration

  • All @haftahave/serverless-ses-template configuration parameters are optional
# add to your serverless.yml

plugins:
  - '@haftahave/serverless-ses-template'

custom:
  sesTemplates:
    addStage: true                             # Specifies whether to add stage to template name (default false)
    configFile: './custom-config-file/path.js' # Config file path (default './ses-email-templates/index.js')
    deployHook: 'after:deploy:deploy'          # Specifies serverless lifecycle event plugin use to deploy templates (default 'before:deploy:deploy')
    disableAutoDeploy: true                    # Specifies whether to sync templates while sls deploy and remove (default false)
    region: 'us-west-2'                        # Specifies AWS region for SES templates (not required)
    removeMissed: false                        # Set this flag in order to remove templates those are not present in your configuration file. (not required, default false)

Template configuration file

Template configuration file should be an async function that returns array of objects (all keys are required):

/**
 * @param {Object} serverless - Serverless instance
 * @param {Object} options - runtime options
 * @returns {Promise<{name: string, subject: string, html: string, text}[]>}
 */
const templateConfiguration = async (serverless, options) => [{
    name: 'example_name',
    subject: 'Your subject',
    html: '<h1>Hello world!</h1>',
    text: 'Hello world!',
}];

export default templateConfiguration

Real world example see here.

Plugin resolves region in the following order:

  • CLI argument named sesTemplatesRegion - top priority
  • serverless.yml plugin configuration param named region
  • CLI argument named region
  • fallback to default region resolving (first region in first stage defined in serverless.yml)

Plugin resolves template configuration file path in the following order:

  • CLI argument named sesTemplateConfig - top priority
  • serverless.yml plugin configuration param named configFile
  • fallback to default ./ses-email-templates/index.js

Usage and command line options

Deploy

Run sls ses-template deploy in order to sync your email templates.

Optional CLI options:

--sesTemplatesRegion The region used to populate your templates. Default: see "Region fallback sequence" in readme.md. [OPTIONAL]
--sesTemplateConfig  Template configuration file path. Default: see "Template configuration file sequence" in readme.md. [OPTIONAL]
--stage        The stage used to populate your templates. Default: the first stage found in your project. [OPTIONAL]
--removeMissed Set this flag in order to remove templates those are not present in your configuration file. [OPTIONAL]

List templates

Run sls ses-template list in order to list your email templates.

CLI options:

--sesTemplatesRegion The region used to list your templates. Default: see "Region fallback sequence" in readme.md. [OPTIONAL]
--filter <string>    Display templates that contain <string>. [OPTIONAL]

Delete template

Run sls ses-template delete --template template_name_goes_here in order to delete your email template.

CLI options:

--template    The template name you are going to delete [REQUIRED]
--sesTemplatesRegion The region used to populate your templates. Default: see "Region fallback sequence" in readme.md. [OPTIONAL]
--stage       The stage used to populate your templates. Default: the first stage found in your project. [OPTIONAL]

Links

License

MIT