Metadata-Version: 2.1
Name: cdk-bucket-deployment-expirator
Version: 1.87.1
Summary: Opinionated CDK Bucket Deployment object pruner for maintaining N old versions
Home-page: https://github.com/kcwinner/cdk-bucket-deployment-expirator.git
Author: Ken Winner<kcswinner@gmail.com>
License: Apache-2.0
Project-URL: Source, https://github.com/kcwinner/cdk-bucket-deployment-expirator.git
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: JavaScript
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Typing :: Typed
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: aws-cdk.aws-iam (<2.0.0,>=1.87.1)
Requires-Dist: aws-cdk.aws-lambda-nodejs (<2.0.0,>=1.87.1)
Requires-Dist: aws-cdk.aws-lambda (<2.0.0,>=1.87.1)
Requires-Dist: aws-cdk.aws-s3-deployment (<2.0.0,>=1.87.1)
Requires-Dist: aws-cdk.aws-s3 (<2.0.0,>=1.87.1)
Requires-Dist: aws-cdk.core (<2.0.0,>=1.87.1)
Requires-Dist: constructs (<4.0.0,>=3.2.27)
Requires-Dist: jsii (<2.0.0,>=1.15.0)
Requires-Dist: publication (>=0.0.3)

# CDK Bucket Deployment Expirator

![build](https://github.com/kcwinner/cdk-bucket-deployment-expirator/workflows/Build/badge.svg)
[![codecov](https://codecov.io/gh/kcwinner/cdk-bucket-deployment-expirator/branch/main/graph/badge.svg)](https://codecov.io/gh/kcwinner/cdk-bucket-deployment-expirator)
[![dependencies Status](https://david-dm.org/kcwinner/cdk-bucket-deployment-expirator/status.svg)](https://david-dm.org/kcwinner/cdk-bucket-deployment-expirator)
[![npm](https://img.shields.io/npm/dt/cdk-bucket-deployment-expirator)](https://www.npmjs.com/package/cdk-bucket-deployment-expirator)

[![npm version](https://badge.fury.io/js/cdk-bucket-deployment-expirator.svg)](https://badge.fury.io/js/cdk-bucket-deployment-expirator)
[![PyPI version](https://badge.fury.io/py/cdk-bucket-deployment-expirator.svg)](https://badge.fury.io/py/cdk-bucket-deployment-expirator)

## Why This Package

I've been having issues with my React deployments to AWS S3 while using Cloudfront due to browsers caching and attempting to load chunks that were unavailable after using [CDK Bucket Deployment](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-s3-deployment-readme.html).

I had been using `prune: true` to clean up the bucket and this was causing all previous chunks to be deleted. However, the reality is we want to support N number of older chunks, just in case, and provide a mechanism for alerting the user that a new version is available (not part of this construct).

## Must Be Used With CDK Bucket Deployment

```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
from aws_cdk.aws_s3 import Bucket
from aws_cdk.aws_s3_deployment import BucketDeployment, Source

bucket = Bucket(self, "SourceBucket")
now = Date().get_time()

bucket_deployment = BucketDeployment(self, "deploy-spa",
    sources=[Source.asset("path/to/assets")],
    destination_bucket=bucket,
    metadata=UserDefinedObjectMetadata(deployed=now.to_string()),
    prune=False
)

BucketDeploymentExpirator(self, "expirator",
    bucket_deployment=bucket_deployment, # need this to add cfn depends on
    source_bucket=bucket
)
```

## Versioning

I will *attempt* to align the major and minor version of this package with [AWS CDK], but always check the release descriptions for compatibility.

This currently supports [![GitHub package.json dependency version (prod)](https://img.shields.io/github/package-json/dependency-version/kcwinner/cdk-bucket-deployment-expirator/@aws-cdk/core)](https://github.com/aws/aws-cdk)

## References

* [CDK Bucket Deployment](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-s3-deployment-readme.html)


