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 🙏

© 2025 – Pkg Stats / Ryan Hefner

amazon-s3-cdn

v0.2.1

Published

Upload files to Amazon S3 bucket

Downloads

28

Readme

Amazon S3 + CDN project

Presentation

This module updates paths in your distribution browser files (.html, .css, .js) to target a CDN domain then upload files to an Amaszon S3 bucket.

Usage / Installation

Install like a node_modules :

npm install amazon-s3-cdn --save

To launch the script use :

"s3cdn": "amazon-s3-cdn --config ../../s3-config.js"

DON'T FORGET TO DEFINE YOUR "s3-config.js" FILE!!!

AND DEFINE YOUR AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_S3_REGION, AWS_S3_BUCKET, etc.

Submodules

Pour installer en sous-module git dans votre dépôt principal :

git submodule add https://github.com/Syldel/amazon-s3-cdn

Après avoir cloné le projet parent qui contient des sous-modules :

Le répertoire "amazon-s3-cdn" est présent mais vide. Vous devez exécuter deux commandes : git submodule init pour initialiser votre fichier local de configuration, et git submodule update pour tirer toutes les données de ce projet et récupérer le commit approprié tel que listé dans votre super-projet.

submodules-install

Look to "submodules-install" to install submodule contents https://github.com/kettek/submodules-install

Heroku

Warning! Unfortunately Heroku doesn't manage submodules

Help about submodules

https://git-scm.com/book/fr/v2/Utilitaires-Git-Sous-modules

Qu'est-ce qu'Amazon CloudFront ?

Amazon CloudFront est un service web qui accélère la distribution de vos contenus web statiques et dynamiques, tels que des fichiers .html, .css, .js multimédias et image, à vos utilisateurs. CloudFront diffuse votre contenu à travers un réseau mondial de centres de données appelés emplacements périphériques. Lorsqu'un utilisateur demande le contenu que vous proposez avec CloudFront, il est dirigé vers l'emplacement périphérique qui fournit la latence la plus faible et, par conséquent, le contenu est remis avec les meilleures performances possibles.

  • Si le contenu se trouve déjà dans l'emplacement périphérique avec la plus faible latence, CloudFront le remet immédiatement.

  • Si le contenu ne se trouve pas à cet emplacement périphérique, CloudFront l'extrait d'une origine que vous avez définie — comme un compartiment Amazon S3, un canal MediaPackage ou un serveur HTTP (par exemple, un serveur web), et que vous avez identifiée comme étant la source de la version définitive de votre contenu.

Example of Cloudfront domain :

domain: 'xxxxxxxxxxxxxx.cloudfront.net'

CORS problems

Example of error: "Access to font at 'https://xxxxxxxxxxxxxx.cloudfront.net/production/glyphicons-halflings-regular.xxxxxxxxxxxxxx.woff' from origin 'https://xxxxxxxxxxxxxx-web-app.herokuapp.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource."

https://stackoverflow.com/questions/12358173/correct-s3-cloudfront-cors-configuration

In Amazon S3, go in "Permissions / Autorisations', then "CORS Configuration" and add :

<CORSConfiguration>
   <CORSRule>
     <AllowedOrigin>*</AllowedOrigin>
     <AllowedMethod>GET</AllowedMethod>
   </CORSRule>
</CORSConfiguration>

In your CloudFront distribution go to Behavior -> choose a behavior -> Edit Enable "Options", then choose "Whitelist" and add :

  • Origin
  • Access-Control-Request-Headers
  • Access-Control-Request-Method

You probably need to Invalid cloudfront cache after that.

CloudFront gzip compression

https://docs.aws.amazon.com/fr_fr/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html#compressed-content-cloudfront

In your CloudFront distribution go to Behavior -> choose a behavior -> Edit Set "Yes" to "Compresser automatiquement les objets"

CloudFront Leverage browser caching

https://docs.aws.amazon.com/fr_fr/AmazonCloudFront/latest/DeveloperGuide/Expiration.html

AWS SDK for JavaScript

https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/