# `@linked-helper/framework.build-tools.aws-artifacts`

Upload/download package artifacts to AWS

## Cli
`npx aws-artifacts`

## Usage

### Configuration

In `package.json` add section `aws-artifacts`

```
"aws-artifacts": {
    "credentials": {
        "accessKeyId": "AKIA...",
        "secretAccessKey": "Dw+Y..."
    },
    "region": "eu-west-1",
    "bucket": "bucket-for-tests",
    "prefix": "",
    // list files to upload/download
    "root": "",
    "files": "dist/*.zip"
}
```

* `credentials` - AWS access credentials
* `region`, `bucket` - target bucket
* `prefix` - optional prefix path for artifacts in bucket, by default is set to `packageName/packageVersion/`
* `root` - `cwd` for listed files (all relative paths for files will be preserved), by default is set to directory of `package.json`
* `files` - files to upload

### Download artifacts when package is installed as dep

Add to `package.json` in `scripts` section:

```
"postinstall": "npx --package=@linked-helper/framework.build-tools.aws-artifacts aws-artifacts postinstall"
```

### Upload artifacts after building

if `electron-builder` is used:
```
"build": {
    ...
    // upload artifacts
    "afterAllArtifactBuild": "@linked-helper/framework.build-tools.aws-artifacts/dist/afterAllArtifactBuild",
    ...
}
```

or just exec `npx aws-artifacts upload` after building

to see all options: `npx aws-artifacts --help`
