ember-cli-deploy-s3-index 4.0.1 → 4.0.3

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/.eslintrc.js CHANGED
@@ -1,7 +1,7 @@
1
1
  module.exports = {
2
2
  root: true,
3
3
  parserOptions: {
4
- ecmaVersion: 6,
4
+ ecmaVersion: 'latest',
5
5
  sourceType: 'module'
6
6
  },
7
7
  extends: 'eslint:recommended',
package/CHANGELOG.md CHANGED
@@ -2,6 +2,24 @@
2
2
 
3
3
 
4
4
 
5
+
6
+
7
+ ## 4.0.3 (2024-05-02)
8
+
9
+ #### :bug: Bug Fix
10
+ * [#143](https://github.com/ember-cli-deploy/ember-cli-deploy-s3-index/pull/143) Handle NotFound S3 Response ([@jrjohnson](https://github.com/jrjohnson))
11
+
12
+ #### Committers: 1
13
+ - Jon Johnson ([@jrjohnson](https://github.com/jrjohnson))
14
+
15
+ ## 4.0.2 (2024-04-05)
16
+
17
+ #### :bug: Bug Fix
18
+ * [#142](https://github.com/ember-cli-deploy/ember-cli-deploy-s3-index/pull/142) Handle empty s3 response ([@jrjohnson](https://github.com/jrjohnson))
19
+
20
+ #### Committers: 1
21
+ - Jon Johnson ([@jrjohnson](https://github.com/jrjohnson))
22
+
5
23
  ## 4.0.1 (2024-04-03)
6
24
 
7
25
  #### :rocket: Enhancement
package/lib/s3.js CHANGED
@@ -9,20 +9,15 @@ var readFile = RSVP.denodeify(fs.readFile);
9
9
  var mime = require('mime-types');
10
10
  var joinUriSegments = require('./util/join-uri-segments');
11
11
 
12
- function headObject(client, params) {
13
- return new RSVP.Promise(function(resolve, reject) {
14
- client.headObject(params, function(err, data) {
15
- if (err && err.code === 'NotFound') {
16
- return resolve();
17
- }
18
- else if (err) {
19
- return reject(err);
20
- }
21
- else {
22
- return resolve(data);
23
- }
24
- });
25
- });
12
+ async function headObject(client, params) {
13
+ try {
14
+ return await client.headObject(params);
15
+ } catch (err) {
16
+ if (err.name === 'NotFound') {
17
+ return;
18
+ }
19
+ throw err;
20
+ }
26
21
  }
27
22
 
28
23
  module.exports = CoreObject.extend({
@@ -37,7 +32,7 @@ module.exports = CoreObject.extend({
37
32
  this._plugin = plugin;
38
33
 
39
34
  var providedS3Client = plugin.readConfig("s3Client");
40
-
35
+
41
36
 
42
37
  if (profile && !providedS3Client) {
43
38
  this._plugin.log("Using AWS profile from config", { verbose: true });
@@ -45,18 +40,18 @@ module.exports = CoreObject.extend({
45
40
  }
46
41
 
47
42
  if (endpoint) {
48
- this._plugin.log('Using endpoint from config', { verbose: true });
43
+ this._plugin.log('Using endpoint from config', { verbose: true });
49
44
  }
50
45
 
51
46
  this._client = providedS3Client || new S3(config);
52
-
47
+
53
48
  if (endpoint) {
54
49
  this._client.config.endpoint = endpoint;
55
50
  }
56
51
  if (credentials) {
57
52
  this._client.config.credentials = credentials;
58
53
  }
59
-
54
+
60
55
  },
61
56
 
62
57
  upload: function(options) {
@@ -166,7 +161,7 @@ module.exports = CoreObject.extend({
166
161
  var revisionPrefix = joinUriSegments(prefix, options.filePattern + ":" + options.revisionKey);
167
162
 
168
163
  return listObjects({ Bucket: bucket, Prefix: revisionPrefix })
169
- .then((response) => response.Contents.find((element) => element.Key === revisionPrefix));
164
+ .then((response) => response.Contents?.find((element) => element.Key === revisionPrefix));
170
165
  },
171
166
 
172
167
  fetchRevisions: function(options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-cli-deploy-s3-index",
3
- "version": "4.0.1",
3
+ "version": "4.0.3",
4
4
  "description": "Ember CLI Deploy plugin to deploy ember-cli's bootstrap index file to S3.",
5
5
  "keywords": [
6
6
  "ember-addon",