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

@saws/website

v1.0.6

Published

<div align='center'>

Downloads

15

Readme

Website

Service for building websites using Vite.

Table of Contents

Installation

From the command line run:

npm install @saws/website

Then add the included service, WebsiteService to your saws.js file.

Development

In development, a WebsiteService will use the Vite dev server to build and serve your website. It will also write any of your dependant service's environment variables to a .env file for Vite to read and inject into your build.

For new WebsiteServices that have just been added to your saws.js file. SAWS will create a hello world world website for you.

Deployment

When you deploy a WebsiteService, a number of resources will be stood up and configured for you:

  • An S3 bucket will be created that is configured to be used as a website.
  • A Cloudfront distribution that serves content out of the above S3 bucket.
  • A Route 53 Record Set Group to point your domain at the above Cloudfront distribution.

Services

@saws/website includes the WebsiteService

WebsiteService

You can require the WebsiteService and use it in your saws.js file like so:

const { WebsiteService } = require('@saws/website/website-service')

const website = new WebsiteService({
  name: 'my-website'
})

module.exports = website

The WebsiteService constructor accepts the following options:

name: string

The name of your service. This should be unique across all of your services.

dependencies: ServiceDefinition[]

An array of all of the other services this service depends on. This will ensure that permissions, environment variables, and execution order are all set up.

port?: number

The port to run the Vite dev server on. If the provided port is in use, a different port will automatically be chosen.

rootDir?: string

Used if you would like the service to point at a different directory for your WebsiteService other than it's name.

domain?: string

A domain name that you would like to use for your website. You must own this domain and have it configured in Route 53.

env?: Record<string, string>

Additional environment variables to include in your Vite build.

certificateArn?: string

The AWS Arn to the certificate you'd like to use for your website to enable HTTPs.

When used as a dependency

When a WebsiteService is used as a dependency, it does not attach any environment variables to the dependant services.

Libraries

@saws/website does not include any libraries with it.