Skip to content

Commit d225379

Browse files
Hugo VieilledentGreatWizard
Hugo Vieilledent
authored andcommitted
docs: add more installation instructions
1 parent 8341efc commit d225379

File tree

1 file changed

+93
-8
lines changed

1 file changed

+93
-8
lines changed

README.md

+93-8
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ $ cat tmp/deploy-dist/index.json
1313
"assets/dummy.css": "assets/dummy-d41d8cd98f00b204e9800998ecf8427e.css",
1414
"assets/dummy.js": "assets/dummy-f1caa4785f44f7dc0ca9118458c120f8.js",
1515
"assets/vendor.js": "assets/vendor-b3a3b580d0c1bf83382792291e35020b.js",
16-
"assets/vendor.css": "assets/vendor-d41d8cd98f00b204e9800998ecf8427e.css",
17-
"crossdomain.xml": "crossdomain.xml",
18-
"robots.txt": "robots.txt"
16+
"assets/vendor.css": "assets/vendor-d41d8cd98f00b204e9800998ecf8427e.css"
1917
}
2018
```
2119

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

2826
## Setup
2927

30-
- Requirements
28+
### Requirements
3129

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

34-
- Install this plugin
32+
- [`ember-cli-deploy`](https://github.com/ember-cli-deploy/ember-cli-deploy)
33+
- [`ember-cli-deploy-s3`](https://github.com/ember-cli-deploy/ember-cli-deploy-s3#quick-start)
34+
- [`ember-cli-deploy-s3-index`](https://github.com/ember-cli-deploy/ember-cli-deploy-s3-index#quick-start)
35+
- [`ember-cli-deploy-build`](https://github.com/ember-cli-deploy/ember-cli-deploy-build)
36+
- [`ember-cli-deploy-revision-data`](https://github.com/ember-cli-deploy/ember-cli-deploy-revision-data)
37+
- [`ember-cli-deploy-display-revisions`](https://github.com/duizendnegen/ember-cli-deploy-display-revisions)
38+
39+
You can do this like so:
40+
41+
```shell
42+
ember install ember-cli-deploy
43+
ember install ember-cli-deploy-s3
44+
ember install ember-cli-deploy-s3-index
45+
ember install ember-cli-deploy-build
46+
ember install ember-cli-deploy-revision-data
47+
ember install ember-cli-deploy-display-revisions
48+
```
49+
50+
### Install this plugin
3551

3652
```bash
3753
$ ember install ember-cli-deploy-index-json
3854
```
3955

40-
- Configuration
56+
### Configuration
57+
58+
When `ember install ember-cli-deploy` was run, it should have
59+
generated a a file at `your-app/config/deploy.js`.
4160

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

@@ -51,7 +70,61 @@ s3: {},
5170
}
5271
```
5372

54-
_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.
73+
_In depth:_ The idea is that `revision-data`, `s3-index` and
74+
`index-json` have the same `filePattern` value. `index-json` is not
75+
present in this example because we're using its default `filePattern` value. More on this in the Ember CLI Deploy plugin section.
76+
77+
Here is a full example of this file, getting the Amazon S3 information
78+
from unix environment variables.
79+
80+
```js
81+
/* eslint-env node */
82+
"use strict";
83+
84+
module.exports = function(deployTarget) {
85+
let ENV = {
86+
s3: {},
87+
"revision-data": {
88+
filePattern: "index.json"
89+
},
90+
"s3-index": {
91+
filePattern: "index.json"
92+
},
93+
build: {}
94+
};
95+
96+
if (deployTarget === "development") {
97+
ENV.build.environment = "development";
98+
// configure other plugins for development deploy target here
99+
}
100+
101+
if (deployTarget === "staging") {
102+
ENV.build.environment = "production";
103+
// configure other plugins for staging deploy target here
104+
}
105+
106+
if (deployTarget === "production") {
107+
ENV.build.environment = "production";
108+
// configure other plugins for production deploy target here
109+
let s3Config = {
110+
allowOverwrite: process.env.ALLOW_OVERWRITE === "true" ? true : false,
111+
signatureVersion: "v4",
112+
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
113+
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
114+
bucket: process.env.S3_BUCKET_URI,
115+
region: process.env.S3_REGION
116+
};
117+
118+
Object.assign(ENV.s3, s3Config);
119+
Object.assign(ENV["s3-index"], s3Config);
120+
}
121+
122+
// Note: if you need to build some configuration asynchronously, you can return
123+
// a promise that resolves with the ENV object instead of returning the
124+
// ENV object synchronously.
125+
return ENV;
126+
};
127+
```
55128

56129
## Usage
57130

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

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

153+
You have to edit `config/deploy.js` so that your configuration looks like the snippet below:
154+
155+
```js
156+
'index-json': {
157+
filePattern: '...',
158+
fileIgnorePattern: '...',
159+
indexPath: '...',
160+
distDir: '...',
161+
distFiles: []
162+
}
163+
```
164+
80165
### filePattern
81166

82167
Files matching this pattern will be included in the index.

0 commit comments

Comments
 (0)