shipzy 0.0.0-stage → 0.1.0-beta.1
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/LICENSE +202 -0
- package/README.md +19 -2
- package/assets/build.sh +259 -0
- package/assets/detect.cjs +127 -0
- package/assets/domain-template.json +1 -0
- package/assets/engine.zip +0 -0
- package/assets/not-found.html +28 -0
- package/assets/site-template.json +1 -0
- package/assets/template.json +1 -0
- package/dist/shipzy.mjs +110959 -0
- package/package.json +69 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
-
#
|
|
1
|
+
# shipzy
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Deploy React and static-export Next.js sites to **your own AWS account** (S3 + CloudFront). Nothing runs on shipzy servers, and there is no shipzy account: it uses your normal AWS credentials.
|
|
4
|
+
|
|
5
|
+
> **Beta.** Install with `shipzy@beta`. The main features have been run against a real AWS account, but there is no automated test suite yet and no independent security audit. Read [limits and roadmap](https://shipzy.quantav.xyz/docs/limits) first.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install -g shipzy@beta
|
|
9
|
+
export AWS_PROFILE=my-profile # an IAM user or SSO profile, not root
|
|
10
|
+
shipzy init # creates the stack in your account (about 5 minutes)
|
|
11
|
+
shipzy deploy ./my-app --project demo
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
What you get: instant rollbacks (a routing change, no re-upload), a CloudFront address per project, custom domains with HTTPS, GitHub push deploys, pull request previews, build-time environment variables, builds in your own AWS account, `shipzy cost` for a monthly estimate, and an optional local dashboard (`shipzy dashboard`, downloaded on request).
|
|
15
|
+
|
|
16
|
+
- Documentation: https://shipzy.quantav.xyz/docs/getting-started
|
|
17
|
+
- Least-privilege IAM policy and script: https://shipzy.quantav.xyz/docs/aws-setup
|
|
18
|
+
- Source and issues: https://github.com/vaibhav0725/Shipzy
|
|
19
|
+
|
|
20
|
+
Requires Node.js 20 or newer. License: Apache-2.0.
|
package/assets/build.sh
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
# Runs inside CodeBuild for every deploy. Inputs arrive as environment variables:
|
|
2
|
+
# fixed by the stack: SITES_BUCKET BUILDS_BUCKET ENGINE_FUNCTION GITHUB_TOKEN_SECRET DEFAULT_HOST
|
|
3
|
+
# per build: DEPLOY_PROJECT DEPLOY_ID [DEPLOY_HOSTS] [DEPLOY_KEEP] (hosts: comma-separated; default is decided by the engine)
|
|
4
|
+
# SOURCE_TYPE (s3|github) SOURCE_S3_KEY | SOURCE_REPO SOURCE_REF [SOURCE_PUBLIC=1: clone without a token]
|
|
5
|
+
# [INSTALL_COMMAND] [BUILD_COMMAND]
|
|
6
|
+
# [DEPLOY_PREVIEW_PR] (set when this is a preview of a pull request)
|
|
7
|
+
set -euo pipefail
|
|
8
|
+
|
|
9
|
+
: "${DEPLOY_PROJECT:?}" "${DEPLOY_ID:?}" "${SOURCE_TYPE:?}"
|
|
10
|
+
SRC=/tmp/source
|
|
11
|
+
mkdir -p "$SRC"
|
|
12
|
+
|
|
13
|
+
UPLOADED=0
|
|
14
|
+
INVOKED=0
|
|
15
|
+
DEST="s3://$SITES_BUCKET/$DEPLOY_PROJECT/$DEPLOY_ID"
|
|
16
|
+
# Until the engine has been asked to promote, a failed build owns its partial upload and removes it.
|
|
17
|
+
# After that the engine owns cleanup (it must not delete a folder a route may already point at).
|
|
18
|
+
# A failed preview also tells the engine, which says so on the pull request.
|
|
19
|
+
on_exit() {
|
|
20
|
+
local code=$?
|
|
21
|
+
if [ "$UPLOADED" = 1 ] && [ "$INVOKED" = 0 ]; then
|
|
22
|
+
echo "==> Removing partial upload"
|
|
23
|
+
aws s3 rm "$DEST/" --recursive --only-show-errors || true
|
|
24
|
+
fi
|
|
25
|
+
if [ "$code" != 0 ] && [ -n "${DEPLOY_PREVIEW_PR:-}" ]; then
|
|
26
|
+
jq -nc --arg project "$DEPLOY_PROJECT" --arg pr "$DEPLOY_PREVIEW_PR" --arg sha "${SOURCE_REF:-}" \
|
|
27
|
+
'{action:"preview-failed",project:$project,pr:($pr|tonumber),sha:$sha}' > /tmp/failed.json || true
|
|
28
|
+
aws lambda invoke --function-name "$ENGINE_FUNCTION" --cli-binary-format raw-in-base64-out \
|
|
29
|
+
--payload file:///tmp/failed.json /tmp/failed-out.json > /dev/null 2>&1 || true
|
|
30
|
+
fi
|
|
31
|
+
}
|
|
32
|
+
trap on_exit EXIT
|
|
33
|
+
|
|
34
|
+
echo "==> Fetching source ($SOURCE_TYPE)"
|
|
35
|
+
case "$SOURCE_TYPE" in
|
|
36
|
+
s3)
|
|
37
|
+
aws s3 cp "s3://$BUILDS_BUCKET/${SOURCE_S3_KEY:?}" /tmp/source.zip --only-show-errors
|
|
38
|
+
unzip -q /tmp/source.zip -d "$SRC"
|
|
39
|
+
;;
|
|
40
|
+
github)
|
|
41
|
+
export GIT_TERMINAL_PROMPT=0 # fail instead of asking for a username
|
|
42
|
+
git -C "$SRC" init -q
|
|
43
|
+
if [ "${SOURCE_PUBLIC:-}" = 1 ]; then
|
|
44
|
+
# A public repository needs no credentials (and a wrong stored token would make GitHub refuse it).
|
|
45
|
+
FETCH=(git -C "$SRC" fetch -q --depth 1 "https://github.com/${SOURCE_REPO:?}.git" "${SOURCE_REF:?}")
|
|
46
|
+
else
|
|
47
|
+
# The token goes in a request header, never in the URL, so it cannot leak into error output.
|
|
48
|
+
TOKEN="$(aws secretsmanager get-secret-value --secret-id "$GITHUB_TOKEN_SECRET" --query SecretString --output text)"
|
|
49
|
+
AUTH="Authorization: Basic $(printf 'x-access-token:%s' "$TOKEN" | base64 -w0)"
|
|
50
|
+
FETCH=(git -C "$SRC" -c "http.extraHeader=$AUTH" fetch -q --depth 1 "https://github.com/${SOURCE_REPO:?}.git" "${SOURCE_REF:?}")
|
|
51
|
+
fi
|
|
52
|
+
if ! "${FETCH[@]}"; then
|
|
53
|
+
echo "Could not fetch ${SOURCE_REPO} at ${SOURCE_REF:0:7}."
|
|
54
|
+
echo "Check that the repository exists and that the stored GitHub token can read it."
|
|
55
|
+
echo "(Store a new token with: shipzy github connect -p <project> --repo ${SOURCE_REPO})"
|
|
56
|
+
exit 1
|
|
57
|
+
fi
|
|
58
|
+
git -C "$SRC" checkout -q FETCH_HEAD
|
|
59
|
+
;;
|
|
60
|
+
*)
|
|
61
|
+
echo "Unknown SOURCE_TYPE: $SOURCE_TYPE"
|
|
62
|
+
exit 1
|
|
63
|
+
;;
|
|
64
|
+
esac
|
|
65
|
+
|
|
66
|
+
cd "$SRC"
|
|
67
|
+
[ -f package.json ] || { echo "No package.json at the project root."; exit 1; }
|
|
68
|
+
|
|
69
|
+
# The same framework detection the CLI uses (embedded here when the CLI is built).
|
|
70
|
+
cat > /tmp/detect.cjs <<'DETECT_EOF'
|
|
71
|
+
"use strict";
|
|
72
|
+
var __create = Object.create;
|
|
73
|
+
var __defProp = Object.defineProperty;
|
|
74
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
75
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
76
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
77
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
78
|
+
var __copyProps = (to, from, except, desc) => {
|
|
79
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
80
|
+
for (let key of __getOwnPropNames(from))
|
|
81
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
82
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
83
|
+
}
|
|
84
|
+
return to;
|
|
85
|
+
};
|
|
86
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
87
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
88
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
89
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
90
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
91
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
92
|
+
mod
|
|
93
|
+
));
|
|
94
|
+
|
|
95
|
+
// ../core/src/framework-cli.ts
|
|
96
|
+
var fs2 = __toESM(require("node:fs"), 1);
|
|
97
|
+
|
|
98
|
+
// ../core/src/framework.ts
|
|
99
|
+
var fs = __toESM(require("node:fs"), 1);
|
|
100
|
+
var path = __toESM(require("node:path"), 1);
|
|
101
|
+
function readPackageJson(dir) {
|
|
102
|
+
const file = path.join(dir, "package.json");
|
|
103
|
+
if (!fs.existsSync(file)) throw new Error(`No package.json found in ${dir}`);
|
|
104
|
+
return JSON.parse(fs.readFileSync(file, "utf8"));
|
|
105
|
+
}
|
|
106
|
+
var NEXT_CONFIGS = ["next.config.mjs", "next.config.js", "next.config.ts", "next.config.cjs", "next.config.mts"];
|
|
107
|
+
var NEXT_HELP = "Only a static export of Next.js can be deployed (no server runs on this platform). In next.config add:\n output: 'export',\n images: { unoptimized: true },\nand remove anything that needs a server (API routes, middleware, getServerSideProps, revalidation).";
|
|
108
|
+
var stripComments = (source) => source.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:\\])\/\/.*$/gm, "$1");
|
|
109
|
+
var exists = (dir, ...parts) => fs.existsSync(path.join(dir, ...parts));
|
|
110
|
+
function checkNextStatic(dir) {
|
|
111
|
+
const configFile = NEXT_CONFIGS.find((f) => exists(dir, f));
|
|
112
|
+
const config = configFile ? stripComments(fs.readFileSync(path.join(dir, configFile), "utf8")) : "";
|
|
113
|
+
if (!/\boutput\s*:\s*(['"`])export\1/.test(config)) {
|
|
114
|
+
throw new Error(
|
|
115
|
+
`This is a Next.js project that is not set up for a static export${configFile ? ` (${configFile} has no output: 'export')` : " (no next.config file)"}.
|
|
116
|
+
${NEXT_HELP}`
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
const problems = [];
|
|
120
|
+
for (const root of ["", "src"]) {
|
|
121
|
+
for (const name of ["middleware", "proxy"]) {
|
|
122
|
+
for (const ext of ["ts", "js", "mts", "mjs"]) {
|
|
123
|
+
if (exists(dir, root, `${name}.${ext}`)) problems.push(`${path.join(root, `${name}.${ext}`)} (middleware does not run on a static site)`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (exists(dir, root, "pages", "api")) problems.push(`${path.join(root, "pages", "api")} (API routes need a server)`);
|
|
127
|
+
}
|
|
128
|
+
if (problems.length > 0) {
|
|
129
|
+
throw new Error(`This Next.js project uses features a static site cannot provide:
|
|
130
|
+
${problems.join("\n ")}
|
|
131
|
+
${NEXT_HELP}`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function detectProject(dir) {
|
|
135
|
+
const pkg = readPackageJson(dir);
|
|
136
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
137
|
+
if (deps["next"]) {
|
|
138
|
+
checkNextStatic(dir);
|
|
139
|
+
return { framework: "next-static", label: "Next.js (static export)", outputDirs: ["out"] };
|
|
140
|
+
}
|
|
141
|
+
if (deps["vite"]) return { framework: "vite", label: "Vite", outputDirs: ["dist", "build"] };
|
|
142
|
+
if (deps["react-scripts"]) return { framework: "create-react-app", label: "Create React App", outputDirs: ["build", "dist"] };
|
|
143
|
+
if (!deps["react"]) throw new Error('This does not look like a React project (no "react" dependency).');
|
|
144
|
+
return { framework: "react", label: "React", outputDirs: ["dist", "build"] };
|
|
145
|
+
}
|
|
146
|
+
function findOutputDir(dir, kind) {
|
|
147
|
+
for (const candidate of kind.outputDirs) {
|
|
148
|
+
const out = path.join(dir, candidate);
|
|
149
|
+
if (fs.existsSync(path.join(out, "index.html"))) return out;
|
|
150
|
+
}
|
|
151
|
+
const expected = kind.outputDirs.map((d) => `${d}/index.html`).join(" or ");
|
|
152
|
+
throw new Error(
|
|
153
|
+
kind.framework === "next-static" ? `Build output not found: expected ${expected}. Is output: 'export' set in next.config?` : `Build output not found: expected ${expected}.`
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
function detectRouting(outDir, kind) {
|
|
157
|
+
if (kind.framework !== "next-static") return void 0;
|
|
158
|
+
const folderIndexes = fs.readdirSync(outDir, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== "_next" && fs.existsSync(path.join(outDir, e.name, "index.html")));
|
|
159
|
+
return folderIndexes.length > 0 ? "dir" : "html";
|
|
160
|
+
}
|
|
161
|
+
function hintForBuildFailure(output) {
|
|
162
|
+
if (output.includes("ERESOLVE")) {
|
|
163
|
+
return '\n\nnpm could not resolve a peer-dependency conflict in your project (ERESOLVE).\nFix the versions in the project, or deploy with a looser install, for example:\n --install-command "npm ci --legacy-peer-deps"';
|
|
164
|
+
}
|
|
165
|
+
if (/Image Optimization using the default loader is not compatible with/i.test(output)) {
|
|
166
|
+
return "\n\nNext.js cannot resize images on a static site. In next.config add:\n images: { unoptimized: true }";
|
|
167
|
+
}
|
|
168
|
+
if (/output:\s*['"]?export['"]?|Page .* is missing .generateStaticParams|getServerSideProps|API Routes/i.test(output)) {
|
|
169
|
+
return `
|
|
170
|
+
|
|
171
|
+
This project uses something a static export cannot do.
|
|
172
|
+
${NEXT_HELP}`;
|
|
173
|
+
}
|
|
174
|
+
return "";
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// ../core/src/framework-cli.ts
|
|
178
|
+
var path2 = __toESM(require("node:path"), 1);
|
|
179
|
+
var [command, arg] = process.argv.slice(2);
|
|
180
|
+
try {
|
|
181
|
+
const dir = process.cwd();
|
|
182
|
+
if (command === "detect") {
|
|
183
|
+
console.log(JSON.stringify(detectProject(dir)));
|
|
184
|
+
} else if (command === "resolve") {
|
|
185
|
+
const kind = detectProject(dir);
|
|
186
|
+
const out = findOutputDir(dir, kind);
|
|
187
|
+
console.log(JSON.stringify({ framework: kind.framework, out: path2.relative(dir, out), routing: detectRouting(out, kind) ?? "" }));
|
|
188
|
+
} else if (command === "hint") {
|
|
189
|
+
const log = fs2.readFileSync(arg ?? "", "utf8").slice(-2e4);
|
|
190
|
+
process.stdout.write(hintForBuildFailure(log));
|
|
191
|
+
} else {
|
|
192
|
+
throw new Error(`Unknown command "${command}".`);
|
|
193
|
+
}
|
|
194
|
+
} catch (err) {
|
|
195
|
+
console.error(err instanceof Error ? err.message : String(err));
|
|
196
|
+
process.exit(1);
|
|
197
|
+
}
|
|
198
|
+
DETECT_EOF
|
|
199
|
+
node /tmp/detect.cjs detect > /dev/null # fails fast, with the reason, on a project that cannot be deployed
|
|
200
|
+
|
|
201
|
+
if [ -f pnpm-lock.yaml ]; then
|
|
202
|
+
PM=pnpm; INSTALL="pnpm install --frozen-lockfile"; corepack enable
|
|
203
|
+
elif [ -f yarn.lock ]; then
|
|
204
|
+
PM=yarn; INSTALL="yarn install --frozen-lockfile"; corepack enable
|
|
205
|
+
elif [ -f package-lock.json ]; then
|
|
206
|
+
PM=npm; INSTALL="npm ci"
|
|
207
|
+
else
|
|
208
|
+
PM=npm; INSTALL="npm install"
|
|
209
|
+
fi
|
|
210
|
+
|
|
211
|
+
echo "==> Installing: ${INSTALL_COMMAND:-$INSTALL}"
|
|
212
|
+
bash -c "${INSTALL_COMMAND:-$INSTALL}"
|
|
213
|
+
echo "==> Building: ${BUILD_COMMAND:-$PM run build}"
|
|
214
|
+
if ! bash -c "${BUILD_COMMAND:-$PM run build}" 2>&1 | tee /tmp/build.log; then
|
|
215
|
+
node /tmp/detect.cjs hint /tmp/build.log || true
|
|
216
|
+
echo
|
|
217
|
+
exit 1
|
|
218
|
+
fi
|
|
219
|
+
|
|
220
|
+
RESOLVED="$(node /tmp/detect.cjs resolve)" # prints the reason and fails when the output folder is missing
|
|
221
|
+
OUT="$(echo "$RESOLVED" | jq -r .out)"
|
|
222
|
+
FRAMEWORK="$(echo "$RESOLVED" | jq -r .framework)"
|
|
223
|
+
ROUTING="$(echo "$RESOLVED" | jq -r .routing)"
|
|
224
|
+
|
|
225
|
+
echo "==> Uploading $OUT to $DEST"
|
|
226
|
+
UPLOADED=1
|
|
227
|
+
# Same cache rules as the CLI: html always revalidates, hashed bundler output is immutable.
|
|
228
|
+
aws s3 sync "$OUT" "$DEST/" --cache-control "public, max-age=3600" --only-show-errors
|
|
229
|
+
for d in assets static _next/static; do
|
|
230
|
+
if [ -d "$OUT/$d" ]; then
|
|
231
|
+
aws s3 cp "$OUT/$d" "$DEST/$d" --recursive --cache-control "public, max-age=31536000, immutable" --only-show-errors
|
|
232
|
+
fi
|
|
233
|
+
done
|
|
234
|
+
# Next.js page payloads (.txt) are not content-hashed, so they revalidate like html.
|
|
235
|
+
find "$OUT" -not -path "$OUT/_next/*" \( -name '*.html' -o -name '*.txt' \) | while IFS= read -r f; do
|
|
236
|
+
aws s3 cp "$f" "$DEST/${f#"$OUT"/}" --cache-control no-cache --only-show-errors
|
|
237
|
+
done
|
|
238
|
+
FILES="$(find "$OUT" -type f | wc -l | tr -d ' ')"
|
|
239
|
+
|
|
240
|
+
echo "==> Promoting $DEPLOY_PROJECT/$DEPLOY_ID"
|
|
241
|
+
PAYLOAD="$(jq -nc --arg project "$DEPLOY_PROJECT" --arg id "$DEPLOY_ID" --arg hosts "${DEPLOY_HOSTS:-}" \
|
|
242
|
+
--argjson keep "${DEPLOY_KEEP:-10}" --argjson files "$FILES" --arg pr "${DEPLOY_PREVIEW_PR:-}" --arg sha "${SOURCE_REF:-}" \
|
|
243
|
+
--arg framework "$FRAMEWORK" --arg routing "$ROUTING" \
|
|
244
|
+
'{action:"promote",project:$project,id:$id,hosts:(if $hosts == "" then null else ($hosts | split(",")) end),keep:$keep,files:$files,framework:$framework}
|
|
245
|
+
+ (if $routing == "" then {} else {routing:$routing} end)
|
|
246
|
+
+ (if $pr == "" then {} else {preview:{pr:($pr|tonumber),sha:$sha}} end)')"
|
|
247
|
+
INVOKED=1
|
|
248
|
+
aws lambda invoke --function-name "$ENGINE_FUNCTION" --cli-read-timeout 300 --cli-binary-format raw-in-base64-out \
|
|
249
|
+
--payload "$PAYLOAD" /tmp/promote.json > /tmp/invoke.json
|
|
250
|
+
cat /tmp/promote.json; echo
|
|
251
|
+
if jq -e 'has("FunctionError")' /tmp/invoke.json > /dev/null; then
|
|
252
|
+
echo "Promote failed."
|
|
253
|
+
exit 1
|
|
254
|
+
fi
|
|
255
|
+
if jq -e 'has("skipped")' /tmp/promote.json > /dev/null; then
|
|
256
|
+
echo "==> Not published: $(jq -r '.skipped' /tmp/promote.json)"
|
|
257
|
+
exit 0
|
|
258
|
+
fi
|
|
259
|
+
echo "==> Live: $(jq -r '.urls | join(", ")' /tmp/promote.json)"
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
|
|
25
|
+
// ../core/src/framework-cli.ts
|
|
26
|
+
var fs2 = __toESM(require("node:fs"), 1);
|
|
27
|
+
|
|
28
|
+
// ../core/src/framework.ts
|
|
29
|
+
var fs = __toESM(require("node:fs"), 1);
|
|
30
|
+
var path = __toESM(require("node:path"), 1);
|
|
31
|
+
function readPackageJson(dir) {
|
|
32
|
+
const file = path.join(dir, "package.json");
|
|
33
|
+
if (!fs.existsSync(file)) throw new Error(`No package.json found in ${dir}`);
|
|
34
|
+
return JSON.parse(fs.readFileSync(file, "utf8"));
|
|
35
|
+
}
|
|
36
|
+
var NEXT_CONFIGS = ["next.config.mjs", "next.config.js", "next.config.ts", "next.config.cjs", "next.config.mts"];
|
|
37
|
+
var NEXT_HELP = "Only a static export of Next.js can be deployed (no server runs on this platform). In next.config add:\n output: 'export',\n images: { unoptimized: true },\nand remove anything that needs a server (API routes, middleware, getServerSideProps, revalidation).";
|
|
38
|
+
var stripComments = (source) => source.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:\\])\/\/.*$/gm, "$1");
|
|
39
|
+
var exists = (dir, ...parts) => fs.existsSync(path.join(dir, ...parts));
|
|
40
|
+
function checkNextStatic(dir) {
|
|
41
|
+
const configFile = NEXT_CONFIGS.find((f) => exists(dir, f));
|
|
42
|
+
const config = configFile ? stripComments(fs.readFileSync(path.join(dir, configFile), "utf8")) : "";
|
|
43
|
+
if (!/\boutput\s*:\s*(['"`])export\1/.test(config)) {
|
|
44
|
+
throw new Error(
|
|
45
|
+
`This is a Next.js project that is not set up for a static export${configFile ? ` (${configFile} has no output: 'export')` : " (no next.config file)"}.
|
|
46
|
+
${NEXT_HELP}`
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
const problems = [];
|
|
50
|
+
for (const root of ["", "src"]) {
|
|
51
|
+
for (const name of ["middleware", "proxy"]) {
|
|
52
|
+
for (const ext of ["ts", "js", "mts", "mjs"]) {
|
|
53
|
+
if (exists(dir, root, `${name}.${ext}`)) problems.push(`${path.join(root, `${name}.${ext}`)} (middleware does not run on a static site)`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (exists(dir, root, "pages", "api")) problems.push(`${path.join(root, "pages", "api")} (API routes need a server)`);
|
|
57
|
+
}
|
|
58
|
+
if (problems.length > 0) {
|
|
59
|
+
throw new Error(`This Next.js project uses features a static site cannot provide:
|
|
60
|
+
${problems.join("\n ")}
|
|
61
|
+
${NEXT_HELP}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function detectProject(dir) {
|
|
65
|
+
const pkg = readPackageJson(dir);
|
|
66
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
67
|
+
if (deps["next"]) {
|
|
68
|
+
checkNextStatic(dir);
|
|
69
|
+
return { framework: "next-static", label: "Next.js (static export)", outputDirs: ["out"] };
|
|
70
|
+
}
|
|
71
|
+
if (deps["vite"]) return { framework: "vite", label: "Vite", outputDirs: ["dist", "build"] };
|
|
72
|
+
if (deps["react-scripts"]) return { framework: "create-react-app", label: "Create React App", outputDirs: ["build", "dist"] };
|
|
73
|
+
if (!deps["react"]) throw new Error('This does not look like a React project (no "react" dependency).');
|
|
74
|
+
return { framework: "react", label: "React", outputDirs: ["dist", "build"] };
|
|
75
|
+
}
|
|
76
|
+
function findOutputDir(dir, kind) {
|
|
77
|
+
for (const candidate of kind.outputDirs) {
|
|
78
|
+
const out = path.join(dir, candidate);
|
|
79
|
+
if (fs.existsSync(path.join(out, "index.html"))) return out;
|
|
80
|
+
}
|
|
81
|
+
const expected = kind.outputDirs.map((d) => `${d}/index.html`).join(" or ");
|
|
82
|
+
throw new Error(
|
|
83
|
+
kind.framework === "next-static" ? `Build output not found: expected ${expected}. Is output: 'export' set in next.config?` : `Build output not found: expected ${expected}.`
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
function detectRouting(outDir, kind) {
|
|
87
|
+
if (kind.framework !== "next-static") return void 0;
|
|
88
|
+
const folderIndexes = fs.readdirSync(outDir, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== "_next" && fs.existsSync(path.join(outDir, e.name, "index.html")));
|
|
89
|
+
return folderIndexes.length > 0 ? "dir" : "html";
|
|
90
|
+
}
|
|
91
|
+
function hintForBuildFailure(output) {
|
|
92
|
+
if (output.includes("ERESOLVE")) {
|
|
93
|
+
return '\n\nnpm could not resolve a peer-dependency conflict in your project (ERESOLVE).\nFix the versions in the project, or deploy with a looser install, for example:\n --install-command "npm ci --legacy-peer-deps"';
|
|
94
|
+
}
|
|
95
|
+
if (/Image Optimization using the default loader is not compatible with/i.test(output)) {
|
|
96
|
+
return "\n\nNext.js cannot resize images on a static site. In next.config add:\n images: { unoptimized: true }";
|
|
97
|
+
}
|
|
98
|
+
if (/output:\s*['"]?export['"]?|Page .* is missing .generateStaticParams|getServerSideProps|API Routes/i.test(output)) {
|
|
99
|
+
return `
|
|
100
|
+
|
|
101
|
+
This project uses something a static export cannot do.
|
|
102
|
+
${NEXT_HELP}`;
|
|
103
|
+
}
|
|
104
|
+
return "";
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// ../core/src/framework-cli.ts
|
|
108
|
+
var path2 = __toESM(require("node:path"), 1);
|
|
109
|
+
var [command, arg] = process.argv.slice(2);
|
|
110
|
+
try {
|
|
111
|
+
const dir = process.cwd();
|
|
112
|
+
if (command === "detect") {
|
|
113
|
+
console.log(JSON.stringify(detectProject(dir)));
|
|
114
|
+
} else if (command === "resolve") {
|
|
115
|
+
const kind = detectProject(dir);
|
|
116
|
+
const out = findOutputDir(dir, kind);
|
|
117
|
+
console.log(JSON.stringify({ framework: kind.framework, out: path2.relative(dir, out), routing: detectRouting(out, kind) ?? "" }));
|
|
118
|
+
} else if (command === "hint") {
|
|
119
|
+
const log = fs2.readFileSync(arg ?? "", "utf8").slice(-2e4);
|
|
120
|
+
process.stdout.write(hintForBuildFailure(log));
|
|
121
|
+
} else {
|
|
122
|
+
throw new Error(`Unknown command "${command}".`);
|
|
123
|
+
}
|
|
124
|
+
} catch (err) {
|
|
125
|
+
console.error(err instanceof Error ? err.message : String(err));
|
|
126
|
+
process.exit(1);
|
|
127
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"Parameters":{"DomainName":{"Type":"String","Description":"The hostname to serve, e.g. blog.example.com or *.preview.example.com"},"CertificateArn":{"Type":"String","Description":"ACM certificate (must be in us-east-1) covering the hostname"},"OriginDomainName":{"Type":"String","Description":"Regional domain name of the main stack's sites bucket"},"OacId":{"Type":"String","Description":"Origin Access Control of the main stack"},"RouterFunctionArn":{"Type":"String","Description":"The main stack's router CloudFront Function"}},"Resources":{"Cdn":{"Type":"AWS::CloudFront::Distribution","Properties":{"DistributionConfig":{"Aliases":[{"Ref":"DomainName"}],"Comment":{"Fn::Sub":"shipzy domain ${DomainName}"},"CustomErrorResponses":[{"ErrorCachingMinTTL":0,"ErrorCode":403,"ResponseCode":404,"ResponsePagePath":"/404.html"},{"ErrorCachingMinTTL":0,"ErrorCode":404,"ResponseCode":404,"ResponsePagePath":"/404.html"}],"DefaultCacheBehavior":{"AllowedMethods":["GET","HEAD"],"CachePolicyId":"658327ea-f89d-4fab-a63d-7e88639e58f6","Compress":true,"FunctionAssociations":[{"EventType":"viewer-request","FunctionARN":{"Ref":"RouterFunctionArn"}}],"TargetOriginId":"sites","ViewerProtocolPolicy":"redirect-to-https"},"Enabled":true,"HttpVersion":"http2","IPV6Enabled":true,"Origins":[{"DomainName":{"Ref":"OriginDomainName"},"Id":"sites","OriginAccessControlId":{"Ref":"OacId"},"S3OriginConfig":{"OriginAccessIdentity":""}}],"PriceClass":"PriceClass_100","ViewerCertificate":{"AcmCertificateArn":{"Ref":"CertificateArn"},"MinimumProtocolVersion":"TLSv1.2_2021","SslSupportMethod":"sni-only"}}}}},"Outputs":{"DistributionId":{"Value":{"Ref":"Cdn"}},"DistributionDomain":{"Value":{"Fn::GetAtt":["Cdn","DomainName"]}}}}
|
|
Binary file
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>404 - Page not found</title>
|
|
7
|
+
<!--shipzy-404-->
|
|
8
|
+
<style>
|
|
9
|
+
body { margin: 0; min-height: 100vh; display: grid; place-items: center; font: 16px/1.5 system-ui, -apple-system, 'Segoe UI', sans-serif; background: #f5f5f5; color: #082f49; }
|
|
10
|
+
main { text-align: center; padding: 24px; }
|
|
11
|
+
h1 { font-size: 64px; margin: 0; letter-spacing: -0.03em; }
|
|
12
|
+
p { margin: 8px 0 0; color: #0369a1; }
|
|
13
|
+
@media (prefers-color-scheme: dark) { body { background: #0a0a0a; color: #f0f9ff; } p { color: #7dd3fc; } }
|
|
14
|
+
</style>
|
|
15
|
+
</head>
|
|
16
|
+
<body>
|
|
17
|
+
<main><h1>404</h1><p>This page could not be found.</p></main>
|
|
18
|
+
<script>
|
|
19
|
+
// CloudFront serves this page, with a 404 status, for any path that has no file. If the site has a 404.html of its
|
|
20
|
+
// own, show that instead: asking for /404.html goes through the router like any request. If the site has none, that
|
|
21
|
+
// request lands back here (the marker above tells us), and this page stays.
|
|
22
|
+
fetch('/404.html', { cache: 'no-store' })
|
|
23
|
+
.then(function (r) { return r.text(); })
|
|
24
|
+
.then(function (t) { if (t.indexOf('shipzy-404') === -1) { document.open(); document.write(t); document.close(); } })
|
|
25
|
+
.catch(function () {});
|
|
26
|
+
</script>
|
|
27
|
+
</body>
|
|
28
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"Parameters":{"ProjectName":{"Type":"String","Description":"The project this address belongs to"},"OriginDomainName":{"Type":"String","Description":"Regional domain name of the main stack's sites bucket"},"OacId":{"Type":"String","Description":"Origin Access Control of the main stack"},"RouterFunctionArn":{"Type":"String","Description":"The main stack's router CloudFront Function"}},"Resources":{"Cdn":{"Type":"AWS::CloudFront::Distribution","Properties":{"DistributionConfig":{"Comment":{"Fn::Sub":"shipzy project ${ProjectName}"},"CustomErrorResponses":[{"ErrorCachingMinTTL":0,"ErrorCode":403,"ResponseCode":404,"ResponsePagePath":"/404.html"},{"ErrorCachingMinTTL":0,"ErrorCode":404,"ResponseCode":404,"ResponsePagePath":"/404.html"}],"DefaultCacheBehavior":{"AllowedMethods":["GET","HEAD"],"CachePolicyId":"658327ea-f89d-4fab-a63d-7e88639e58f6","Compress":true,"FunctionAssociations":[{"EventType":"viewer-request","FunctionARN":{"Ref":"RouterFunctionArn"}}],"TargetOriginId":"sites","ViewerProtocolPolicy":"redirect-to-https"},"Enabled":true,"HttpVersion":"http2","IPV6Enabled":true,"Origins":[{"DomainName":{"Ref":"OriginDomainName"},"Id":"sites","OriginAccessControlId":{"Ref":"OacId"},"S3OriginConfig":{"OriginAccessIdentity":""}}],"PriceClass":"PriceClass_100","ViewerCertificate":{"CloudFrontDefaultCertificate":true}}}}},"Outputs":{"DistributionId":{"Value":{"Ref":"Cdn"}},"DistributionDomain":{"Value":{"Fn::GetAtt":["Cdn","DomainName"]}}}}
|