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

@maxletou/ngx-aws-deploy

v4.2.5

Published

Deploy an Angular app to Amazon S3 directly from the Angular CLI

Downloads

32

Readme

Disclaimer: This is a temporary fork from @jefiozie/ngx-aws-deploy <-- use this instead

This temporary fork adds the new feature waiting to be merged in the original repo, linked below and described at step #7 of the Quick Start documentation below.

add a globFileUploadParamsList option to set properties on uploaded files

NGX-AWS-DEPLOY

☁️🚀 Deploy your Angular app to Amazon S3 directly from the Angular CLI 🚀☁️

All Contributors

CI npm npm (scoped) GitHub issues

Quick Start

  1. Install the latest version of Angular cli

    yarn global add @angular/cli
  2. Create a new Angular project

    ng new hello-world --defaults
    cd hello-world
  3. Add @jefiozie/ngx-aws-deploy to your project

    ng add @jefiozie/ngx-aws-deploy
  4. After these steps your angular.json is updated with a new builder:

    "deploy": {
       "builder": "@jefiozie/ngx-aws-deploy:deploy",
       "options": {}
    }
  5. Due to security risk we have made the decision to never add any options to the angular.json. You should set the environments variable during the ng deploy command. Below is an example on how you could do this.

npx cross-env NG_DEPLOY_AWS_ACCESS_KEY_ID=1234 NG_DEPLOY_AWS_SECRET_ACCESS_KEY=321ACCESS NG_DEPLOY_AWS_BUCKET=mys3bucket NG_DEPLOY_AWS_REGION=eu-1-region NG_DEPLOY_AWS_SUB_FOLDER=path/on/bucker ng deploy
  1. To trigger an optional invalidation of the files in an AWS CloudFront distribution, add these parameters to the above command line:
npx cross-env ... NG_DEPLOY_AWS_CF_DISTRIBUTION_ID=1234 ... ng deploy
  1. To apply properties on uploaded files, use the NG_DEPLOY_AWS_GLOB_FILE_UPLOAD_PARAMS_LIST variable or the target option globFileUploadParamsList as shown below.
    We use an array of objects to represent the different configurations.
    Each config object needs a glob property to define on which files the params will be set.
    Other properties on the config object are the params to apply. For informations about the possible params (ACL, Bucket, CacheControl, etc), checkout the documentation of the s3.upload method (https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#upload-property)
"deploy": {
  "builder": "@jefiozie/ngx-aws-deploy:deploy",
  "options": {
    "globFileUploadParamsList": [
      {
        "glob": "*",
        "ACL": "public-read",
        "CacheControl": "max-age=3600"
      },
      {
        "glob": "*.html",
        "CacheControl": "max-age=300"
      }
    ]
  }
},

The order of the config objects matters, the one that comes last is the one that will be used, as shown above:

  • CacheControl is set for all files but it's overidden by the next config object only for html files. Convenient for declaring exceptions and not repeat global settings.

To set this using the environment variable NG_DEPLOY_AWS_GLOB_FILE_UPLOAD_PARAMS_LIST, simply stringify the config object to JSON with JSON.stringify.

npx cross-env ... NG_DEPLOY_AWS_GLOB_FILE_UPLOAD_PARAMS_LIST='[{"glob":"*","ACL":"public-read","CacheControl":"max-age=3600"},{"glob":"*.html","CacheControl":"max-age=300"}]' ... ng deploy
  1. Run ng deploy to deploy your application to Amazon S3.

🚀**Happy deploying!** 🚀

Security 🔑

Keep in mind that with the default config, everybody that has access to the angular.json will have your aws secret. If you want more security, you can also use environment variable with NG_DEPLOY_AWS_ACCESS_KEY_ID, NG_DEPLOY_AWS_SECRET_ACCESS_KEY, NG_DEPLOY_AWS_BUCKET and NG_DEPLOY_AWS_REGION.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. The builder is located in the libs\ngx-aws-deployfolder. The sample app is located in the apps\demo-app folder. Please make sure to update tests as appropriate.

License

MIT

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!