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

@stellar-apps/create-static-react-router-app

v1.0.14

Published

This is an [`inst`](https://github.com/jaredLunde/inst-pkg) template for launching static hosted React apps with a Router on S3 + CloudFront with custom domains.

Downloads

11

Readme

@stellar-apps/create-static-react-router-app

This is an inst template for launching static hosted React apps with a Router on S3 + CloudFront with custom domains.

Installation

This assumes you've already created an inst workspace with inst init [workspace]

cd my-workspace
yarn inst @stellar-apps/create-static-react-router-app

Installation options

  • Name
    • The name of the package you're creating
  • AWS profile
    • The name of the AWS profile in your ~/.aws/credentials file that you'd like to use to deploy this application
  • Domain name [production]
    • The domain name to launch the production version of your static app on
  • Website S3 bucket [production]
    • default [value of production Domain name]
    • The name of the bucket to deploy the static site (HTML files, robots.txt, etc.) into.
  • Client S3 bucket [production]
    • default [Name]-public
    • The name of the bucket to deploy your client JS, images, etc. into. These are resources that are external to your static application, as in, not HTML files, robots.txt, etc.
  • Domain name [staging]
    • default staging-[Domain name] if [Domain name] is a subdomain, otherwise staging.[Domain name]
    • The domain name to launch the staging version of your static app on
  • Website S3 bucket [staging]
    • default [value of staging Domain name]
    • See production above for description
  • Client S3 bucket [staging]
    • default [value of production Client S3 bucket with '-public' replaced by '-staging-public']
    • See production above for description
  • Inherits code from
    • Use the spacebar and arrow keys to select libraries already part of your Workspace to inherit code from, e.g. a core or shared directory. You will then be able to import these libraries into your application via the alias ~[library name] e.g. import {Header} from '~core'

Configuring CloudFormation

You should pay special attention to these values in serverless.yml EVERY TIME you create a new app from this template. This should be the FIRST THING you do after you create an app.

  1. The default template assumes you're using a unique bucket for the public client assets of this application. If you're using a shared bucket that already exists, be sure to delete the resources.Resources.ClientS3Bucket section of the serverless.yml that gets generated.

  2. The default behavior for client buckets is to retain them on teardown so as not to accidentally empty a bucket that is in use by other applications. To change this behavior, assuming your bucket is unique, you can change the option for retain to false in custom.syncBundle['webpack/client.config.js'].bucket and comment out resources.Resources.ClientS3Bucket.DeletionPolicy.

  3. The default behavior for managing ACM certificates is to retain them on teardown. This is to prevent encountering errors when you try to remove certificates that are still in use by other applications, e.g. wildcard certificates. To change this behavior, set retain to false in custom.certificateManager.retain

  4. Pay special attention to the custom.certificateManager.domains listed to be sure they are exactly the domains you need a certificate for and that they will use the exact same certificate.

  5. You will want to glance at the .env.[stage] files to ensure the proper PUBLIC_PATH is defined if you're using a CloudFront distribution in front of your S3 bucket.

Managing the application

Starting the app in the development stage and development NODE_ENV on a local server

cd my-workspace
yarn my-app start

Starting the app in the development stage and production NODE_ENV on a local server

cd my-workspace
yarn my-app start production

Deploying the CloudFormation stack to staging stage

Note: You have to use this command before using deploy without a --stack flag

cd my-workspace
yarn my-app deploy --stack

Deploying the CloudFormation stack to production stage

Note: You have to use this command before using deploy production without a --stack flag

cd my-workspace
yarn my-app deploy production --stack

Deploying the application without changing the CloudFormation stack to staging stage

cd my-workspace
yarn my-app deploy

Deploying the application without changing the CloudFormation stack to production stage

cd my-workspace
yarn my-app deploy production

Bundling the application without uploading the staging stage to S3

cd my-workspace
yarn my-app bundle

Bundling the application without uploading the production stage to S3

cd my-workspace
yarn my-app bundle production

Tearing down the staging CloudFormation stack

This removes your CloudFormation stack and all the resources defined within it. Use with extreme caution.

cd my-workspace
yarn my-app teardown

Tearing down the production CloudFormation stack

This removes your CloudFormation stack and all the resources defined within it. Use with extreme caution.

cd my-workspace
yarn my-app teardown production