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

cloudformation-helper

v0.0.9

Published

Automation helpers for structuring and maintaining applications with AWS CloudFormation stacks.

Downloads

23

Readme

CloudFormation Helper

version: 0.0.9

Providing the boiler plate for your AWS Application CloudFormation templates.

Building large scale AWS Applications requires careful consideration in the usage and versioning of provisioned resources.

Prerequisites

  • Node.js >=v0.12

TL;DR

For your project, you can install cloudformation-helper to use in Node.js build scripts. Maintain persistent application parameters across your templates (such as Application Name and Environment, more on that in an upcoming blog post).

# npm install --save-dev cloudformation-helper
const { ApplicationParameters, CloudFormationHelper, AppExports } = require('cloudformation-helper');

// see example.parameters.json which can also contain tokens that can be programmatically populated later
let parametersFile = "./examples/example.parameters.json";
let templateFile = "./examples/example.uber-stack.yml";
let environment = "Dev";
let stack = "MySQSStack";

let params = new ApplicationParameters({
    allowEmptyTokens: true,
    stripEmptyParameters: true,
    parametersFile: parametersFile,
    keys: ["AppName", "Environment"],
    parameterTokens: {
        environment: environment
    }
});

let appName = params.getParameterValue("AppName");

// Applications usually mean deploying multiple instances in one or many accounts, each Application instance needs to
// be uniquely named.
let stackName = `${appName}${environment}${stack}`;
let helper = new CloudFormationHelper(stackName, templateFile, params);

// maybe you need to get an existing AWS resource during your build, like perhaps an S3 bucket to fill with the 
// current versions of templates that you'll refer to in a nested stack.  We will need to know which copy of that
// bucket to get based on Application Name and Environment.  AppExports will remove the AppName and Environment prefix
// from each export so that we can refer to it generically in any copy of the application within the account.
var props = new AppExports();

props.fetch(appName, environment).then((exports) => {
    let bucket = exports["StackBucket"];

    // upload the child templates to the S3 bucket (from CICD stack) before running the create action, or after
    // other CLI build steps that you might have
    execSync(`aws s3 cp --recursive examples s3://${bucket}`);

    helper.create();
});

There are also command line tools installed here, specifically cfn-exports which will produce a JSON version of your CloudFormation template exports that you can bundle with your project, which can provide useful properties like API Gateway endpoints, S3 bucket names, or other values that you might want to programatically interact with.

# npm install -g cloudformation-helper
# cfn-exports --help
# cfn-exports --appName MyApp --environment Prod -o aws-environment.json --pretty

Versioning

We use generate-release for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details