aws-architect 6.6.49 → 6.7.51
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/CHANGELOG.md +2 -0
- package/index.d.ts +0 -1
- package/index.js +1 -1
- package/lib/BucketManager.js +7 -17
- package/package.json +1 -1
- package/lib/appRedirect.html +0 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Change log
|
|
2
2
|
This is the changelog for [AWS Architect](readme.md).
|
|
3
3
|
|
|
4
|
+
## 6.7 ##
|
|
5
|
+
* Fix handlers for /route and /route/ so that the index.html is always duplicated.
|
|
4
6
|
## 6.6 ##
|
|
5
7
|
* Add support to `deleteWebsiteVersion(version)`
|
|
6
8
|
* Fix `The function must be in an Active state. The current state for function arn:aws:lambda:Function:514 is Pending`.
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -226,7 +226,7 @@ AwsArchitect.prototype.publishWebsite = AwsArchitect.prototype.PublishWebsite =
|
|
|
226
226
|
if (!this.BucketManager.Bucket) { throw new Error('Bucket in content options has not been defined.'); }
|
|
227
227
|
if (!this.ContentOptions.contentDirectory) { throw new Error('Content directory is not defined.'); }
|
|
228
228
|
|
|
229
|
-
return this.BucketManager.Deploy(this.ContentOptions.contentDirectory, version, options.cacheControlRegexMap || [], options.contentTypeMappingOverride
|
|
229
|
+
return this.BucketManager.Deploy(this.ContentOptions.contentDirectory, version, options.cacheControlRegexMap || [], options.contentTypeMappingOverride);
|
|
230
230
|
};
|
|
231
231
|
|
|
232
232
|
AwsArchitect.prototype.deleteWebsiteVersion = function(version) {
|
package/lib/BucketManager.js
CHANGED
|
@@ -27,7 +27,7 @@ class BucketManager {
|
|
|
27
27
|
}));
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
async Deploy(contentPath, rawVersion, cacheControlRegexMap = [], contentTypeMappingOverride = {}
|
|
30
|
+
async Deploy(contentPath, rawVersion, cacheControlRegexMap = [], contentTypeMappingOverride = {}) {
|
|
31
31
|
const version = rawVersion || '';
|
|
32
32
|
let contentTypeMapping = Object.assign({}, contentTypeMappingConst, contentTypeMappingOverride || {});
|
|
33
33
|
console.log('Deploying Website');
|
|
@@ -62,27 +62,17 @@ class BucketManager {
|
|
|
62
62
|
const unixifiedIndexFilePath = this.unixify(relativePath);
|
|
63
63
|
if (unixifiedIndexFilePath.match(/\/index.html$/)) {
|
|
64
64
|
// First duplicate the file at the "/" location
|
|
65
|
+
// Then add a redirect from the base location to the "/" by duplicating the file again, this way `/route`, `/route/`, and `/route/index.html` all point to `/route/index.html`
|
|
65
66
|
const redirectFileUrl = unixifiedIndexFilePath.replace(/\/index.html$/, '');
|
|
66
67
|
putObjectParams.Body = fileData;
|
|
67
68
|
putObjectParams.Key = `${this.unixify(path.join(version, redirectFileUrl))}/`;
|
|
68
69
|
await this.putObjectIfDifferent(putObjectParams);
|
|
69
|
-
console.log(` => ${putObjectParams.Key} (
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
putObjectParams.Body = fileData;
|
|
74
|
-
putObjectParams.Key = `${this.unixify(path.join(version, redirectFileUrl))}`;
|
|
75
|
-
} else {
|
|
76
|
-
const redirectFile = await fs.readFile(path.join(__dirname, './appRedirect.html'));
|
|
77
|
-
let lastPartOfPath = redirectFile.toString().split('/').slice(-1)[0];
|
|
78
|
-
const updatedRedirectFile = redirectFile.toString().replace('{{PATH}}', lastPartOfPath); // redirectFileUrl[0] === '/' ? redirectFileUrl : `/${redirectFileUrl}`);
|
|
79
|
-
putObjectParams.Body = Buffer.from(updatedRedirectFile);
|
|
80
|
-
putObjectParams.Key = this.unixify(path.join(version, redirectFileUrl));
|
|
81
|
-
putObjectParams.ContentMD5 = createHash('md5').update(updatedRedirectFile).digest('base64');
|
|
82
|
-
putObjectParams.Metadata.Hash = createHash('md5').update(fileData).digest('base64');
|
|
83
|
-
}
|
|
70
|
+
console.log(` => ${putObjectParams.Key} (Handler with: /)`);
|
|
71
|
+
|
|
72
|
+
putObjectParams.Body = fileData;
|
|
73
|
+
putObjectParams.Key = `${this.unixify(path.join(version, redirectFileUrl))}`;
|
|
84
74
|
await this.putObjectIfDifferent(putObjectParams);
|
|
85
|
-
console.log(` => ${putObjectParams.Key} (
|
|
75
|
+
console.log(` => ${putObjectParams.Key} (Handler without: /)`);
|
|
86
76
|
}
|
|
87
77
|
} catch (failure) {
|
|
88
78
|
throw { File: file, Error: failure.stack || failure.toString(), Detail: failure };
|
package/package.json
CHANGED
package/lib/appRedirect.html
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="UTF-8">
|
|
6
|
-
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1">
|
|
7
|
-
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
8
|
-
<meta name="theme-color" content="#2d434d">
|
|
9
|
-
<title>Redirect</title>
|
|
10
|
-
<meta http-equiv="refresh" content="0; URL='./{{PATH}}/'" />
|
|
11
|
-
</head>
|
|
12
|
-
|
|
13
|
-
<body style="margin: 0; background-color: #e9eff2">
|
|
14
|
-
</body>
|
|
15
|
-
|
|
16
|
-
</html>
|