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

deploy-mandrill

v2.1.1

Published

Compiles, deploys and prunes templates to/from Mandrill.

Downloads

4

Readme

deploy-mandrill

Compiles, deploys and prunes templates to/from Mandrill using MJML templates.

Installation

yarn add deploy-mandrill

Authentication

The tool will prompt for your Mandrill API key when required. Non-interactive mode is not currently supported.

"scripts": { "compile": "deploy-mandrill compile", "deploy": "deploy-mandrill deploy", "prune": "deploy-mandrill prune" }

Usage

deploy-mandrill compile [options] # Compile templates.
deploy-mandrill deploy [options] # Deploy compiled templates to Mandrill.
deploy-mandrill prune [options] # Remove templates from Mandrill that do not exist locally.

Options

Options: Global

--debug

Enable output of debugging log messages.

Default: false

--non-interactive

Do not prompt for confirmations.

The Mandrill API key should be provided in the MANDRILL_API_KEY environment variable when --non-interactive is true.

Default: false

--output-format <format>

Logging output format.

Accepted formats are: colorized, json or text.

Default: colorized

Options: deploy-mandrill compile

--locale

Compile specific locale(s).

Use * to compile all locales.

Default: *

--template

Compile specific template(s).

Use * to compile all templates.

Default: *

Options: deploy-mandrill deploy

--locale

Deploy specific locale(s).

Use * to deploy all locales.

Default: *

--template

Deploy specific template(s).

Use * to deploy all templates.

Default: *

Installation as a run-script alias (optional)

Add script aliases to your package.json file:

{
  ...
  "scripts": {
    ...
    "predeploy": "deploy-mandrill compile",
    "deploy": "deploy-mandrill deploy",
    "postdeploy": "deploy-mandrill prune"
  }
}

Run yarn run deploy or npm run deploy to compile, deploy and prune with a single command.

If you need to pass user or environment-level options that you don't want committed into package.json you can provide these at call-time, e.g. yarn run deploy --template welcome or npm run deploy -- --template welcome.

Concepts

Layout

A layout represents the overall appearance of the e-mail template. It contains the HTML header and footer that wrap the main content (the template).

This tool allows for multiple layouts allowing different messages to have different appearances. You could also make use of multiple layouts to apply a temporary seasonal theme the to e-mails (e.g. create an xmas layout with a Christmas-y background, etc.)

Each layout is stored in the ./layouts/ folder. A single layout file exists for all locales. Any necessary localisation should be implemented using partials.

Use the <!--TEMPLATE--> placeholder to mark where the template should be embedded.

Templates

Each message has a corresponding template. This is the content specific for the message being sent.

Each template is stored in the ./templates/ folder. A template file exist for each supported locale.

The template is published to Mandill using the naming convention <template>-<locale> (e.g. welcome-en-us).

Partials

Layouts and templates often share snippets of HTML, such as welcoming or sign-off messaging. To avoid repetition, you should embed a partial.

Like templates, each partial is stored as a subfolder in the ./partials/ folder, and contains various .mjml files; one for each supported locale.

Each partial is stored in the partials/ folder. A partial file exist for each supported locale.

Use the <!--PARTIAL:name--> placeholder where you'd like a partial to be embedded, replacing name with the name of the partial.

Configuration

The global configuration file should be located at ./config.json. This contains some default settings which are inherited by the templates.

Individual options can be overridden by templates. Create a config file in ./templates/<template>/config.json containing the options you'd like to override.

The configuration file is in JSON format. At the top level is the locale for which the options are applied to.

Example

# Global config at ./config.json (inherited by all templates)
{
  "en-us": {
    "layout": "default",
    "subject": null,
    "from": {
      "name": "My Company",
      "email": "[email protected]"
    }
  }
}

# Template-specific config at ./templates/welcome/config.json
{
  "en-us": {
    "subject": "Welcome Aboard!",
    "preview": "Thanks for joining! Your login details are inside..."
  }
}

# Effective config passed to the "welcome-en-us" template
{
  "en-us": {
    "layout": "default",
    "subject": "Welcome Aboard!",
    "preview": "Thanks for joining! Your login details are inside...",
    "from": {
      "name": "My Company",
      "email": "[email protected]"
    }
  }
}