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

lenticular

v0.2.1

Published

A particular CloudFormation helper

Downloads

3

Readme

lenticular

A particular CloudFormation helper.

What is this thing?

This is my attempt at making CloudFormation sane. I want nice and short-as-possible names for my AWS resources. I want semantic names for artifacts in my S3 buckets, instead of hex strings. And I want continuous deployment of my product’s infrastructure side-by-side with my product’s code.

So what lenticular does is provide a little command line utility that helps with these goals and writes some boilerplate for you, hopefully putting you on a good path.

I’m learning infrastructure-as-code as I go along, so if you see something that might be done better another way, please open an issue!

Setup

The very first thing you need is a product name for your product. This should be a relatively unique identifier to avoid S3 bucket name collisions (keeping in mind that S3 buckets are a global, publicly-shared namespace). It should be all lowercase, with dashes (-) separating words.

Now, assuming you’ve got a git repo and an npm package.json all set up in a directory with the same name as your product, run the following in that directory:

npm install --save-dev lenticular      # Local CLI install.
sudo npm install --global lenticular   # Global CLI always falls back to local.
lenticular init                        # Creates .lenticularrc and ./infra/

Now, take a look at the newly created .lenticularrc, infra/pipeline.yaml and buildspec.yml files.

Writing CloudFormation Templates

I like to put my main CloudFormation template in /infra/index.yaml. You can override this with the indexTemplate configuration property.

By default CloudFormation gives your resources random names that are useless. Lenticular gives you two functions to help with giving your resources meaningful, short-as-possible, and non-colliding names. For example, in the following template, your lambda function would get a FunctionName value of projectx-ProcessUpload:

Resources:
  ProcessUploadFunction:
    Type: AWS::Serverless::Function
    Properties:
      FunctionName: !Lenticular::ResourceName 'ProcessUpload'

Or the following for an S3 bucket or other resources in a global namespace, to generate a value of projectx-UserData-us-west-2:

Resources:
  UserDataBucket:
    Type: AWS::S3::Bucket
    Properties:
      BucketName: !Lenticular::ResourceNameWithRegion 'UserData'