# webpack-s3

> webpack S3 scripts

Latest version **2019.8.15** (published 2019-08-15) · Unlicense license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install webpack-s3
pnpm add webpack-s3
yarn add webpack-s3
bun add webpack-s3
```

Provides the commands `webpack-s3`, `webpack-s3-upload`, `webpack-s3-download`, `webpack-s3-create-bucket`, `webpack-s3-create-read-only-env`, `webpack-s3-create-full-access-env`.

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2019.8.15 |
| Published | 2019-08-15 |
| First published | 2019-08-10 |
| Weekly downloads | 0 |
| License | Unlicense |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | andrewp-as-is |
| Keywords | webpack, s3 |

## Links

- npm: https://www.npmjs.com/package/webpack-s3
- Homepage: https://github.com/andrewp-as-is/webpack-s3
- npm.io page: https://npm.io/package/webpack-s3

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 2019.8.15 (latest) — 2019-08-15
- 2019.8.11 — 2019-08-10
- 2019.8.10 — 2019-08-10
- 2019.8.8 — 2019-08-10

## README

<!--
https://pypi.org/project/readme-generator/
https://pypi.org/project/python-readme-generator/
-->

[![](https://img.shields.io/badge/OS-Unix-blue.svg?longCache=True)]()

<b>webpack S3 scripts</b>

#### Installation
```bash
$ [sudo] npm i -g webpack-s3
```

#### Pros
+   store webpack build/etc files on S3

#### How it works
`webpack/` hard-coded folder

scripts:
+   create full-access/read-only user and credentials
+   upload/download `webpack/`

hard-coded environment variables names:
+   `AWS_S3_WEBPACK_BUCKET`
+   `AWS_S3_WEBPACK_USER`
+   `AWS_S3_WEBPACK_ACCESS_KEY_ID`
+   `AWS_S3_WEBPACK_SECRET_ACCESS_KEY`

webpack prod config:
```javascript
const output = {
  path: path.resolve('./webpack'),
  filename: "[name]-[hash].js",
  publicPath: 'https://'+process.env.AWS_S3_WEBPACK_BUCKET+'.s3.amazonaws.com/'
}
```

#### Scripts usage
command|`usage`
-|-
`webpack-s3` |`usage: webpack-s3 command [args]`
`webpack-s3-create-bucket` |`usage: webpack-s3-create-bucket bucket`
`webpack-s3-create-full-access-env` |`usage: webpack-s3-create-full-access-env bucket`
`webpack-s3-create-read-only-env` |`usage: webpack-s3-create-read-only-env bucket`
`webpack-s3-download` |`usage: webpack-s3-download`
`webpack-s3-upload` |`usage: webpack-s3-upload`

#### Examples
`Makefile`, create env
```bash
WEBPACK_BUCKET:=BUCKET_NAME
all:
    test -s .env.s3.webpack || webpack-s3-create-full-access-env $(WEBPACK_BUCKET) > .env.s3.webpack
    test -s .env.prod.webpack || webpack-s3-create-read-only-env $(WEBPACK_BUCKET) > .env.prod.webpack
```

build and upload to S3 
```bash
set -o allexport
. .env.s3.webpack || exit

webpack --config webpack.config.prod.js || exit
webpack-s3-upload
```

##### optional: deploy webpack files to server

`Dockerfile` 
```Dockerfile
ENTRYPOINT ["/bin/sh","/entrypoint.sh"]
```

`entrypoint.sh`
```bash
webpack-s3-download
...
```

`ansible-playbook.yml`
```yml
...
  tasks:
  - name: task_name
    docker_container:
      ...
      env_file: ".env"
```

<p align="center">
    <a href="https://pypi.org/project/python-readme-generator/">python-readme-generator</a>
</p>

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