# aeonian

> Continuous deployment to for S3->CloudFront setups

Latest version **1.2.3** (published 2020-05-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install aeonian
pnpm add aeonian
yarn add aeonian
bun add aeonian
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.3 |
| Published | 2020-05-13 |
| First published | 2017-06-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 352.5 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 43 |
| Author | Kevin Olson |
| Maintainers | acidjazz |

## Links

- npm: https://www.npmjs.com/package/aeonian
- Repository: https://github.com/acidjazz/aeonian
- Homepage: https://github.com/acidjazz/aeonian#readme
- Issues: https://github.com/acidjazz/aeonian/issues
- npm.io page: https://npm.io/package/aeonian

## Dependencies (10)

- [ora](https://npm.io/package/ora.md) ^3.0.0
- [mime](https://npm.io/package/mime.md) ^2.4.4
- [pend](https://npm.io/package/pend.md) ^1.2.0
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [rimraf](https://npm.io/package/rimraf.md) ^2.6.3
- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.415.0
- [findit2](https://npm.io/package/findit2.md) ^2.2.3
- [fd-slicer](https://npm.io/package/fd-slicer.md) ^1.1.0
- [streamsink](https://npm.io/package/streamsink.md) ^1.2.0
- [graceful-fs](https://npm.io/package/graceful-fs.md) ^4.2.0

## Recent versions

- 1.2.3 (latest) — 2020-05-13
- 1.2.0 — 2019-07-16
- 1.1.8 — 2019-07-11
- 1.1.7 — 2019-03-21
- 1.1.6 — 2019-03-21
- 1.1.5 — 2019-03-18
- 1.1.4 — 2019-03-05
- 1.1.3 — 2018-08-01
- 1.1.2 — 2018-08-01
- 1.1.1 — 2018-08-01
- 1.0.9 — 2017-07-01
- 1.0.8 — 2017-07-01
- 1.0.7 — 2017-06-29
- 1.0.6 — 2017-06-29
- 1.0.5 — 2017-06-25
- … 4 more at https://npm.io/package/aeonian/versions

## README

<p align="center">
  <img src="https://github.com/acidjazz/aeonian/raw/master/media/ae.png" alt="Aeonian Logo"/>
</p>

<h1 align="center"> æonian</h1>

<p align="center">
  <img src="https://github.com/acidjazz/aeonian/raw/master/media/automate.png"/>
  <img src="https://github.com/acidjazz/aeonian/raw/master/media/your.png"/>
  <img src="https://github.com/acidjazz/aeonian/raw/master/media/s3.png"/>
  <img src="https://github.com/acidjazz/aeonian/raw/master/media/plus.png"/>
  <img src="https://github.com/acidjazz/aeonian/raw/master/media/cf.png"/>
</p>

<p align="center">Continuous Deployment for your AWS S3 + CloudFront environments</p>

> still in early development

[![npm version](https://badge.fury.io/js/aeonian.svg)](https://badge.fury.io/js/aeonian)
[![GitHub issues](https://img.shields.io/github/issues/acidjazz/aeonian.svg)](https://github.com/acidjazz/aeonian/issues)
[![GitHub license](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://raw.githubusercontent.com/acidjazz/aeonian/master/license)
[![CircleCI](https://img.shields.io/circleci/project/github/acidjazz/aeonian.svg)](https://circleci.com/gh/acidjazz/aeonian/)
[![Join the chat at https://gitter.im/aws-aeonian/Lobby](https://badges.gitter.im/aws-aeonian/Lobby.svg)](https://gitter.im/aws-aeonian/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)


[![NPM](https://nodei.co/npm/aeonian.png)](https://nodei.co/npm/aeonian/)

I've built this to help supply a continuous delivery [git-flow](http://nvie.com/posts/a-successful-git-branching-model/) workflow hosted on an AWS serverless setup 

###  What does this do? 
Running `.deploy('{environment}')` will do the following:
1. Create a new S3 bucket `{prefix}-{commit-hash}-{environment}` based on the current repo and config
2. Upload the contents of a local directory you specified as `localDir` 
3. Configure the newly created bucket as a static website 
4. Change the origin of the CloudFront ID associated to point to our new bucket's website URL
5. Initiate an invalidation on `*` making the Distribution pull the new bucket's content
6. Delete the previous bucket that was assigned as the origin as to not leave a trail of buckets

### Example
Let's say you have a script `operations/aeonian.js` with the following
```javascript
require('aeonian').config({
  bucket: {
    localDir: './dist/',
    prefix: 'mysite-'
  },
  website: {
    index: 'index.html',
    error: 'error/index.html',
  },
  environments: {
    staging: 'CLOUDFRONT_ID',
    production: 'CLOUDFRONT_ID',
  }
}).deploy(process.argv[2])
```
Running `node operations/aeonian.js staging` this would result in
<p align="center">
 <img src="https://github.com/acidjazz/aeonian/raw/master/demo.gif" alt="Aeonian Demo"/>
</p>

Which would deploy `./dist/` to your S3+CF `staging` environment

### Installation

* Install the aeonian package
`npm install aeonian` or `yarn add aeonian`
* Set the current environment variables to your AWS key and secret for the [AWS JS SDK](https://aws.amazon.com/sdk-for-node-js/)
  * `AWS_ACCESS_KEY_ID`
  * `AWS_SECRET_ACCESS_KEY`
  * Other options on this step can be found [here](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-credentials-node.html)

### CircleCI Integration
This is mostly why aeonian exists, to deploy based on commits.  Based on the example above, lets say you have the above script `operations/aeonian.js` in your repo.  you could then add the following to your `package.json`
```javascript
"scripts": {
  ...
  "staging": "node operations/aeonian.js staging",
  "production": "node operations/aeonian.js production",
  ...
},
```
After setting your AWS credentials on CircleCi, you could add something like this to your `circle.yml`
```yaml
deployment:
  staging:
    branch: staging
    commands:
      - npm run staging
  production:
    branch: master
    commands:
      - npm run production
```
* Any commit/PR merge to the `staging` branch would deploy the `staging` environment
* Any commit/PR merge to the `master` branch would deploy the `production` environment

### Nuxt.js Integration
The main reason I built aeonian is for my all of my [Nuxt.js](https://nuxtjs.org/) projects. I have the following commands in my `package.json` that I have CircleCI run based on environment

```javascript
  "scripts": {
    ...
    "production": "yarn generate; node operations/aeonian.js production",
    "staging": "yarn generate; node operations/aeonian.js staging",
    ...
  },

```

---
_Source: https://npm.io/package/aeonian · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
