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

aws-deploy-script-fe

v1.0.9

Published

AWS script for deploying your frontend applications.

Downloads

378

Readme

AWS Deploy script

FEArmy

AWS script for deploying your frontend applications.

Introduction

The most common configuration used for our projects is using an S3 Bucket to contain our static files. Optionally you can have a CloudFront playing as a CDN.

The aim of this script is to read all your files and sync directly to the bucket without having to install AWS CLI or any kind of credentials configuration.

This script is cross project which means you only need to have a build/ folder to sync.

Folder structure

ROOT
    build/
      index.html
      ...
    aws.js
    ...
  • The aws.js file should be at the root of your project, it will contain credentials and will export them as an object like this:

  • The aws.js file also contains a specific object called metrics to persist the measured deploy-time in a db. If you do not wish to persist the metric the object can be removed.

module.exports = {
  development: {
    accessKeyId: "XXXXXXXXXXXXXXXXXXXX",
    secretAccessKey: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    region: "us-east-1",
    bucket: "<Name of the bucket>",
    distributionId: "XXXXXXXXXXXXXX",
    options: { // Optional
      preserveFiles: [/^sitemap/, "bar.js"]
    }
  },
  stage: {
    accessKeyId: "XXXXXXXXXXXXXXXXXXXX",
    secretAccessKey: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    region: "us-east-1",
    bucket: "<Name of the bucket>",
    distributionId: "XXXXXXXXXXXXXX",
    options: { // Optional
      preserveFiles: ["static/baz.js"]
    }
  },
  metrics: {
    tech: "react/vue/angular",
    repoName: "<Name of the repository>",
    baseUrl: "<Url to the api db>"
  }
};
  • The build/ folder will contain the file you want to sync

  • The distributionId is optional, in case you've got it. The script will create an invalidation for all your files.

Options

  • preserveFiles. It allows to specify an array of S3 file paths that won't be removed when the script cleans the bucket before uploading the new build. It's useful if you want to upload files manually to the S3 bucket. Supports regex and strings

  • environment or e. It specifies the environment in which you are going to deploy your app. Also the key of your aws.js file that has the corresponding credentials

  • path or p. The path of you generated static build files.

  • outputPath or o. The S3 path to upload your files (e.g. in case you don't want to upload all files in the root of the bucket)

Usage

You can install this package globally and run aws-deploy

npm install -g aws-deploy-script-fe

The command line to execute can be:

aws-deploy --env <enviroment-name> --path <build-path>

or

aws-deploy -e <enviroment-name> -p <build-path>
  • This enviroment-name is the key of the main object exported in aws.js.
  • If no enviroment-name is declared then it will use development as default.
  • The build-path is optional and defaults to build.

Required dependencies

The dependency you need to install is aws-sdk

Required policies

To run this script you must add these action policies to the user configured in the aws.js file

"Action": [
  "s3:GetObject",
  "s3:GetObjectAcl",
  "s3:ListMultipartUploadParts",
  "s3:PutObject",
  "s3:PutObjectAcl",
  "s3:DeleteObject",
  "cloudfront:CreateInvalidation"
]

About

This project is maintained by Damián Finkelstein, Pablo Ferro, Francisco Iglesias and Lucas Zibell and it was written by Wolox.

Wolox