|
| 1 | +# @agentofuser/ipfs-deploy |
| 2 | + |
| 3 | +[](https://github.com/RichardLitt/standard-readme) |
| 4 | + |
| 5 | +> Pin directory locally, send hash to pinning service, and update dnslink. |
| 6 | +
|
| 7 | +## 🚨 WARNING: This is alpha software and very much in "quick hack that works for me" status. Use with caution. |
| 8 | + |
| 9 | +The goal of @agentofuser/ipfs-deploy is to make it as easy as possible to |
| 10 | +deploy a static website to IPFS. |
| 11 | + |
| 12 | +## Table of Contents |
| 13 | + |
| 14 | +- [Security](#security) |
| 15 | +- [Background](#background) |
| 16 | +- [Install](#install) |
| 17 | +- [Usage](#usage) |
| 18 | +- [API](#api) |
| 19 | +- [Contributing](#contributing) |
| 20 | +- [License](#license) |
| 21 | + |
| 22 | +## Security |
| 23 | + |
| 24 | +We use `dotenv` to handle credentials. Don't commit your `.env` file to source |
| 25 | +control. |
| 26 | + |
| 27 | +## Background |
| 28 | + |
| 29 | +So far, ipfs-deploy relies on [Pinata.cloud](https://pinata.cloud) as the |
| 30 | +pinning service and [Cloudflare](https://cloudflare.com) as the DNS provider |
| 31 | +and IPFS gateway. Hopefully those will be configurable in the future. |
| 32 | + |
| 33 | +Cloudflare doesn't host the content itself, so Pinata is needed if you don't |
| 34 | +want to rely on your computer's IPFS daemon's availability to serve your |
| 35 | +website. |
| 36 | + |
| 37 | +These are free services subject to their terms. Not a decentralization nirvana |
| 38 | +by any stretch of the imagination, but a nice way to get started quickly with a |
| 39 | +blog, static website, or frontend web app. |
| 40 | + |
| 41 | +If you use this to deploy your website, send a pull request and I'll add it to |
| 42 | +the README. |
| 43 | + |
| 44 | +### Any optional sections |
| 45 | + |
| 46 | +## Install |
| 47 | + |
| 48 | +``` |
| 49 | +npm install --save-dev @agentofuser/ipfs-deploy |
| 50 | +``` |
| 51 | + |
| 52 | +## Usage |
| 53 | + |
| 54 | +I won't go over how to set up Pinata and Cloudflare right now, but you can read |
| 55 | +up on that over at: |
| 56 | + |
| 57 | +https://www.cloudflare.com/distributed-web-gateway/ |
| 58 | + |
| 59 | +and: |
| 60 | + |
| 61 | +https://pinata.cloud/documentation#GettingStarted |
| 62 | + |
| 63 | +Then copy over `.env.sample` to `.env` and fill out your credentials: |
| 64 | + |
| 65 | +``` |
| 66 | +PINATA_API_KEY= |
| 67 | +PINATA_SECRET_API_KEY= |
| 68 | +SITE_DOMAIN= |
| 69 | +CF_API_KEY= |
| 70 | +CF_API_EMAIL= |
| 71 | +``` |
| 72 | + |
| 73 | +(**Don't** commit it!) |
| 74 | + |
| 75 | +``` |
| 76 | +$ echo '.env' >> .gitignore |
| 77 | +``` |
| 78 | + |
| 79 | +Put this somewhere in a `deploy.js` file: |
| 80 | + |
| 81 | +``` |
| 82 | +const ipfsDeploy = require(@agentofuser/ipfs-deploy) |
| 83 | +ipfsDeploy() |
| 84 | +``` |
| 85 | + |
| 86 | +Add a deploy command to your `package.json`: |
| 87 | + |
| 88 | +```javascript |
| 89 | +// ⋮ |
| 90 | + "scripts": { |
| 91 | +// ⋮ |
| 92 | + "deploy": "node ./ipfs-deploy.js", |
| 93 | +// ⋮ |
| 94 | + } |
| 95 | +// ⋮ |
| 96 | +``` |
| 97 | + |
| 98 | +## Contributing |
| 99 | + |
| 100 | +PRs accepted. |
| 101 | + |
| 102 | +Small note: If editing the Readme, please conform to the |
| 103 | +[standard-readme](https://github.com/RichardLitt/standard-readme) |
| 104 | +specification. |
| 105 | + |
| 106 | +## License |
| 107 | + |
| 108 | +[BlueOak-1.0.0 OR BSD-2-Clause-Patent © Agent of User](./LICENSE.md) |
| 109 | + |
| 110 | +(These are the most permissive possible ever.) |
0 commit comments