@supacloud/cli 0.91.0 → 0.92.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/dist/index.js +6 -44
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -28522,16 +28522,10 @@ async function stageApplicationWebRelease(http, projectRef, configRoot, skipBuil
|
|
|
28522
28522
|
const remoteOutput = selected.outputDirectory && selected.outputDirectory !== "." ? selected.outputDirectory : "";
|
|
28523
28523
|
const outputDirectory = resolveInsideProject(projectDirectory, configuredOutput || remoteOutput || defaultOutputDirectory(selected.framework));
|
|
28524
28524
|
const build = createBuildEnvironment(target.config.buildEnv, environmentVariables);
|
|
28525
|
-
const report = phaseReporter(json);
|
|
28526
|
-
report("web", `${target.name} (${selected.id})`);
|
|
28527
28525
|
assertBuildEnvironment(build, skipBuild);
|
|
28528
28526
|
if (!skipBuild) {
|
|
28529
|
-
report("build", buildCommand);
|
|
28530
28527
|
await runBuild(buildCommand, projectDirectory, build.env, json);
|
|
28531
|
-
} else {
|
|
28532
|
-
report("build", "skipped");
|
|
28533
28528
|
}
|
|
28534
|
-
report("package", relative10(projectDirectory, outputDirectory) || ".");
|
|
28535
28529
|
const archive = await createFrontendArchive(outputDirectory);
|
|
28536
28530
|
try {
|
|
28537
28531
|
const authority = payload(await readFrontendReleaseAuthority(http, projectRef, selected.id));
|
|
@@ -28542,10 +28536,8 @@ async function stageApplicationWebRelease(http, projectRef, configRoot, skipBuil
|
|
|
28542
28536
|
throw new Error("Active Web release tree does not match the local archive");
|
|
28543
28537
|
}
|
|
28544
28538
|
if (archive.treeSha256 === current?.tree_sha256) {
|
|
28545
|
-
report("done", "Web already current");
|
|
28546
28539
|
return {};
|
|
28547
28540
|
}
|
|
28548
|
-
report("upload", `${archive.fileCount} files`);
|
|
28549
28541
|
const uploaded = payload(await uploadFrontendRelease(http, projectRef, selected.id, archive.archivePath));
|
|
28550
28542
|
const release = record4(uploaded.release);
|
|
28551
28543
|
const releaseId = requiredString(release?.release_id, "release.release_id");
|
|
@@ -28553,7 +28545,6 @@ async function stageApplicationWebRelease(http, projectRef, configRoot, skipBuil
|
|
|
28553
28545
|
throw new Error("Uploaded Web release identity does not match the local archive");
|
|
28554
28546
|
if (release?.tree_sha256 !== archive.treeSha256)
|
|
28555
28547
|
throw new Error("Uploaded Web release tree does not match the local build");
|
|
28556
|
-
report("done", releaseId.slice(0, 12));
|
|
28557
28548
|
return {
|
|
28558
28549
|
request: {
|
|
28559
28550
|
deployment_id: selected.id,
|
|
@@ -28567,14 +28558,6 @@ async function stageApplicationWebRelease(http, projectRef, configRoot, skipBuil
|
|
|
28567
28558
|
await archive.cleanup();
|
|
28568
28559
|
}
|
|
28569
28560
|
}
|
|
28570
|
-
function phaseReporter(json) {
|
|
28571
|
-
const started = performance.now();
|
|
28572
|
-
return (phase, detail) => {
|
|
28573
|
-
if (!json)
|
|
28574
|
-
console.error(` ${phase.padEnd(10)} ${detail}`);
|
|
28575
|
-
return Math.round(performance.now() - started);
|
|
28576
|
-
};
|
|
28577
|
-
}
|
|
28578
28561
|
function deployResponse(result, json) {
|
|
28579
28562
|
if (json)
|
|
28580
28563
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
@@ -28583,8 +28566,7 @@ function deployResponse(result, json) {
|
|
|
28583
28566
|
result.url ? `URL: ${String(result.url)}` : null,
|
|
28584
28567
|
result.release_id ? `Release: ${String(result.release_id)}` : null,
|
|
28585
28568
|
result.active_version ? `Active version: ${String(result.active_version)}` : null,
|
|
28586
|
-
result.file_count ? `Files: ${String(result.file_count)}` : null
|
|
28587
|
-
`Duration: ${(Number(result.duration_ms) / 1000).toFixed(1)}s`
|
|
28569
|
+
result.file_count ? `Files: ${String(result.file_count)}` : null
|
|
28588
28570
|
].filter((line) => Boolean(line));
|
|
28589
28571
|
return { content: [{ type: "text", text: lines.join(`
|
|
28590
28572
|
`) }] };
|
|
@@ -28656,8 +28638,6 @@ function registerDeployTools(server, http, options = {}) {
|
|
|
28656
28638
|
}
|
|
28657
28639
|
const requestedId = String(args.id || target.config.id || "").trim() || undefined;
|
|
28658
28640
|
const build = createBuildEnvironment(target.config.buildEnv, options.environmentVariables);
|
|
28659
|
-
const report = phaseReporter(args.json === true);
|
|
28660
|
-
report("inspect", `${target.name} (${projectRef})`);
|
|
28661
28641
|
if (target.config.type === "edge_function") {
|
|
28662
28642
|
if (args.diff === true)
|
|
28663
28643
|
throw new Error("Function release diffs require an immutable function release manifest");
|
|
@@ -28702,12 +28682,8 @@ function registerDeployTools(server, http, options = {}) {
|
|
|
28702
28682
|
}
|
|
28703
28683
|
assertBuildEnvironment(build, args.skip_build === true);
|
|
28704
28684
|
if (args.skip_build !== true) {
|
|
28705
|
-
report("build", buildCommand);
|
|
28706
28685
|
await runBuild(buildCommand, projectDirectory, build.env, args.json === true);
|
|
28707
|
-
} else {
|
|
28708
|
-
report("build", "skipped");
|
|
28709
28686
|
}
|
|
28710
|
-
report("deploy", `edge function ${slug}`);
|
|
28711
28687
|
const deployed = await options.edgeFunctionDeploy({
|
|
28712
28688
|
action: "deploy_bundle",
|
|
28713
28689
|
ref: projectRef,
|
|
@@ -28724,7 +28700,6 @@ function registerDeployTools(server, http, options = {}) {
|
|
|
28724
28700
|
return deployed;
|
|
28725
28701
|
const deployedText = deployed.content.find((chunk) => chunk.type === "text")?.text;
|
|
28726
28702
|
const deployedPayload = deployedText ? record4(JSON.parse(deployedText)) : null;
|
|
28727
|
-
const durationMs = report("done", slug);
|
|
28728
28703
|
return deployResponse({
|
|
28729
28704
|
ok: true,
|
|
28730
28705
|
unchanged: false,
|
|
@@ -28733,8 +28708,7 @@ function registerDeployTools(server, http, options = {}) {
|
|
|
28733
28708
|
project_ref: projectRef,
|
|
28734
28709
|
slug,
|
|
28735
28710
|
active_version: deployedPayload?.active_version,
|
|
28736
|
-
activation_id: deployedPayload?.activation_id
|
|
28737
|
-
duration_ms: durationMs
|
|
28711
|
+
activation_id: deployedPayload?.activation_id
|
|
28738
28712
|
}, args.json === true);
|
|
28739
28713
|
}
|
|
28740
28714
|
const listResponse = await http.get(`/v1/projects/${encodeURIComponent(projectRef)}/frontend/deployments`);
|
|
@@ -28760,12 +28734,8 @@ function registerDeployTools(server, http, options = {}) {
|
|
|
28760
28734
|
}
|
|
28761
28735
|
assertBuildEnvironment(build, args.skip_build === true);
|
|
28762
28736
|
if (args.skip_build !== true) {
|
|
28763
|
-
report("build", buildCommand);
|
|
28764
28737
|
await runBuild(buildCommand, projectDirectory, build.env, args.json === true);
|
|
28765
|
-
} else {
|
|
28766
|
-
report("build", "skipped");
|
|
28767
28738
|
}
|
|
28768
|
-
report("package", relative10(projectDirectory, outputDirectory) || ".");
|
|
28769
28739
|
const archive = await createFrontendArchive(outputDirectory);
|
|
28770
28740
|
try {
|
|
28771
28741
|
const inventory = payload(await readFrontendReleaseAuthority(http, projectRef, selected.id));
|
|
@@ -28777,7 +28747,6 @@ function registerDeployTools(server, http, options = {}) {
|
|
|
28777
28747
|
}
|
|
28778
28748
|
const unchanged = archive.treeSha256 === current?.tree_sha256;
|
|
28779
28749
|
if (args.plan === true || args.diff === true) {
|
|
28780
|
-
const durationMs = report("done", unchanged ? "unchanged plan" : "release diff ready");
|
|
28781
28750
|
return { content: [{ type: "text", text: JSON.stringify({
|
|
28782
28751
|
schema: "supacloud.frontend-deploy-plan.v1",
|
|
28783
28752
|
ok: true,
|
|
@@ -28800,12 +28769,10 @@ function registerDeployTools(server, http, options = {}) {
|
|
|
28800
28769
|
actions: unchanged ? [] : ["upload_release", "activate_release"],
|
|
28801
28770
|
file_count: archive.fileCount,
|
|
28802
28771
|
source_bytes: archive.sourceBytes,
|
|
28803
|
-
archive_bytes: archive.archiveBytes
|
|
28804
|
-
duration_ms: durationMs
|
|
28772
|
+
archive_bytes: archive.archiveBytes
|
|
28805
28773
|
}, null, 2) }] };
|
|
28806
28774
|
}
|
|
28807
28775
|
if (unchanged) {
|
|
28808
|
-
const durationMs = report("done", "already current");
|
|
28809
28776
|
return deployResponse({
|
|
28810
28777
|
ok: true,
|
|
28811
28778
|
unchanged: true,
|
|
@@ -28815,11 +28782,9 @@ function registerDeployTools(server, http, options = {}) {
|
|
|
28815
28782
|
tree_sha256: archive.treeSha256,
|
|
28816
28783
|
url: selected.deploymentUrl,
|
|
28817
28784
|
file_count: archive.fileCount,
|
|
28818
|
-
source_bytes: archive.sourceBytes
|
|
28819
|
-
duration_ms: durationMs
|
|
28785
|
+
source_bytes: archive.sourceBytes
|
|
28820
28786
|
}, args.json === true);
|
|
28821
28787
|
}
|
|
28822
|
-
report("upload", `${archive.fileCount} files`);
|
|
28823
28788
|
const uploaded = payload(await uploadFrontendRelease(http, projectRef, selected.id, archive.archivePath));
|
|
28824
28789
|
const release = record4(uploaded.release);
|
|
28825
28790
|
const releaseId = requiredString(release?.release_id, "release.release_id");
|
|
@@ -28827,7 +28792,6 @@ function registerDeployTools(server, http, options = {}) {
|
|
|
28827
28792
|
throw new Error("Uploaded release identity does not match the local archive");
|
|
28828
28793
|
if (release?.tree_sha256 !== archive.treeSha256)
|
|
28829
28794
|
throw new Error("Uploaded release tree does not match the local build");
|
|
28830
|
-
report("activate", releaseId.slice(0, 12));
|
|
28831
28795
|
const mutationId = crypto.randomUUID();
|
|
28832
28796
|
const activationResponse = await activateFrontendRelease(http, {
|
|
28833
28797
|
projectRef,
|
|
@@ -28856,7 +28820,6 @@ function registerDeployTools(server, http, options = {}) {
|
|
|
28856
28820
|
const activated = payload(activationResponse);
|
|
28857
28821
|
const finalResponse = await http.get(`/v1/projects/${encodeURIComponent(projectRef)}/frontend/deployments/${encodeURIComponent(selected.id)}`);
|
|
28858
28822
|
const finalDeployment = finalResponse.ok ? frontendDeployment(finalResponse.data) : selected;
|
|
28859
|
-
const durationMs = report("done", finalDeployment.deploymentUrl || selected.id);
|
|
28860
28823
|
return deployResponse({
|
|
28861
28824
|
ok: true,
|
|
28862
28825
|
unchanged: false,
|
|
@@ -28868,8 +28831,7 @@ function registerDeployTools(server, http, options = {}) {
|
|
|
28868
28831
|
previous_activation_id: activeActivationId,
|
|
28869
28832
|
url: finalDeployment.deploymentUrl,
|
|
28870
28833
|
file_count: archive.fileCount,
|
|
28871
|
-
source_bytes: archive.sourceBytes
|
|
28872
|
-
duration_ms: durationMs
|
|
28834
|
+
source_bytes: archive.sourceBytes
|
|
28873
28835
|
}, args.json === true);
|
|
28874
28836
|
} finally {
|
|
28875
28837
|
await archive.cleanup();
|
|
@@ -29558,7 +29520,7 @@ async function runProjectDeployment(http, args) {
|
|
|
29558
29520
|
// package.json
|
|
29559
29521
|
var package_default = {
|
|
29560
29522
|
name: "@supacloud/cli",
|
|
29561
|
-
version: "0.
|
|
29523
|
+
version: "0.92.0",
|
|
29562
29524
|
description: "Project-scoped CLI for SupaCloud users",
|
|
29563
29525
|
type: "module",
|
|
29564
29526
|
main: "./dist/index.js",
|