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

@hexlabs/kloudformation-ts

v2.0.258

Published

A Typescript way to build CloudFormation

Downloads

463

Readme

KloudFormation-ts workflow NPM Version

KloudFormation-ts

KloudFormation-ts is a one-to-one mapping of Amazon's CloudFormation generated into a TypeScript library allowing users to write type safe stacks in TypeScript.

KloudFormation can be invoked inside a Typescript program or on command line by running

npm install -g @hexlabs/kloudformation-ts

Benefits Include

  • Type Safety
  • Code Completion
  • Stacks as Code
  • Modular Templating
  • Coverage generated for all Cloudformation resources with each release

This is what it looks like

Template.create(
  (aws: AWS) => {
    const snsTopic = aws.snsTopic({})
    aws.s3Bucket({
        bucketName: snsTopic.attributes.TopicName
    })
  });

This is what it Produces

{
  "Parameters": {},
  "Resources": {
    "Topic": {
      "Type": "AWS::SNS::Topic"
    },
    "Bucket": {
      "Type": "AWS::S3::Bucket",
      "Properties": {
        "BucketName": {
          "Fn::GetAtt": [
            "Topic",
            "TopicName"
          ]
        }
      }
    }
  }
}

Get Started

To install on command line globally use

npm install -g @hexlabs/kloudformation-ts

Generate a Template

A Cloudformation template can be generated using

kloudformation translate -s klouds-users-dev klouds-keys-dev -- $(pwd)/stack/stack.ts

Full list of kloudformation template option

Options:
  -s, --stack-info <stacks...>  A space separated list of stacks to get outputs as environment variables
  -r, --region <region>         The region to gather stack outputs from (default: "eu-west-1")
  -t, --ts-project <fileName>   TS Config
  -h, --help                    display help for command

Deployment

kloudformation deploy --file $(pwd)/dist --bucket deployments-bucket --prefix s3-key-prefix stack-name $(pwd)/stack/stack.ts"

This command will zip and upload a files in $(pwd)/dist to s3://deployments-bucket/s3-key-prefix then create the stack "stack-name"

Full list of kloudformation deploy options

Options:
  -r, --region <region>               The region to delete stack from (default: "eu-west-1")
  -e, --endpoint-url <endpoint-url>   
  -c, --capabilities <capability...>  A space separated list of any of CAPABILITY_IAM, CAPABILITY_NAMED_IAM or CAPABILITY_AUTO_EXPAND (default: ["CAPABILITY_NAMED_IAM"])
  -f, --file <files...>               A space separated list of files to upload to s3
  -b, --bucket <bucket>               The s3 bucket in which to upload files
  -p, --prefix <prefix>               The s3 object key prefix in which to upload files
  -s, --stack-info <stacks...>        A space separated list of stacks to get outputs as environment variables
  -o, --output-file <fileName>        A file to output key-value pairs from stack-info
  -t, --ts-project <fileName>         TS Config
  -h, --help                          display help for command