@kungfu-tech/buildchain 2.0.17-alpha.0 → 2.0.18-alpha.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/package.json +1 -1
- package/scripts/web-surface-core.mjs +19 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kungfu-tech/buildchain",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.18-alpha.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Kungfu Buildchain reusable workflows, release governance, and CLI tooling.",
|
|
6
6
|
"repository": "https://github.com/kungfu-systems/buildchain",
|
|
@@ -122,7 +122,10 @@ function manifestPrefixFor(deployConfig) {
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
function objectPrefixFor(deployConfig, alias) {
|
|
125
|
-
|
|
125
|
+
if (Object.hasOwn(deployConfig, "prefix")) {
|
|
126
|
+
return normalizeS3Key(deployConfig.prefix);
|
|
127
|
+
}
|
|
128
|
+
return alias || "preview";
|
|
126
129
|
}
|
|
127
130
|
|
|
128
131
|
function normalizeS3Key(value) {
|
|
@@ -148,6 +151,19 @@ function cdnPath(value) {
|
|
|
148
151
|
return normalized ? `/${normalized}` : "/";
|
|
149
152
|
}
|
|
150
153
|
|
|
154
|
+
function cdnWildcardPath(value) {
|
|
155
|
+
const normalized = normalizeS3Key(value);
|
|
156
|
+
return normalized ? `/${normalized}/*` : "/*";
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function syncStaticArtifactArgs({ artifactRoot, bucket, objectPrefix }) {
|
|
160
|
+
const args = ["s3", "sync", artifactRoot, s3Uri(bucket, objectPrefix), "--delete"];
|
|
161
|
+
if (!objectPrefix) {
|
|
162
|
+
args.push("--exclude", ".buildchain/*");
|
|
163
|
+
}
|
|
164
|
+
return args;
|
|
165
|
+
}
|
|
166
|
+
|
|
151
167
|
function defaultCommandRunner({ command, args, stdin = "" }) {
|
|
152
168
|
const result = spawnSync(command, args, {
|
|
153
169
|
encoding: "utf8",
|
|
@@ -521,12 +537,12 @@ export function applyWebSurfaceDeploy({
|
|
|
521
537
|
const artifactRoot = path.resolve(cwd, resolvedPlan.artifact.path);
|
|
522
538
|
const objectPrefix = objectPrefixFor(deployConfig, resolvedPlan.manifest.alias || resolvedPlan.manifest.channel);
|
|
523
539
|
const manifestKey = deployManifestKey(deployConfig, resolvedPlan.manifest);
|
|
524
|
-
const invalidationPaths = [
|
|
540
|
+
const invalidationPaths = [cdnWildcardPath(objectPrefix), cdnPath(manifestKey)];
|
|
525
541
|
const operations = [
|
|
526
542
|
{
|
|
527
543
|
action: "sync-static-artifact",
|
|
528
544
|
command: "aws",
|
|
529
|
-
args:
|
|
545
|
+
args: syncStaticArtifactArgs({ artifactRoot, bucket, objectPrefix }),
|
|
530
546
|
},
|
|
531
547
|
{
|
|
532
548
|
action: "write-deployment-manifest",
|