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

cf-render

v1.0.1

Published

A CLI tool that renders AWS CloudFormation templates using AWS Application Composer's public UI.

Downloads

3

Readme

CloudFormation Template Renderer

npm

This is a simple tool that leverages AWS Application Composer's renderer to render CloudFormation templates. Since CDK also generates CloudFormation templates, this tool can be used to render the stacks created by CDK projects as well.

Beta notice: This tool is currently in beta. Please report any issues you encounter. also read the Good to know section.

Example output

Below image is the output of this template. Example output

Installation

First you need to install Playwright. This tool uses Playwright to render the templates. You can install it using npm:

# For now this library only supports rendering using Chromium
npx --yes playwright install chromium

Then you can install cf-renderer using npm either globally or locally. If you install it globally, you can use it as a CLI tool. If you install it locally, you can use it as a library.

# To use it as a CLI tool
npm install -g cf-render

# To use it as a library
npm install cf-render

Usage - CLI

Usage: cf-render [options]

CLI to render AWS CloudFormation templates

Options:
  -V, --version                output the version number
  -i, --input <template-path>  Path to the cloudFormation template to render
  -o, --output <image-path>    Path to the output image. Must end with .png
  -h, --help                   display help for command

Examples:
  $ cf-render --input template.json --output template.png
  $ cf-render -i template.yaml -o template.png

Usage - Library

import { renderTemplate } from 'cf-render';

...
  await renderTemplate({
    inputPath: './template.yaml', 
    outputPath: './template.png'
  });
...

How to use it with CDK

CDK generates CloudFormation templates in the cdk.out directory when synthesizing the stacks. You can use this tool to render the generated templates. You can also ask CDK to just synthesize your stacks and not deploy them.

cdk synth
cf-render -i cdk.out/MyStack.template.json -o MyStack.png

Roadmap

  • [x] Put it out there!
  • [ ] Add support for screen size configuration
  • [ ] Trim the output image. Currently the canvas area is too large.

Good to know

  • This tool uses the publicly available AWS Application Composer instance to render the templates. I'm not aware of any legal issues with using this public instance. If you represent AWS and you have any issues with this tool, please let me know but just don't tell Jeff.
  • Changes to the Application Composer's web UI might affect this library's functionality. If you encounter any issues, please report them. If your life depends on generating diagrams from CloudFormation templates, you might want to consider using a different tool. Otherwise, you can help improving this tool.
  • You need to have an internet connection to use this tool.