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

@0x4447/potato

v2.4.7

Published

๐Ÿฅ” Upload a static page to AWS S3 while automatically configuring CloudFront.

Downloads

197

Readme

๐Ÿฅ” Potato

We built Potato to cut down on time, stress, and drama. The process of deploying a static page to S3 and configuring CloudFront, Certificate Manager, and Route53 is tedious and prone to error. It also involves too many steps to remember โ€“ and so, Potato was grown.

You might wonder why we didn't create a CloudFormation template. The reason is simple: CF doesn't fully support Route53, so creating a certificate and updating the domain with the correct information would require a special Lambda. You can see that we could quickly end up in a complex spiral.

With Potato, we can use code to overcome all the limitations of CF and configure everything in one go. Potato also streamlines the process of updating a static site.

How to install

] sudo npm install -g @0x4447/potato

How to use

] potato -s PATH_TO_FOLDER

Where to get help

] potato -h

What to expect

The CLI offers the following options:

Update

This option allows you to update the content of a site on S3 and automatically invalidate the CloudFront Distribution Cache. Just provide the path to the folder containing the new content, and the CLI automatically does the rest for you. All you have to do is follow the steps on the screen.

Create

This process is more involved, but it will save your sanity - and quite a bit of time. When you select this option, you'll be asked for the domain name you'd like to use for your website. Once that information is provided, everything else is automatic. At that point, all you need to do is sit down and relax.

The following is a list of everything that happens in the background:

  • list_all_certificates
  • look_for_domain_certificate
  • create_a_certificate
  • get_certificate_metadata
  • list_hosted_zones
  • look_for_domain
  • update_route53_with_cert_validation
  • check_certificate_validity
  • check_if_bucket_exists
  • create_a_bucket
  • convert_bucket_to_site
  • change_bucket_policy
  • upload
  • create_a_distribution
  • get_all_domain_records
  • look_for_domain_entry
  • delete_domain_entry
  • create_a_route_53_record
  • print_domain_configuration

WARNING: What if the certificate takes too long to validate? After 60 seconds, the app quits and prints out a detailed explanation of what your next steps should be. Take the time to thoroughly go over the printout, and you'll be good.

Credentials

To use this CLI, create a programmatic user or create a role with the following permissions:

  • AmazonS3FullAccess
  • CloudFrontFullAccess
  • AmazonRoute53FullAccess
  • AWSCertificateManagerFullAccess

How to pass the credentials

Each time you run Potato, it does the following:

  1. Check whether it's running on an EC2 server and whether there's an attached role
  2. If this fails, it will check whether it's running inside a CodeBuld container and then check for a Role
  3. Lastly, if all fails, the app prompts for credentials

Is deployment instant?

No, it's not. The following aspects don't happen right away:

  • SSL Certificate confirmation
  • CloudFront distribution

SSL Certificate confirmation

The time frame for this process ranges from 10 seconds to 24 hours. It's completely unpredictable, and there's no way to speed up the process. Because of this, the app quits if the certificate isn't confirmed within 60 seconds. When that happens, go to the AWS Console to monitor the certificate.

CloudFront distribution

This takes up to 15 or 20 minutes, but when you reach this point, you can be certain that the configuration is correct. At this point, you just need to wait until the process is complete. Only then does the domain deliver the website.

Companion software

The Potato CLI tool also works well with the following software:

  • Avocado: a mini-framework that enables you to create basic HTML websites without the complexity of modern frameworks
  • Strawberry: allows you to create redirects supporting HTTP and HTTPS for your site.

The End

If you enjoyed this project, please consider giving it a ๐ŸŒŸ. And check out our 0x4447 GitHub account, which contains additional resources you might find useful or interesting.

Sponsor ๐ŸŽŠ

This project is brought to you by 0x4447 LLC, a software company specializing in building custom solutions on top of AWS. Follow this link to learn more: https://0x4447.com. Alternatively, send an email to [email protected].