ember-cli-deploy-s3-index 1.3.1 → 4.0.0-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yaml +40 -0
- package/CHANGELOG.md +21 -0
- package/README.md +19 -3
- package/RELEASE.md +60 -0
- package/index.js +25 -1
- package/lib/s3.js +44 -18
- package/package.json +30 -20
- package/bin/changelog +0 -84
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: Continuous Integration
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
test:
|
|
9
|
+
name: Test
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
strategy:
|
|
12
|
+
matrix:
|
|
13
|
+
node-version: [14.x, 16.x, 18.x, 20.x]
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v2
|
|
16
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
17
|
+
uses: actions/setup-node@v2
|
|
18
|
+
with:
|
|
19
|
+
node-version: ${{ matrix.node-version }}
|
|
20
|
+
cache: 'yarn'
|
|
21
|
+
- run: yarn install
|
|
22
|
+
- run: yarn test
|
|
23
|
+
|
|
24
|
+
test-floating:
|
|
25
|
+
name: Floating Dependencies
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
strategy:
|
|
28
|
+
matrix:
|
|
29
|
+
node-version: [14.x, 16.x, 18.x, 20.x]
|
|
30
|
+
steps:
|
|
31
|
+
- uses: actions/checkout@v2
|
|
32
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
33
|
+
uses: actions/setup-node@v2
|
|
34
|
+
with:
|
|
35
|
+
node-version: ${{ matrix.node-version }}
|
|
36
|
+
cache: 'yarn'
|
|
37
|
+
- name: install dependencies
|
|
38
|
+
run: yarn install --no-lockfile
|
|
39
|
+
- name: test
|
|
40
|
+
run: yarn test
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
## 4.0.0-0 (2023-08-28)
|
|
5
|
+
|
|
6
|
+
## 3.0.0 (2023-05-16)
|
|
7
|
+
|
|
8
|
+
#### :boom: Breaking Change
|
|
9
|
+
* [#133](https://github.com/ember-cli-deploy/ember-cli-deploy-s3-index/pull/133) Update node version requirements and dependencies ([@lukemelia](https://github.com/lukemelia))
|
|
10
|
+
* [#113](https://github.com/ember-cli-deploy/ember-cli-deploy-s3-index/pull/113) [breaking] Switch to Github Actions for CI ([@jrjohnson](https://github.com/jrjohnson))
|
|
11
|
+
|
|
12
|
+
#### :rocket: Enhancement
|
|
13
|
+
* [#130](https://github.com/ember-cli-deploy/ember-cli-deploy-s3-index/pull/130) Add support for didDeployMessage ([@jkeen](https://github.com/jkeen))
|
|
14
|
+
* [#119](https://github.com/ember-cli-deploy/ember-cli-deploy-s3-index/pull/119) Optimise activation speed ([@vitch](https://github.com/vitch))
|
|
15
|
+
|
|
16
|
+
#### Committers: 4
|
|
17
|
+
- Jeff Keen ([@jkeen](https://github.com/jkeen))
|
|
18
|
+
- Jon Johnson ([@jrjohnson](https://github.com/jrjohnson))
|
|
19
|
+
- Kelvin Luck ([@vitch](https://github.com/vitch))
|
|
20
|
+
- Luke Melia ([@lukemelia](https://github.com/lukemelia))
|
|
21
|
+
|
|
22
|
+
## 2.0.0 There was no 2.0
|
|
23
|
+
|
|
3
24
|
## [v1.0.1](https://github.com/ember-cli-deploy/ember-cli-deploy-s3-index/tree/v1.0.1)
|
|
4
25
|
[Full Changelog](https://github.com/ember-cli-deploy/ember-cli-deploy-s3-index/compare/v1.0.0...v1.0.1)
|
|
5
26
|
|
package/README.md
CHANGED
|
@@ -140,9 +140,9 @@ A flag to specify whether the revision should be overwritten if it already exist
|
|
|
140
140
|
|
|
141
141
|
The underlying S3 library used to upload the files to S3. This allows the user to use the default upload client provided by this plugin but switch out the underlying library that is used to actually send the files.
|
|
142
142
|
|
|
143
|
-
The client specified MUST implement functions called `getObject` and `putObject`.
|
|
143
|
+
The client specified MUST implement functions called `getObject` and `putObject`. See [Using V2 API] (https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/welcome.html#using_v2_commands).
|
|
144
144
|
|
|
145
|
-
*Default:* the default S3 library is
|
|
145
|
+
*Default:* the default S3 library is `@aws-sdk/s3-client` (AWS JS SDK v3). Please use this addon version < 3.0.0 if you want to use AWS JS SDK 2.0
|
|
146
146
|
|
|
147
147
|
### endpoint
|
|
148
148
|
|
|
@@ -170,6 +170,22 @@ If you are using DigitalOcean spaces you need to set this setting to `false`.
|
|
|
170
170
|
|
|
171
171
|
*Default:* `true`
|
|
172
172
|
|
|
173
|
+
### didDeployMessage
|
|
174
|
+
|
|
175
|
+
A message that will be displayed after the index file has been successfully uploaded to S3. By default this message will only display if the revision for `revisionData.revisionKey` of the deployment context has been activated.
|
|
176
|
+
|
|
177
|
+
*Default:*
|
|
178
|
+
|
|
179
|
+
```javascript
|
|
180
|
+
if (context.revisionData.revisionKey && !context.revisionData.activatedRevisionKey) {
|
|
181
|
+
return "Deployed but did not activate revision " + context.revisionData.revisionKey + ". "
|
|
182
|
+
+ "To activate, run: "
|
|
183
|
+
+ "ember deploy:activate " + context.revisionData.revisionKey + " --environment=" + context.deployEnvironment + "\n";
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
173
189
|
### How do I activate a revision?
|
|
174
190
|
|
|
175
191
|
A user can activate a revision by either:
|
|
@@ -318,4 +334,4 @@ If you'd like to be able to preview a deployed revision before activation, you'l
|
|
|
318
334
|
[4]: https://github.com/ember-cli-deploy/ember-cli-deploy-build "ember-cli-deploy-build"
|
|
319
335
|
[5]: https://github.com/ember-cli/ember-cli-deploy "ember-cli-deploy"
|
|
320
336
|
[6]: https://github.com/ember-cli-deploy/ember-cli-deploy-revision-data "ember-cli-deploy-revision-data"
|
|
321
|
-
[7]: https://docs.aws.amazon.com/
|
|
337
|
+
[7]: https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/loading-node-credentials-shared.html "Setting AWS Credentials"
|
package/RELEASE.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Release Process
|
|
2
|
+
|
|
3
|
+
Releases are mostly automated using
|
|
4
|
+
[release-it](https://github.com/release-it/release-it/) and
|
|
5
|
+
[lerna-changelog](https://github.com/lerna/lerna-changelog/).
|
|
6
|
+
|
|
7
|
+
## Preparation
|
|
8
|
+
|
|
9
|
+
Since the majority of the actual release process is automated, the primary
|
|
10
|
+
remaining task prior to releasing is confirming that all pull requests that
|
|
11
|
+
have been merged since the last release have been labeled with the appropriate
|
|
12
|
+
`lerna-changelog` labels and the titles have been updated to ensure they
|
|
13
|
+
represent something that would make sense to our users. Some great information
|
|
14
|
+
on why this is important can be found at
|
|
15
|
+
[keepachangelog.com](https://keepachangelog.com/en/1.0.0/), but the overall
|
|
16
|
+
guiding principle here is that changelogs are for humans, not machines.
|
|
17
|
+
|
|
18
|
+
When reviewing merged PR's the labels to be used are:
|
|
19
|
+
|
|
20
|
+
* breaking - Used when the PR is considered a breaking change.
|
|
21
|
+
* enhancement - Used when the PR adds a new feature or enhancement.
|
|
22
|
+
* bug - Used when the PR fixes a bug included in a previous release.
|
|
23
|
+
* documentation - Used when the PR adds or updates documentation.
|
|
24
|
+
* internal - Used for internal changes that still require a mention in the
|
|
25
|
+
changelog/release notes.
|
|
26
|
+
|
|
27
|
+
## Release
|
|
28
|
+
|
|
29
|
+
Once the prep work is completed, the actual release is straight forward:
|
|
30
|
+
|
|
31
|
+
* First, ensure that you have installed your projects dependencies:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
yarn install
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
* Second, ensure that you have obtained a
|
|
38
|
+
[GitHub personal access token][generate-token] with the `repo` scope (no
|
|
39
|
+
other permissions are needed). Make sure the token is available as the
|
|
40
|
+
`GITHUB_AUTH` environment variable.
|
|
41
|
+
|
|
42
|
+
For instance:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
export GITHUB_AUTH=abc123def456
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
[generate-token]: https://github.com/settings/tokens/new?scopes=repo&description=GITHUB_AUTH+env+variable
|
|
49
|
+
|
|
50
|
+
* And last (but not least 😁) do your release.
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
npx release-it
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
[release-it](https://github.com/release-it/release-it/) manages the actual
|
|
57
|
+
release process. It will prompt you to to choose the version number after which
|
|
58
|
+
you will have the chance to hand tweak the changelog to be used (for the
|
|
59
|
+
`CHANGELOG.md` and GitHub release), then `release-it` continues on to tagging,
|
|
60
|
+
pushing the tag and commits, etc.
|
package/index.js
CHANGED
|
@@ -34,6 +34,15 @@ module.exports = {
|
|
|
34
34
|
brotliCompressedFiles: function(context) {
|
|
35
35
|
return context.brotliCompressedFiles || [];
|
|
36
36
|
},
|
|
37
|
+
didDeployMessage: function(context){
|
|
38
|
+
var revisionKey = context.revisionData && context.revisionData.revisionKey;
|
|
39
|
+
var activatedRevisionKey = context.revisionData && context.revisionData.activatedRevisionKey;
|
|
40
|
+
if (revisionKey && !activatedRevisionKey) {
|
|
41
|
+
return "Deployed but did not activate revision " + revisionKey + ". "
|
|
42
|
+
+ "To activate, run: "
|
|
43
|
+
+ "ember deploy:activate " + context.deployTarget + " --revision=" + revisionKey + "\n";
|
|
44
|
+
}
|
|
45
|
+
},
|
|
37
46
|
allowOverwrite: false
|
|
38
47
|
},
|
|
39
48
|
|
|
@@ -103,7 +112,22 @@ module.exports = {
|
|
|
103
112
|
this.log('preparing to activate `' + revisionKey + '`', { verbose: true });
|
|
104
113
|
|
|
105
114
|
var s3 = new this.S3({ plugin: this });
|
|
106
|
-
return s3.activate(options)
|
|
115
|
+
return s3.activate(options).then(() => {
|
|
116
|
+
this.log(`✔ Activated revision \`${revisionKey}\``, {});
|
|
117
|
+
|
|
118
|
+
return {
|
|
119
|
+
revisionData: {
|
|
120
|
+
activatedRevisionKey: revisionKey
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
didDeploy: function(/* context */){
|
|
127
|
+
var didDeployMessage = this.readConfig('didDeployMessage');
|
|
128
|
+
if (didDeployMessage) {
|
|
129
|
+
this.log(didDeployMessage);
|
|
130
|
+
}
|
|
107
131
|
},
|
|
108
132
|
|
|
109
133
|
fetchRevisions: function(context) {
|
package/lib/s3.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var { fromIni } = require('@aws-sdk/credential-providers');
|
|
4
|
+
var { S3 } = require('@aws-sdk/client-s3');
|
|
4
5
|
var CoreObject = require('core-object');
|
|
5
6
|
var RSVP = require('rsvp');
|
|
6
7
|
var fs = require('fs');
|
|
@@ -31,20 +32,31 @@ module.exports = CoreObject.extend({
|
|
|
31
32
|
var config = plugin.pluginConfig;
|
|
32
33
|
var profile = plugin.readConfig('profile');
|
|
33
34
|
var endpoint = plugin.readConfig('endpoint');
|
|
35
|
+
var credentials;
|
|
34
36
|
|
|
35
37
|
this._plugin = plugin;
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
var providedS3Client = plugin.readConfig("s3Client");
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
if (profile && !providedS3Client) {
|
|
43
|
+
this._plugin.log("Using AWS profile from config", { verbose: true });
|
|
44
|
+
credentials = fromIni({ profile: profile });
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
if (endpoint) {
|
|
43
|
-
this._plugin.log('Using endpoint from config', { verbose: true });
|
|
44
|
-
AWS.config.endpoint = new AWS.Endpoint(endpoint);
|
|
48
|
+
this._plugin.log('Using endpoint from config', { verbose: true });
|
|
45
49
|
}
|
|
46
50
|
|
|
47
|
-
this._client =
|
|
51
|
+
this._client = providedS3Client || new S3(config);
|
|
52
|
+
|
|
53
|
+
if (endpoint) {
|
|
54
|
+
this._client.config.endpoint = endpoint;
|
|
55
|
+
}
|
|
56
|
+
if (credentials) {
|
|
57
|
+
this._client.config.credentials = credentials;
|
|
58
|
+
}
|
|
59
|
+
|
|
48
60
|
},
|
|
49
61
|
|
|
50
62
|
upload: function(options) {
|
|
@@ -62,6 +74,7 @@ module.exports = CoreObject.extend({
|
|
|
62
74
|
var isGzipped = gzippedFilePaths.indexOf(options.filePattern) !== -1;
|
|
63
75
|
var isBrotliCompressed = brotliCompressedFilePaths.indexOf(options.filePattern) !== -1;
|
|
64
76
|
var serverSideEncryption = options.serverSideEncryption;
|
|
77
|
+
var checkForOverwrite = RSVP.resolve();
|
|
65
78
|
|
|
66
79
|
var params = {
|
|
67
80
|
Bucket: bucket,
|
|
@@ -83,14 +96,17 @@ module.exports = CoreObject.extend({
|
|
|
83
96
|
params.ContentEncoding = 'br';
|
|
84
97
|
}
|
|
85
98
|
|
|
86
|
-
|
|
87
|
-
.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
99
|
+
if (!allowOverwrite) {
|
|
100
|
+
checkForOverwrite = this.findRevision(options)
|
|
101
|
+
.then(function(found) {
|
|
102
|
+
if (found !== undefined) {
|
|
103
|
+
return RSVP.reject("REVISION ALREADY UPLOADED! (set `allowOverwrite: true` if you want to support overwriting revisions)");
|
|
104
|
+
}
|
|
105
|
+
return RSVP.resolve();
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return checkForOverwrite
|
|
94
110
|
.then(readFile.bind(this, options.filePath))
|
|
95
111
|
.then(function(fileContents) {
|
|
96
112
|
params.Body = fileContents;
|
|
@@ -131,9 +147,8 @@ module.exports = CoreObject.extend({
|
|
|
131
147
|
params.ServerSideEncryption = serverSideEncryption;
|
|
132
148
|
}
|
|
133
149
|
|
|
134
|
-
return this.
|
|
135
|
-
|
|
136
|
-
if (found >= 0) {
|
|
150
|
+
return this.findRevision(options).then(function(found) {
|
|
151
|
+
if (found !== undefined) {
|
|
137
152
|
return copyObject(params).then(function() {
|
|
138
153
|
plugin.log('✔ ' + revisionKey + " => " + indexKey);
|
|
139
154
|
});
|
|
@@ -143,6 +158,17 @@ module.exports = CoreObject.extend({
|
|
|
143
158
|
});
|
|
144
159
|
},
|
|
145
160
|
|
|
161
|
+
findRevision: function(options) {
|
|
162
|
+
var client = this._client;
|
|
163
|
+
var listObjects = RSVP.denodeify(client.listObjects.bind(client));
|
|
164
|
+
var bucket = options.bucket;
|
|
165
|
+
var prefix = options.prefix;
|
|
166
|
+
var revisionPrefix = joinUriSegments(prefix, options.filePattern + ":" + options.revisionKey);
|
|
167
|
+
|
|
168
|
+
return listObjects({ Bucket: bucket, Prefix: revisionPrefix })
|
|
169
|
+
.then((response) => response.Contents.find((element) => element.Key === revisionPrefix));
|
|
170
|
+
},
|
|
171
|
+
|
|
146
172
|
fetchRevisions: function(options) {
|
|
147
173
|
var client = this._client;
|
|
148
174
|
var bucket = options.bucket;
|
package/package.json
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-cli-deploy-s3-index",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-0",
|
|
4
4
|
"description": "Ember CLI Deploy plugin to deploy ember-cli's bootstrap index file to S3.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ember-addon",
|
|
7
|
+
"ember-cli-deploy-plugin"
|
|
8
|
+
],
|
|
9
|
+
"repository": "https://github.com/ember-cli-deploy/ember-cli-deploy-s3-index",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"author": "",
|
|
5
12
|
"directories": {
|
|
6
13
|
"doc": "doc",
|
|
7
14
|
"test": "tests"
|
|
@@ -10,40 +17,43 @@
|
|
|
10
17
|
"release": "release-it",
|
|
11
18
|
"test": "node tests/runner.js && ./node_modules/.bin/eslint index.js lib/* tests/**/*.js"
|
|
12
19
|
},
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
"
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@aws-sdk/client-s3": "^3.385.0",
|
|
22
|
+
"@aws-sdk/credential-providers": "^3.391.0",
|
|
23
|
+
"core-object": "^3.0.0",
|
|
24
|
+
"ember-cli-deploy-plugin": "^0.2.9",
|
|
25
|
+
"mime-types": "^2.1.27",
|
|
26
|
+
"rsvp": "^4.8.5"
|
|
16
27
|
},
|
|
17
|
-
"author": "",
|
|
18
|
-
"license": "MIT",
|
|
19
28
|
"devDependencies": {
|
|
20
|
-
"github": "^0.2.4",
|
|
21
29
|
"chai": "^4.2.0",
|
|
22
30
|
"chai-as-promised": "^7.1.1",
|
|
23
31
|
"ember-cli": "~3.18.0",
|
|
24
32
|
"eslint": "^7.0.0",
|
|
25
33
|
"glob": "^7.1.6",
|
|
26
34
|
"mocha": "^7.1.2",
|
|
27
|
-
"release-it": "
|
|
35
|
+
"release-it": "^14.2.1",
|
|
36
|
+
"release-it-lerna-changelog": "^3.1.0"
|
|
28
37
|
},
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"aws-sdk": "^2.667.0",
|
|
35
|
-
"core-object": "^3.0.0",
|
|
36
|
-
"ember-cli-deploy-plugin": "^0.2.9",
|
|
37
|
-
"mime-types": "^2.1.27",
|
|
38
|
-
"rsvp": "^4.8.5"
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": "14.* || 16.* || 18.* || >= 20"
|
|
40
|
+
},
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"registry": "https://registry.npmjs.org"
|
|
39
43
|
},
|
|
40
44
|
"release-it": {
|
|
41
45
|
"git": {
|
|
42
|
-
"changelog": "./bin/changelog",
|
|
43
46
|
"requireCleanWorkingDir": false
|
|
44
47
|
},
|
|
45
48
|
"github": {
|
|
46
|
-
"release": true
|
|
49
|
+
"release": true,
|
|
50
|
+
"tokenRef": "GITHUB_AUTH"
|
|
51
|
+
},
|
|
52
|
+
"plugins": {
|
|
53
|
+
"release-it-lerna-changelog": {
|
|
54
|
+
"infile": "CHANGELOG.md",
|
|
55
|
+
"launchEditor": true
|
|
56
|
+
}
|
|
47
57
|
}
|
|
48
58
|
}
|
|
49
59
|
}
|
package/bin/changelog
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
/*
|
|
5
|
-
* This script generates the template a changelog by comparing a current version
|
|
6
|
-
* with master. Run this, copy what's logged into the `CHANGELOG.md` and update
|
|
7
|
-
* the top section based on the changes listed in "Community Contributions"
|
|
8
|
-
*
|
|
9
|
-
* Usage:
|
|
10
|
-
*
|
|
11
|
-
* bin/changelog
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
var EOL = require('os').EOL;
|
|
15
|
-
var RSVP = require('rsvp');
|
|
16
|
-
var GitHubApi = require('github');
|
|
17
|
-
|
|
18
|
-
var github = new GitHubApi({version: '3.0.0'});
|
|
19
|
-
var compareCommits = RSVP.denodeify(github.repos.compareCommits);
|
|
20
|
-
var currentVersion = 'v' + require('../package').version;
|
|
21
|
-
|
|
22
|
-
var user = 'ember-cli-deploy';
|
|
23
|
-
|
|
24
|
-
var repo = 'ember-cli-deploy-s3-index';
|
|
25
|
-
compareCommits({
|
|
26
|
-
user: user,
|
|
27
|
-
repo: repo,
|
|
28
|
-
base: currentVersion,
|
|
29
|
-
head: 'master'
|
|
30
|
-
}).then(function(res) {
|
|
31
|
-
return res.commits.map(function(commitInfo) {
|
|
32
|
-
return commitInfo.commit.message
|
|
33
|
-
|
|
34
|
-
}).filter(function(message) {
|
|
35
|
-
return message.indexOf('Merge pull request #') > -1;
|
|
36
|
-
|
|
37
|
-
}).map(function(message) {
|
|
38
|
-
var numAndAuthor = message.match(/#(\d+) from (.*)\//).slice(1,3);
|
|
39
|
-
var title = message.split('\n\n')[1];
|
|
40
|
-
|
|
41
|
-
return {
|
|
42
|
-
number: +numAndAuthor[0],
|
|
43
|
-
author: numAndAuthor[1],
|
|
44
|
-
title: title
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
}).sort(function(a, b) {
|
|
48
|
-
return a.number > b.number;
|
|
49
|
-
}).map(function(pr) {
|
|
50
|
-
var link = '[#' + pr.number + ']' +
|
|
51
|
-
'(https://github.com/' + user + '/' + repo + '/pull/' + pr.number + ')';
|
|
52
|
-
var title = pr.title;
|
|
53
|
-
var author = '[@' + pr.author + ']' +
|
|
54
|
-
'(https://github.com/' + pr.author +')';
|
|
55
|
-
|
|
56
|
-
return '- ' + link + ' ' + title + ' ' + author;
|
|
57
|
-
|
|
58
|
-
}).join('\n');
|
|
59
|
-
|
|
60
|
-
}).then(function(contributions) {
|
|
61
|
-
var changelog = generateChangelog(contributions);
|
|
62
|
-
|
|
63
|
-
console.log(changelog);
|
|
64
|
-
}).catch(function(err) {
|
|
65
|
-
console.error(err);
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
function generateChangelog(contributions) {
|
|
69
|
-
var header = `
|
|
70
|
-
The following changes are required if you are upgrading from the previous
|
|
71
|
-
version:
|
|
72
|
-
- Users
|
|
73
|
-
+ Upgrade your project's ember-cli version - [docs](http://www.ember-cli.com/#project-update)
|
|
74
|
-
- Addon Developers
|
|
75
|
-
+ No changes required
|
|
76
|
-
- Core Contributors
|
|
77
|
-
+ No changes required
|
|
78
|
-
#### Community Contributions
|
|
79
|
-
`;
|
|
80
|
-
|
|
81
|
-
var footer = 'Thank you to all who took the time to contribute!';
|
|
82
|
-
|
|
83
|
-
return header + EOL + EOL + contributions + EOL + EOL + footer;
|
|
84
|
-
}
|