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

@mapbox/cloudfriend

v8.2.0

Published

Helper functions for assembling CloudFormation templates in JavaScript

Downloads

228,278

Readme

cloudfriend

Build Status

Helper functions for assembling CloudFormation templates in JavaScript.

Shortcuts

Cloudfriend contains a library of JS classes that reduce the amount of "boilerplate" CloudFormation that you need to write to setup a common set of AWS Resources. See the shortcuts readme for more information, or the shortcuts API documentation to look at shortcut-specific configuration.

Intrinsic functions and conditions

These are functions that you can use in place of various CloudFormation objects.

CloudFriend | CloudFormation --- | --- base64(value) | Fn::Base64 cidr(ipBlock, count, cidrBits) | Fn::Cidr findInMap(mapping, key, attr) | Fn::FindInMap forEach(uniqueLoopName, identifier, collection, outputKeyPrefix, outputValue) | Fn::ForEach getAtt(obj, key) | Fn::GetAtt getAzs(region) | Fn::GetAZs join(delimiter, pieces) | Fn::Join split(delimiter, string) | Fn::Split select(index, list) | Fn::Select ref(name) | Ref userData(list) | Fn::Base64 and Fn::Join with \n delimiter and(conditions) | Fn::And equals(a, b) | Fn::Equals if(condition, ifTrue, ifFalse) | Fn::If not(condition) | Fn::Not or(conditions) | Fn::Or notEquals(a, b) | Fn::Not and Fn::Equals sub(str, variables) | Fn::Sub importValue(sharedValue) | Fn::ImportValue, arn(service, suffix) | Fn::Sub designed for an ARN transform(name, parameters) | Fn::Transform contains(strings, s) | Fn::Contains eachMemberEquals(strings, s) | Fn::EachMemberEquals eachMemberIn(stringsToCheck, stringsToMatch) | Fn::EachMemberIn refAll(parameterType) | Fn::RefAll valueOf(parameterLogicalId, attribute) | Fn::ValueOf valueOfAll(parameterType, attribute) | Fn::ValueOfAll

Pseudo parameters

These are static properties of cloudfriend that you can use to reference various CloudFormation objects.

CloudFriend | CloudFormation --- | --- accountId | AWS::AccountId notificationArns | AWS::NotificationARNs noValue | AWS::NoValue region | AWS::Region stackId | AWS::StackId stackName | AWS::StackName partition | AWS::Partition urlSuffix | AWS::URLSuffix

Other helpers

method | description --- | --- build(file, opts) | Builds a template defined by a static JavaScript export, a synchronous or an asynchronous function. validate(file) | Uses the cloudformation:ValidateTemplate API call to perform rudimentary template validation merge(...template) | Merges templates together. Throws errors if logical names are reused. Transform macros from all template arguments are merged into a single array, in order of their appearance in the template arguments, and an error is thrown if any macro is repeated.

CLI tools

By installing cloudfriend globally, it can provide you with simple CLI tools for building and validating CloudFormation templates.

# either...
$ git clone https://github.com/mapbox/cloudfriend && cd cloudfriend && npm link
# ... or ...
$ npm install -g @mapbox/cloudfriend

Then, to build a template:

# Prints the template as JSON to stdout
$ build-template path/to/template.js

Or, to validate a template:

# Make sure that your shell is configured to make AWS requests
$ validate-template path/to/template.js

You may also specify a region for validation:

# Make sure that your shell is configured to make AWS requests
$ validate-template path/to/template.js us-east-1