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

@cannery/hoist

v0.11.1

Published

DIY Static Website Hosting

Downloads

106

Readme

Hoist

Upload and host static websites in Google Storage Buckets.

yarn global add @cannery/hoist
# or
npm install -g @cannery/hoist

Hoist understands, and automatically pre-processes for production, the following file types out of the box:

  • HTML: URLs referenced replaced with hashed CDN names and minified for production
  • CSS: File URLs replaced with hashed CDN names, autoprefixer applied with default settings, minified for production, and file name is hashed for CDN cache busting.
  • JavaScript: Minified for production and file name is hashed for CDN cache busting.
  • JPEG, PNG, GIF: Compressed, and file names are hashed for CDN cache busting.
  • SVG, Ico, BMP, WebP: File names are hashed for CDN cache busting

All other files discovered are uploaded as-is to the hosting provider. All files are gzipped as they are uploaded and appropriate cache-key headers are set.

CLI Usage

Hoist comes with just two commands:

$ hoist up [root] [subdirectory] [bucket_name]
$ hoist down
$ hoist serve directory [port]

hoist up will make your site public to the world. If you pass a directory root as the second CLI argument it will upload that directory to your production site. You can optionally pass a subdirectory to only upload that subdirectory to remote, and a bucket name other than the one specified in your gcloud.json auth file (see below) to select an alternate GCS bucket to upload to.

hoist down will make your site private, nobody will be able to see files in the Google Storage Bucket.

hoist serve will serve your site locally over SSL for you to preview. If you pass a preferred port Hoist will use the provided port if available.

Configuration

When you run Hoist from the CLI, it will crawl up directories until it finds a gcloud.json file with the Service Account Key and attempt to use it for authentication.

Hoist needs a Service Account and a Service Account Key with Storage Bucket management permissions to operate.

You may optionally include a cloudflare_token to automatically clear your CDN cache on upload. This token must be granted Zone.Zone read access and Zone.Cache Purge permissions for relevant DNS Zones.

You may optionally include a test_domain to configure the local domain that hoist serve uses. By default it will make the site available at https://hoist.test.

To configure the bucket that the site will upload to by default, add a single bucket field to this gcloud.json file with the target bucket name.

Once configured, your gcloud.json file should look something like this:

{
  "type": "service_account",
  "project_id": "projectid",
  "bucket": "bucketname.com",
  "test_domain": "appname.test",
  "cloudflare_token": "01234567890123456789",
  "private_key_id": "01234567890123456789",
  "private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n",
  "client_email": "[email protected]",
  "client_id": "01234567890123456789",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/name%40projectid.iam.gserviceaccount.com"
}