Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add more installation instructions #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 93 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ $ cat tmp/deploy-dist/index.json
"assets/dummy.css": "assets/dummy-d41d8cd98f00b204e9800998ecf8427e.css",
"assets/dummy.js": "assets/dummy-f1caa4785f44f7dc0ca9118458c120f8.js",
"assets/vendor.js": "assets/vendor-b3a3b580d0c1bf83382792291e35020b.js",
"assets/vendor.css": "assets/vendor-d41d8cd98f00b204e9800998ecf8427e.css",
"crossdomain.xml": "crossdomain.xml",
"robots.txt": "robots.txt"
"assets/vendor.css": "assets/vendor-d41d8cd98f00b204e9800998ecf8427e.css"
}
```

Expand All @@ -27,17 +25,38 @@ For more information on what plugins are and how they work, please refer to the

## Setup

- Requirements
### Requirements

You'll first have to [setup `ember-cli-deploy-s3-index`](https://github.com/ember-cli-deploy/ember-cli-deploy-s3-index#quick-start).
You'll first have to install and configure:

- Install this plugin
- [`ember-cli-deploy`](https://github.com/ember-cli-deploy/ember-cli-deploy)
- [`ember-cli-deploy-s3`](https://github.com/ember-cli-deploy/ember-cli-deploy-s3#quick-start)
- [`ember-cli-deploy-s3-index`](https://github.com/ember-cli-deploy/ember-cli-deploy-s3-index#quick-start)
- [`ember-cli-deploy-build`](https://github.com/ember-cli-deploy/ember-cli-deploy-build)
- [`ember-cli-deploy-revision-data`](https://github.com/ember-cli-deploy/ember-cli-deploy-revision-data)
- [`ember-cli-deploy-display-revisions`](https://github.com/duizendnegen/ember-cli-deploy-display-revisions)

You can do this like so:

```shell
ember install ember-cli-deploy
ember install ember-cli-deploy-s3
ember install ember-cli-deploy-s3-index
ember install ember-cli-deploy-build
ember install ember-cli-deploy-revision-data
ember install ember-cli-deploy-display-revisions
```

### Install this plugin

```bash
$ ember install ember-cli-deploy-index-json
```

- Configuration
### Configuration

When `ember install ember-cli-deploy` was run, it should have
generated a a file at `your-app/config/deploy.js`.

Edit `config/deploy.js` so that your configuration looks like the snippet below.

Expand All @@ -51,7 +70,61 @@ s3: {},
}
```

_In depth:_ The idea is that `revision-data`, `s3-index` and `index-json` have the same `filePattern` value. `index-json` is not present in this example because we're using its default `filePattern` value.
_In depth:_ The idea is that `revision-data`, `s3-index` and
`index-json` have the same `filePattern` value. `index-json` is not
present in this example because we're using its default `filePattern` value. More on this in the Ember CLI Deploy plugin section.

Here is a full example of this file, getting the Amazon S3 information
from unix environment variables.

```js
/* eslint-env node */
"use strict";

module.exports = function(deployTarget) {
let ENV = {
s3: {},
"revision-data": {
filePattern: "index.json"
},
"s3-index": {
filePattern: "index.json"
},
build: {}
};

if (deployTarget === "development") {
ENV.build.environment = "development";
// configure other plugins for development deploy target here
}

if (deployTarget === "staging") {
ENV.build.environment = "production";
// configure other plugins for staging deploy target here
}

if (deployTarget === "production") {
ENV.build.environment = "production";
// configure other plugins for production deploy target here
let s3Config = {
allowOverwrite: process.env.ALLOW_OVERWRITE === "true" ? true : false,
signatureVersion: "v4",
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
bucket: process.env.S3_BUCKET_URI,
region: process.env.S3_REGION
};

Object.assign(ENV.s3, s3Config);
Object.assign(ENV["s3-index"], s3Config);
}

// Note: if you need to build some configuration asynchronously, you can return
// a promise that resolves with the ENV object instead of returning the
// ENV object synchronously.
return ENV;
};
```

## Usage

Expand All @@ -77,6 +150,18 @@ For detailed information on what plugin hooks are and how they work, please refe

For detailed information on how configuration of plugins works, please refer to the [Plugin Documentation][1].

You have to edit `config/deploy.js` so that your configuration looks like the snippet below:

```js
'index-json': {
filePattern: '...',
fileIgnorePattern: '...',
indexPath: '...',
distDir: '...',
distFiles: []
}
```

### filePattern

Files matching this pattern will be included in the index.
Expand Down