Skip to content

Commit c8b6b87

Browse files
authored
Merge pull request #190 from ember-cli-deploy/aws-sdk-v3-take-2
Re-apply upgrade of aws-sdk in preparation for 5.0.0
2 parents 2772dd5 + f0ce421 commit c8b6b87

File tree

3 files changed

+1200
-182
lines changed

3 files changed

+1200
-182
lines changed

Diff for: lib/s3.js

+16-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@ var _ = require('lodash');
99
module.exports = CoreObject.extend({
1010
init: function(options) {
1111
this._super(options);
12-
var AWS = require('aws-sdk');
12+
13+
const {
14+
fromIni
15+
} = require('@aws-sdk/credential-providers');
16+
17+
const {
18+
S3
19+
} = require('@aws-sdk/client-s3');
20+
1321
var s3Options = {
1422
region: this.plugin.readConfig('region')
1523
};
@@ -38,8 +46,10 @@ module.exports = CoreObject.extend({
3846

3947
if (accessKeyId && secretAccessKey) {
4048
this.plugin.log('Using AWS access key id and secret access key from config', { verbose: true });
41-
s3Options.accessKeyId = accessKeyId;
42-
s3Options.secretAccessKey = secretAccessKey;
49+
s3Options.credentials = {
50+
accessKeyId: accessKeyId,
51+
secretAccessKey: secretAccessKey,
52+
};
4353
}
4454

4555
if (signatureVersion) {
@@ -54,15 +64,15 @@ module.exports = CoreObject.extend({
5464

5565
if (profile && !this.plugin.readConfig('s3Client')) {
5666
this.plugin.log('Using AWS profile from config', { verbose: true });
57-
AWS.config.credentials = new AWS.SharedIniFileCredentials({ profile: profile });
67+
s3Options.credentials = fromIni({ profile: profile });
5868
}
5969

6070
if (endpoint) {
6171
this.plugin.log('Using endpoint from config', { verbose: true });
62-
s3Options.endpoint = new AWS.Endpoint(endpoint);
72+
s3Options.endpoint = endpoint;
6373
}
6474

65-
this._client = this.plugin.readConfig('s3Client') || new AWS.S3(s3Options);
75+
this._client = this.plugin.readConfig('s3Client') || new S3(s3Options);
6676
},
6777

6878
upload: function(options) {

Diff for: package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"test": "node tests/runner.js && ./node_modules/.bin/eslint index.js lib/* tests/**/*-test.js"
1919
},
2020
"dependencies": {
21-
"aws-sdk": "^2.1354.0",
21+
"@aws-sdk/client-s3": "^3.525.0",
22+
"@aws-sdk/credential-providers": "^3.525.0",
2223
"chalk": "^4.1.0",
2324
"core-object": "^3.1.5",
2425
"ember-cli-deploy-plugin": "^0.2.9",

0 commit comments

Comments
 (0)