Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ JSON error envelope. Successful results use `RunCommandResult.stdout`; progress
and server warnings use the context logger. Deployment reads project resources;
deletion only needs the selected app context.

Function and actor deploy responses carry non-fatal server `warnings`. Keep them
in the response schema; `formatDeployResult` prints them under each result line.

## Branch targeting

Discover names with `base44 branches list --app-id <app-id> --json`.
Expand Down
3 changes: 0 additions & 3 deletions packages/cli/src/cli/commands/actors/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ async function deployActorsAction(
onResult: (result) => {
completed++;
formatDeployResult(result, log);
if (result.status !== "error")
for (const warning of result.warnings)
log.warn(`${result.name}: ${warning}`);
},
});
const summary = {
Expand Down
5 changes: 5 additions & 0 deletions packages/cli/src/cli/commands/functions/formatDeployResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,10 @@ export function formatDeployResult(
log.success(`${label} unchanged`);
} else {
log.error(`${label} error: ${result.error}`);
return;
}
for (const warning of result.warnings ?? []) {
const prefix = `${result.name}: `;
log.warn(warning.startsWith(prefix) ? warning : `${prefix}${warning}`);
}
}
3 changes: 0 additions & 3 deletions packages/cli/src/cli/commands/project/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,6 @@ export async function deployAction(
onActorResult: (result) => {
actorCompleted++;
formatDeployResult(result, log);
if (result.status !== "error")
for (const warning of result.warnings)
log.warn(`${result.name}: ${warning}`);
},
});

Expand Down
2 changes: 2 additions & 0 deletions packages/cli/src/core/resources/function/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface SingleFunctionDeployResult {
status: "deployed" | "unchanged" | "error";
error?: string | null;
durationMs?: number;
warnings?: string[];
}

async function deployOne(
Expand All @@ -47,6 +48,7 @@ async function deployOne(
name: functionWithCode.name,
status: response.status,
durationMs: Date.now() - start,
warnings: response.warnings,
};
} catch (error) {
return {
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/core/resources/function/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ const BackendFunctionSchema = FunctionConfigSchema.extend({

export const DeploySingleFunctionResponseSchema = z.object({
status: z.enum(["deployed", "unchanged"]),
warnings: z.array(z.string()).optional().default([]),
});

const FunctionInfoSchema = z
Expand Down
20 changes: 20 additions & 0 deletions packages/cli/tests/cli/deploy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,26 @@ describe("deploy command (unified)", () => {
t.expectResult(result).toContain("App deployed successfully");
});

it("prints function deploy warnings", async () => {
await t.givenLoggedInWithProject(fixture("with-functions-and-entities"));
t.api.mockEntitiesPush({ created: ["Order"], updated: [], deleted: [] });
t.api.mockSingleFunctionDeploy({
status: "deployed",
warnings: ["process-order: automations not created (nightly)."],
});
t.api.mockAgentsPush({ created: [], updated: [], deleted: [] });
t.api.mockConnectorsList({ integrations: [] });
t.api.mockStripeStatus({ stripe_mode: null });

const result = await t.run("deploy", "-y");

t.expectResult(result).toSucceed();
t.expectResult(result).toContain(
"process-order: automations not created (nightly).",
);
t.expectResult(result).toContain("App deployed successfully");
});

it("deploys zero-config functions (path-based names) with unified deploy", async () => {
await t.givenLoggedInWithProject(fixture("with-zero-config-functions"));
t.api.mockEntitiesPush({ created: [], updated: [], deleted: [] });
Expand Down
35 changes: 35 additions & 0 deletions packages/cli/tests/cli/functions_deploy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,41 @@ describe("functions deploy command", () => {
t.expectResult(result).toContain("1 unchanged");
});

it("prints server warnings for a deployed function", async () => {
await t.givenLoggedInWithProject(fixture("with-functions-and-entities"));
t.api.mockSingleFunctionDeploy({
status: "deployed",
warnings: [
"process-order: automations not created (nightly) and none removed.",
"Private data source warehouse is unavailable.",
],
});

const result = await t.run("functions", "deploy");

t.expectResult(result).toSucceed();
t.expectResult(result).toContain(
"process-order: automations not created (nightly) and none removed.",
);
t.expectResult(result).toNotContain("process-order: process-order:");
t.expectResult(result).toContain(
"process-order: Private data source warehouse is unavailable.",
);
});

it("prints server warnings for an unchanged function", async () => {
await t.givenLoggedInWithProject(fixture("with-functions-and-entities"));
t.api.mockSingleFunctionDeploy({
status: "unchanged",
warnings: ["Automations are retired."],
});

const result = await t.run("functions", "deploy");

t.expectResult(result).toSucceed();
t.expectResult(result).toContain("process-order: Automations are retired.");
});

it("deploys zero-config and path-named functions successfully", async () => {
await t.givenLoggedInWithProject(fixture("with-zero-config-functions"));
t.api.mockSingleFunctionDeploy({ status: "deployed" });
Expand Down
1 change: 1 addition & 0 deletions packages/cli/tests/cli/testkit/TestAPIServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ interface SecretsDeleteResponse {

interface SingleFunctionDeployResponse {
status: "deployed" | "unchanged";
warnings?: string[];
}

interface AutomationBase {
Expand Down
Loading