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

laita

v0.2.0

Published

A CLI utility to deploy static websites to the cloud

Downloads

15

Readme

Laita

Build Status Dependencies npm version License Sponsored

A CLI utility to easily deploy static websites to the cloud

Supported targets:

  • [x] AWS S3 + Cloudfront
  • [x] Azure Storage + Azure CDN
  • [ ] GCP Cloud Storage
  • [ ] Netlify
  • [ ] Heroku

Requirements

  • Node.js
  • Terraform

Install

npm install -g laita

Quick start

laita config # follow interactive prompts to create .laitarc config
laita provision # provision selected cloud infra using terraform
laita deploy # deploy the static website to the provisioned infra

Configuration

Laita uses a .laitarc file to store its configuration.

You can generate configurations interactively using the laita config command.

The .laitarc file contents look like this:

default:
  source: public/
  target: aws-s3-cloudfront
  region: eu-west-1
  bucketName: laita-static-default-2094db20
  createCloudFront: true
  domains:
  - mydomain.com
  - www.mydomain.com
  acmCertificateARN: arn:aws:acm:us-east-1:921809084865:certificate/c0b7309b-39cc-4925-9df3-bcedf78b92f8

Example

Configuration with laita config

$ laita config
? Static files directory? public/
? Choose method aws-s3-cloudfront
? AWS Region? eu-west-1
? S3 bucket name? laita-static-default-2094db20
? Create CloudFront distribution? (needed to use custom domains) Yes
? Add a domain name? (leave empty to continue) my.example-website.com
? Add another domain name? (leave empty to continue)
? Add ACM certificate? (needed to use custom domains) Yes
? ACM Certificate ARN? 	arn:aws:acm:us-east-1:921809084865:certificate/c0b7309b-39cc-4925-9df3-bcedf78b92f8
? Store terraform state remotely? s3
? Terraform bucket name laita-terraform-d40cb707
? Terraform bucket region eu-west-1
? Create bucket now? Yes
----> Running "aws s3api create-bucket --bucket laita-terraform-d40cb707 --region eu-west-1 --create-bucket-configuration LocationConstraint=eu-west-1"...
Config written to .laitarc

Provisioning with laita provision

$ laita provision
Provisioning AWS S3 + Cloudfront resources... (stage: default)
----> Running "terraform init"...
Initializing modules...
- cloudfront_distribution_default in cloudfront-distribution

Initializing the backend...

Successfully configured the backend "s3"! Terraform will automatically
use this backend unless the backend configuration changes.

Initializing provider plugins...

Terraform has been successfully initialized!

...

Plan: 2 to add, 0 to change, 0 to destroy.

------------------------------------------------------------------------

? Apply changes? Yes
----> Running "terraform apply -auto-approve -target module.s3_website_default -target module.cloudfront_distribution_default"...

module.s3_website_default.aws_s3_bucket.static: Creating...
module.s3_website_default.aws_s3_bucket.static: Creation complete after 7s [id=laita-static-default-2094db20]
module.cloudfront_distribution_default.aws_cloudfront_distribution.static: Creating...
...
module.cloudfront_distribution_default.aws_cloudfront_distribution.static: Creation complete after 28m42s [id=EW9JZP1F0BO3L]
module.cloudfront_distribution_default.aws_cloudfront_distribution.static: Creation complete after 28m42s [id=EW9JZP1F0BO3L]

Apply complete! Resources: 2 added, 0 changed, 0 destroyed.

Outputs:

cloudfront_endpoint_default = https://d3ib5k4yxe7qbv.cloudfront.net
s3_endpoint_default = http://laita-static-default-2094db20.s3-website-eu-west-1.amazonaws.com

Deployment with laita deploy

$ laita deploy
Deploying site to S3... (stage: default)
----> Running "aws s3 sync --delete public/ s3://laita-static-default-2094db20"...
upload: public/bundle.css to s3://laita-static-default-2094db20/bundle.css
upload: public/index.html to s3://laita-static-default-2094db20/index.html
upload: public/global.css to s3://laita-static-default-2094db20/global.css
upload: public/favicon.png to s3://laita-static-default-2094db20/favicon.png
upload: public/.DS_Store to s3://laita-static-default-2094db20/.DS_Store
upload: public/bundle.css.map to s3://laita-static-default-2094db20/bundle.css.map
upload: public/bundle.js to s3://laita-static-default-2094db20/bundle.js
upload: public/images/anttiviljami.jpg to s3://laita-static-default-2094db20/images/anttiviljami.jpg
upload: public/bundle.js.map to s3://laita-static-default-2094db20/bundle.js.map